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" |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 33 | #include <wlan_defs.h> |
| 34 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 35 | #ifdef CONVERGED_P2P_ENABLE |
| 36 | #include "wlan_p2p_public_struct.h" |
| 37 | #endif |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 38 | #ifdef WLAN_PMO_ENABLE |
| 39 | #include "wlan_pmo_hw_filter_public_struct.h" |
| 40 | #endif |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 41 | #include <wlan_utility.h> |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 42 | |
| 43 | /* copy_vdev_create_pdev_id() - copy pdev from host params to target command |
| 44 | * buffer. |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 45 | * @wmi_handle: pointer to wmi_handle |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 46 | * @cmd: pointer target vdev create command buffer |
| 47 | * @param: pointer host params for vdev create |
| 48 | * |
| 49 | * Return: None |
| 50 | */ |
| 51 | #ifdef CONFIG_MCL |
| 52 | static inline void copy_vdev_create_pdev_id( |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 53 | struct wmi_unified *wmi_handle, |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 54 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 55 | struct vdev_create_params *param) |
| 56 | { |
| 57 | cmd->pdev_id = WMI_PDEV_ID_SOC; |
| 58 | } |
| 59 | #else |
| 60 | static inline void copy_vdev_create_pdev_id( |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 61 | struct wmi_unified *wmi_handle, |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 62 | wmi_vdev_create_cmd_fixed_param * cmd, |
| 63 | struct vdev_create_params *param) |
| 64 | { |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 65 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 66 | param->pdev_id); |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 67 | } |
| 68 | #endif |
| 69 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 70 | /** |
| 71 | * send_vdev_create_cmd_tlv() - send VDEV create command to fw |
| 72 | * @wmi_handle: wmi handle |
| 73 | * @param: pointer to hold vdev create parameter |
| 74 | * @macaddr: vdev mac address |
| 75 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 76 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 77 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 78 | 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] | 79 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 80 | struct vdev_create_params *param) |
| 81 | { |
| 82 | wmi_vdev_create_cmd_fixed_param *cmd; |
| 83 | wmi_buf_t buf; |
| 84 | int32_t len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 85 | QDF_STATUS ret; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 86 | int num_bands = 2; |
| 87 | uint8_t *buf_ptr; |
| 88 | wmi_vdev_txrx_streams *txrx_streams; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 89 | |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 90 | len += (num_bands * sizeof(*txrx_streams) + WMI_TLV_HDR_SIZE); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 91 | buf = wmi_buf_alloc(wmi_handle, len); |
| 92 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 93 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 94 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 95 | } |
| 96 | cmd = (wmi_vdev_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 97 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 98 | WMITLV_TAG_STRUC_wmi_vdev_create_cmd_fixed_param, |
| 99 | WMITLV_GET_STRUCT_TLVLEN |
| 100 | (wmi_vdev_create_cmd_fixed_param)); |
| 101 | cmd->vdev_id = param->if_id; |
| 102 | cmd->vdev_type = param->type; |
| 103 | cmd->vdev_subtype = param->subtype; |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 104 | cmd->num_cfg_txrx_streams = num_bands; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 105 | copy_vdev_create_pdev_id(wmi_handle, cmd, param); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 106 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->vdev_macaddr); |
Neil Zhao | 98ec4c4 | 2017-08-10 11:51:33 -0700 | [diff] [blame] | 107 | WMI_LOGD("%s: ID = %d[pdev:%d] VAP Addr = %02x:%02x:%02x:%02x:%02x:%02x", |
| 108 | __func__, param->if_id, cmd->pdev_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 109 | macaddr[0], macaddr[1], macaddr[2], |
| 110 | macaddr[3], macaddr[4], macaddr[5]); |
Kiran Kumar Lokere | 51b7a16 | 2016-05-02 12:32:27 -0700 | [diff] [blame] | 111 | buf_ptr = (uint8_t *)cmd + sizeof(*cmd); |
| 112 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 113 | (num_bands * sizeof(wmi_vdev_txrx_streams))); |
| 114 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 115 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 116 | 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] | 117 | param->type, param->subtype, |
| 118 | param->nss_2g, param->nss_5g); |
| 119 | txrx_streams = (wmi_vdev_txrx_streams *)buf_ptr; |
| 120 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_2G; |
| 121 | txrx_streams->supported_tx_streams = param->nss_2g; |
| 122 | txrx_streams->supported_rx_streams = param->nss_2g; |
| 123 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 124 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 125 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
| 126 | |
| 127 | txrx_streams++; |
| 128 | txrx_streams->band = WMI_TPC_CHAINMASK_CONFIG_BAND_5G; |
| 129 | txrx_streams->supported_tx_streams = param->nss_5g; |
| 130 | txrx_streams->supported_rx_streams = param->nss_5g; |
| 131 | WMITLV_SET_HDR(&txrx_streams->tlv_header, |
| 132 | WMITLV_TAG_STRUC_wmi_vdev_txrx_streams, |
| 133 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_txrx_streams)); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 134 | 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] | 135 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 136 | WMI_LOGE("Failed to send WMI_VDEV_CREATE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 137 | wmi_buf_free(buf); |
| 138 | } |
| 139 | |
| 140 | return ret; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * send_vdev_delete_cmd_tlv() - send VDEV delete command to fw |
| 145 | * @wmi_handle: wmi handle |
| 146 | * @if_id: vdev id |
| 147 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 148 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 149 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 150 | 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] | 151 | uint8_t if_id) |
| 152 | { |
| 153 | wmi_vdev_delete_cmd_fixed_param *cmd; |
| 154 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 155 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 156 | |
| 157 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 158 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 159 | WMI_LOGP("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 160 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | cmd = (wmi_vdev_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 164 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 165 | WMITLV_TAG_STRUC_wmi_vdev_delete_cmd_fixed_param, |
| 166 | WMITLV_GET_STRUCT_TLVLEN |
| 167 | (wmi_vdev_delete_cmd_fixed_param)); |
| 168 | cmd->vdev_id = if_id; |
| 169 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 170 | sizeof(wmi_vdev_delete_cmd_fixed_param), |
| 171 | WMI_VDEV_DELETE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 172 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 173 | WMI_LOGE("Failed to send WMI_VDEV_DELETE_CMDID"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 174 | wmi_buf_free(buf); |
| 175 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 176 | WMI_LOGD("%s:vdev id = %d", __func__, if_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 177 | |
| 178 | return ret; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * send_vdev_stop_cmd_tlv() - send vdev stop command to fw |
| 183 | * @wmi: wmi handle |
| 184 | * @vdev_id: vdev id |
| 185 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 186 | * Return: QDF_STATUS_SUCCESS for success or erro code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 187 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 188 | static QDF_STATUS send_vdev_stop_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 189 | uint8_t vdev_id) |
| 190 | { |
| 191 | wmi_vdev_stop_cmd_fixed_param *cmd; |
| 192 | wmi_buf_t buf; |
| 193 | int32_t len = sizeof(*cmd); |
| 194 | |
| 195 | buf = wmi_buf_alloc(wmi, len); |
| 196 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 197 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 198 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 199 | } |
| 200 | cmd = (wmi_vdev_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 201 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 202 | WMITLV_TAG_STRUC_wmi_vdev_stop_cmd_fixed_param, |
| 203 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_stop_cmd_fixed_param)); |
| 204 | cmd->vdev_id = vdev_id; |
| 205 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 206 | WMI_LOGP("%s: Failed to send vdev stop command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 207 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 208 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 209 | } |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 210 | WMI_LOGD("%s:vdev id = %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 211 | |
| 212 | return 0; |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * send_vdev_down_cmd_tlv() - send vdev down command to fw |
| 217 | * @wmi: wmi handle |
| 218 | * @vdev_id: vdev id |
| 219 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 220 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 221 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 222 | 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] | 223 | { |
| 224 | wmi_vdev_down_cmd_fixed_param *cmd; |
| 225 | wmi_buf_t buf; |
| 226 | int32_t len = sizeof(*cmd); |
| 227 | |
| 228 | buf = wmi_buf_alloc(wmi, len); |
| 229 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 230 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 231 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 232 | } |
| 233 | cmd = (wmi_vdev_down_cmd_fixed_param *) wmi_buf_data(buf); |
| 234 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 235 | WMITLV_TAG_STRUC_wmi_vdev_down_cmd_fixed_param, |
| 236 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_down_cmd_fixed_param)); |
| 237 | cmd->vdev_id = vdev_id; |
| 238 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_DOWN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 239 | WMI_LOGP("%s: Failed to send vdev down", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 240 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 241 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 242 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 243 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 244 | |
| 245 | return 0; |
| 246 | } |
| 247 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 248 | #ifdef CONFIG_MCL |
| 249 | static inline void copy_channel_info( |
| 250 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 251 | wmi_channel *chan, |
| 252 | struct vdev_start_params *req) |
| 253 | { |
| 254 | chan->mhz = req->chan_freq; |
| 255 | |
| 256 | WMI_SET_CHANNEL_MODE(chan, req->chan_mode); |
| 257 | |
| 258 | chan->band_center_freq1 = req->band_center_freq1; |
| 259 | chan->band_center_freq2 = req->band_center_freq2; |
| 260 | |
| 261 | if (req->is_half_rate) |
| 262 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 263 | else if (req->is_quarter_rate) |
| 264 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 265 | |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 266 | if (req->is_dfs && req->flag_dfs) { |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 267 | WMI_SET_CHANNEL_FLAG(chan, req->flag_dfs); |
| 268 | cmd->disable_hw_ack = req->dis_hw_ack; |
| 269 | } |
| 270 | |
| 271 | WMI_SET_CHANNEL_REG_POWER(chan, req->max_txpow); |
| 272 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->max_txpow); |
| 273 | |
| 274 | } |
| 275 | #else |
| 276 | static inline void copy_channel_info( |
| 277 | wmi_vdev_start_request_cmd_fixed_param * cmd, |
| 278 | wmi_channel *chan, |
| 279 | struct vdev_start_params *req) |
| 280 | { |
| 281 | chan->mhz = req->channel.mhz; |
| 282 | |
| 283 | WMI_SET_CHANNEL_MODE(chan, req->channel.phy_mode); |
| 284 | |
| 285 | chan->band_center_freq1 = req->channel.cfreq1; |
| 286 | chan->band_center_freq2 = req->channel.cfreq2; |
| 287 | |
| 288 | if (req->channel.half_rate) |
| 289 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 290 | else if (req->channel.quarter_rate) |
| 291 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 292 | |
| 293 | if (req->channel.dfs_set) { |
Kiran Venkatappa | f0b91a8 | 2016-11-09 13:59:16 +0530 | [diff] [blame] | 294 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 295 | cmd->disable_hw_ack = req->disable_hw_ack; |
| 296 | } |
| 297 | |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 298 | if (req->channel.dfs_set_cfreq2) |
| 299 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_DFS_CFREQ2); |
| 300 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 301 | /* FIXME: Find out min, max and regulatory power levels */ |
| 302 | WMI_SET_CHANNEL_REG_POWER(chan, req->channel.maxregpower); |
| 303 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->channel.maxpower); |
| 304 | |
| 305 | } |
| 306 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 307 | /** |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 308 | * send_vdev_start_cmd_tlv() - send vdev start request to fw |
| 309 | * @wmi_handle: wmi handle |
| 310 | * @req: vdev start params |
| 311 | * |
| 312 | * Return: QDF status |
| 313 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 314 | 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] | 315 | struct vdev_start_params *req) |
| 316 | { |
| 317 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 318 | wmi_buf_t buf; |
| 319 | wmi_channel *chan; |
| 320 | int32_t len, ret; |
| 321 | uint8_t *buf_ptr; |
| 322 | |
| 323 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 324 | buf = wmi_buf_alloc(wmi_handle, len); |
| 325 | if (!buf) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 326 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 327 | return QDF_STATUS_E_NOMEM; |
| 328 | } |
| 329 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 330 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 331 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 332 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 333 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 334 | WMITLV_GET_STRUCT_TLVLEN |
| 335 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 336 | WMITLV_SET_HDR(&chan->tlv_header, WMITLV_TAG_STRUC_wmi_channel, |
| 337 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 338 | cmd->vdev_id = req->vdev_id; |
| 339 | |
| 340 | /* Fill channel info */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 341 | copy_channel_info(cmd, chan, req); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 342 | |
| 343 | cmd->beacon_interval = req->beacon_intval; |
| 344 | cmd->dtim_period = req->dtim_period; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 345 | |
Jiachao Wu | b89e3bf | 2017-08-23 15:27:11 +0800 | [diff] [blame] | 346 | cmd->bcn_tx_rate = req->bcn_tx_rate_code; |
| 347 | if (req->bcn_tx_rate_code) |
| 348 | cmd->flags |= WMI_UNIFIED_VDEV_START_BCN_TX_RATE_PRESENT; |
| 349 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 350 | if (!req->is_restart) { |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 351 | cmd->beacon_interval = req->beacon_intval; |
| 352 | cmd->dtim_period = req->dtim_period; |
| 353 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 354 | /* Copy the SSID */ |
| 355 | if (req->ssid.length) { |
| 356 | if (req->ssid.length < sizeof(cmd->ssid.ssid)) |
| 357 | cmd->ssid.ssid_len = req->ssid.length; |
| 358 | else |
| 359 | cmd->ssid.ssid_len = sizeof(cmd->ssid.ssid); |
| 360 | qdf_mem_copy(cmd->ssid.ssid, req->ssid.mac_ssid, |
| 361 | cmd->ssid.ssid_len); |
| 362 | } |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 363 | |
| 364 | if (req->hidden_ssid) |
| 365 | cmd->flags |= WMI_UNIFIED_VDEV_START_HIDDEN_SSID; |
| 366 | |
| 367 | if (req->pmf_enabled) |
| 368 | cmd->flags |= WMI_UNIFIED_VDEV_START_PMF_ENABLED; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 369 | } |
| 370 | |
Varun Reddy Yeturu | 3e4d819 | 2017-03-20 17:28:42 -0700 | [diff] [blame] | 371 | cmd->flags |= WMI_UNIFIED_VDEV_START_LDPC_RX_ENABLED; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 372 | cmd->num_noa_descriptors = req->num_noa_descriptors; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 373 | cmd->preferred_rx_streams = req->preferred_rx_streams; |
| 374 | cmd->preferred_tx_streams = req->preferred_tx_streams; |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 375 | cmd->cac_duration_ms = req->cac_duration_ms; |
| 376 | cmd->regdomain = req->regdomain; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 377 | cmd->he_ops = req->he_ops; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 378 | |
| 379 | buf_ptr = (uint8_t *) (((uintptr_t) cmd) + sizeof(*cmd) + |
| 380 | sizeof(wmi_channel)); |
| 381 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 382 | cmd->num_noa_descriptors * |
| 383 | sizeof(wmi_p2p_noa_descriptor)); |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 384 | WMI_LOGI("%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] | 385 | "beacon interval %d dtim %d center_chan %d center_freq2 %d " |
| 386 | "reg_info_1: 0x%x reg_info_2: 0x%x, req->max_txpow: 0x%x " |
Varun Reddy Yeturu | 3e4d819 | 2017-03-20 17:28:42 -0700 | [diff] [blame] | 387 | "Tx SS %d, Rx SS %d, ldpc_rx: %d, cac %d, regd %d, HE ops: %d", |
Naveen Rawat | 44f2f43 | 2016-12-01 12:58:57 -0800 | [diff] [blame] | 388 | __func__, req->vdev_id, chan->mhz, req->chan_mode, chan->info, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 389 | req->is_dfs, req->beacon_intval, cmd->dtim_period, |
| 390 | chan->band_center_freq1, chan->band_center_freq2, |
| 391 | chan->reg_info_1, chan->reg_info_2, req->max_txpow, |
Arif Hussain | df0211a | 2017-03-13 15:42:20 -0700 | [diff] [blame] | 392 | req->preferred_tx_streams, req->preferred_rx_streams, |
Varun Reddy Yeturu | 3e4d819 | 2017-03-20 17:28:42 -0700 | [diff] [blame] | 393 | req->ldpc_rx_enabled, req->cac_duration_ms, |
| 394 | req->regdomain, req->he_ops); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 395 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 396 | if (req->is_restart) |
| 397 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 398 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 399 | else |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 400 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 401 | WMI_VDEV_START_REQUEST_CMDID); |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 402 | if (ret) { |
| 403 | WMI_LOGP("%s: Failed to send vdev start command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 404 | wmi_buf_free(buf); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 405 | return QDF_STATUS_E_FAILURE; |
Siddarth Poddar | aa0b9a4 | 2016-03-29 15:13:26 +0530 | [diff] [blame] | 406 | } |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 407 | |
| 408 | return QDF_STATUS_SUCCESS; |
| 409 | } |
| 410 | |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 411 | /** |
| 412 | * send_hidden_ssid_vdev_restart_cmd_tlv() - restart vdev to set hidden ssid |
| 413 | * @wmi_handle: wmi handle |
| 414 | * @restart_params: vdev restart params |
| 415 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 416 | * Return: QDF_STATUS_SUCCESS for success or error code |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 417 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 418 | 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] | 419 | struct hidden_ssid_vdev_restart_params *restart_params) |
| 420 | { |
| 421 | wmi_vdev_start_request_cmd_fixed_param *cmd; |
| 422 | wmi_buf_t buf; |
| 423 | wmi_channel *chan; |
| 424 | int32_t len; |
| 425 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 426 | QDF_STATUS ret = 0; |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 427 | |
| 428 | len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE; |
| 429 | buf = wmi_buf_alloc(wmi_handle, len); |
| 430 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 431 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 432 | return QDF_STATUS_E_NOMEM; |
| 433 | } |
| 434 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 435 | cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr; |
| 436 | chan = (wmi_channel *) (buf_ptr + sizeof(*cmd)); |
| 437 | |
| 438 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 439 | WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param, |
| 440 | WMITLV_GET_STRUCT_TLVLEN |
| 441 | (wmi_vdev_start_request_cmd_fixed_param)); |
| 442 | |
| 443 | WMITLV_SET_HDR(&chan->tlv_header, |
| 444 | WMITLV_TAG_STRUC_wmi_channel, |
| 445 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 446 | |
| 447 | cmd->vdev_id = restart_params->session_id; |
| 448 | cmd->ssid.ssid_len = restart_params->ssid_len; |
| 449 | qdf_mem_copy(cmd->ssid.ssid, |
| 450 | restart_params->ssid, |
| 451 | cmd->ssid.ssid_len); |
| 452 | cmd->flags = restart_params->flags; |
| 453 | cmd->requestor_id = restart_params->requestor_id; |
| 454 | cmd->disable_hw_ack = restart_params->disable_hw_ack; |
| 455 | |
| 456 | chan->mhz = restart_params->mhz; |
| 457 | chan->band_center_freq1 = |
| 458 | restart_params->band_center_freq1; |
| 459 | chan->band_center_freq2 = |
| 460 | restart_params->band_center_freq2; |
| 461 | chan->info = restart_params->info; |
| 462 | chan->reg_info_1 = restart_params->reg_info_1; |
| 463 | chan->reg_info_2 = restart_params->reg_info_2; |
| 464 | |
| 465 | cmd->num_noa_descriptors = 0; |
| 466 | buf_ptr = (uint8_t *) (((uint8_t *) cmd) + sizeof(*cmd) + |
| 467 | sizeof(wmi_channel)); |
| 468 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 469 | cmd->num_noa_descriptors * |
| 470 | sizeof(wmi_p2p_noa_descriptor)); |
| 471 | |
| 472 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 473 | WMI_VDEV_RESTART_REQUEST_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 474 | if (QDF_IS_STATUS_ERROR(ret)) { |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 475 | wmi_buf_free(buf); |
| 476 | return QDF_STATUS_E_FAILURE; |
| 477 | } |
| 478 | return QDF_STATUS_SUCCESS; |
| 479 | } |
| 480 | |
| 481 | |
| 482 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 483 | * send_peer_flush_tids_cmd_tlv() - flush peer tids packets in fw |
| 484 | * @wmi: wmi handle |
| 485 | * @peer_addr: peer mac address |
| 486 | * @param: pointer to hold peer flush tid parameter |
| 487 | * |
| 488 | * Return: 0 for sucess or error code |
| 489 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 490 | 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] | 491 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 492 | struct peer_flush_params *param) |
| 493 | { |
| 494 | wmi_peer_flush_tids_cmd_fixed_param *cmd; |
| 495 | wmi_buf_t buf; |
| 496 | int32_t len = sizeof(*cmd); |
| 497 | |
| 498 | buf = wmi_buf_alloc(wmi, len); |
| 499 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 500 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 501 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 502 | } |
| 503 | cmd = (wmi_peer_flush_tids_cmd_fixed_param *) wmi_buf_data(buf); |
| 504 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 505 | WMITLV_TAG_STRUC_wmi_peer_flush_tids_cmd_fixed_param, |
| 506 | WMITLV_GET_STRUCT_TLVLEN |
| 507 | (wmi_peer_flush_tids_cmd_fixed_param)); |
| 508 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 509 | cmd->peer_tid_bitmap = param->peer_tid_bitmap; |
| 510 | cmd->vdev_id = param->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 511 | 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] | 512 | peer_addr, param->vdev_id, |
| 513 | param->peer_tid_bitmap); |
| 514 | 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] | 515 | WMI_LOGP("%s: Failed to send flush tid command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 516 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 517 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 518 | } |
| 519 | |
| 520 | return 0; |
| 521 | } |
| 522 | |
| 523 | /** |
| 524 | * send_peer_delete_cmd_tlv() - send PEER delete command to fw |
| 525 | * @wmi: wmi handle |
| 526 | * @peer_addr: peer mac addr |
| 527 | * @vdev_id: vdev id |
| 528 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 529 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 530 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 531 | static QDF_STATUS send_peer_delete_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 532 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 533 | uint8_t vdev_id) |
| 534 | { |
| 535 | wmi_peer_delete_cmd_fixed_param *cmd; |
| 536 | wmi_buf_t buf; |
| 537 | int32_t len = sizeof(*cmd); |
| 538 | buf = wmi_buf_alloc(wmi, len); |
| 539 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 540 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 541 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 542 | } |
| 543 | cmd = (wmi_peer_delete_cmd_fixed_param *) wmi_buf_data(buf); |
| 544 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 545 | WMITLV_TAG_STRUC_wmi_peer_delete_cmd_fixed_param, |
| 546 | WMITLV_GET_STRUCT_TLVLEN |
| 547 | (wmi_peer_delete_cmd_fixed_param)); |
| 548 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 549 | cmd->vdev_id = vdev_id; |
| 550 | |
Orhan K AKYILDIZ | c8d1c4b | 2017-01-10 14:32:18 -0800 | [diff] [blame] | 551 | 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] | 552 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_DELETE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 553 | WMI_LOGP("%s: Failed to send peer delete command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 554 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 555 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 556 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 557 | |
| 558 | return 0; |
| 559 | } |
| 560 | |
| 561 | /** |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 562 | * convert_host_peer_id_to_target_id_tlv - convert host peer param_id |
| 563 | * to target id. |
| 564 | * @targ_paramid: Target parameter id to hold the result. |
| 565 | * @peer_param_id: host param id. |
| 566 | * |
| 567 | * Return: QDF_STATUS_SUCCESS for success |
| 568 | * QDF_STATUS_E_NOSUPPORT when the param_id in not supported in tareget |
| 569 | */ |
| 570 | #ifdef CONFIG_MCL |
| 571 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 572 | uint32_t *targ_paramid, |
| 573 | uint32_t peer_param_id) |
| 574 | { |
| 575 | *targ_paramid = peer_param_id; |
| 576 | return QDF_STATUS_SUCCESS; |
| 577 | } |
| 578 | #else |
| 579 | static QDF_STATUS convert_host_peer_id_to_target_id_tlv( |
| 580 | uint32_t *targ_paramid, |
| 581 | uint32_t peer_param_id) |
| 582 | { |
| 583 | switch (peer_param_id) { |
| 584 | case WMI_HOST_PEER_MIMO_PS_STATE: |
| 585 | *targ_paramid = WMI_PEER_MIMO_PS_STATE; |
| 586 | break; |
| 587 | case WMI_HOST_PEER_AMPDU: |
| 588 | *targ_paramid = WMI_PEER_AMPDU; |
| 589 | break; |
| 590 | case WMI_HOST_PEER_AUTHORIZE: |
| 591 | *targ_paramid = WMI_PEER_AUTHORIZE; |
| 592 | break; |
| 593 | case WMI_HOST_PEER_CHWIDTH: |
| 594 | *targ_paramid = WMI_PEER_CHWIDTH; |
| 595 | break; |
| 596 | case WMI_HOST_PEER_NSS: |
| 597 | *targ_paramid = WMI_PEER_NSS; |
| 598 | break; |
| 599 | case WMI_HOST_PEER_USE_4ADDR: |
| 600 | *targ_paramid = WMI_PEER_USE_4ADDR; |
| 601 | break; |
| 602 | case WMI_HOST_PEER_MEMBERSHIP: |
| 603 | *targ_paramid = WMI_PEER_MEMBERSHIP; |
| 604 | break; |
| 605 | case WMI_HOST_PEER_USERPOS: |
| 606 | *targ_paramid = WMI_PEER_USERPOS; |
| 607 | break; |
| 608 | case WMI_HOST_PEER_CRIT_PROTO_HINT_ENABLED: |
| 609 | *targ_paramid = WMI_PEER_CRIT_PROTO_HINT_ENABLED; |
| 610 | break; |
| 611 | case WMI_HOST_PEER_TX_FAIL_CNT_THR: |
| 612 | *targ_paramid = WMI_PEER_TX_FAIL_CNT_THR; |
| 613 | break; |
| 614 | case WMI_HOST_PEER_SET_HW_RETRY_CTS2S: |
| 615 | *targ_paramid = WMI_PEER_SET_HW_RETRY_CTS2S; |
| 616 | break; |
| 617 | case WMI_HOST_PEER_IBSS_ATIM_WINDOW_LENGTH: |
| 618 | *targ_paramid = WMI_PEER_IBSS_ATIM_WINDOW_LENGTH; |
| 619 | break; |
| 620 | case WMI_HOST_PEER_PHYMODE: |
| 621 | *targ_paramid = WMI_PEER_PHYMODE; |
| 622 | break; |
| 623 | case WMI_HOST_PEER_USE_FIXED_PWR: |
| 624 | *targ_paramid = WMI_PEER_USE_FIXED_PWR; |
| 625 | break; |
| 626 | case WMI_HOST_PEER_PARAM_FIXED_RATE: |
| 627 | *targ_paramid = WMI_PEER_PARAM_FIXED_RATE; |
| 628 | break; |
| 629 | case WMI_HOST_PEER_SET_MU_WHITELIST: |
| 630 | *targ_paramid = WMI_PEER_SET_MU_WHITELIST; |
| 631 | break; |
| 632 | case WMI_HOST_PEER_SET_MAC_TX_RATE: |
| 633 | *targ_paramid = WMI_PEER_SET_MAX_TX_RATE; |
| 634 | break; |
| 635 | case WMI_HOST_PEER_SET_MIN_TX_RATE: |
| 636 | *targ_paramid = WMI_PEER_SET_MIN_TX_RATE; |
| 637 | break; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 638 | case WMI_HOST_PEER_SET_DEFAULT_ROUTING: |
| 639 | *targ_paramid = WMI_PEER_SET_DEFAULT_ROUTING; |
| 640 | break; |
Soumya Bhat | 8db697d | 2017-08-29 18:49:13 +0530 | [diff] [blame] | 641 | case WMI_HOST_PEER_NSS_VHT160: |
| 642 | *targ_paramid = WMI_PEER_NSS_VHT160; |
| 643 | break; |
| 644 | case WMI_HOST_PEER_NSS_VHT80_80: |
| 645 | *targ_paramid = WMI_PEER_NSS_VHT80_80; |
| 646 | break; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 647 | default: |
| 648 | return QDF_STATUS_E_NOSUPPORT; |
| 649 | } |
| 650 | |
| 651 | return QDF_STATUS_SUCCESS; |
| 652 | } |
| 653 | #endif |
| 654 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 655 | * send_peer_param_cmd_tlv() - set peer parameter in fw |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 656 | * @wmi: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 657 | * @peer_addr: peer mac address |
| 658 | * @param : pointer to hold peer set parameter |
| 659 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 660 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 661 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 662 | static QDF_STATUS send_peer_param_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 663 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 664 | struct peer_set_params *param) |
| 665 | { |
| 666 | wmi_peer_set_param_cmd_fixed_param *cmd; |
| 667 | wmi_buf_t buf; |
| 668 | int32_t err; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 669 | uint32_t param_id; |
| 670 | |
| 671 | if (convert_host_peer_id_to_target_id_tlv(¶m_id, |
| 672 | param->param_id) != QDF_STATUS_SUCCESS) |
| 673 | return QDF_STATUS_E_NOSUPPORT; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 674 | |
| 675 | buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 676 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 677 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 678 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 679 | } |
| 680 | cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 681 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 682 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 683 | WMITLV_GET_STRUCT_TLVLEN |
| 684 | (wmi_peer_set_param_cmd_fixed_param)); |
| 685 | cmd->vdev_id = param->vdev_id; |
| 686 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 687 | cmd->param_id = param_id; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 688 | cmd->param_value = param->param_value; |
| 689 | err = wmi_unified_cmd_send(wmi, buf, |
| 690 | sizeof(wmi_peer_set_param_cmd_fixed_param), |
| 691 | WMI_PEER_SET_PARAM_CMDID); |
| 692 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 693 | WMI_LOGE("Failed to send set_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 694 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 695 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 696 | } |
| 697 | |
| 698 | return 0; |
| 699 | } |
| 700 | |
| 701 | /** |
| 702 | * send_vdev_up_cmd_tlv() - send vdev up command in fw |
| 703 | * @wmi: wmi handle |
| 704 | * @bssid: bssid |
| 705 | * @vdev_up_params: pointer to hold vdev up parameter |
| 706 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 707 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 708 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 709 | static QDF_STATUS send_vdev_up_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 710 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 711 | struct vdev_up_params *params) |
| 712 | { |
| 713 | wmi_vdev_up_cmd_fixed_param *cmd; |
| 714 | wmi_buf_t buf; |
| 715 | int32_t len = sizeof(*cmd); |
| 716 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 717 | WMI_LOGD("%s: VDEV_UP", __func__); |
| 718 | WMI_LOGD("%s: vdev_id %d aid %d bssid %pM", __func__, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 719 | params->vdev_id, params->assoc_id, bssid); |
| 720 | buf = wmi_buf_alloc(wmi, len); |
| 721 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 722 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 723 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 724 | } |
| 725 | cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf); |
| 726 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 727 | WMITLV_TAG_STRUC_wmi_vdev_up_cmd_fixed_param, |
| 728 | WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_up_cmd_fixed_param)); |
| 729 | cmd->vdev_id = params->vdev_id; |
| 730 | cmd->vdev_assoc_id = params->assoc_id; |
| 731 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid, &cmd->vdev_bssid); |
| 732 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 733 | WMI_LOGP("%s: Failed to send vdev up command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 734 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 735 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 736 | } |
| 737 | |
| 738 | return 0; |
| 739 | } |
| 740 | |
| 741 | /** |
| 742 | * send_peer_create_cmd_tlv() - send peer create command to fw |
| 743 | * @wmi: wmi handle |
| 744 | * @peer_addr: peer mac address |
| 745 | * @peer_type: peer type |
| 746 | * @vdev_id: vdev id |
| 747 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 748 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 749 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 750 | static QDF_STATUS send_peer_create_cmd_tlv(wmi_unified_t wmi, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 751 | struct peer_create_params *param) |
| 752 | { |
| 753 | wmi_peer_create_cmd_fixed_param *cmd; |
| 754 | wmi_buf_t buf; |
| 755 | int32_t len = sizeof(*cmd); |
| 756 | |
| 757 | buf = wmi_buf_alloc(wmi, len); |
| 758 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 759 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 760 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 761 | } |
| 762 | cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf); |
| 763 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 764 | WMITLV_TAG_STRUC_wmi_peer_create_cmd_fixed_param, |
| 765 | WMITLV_GET_STRUCT_TLVLEN |
| 766 | (wmi_peer_create_cmd_fixed_param)); |
| 767 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 768 | cmd->peer_type = param->peer_type; |
| 769 | cmd->vdev_id = param->vdev_id; |
| 770 | |
| 771 | if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 772 | WMI_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 773 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 774 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 775 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 776 | 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] | 777 | param->vdev_id); |
| 778 | |
| 779 | return 0; |
| 780 | } |
| 781 | |
| 782 | /** |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 783 | * send_peer_rx_reorder_queue_setup_cmd_tlv() - send rx reorder setup |
| 784 | * command to fw |
| 785 | * @wmi: wmi handle |
| 786 | * @rx_reorder_queue_setup_params: Rx reorder queue setup parameters |
| 787 | * |
| 788 | * Return: 0 for success or error code |
| 789 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 790 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 791 | QDF_STATUS send_peer_rx_reorder_queue_setup_cmd_tlv(wmi_unified_t wmi, |
| 792 | struct rx_reorder_queue_setup_params *param) |
| 793 | { |
| 794 | wmi_peer_reorder_queue_setup_cmd_fixed_param *cmd; |
| 795 | wmi_buf_t buf; |
| 796 | int32_t len = sizeof(*cmd); |
| 797 | |
| 798 | buf = wmi_buf_alloc(wmi, len); |
| 799 | if (!buf) { |
| 800 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 801 | return QDF_STATUS_E_NOMEM; |
| 802 | } |
| 803 | cmd = (wmi_peer_reorder_queue_setup_cmd_fixed_param *)wmi_buf_data(buf); |
| 804 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 805 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_setup_cmd_fixed_param, |
| 806 | WMITLV_GET_STRUCT_TLVLEN |
| 807 | (wmi_peer_reorder_queue_setup_cmd_fixed_param)); |
| 808 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 809 | cmd->vdev_id = param->vdev_id; |
| 810 | cmd->tid = param->tid; |
| 811 | cmd->queue_ptr_lo = param->hw_qdesc_paddr_lo; |
| 812 | cmd->queue_ptr_hi = param->hw_qdesc_paddr_hi; |
| 813 | cmd->queue_no = param->queue_no; |
| 814 | |
| 815 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 816 | WMI_PEER_REORDER_QUEUE_SETUP_CMDID)) { |
| 817 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_SETUP_CMDID", |
| 818 | __func__); |
| 819 | qdf_nbuf_free(buf); |
| 820 | return QDF_STATUS_E_FAILURE; |
| 821 | } |
| 822 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid %d\n", __func__, |
| 823 | param->peer_macaddr, param->vdev_id, param->tid); |
| 824 | |
| 825 | return QDF_STATUS_SUCCESS; |
| 826 | } |
| 827 | |
| 828 | /** |
| 829 | * send_peer_rx_reorder_queue_remove_cmd_tlv() - send rx reorder remove |
| 830 | * command to fw |
| 831 | * @wmi: wmi handle |
| 832 | * @rx_reorder_queue_remove_params: Rx reorder queue remove parameters |
| 833 | * |
| 834 | * Return: 0 for success or error code |
| 835 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 836 | static |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 837 | QDF_STATUS send_peer_rx_reorder_queue_remove_cmd_tlv(wmi_unified_t wmi, |
| 838 | struct rx_reorder_queue_remove_params *param) |
| 839 | { |
| 840 | wmi_peer_reorder_queue_remove_cmd_fixed_param *cmd; |
| 841 | wmi_buf_t buf; |
| 842 | int32_t len = sizeof(*cmd); |
| 843 | |
| 844 | buf = wmi_buf_alloc(wmi, len); |
| 845 | if (!buf) { |
| 846 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 847 | return QDF_STATUS_E_NOMEM; |
| 848 | } |
| 849 | cmd = (wmi_peer_reorder_queue_remove_cmd_fixed_param *) |
| 850 | wmi_buf_data(buf); |
| 851 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 852 | WMITLV_TAG_STRUC_wmi_peer_reorder_queue_remove_cmd_fixed_param, |
| 853 | WMITLV_GET_STRUCT_TLVLEN |
| 854 | (wmi_peer_reorder_queue_remove_cmd_fixed_param)); |
| 855 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, &cmd->peer_macaddr); |
| 856 | cmd->vdev_id = param->vdev_id; |
| 857 | cmd->tid_mask = param->peer_tid_bitmap; |
| 858 | |
| 859 | if (wmi_unified_cmd_send(wmi, buf, len, |
| 860 | WMI_PEER_REORDER_QUEUE_REMOVE_CMDID)) { |
| 861 | WMI_LOGP("%s: fail to send WMI_PEER_REORDER_QUEUE_REMOVE_CMDID", |
| 862 | __func__); |
| 863 | qdf_nbuf_free(buf); |
| 864 | return QDF_STATUS_E_FAILURE; |
| 865 | } |
| 866 | WMI_LOGD("%s: peer_macaddr %pM vdev_id %d, tid_map %d", __func__, |
| 867 | param->peer_macaddr, param->vdev_id, param->peer_tid_bitmap); |
| 868 | |
| 869 | return QDF_STATUS_SUCCESS; |
| 870 | } |
| 871 | |
| 872 | /** |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 873 | * send_peer_add_wds_entry_cmd_tlv() - send peer add command to fw |
| 874 | * @wmi_handle: wmi handle |
| 875 | * @param: pointer holding peer details |
| 876 | * |
| 877 | * Return: 0 for success or error code |
| 878 | */ |
| 879 | static QDF_STATUS send_peer_add_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 880 | struct peer_add_wds_entry_params *param) |
| 881 | { |
| 882 | wmi_peer_add_wds_entry_cmd_fixed_param *cmd; |
| 883 | wmi_buf_t buf; |
| 884 | int len = sizeof(*cmd); |
| 885 | |
| 886 | buf = wmi_buf_alloc(wmi_handle, len); |
| 887 | if (!buf) { |
| 888 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 889 | return QDF_STATUS_E_FAILURE; |
| 890 | } |
| 891 | cmd = (wmi_peer_add_wds_entry_cmd_fixed_param *) wmi_buf_data(buf); |
| 892 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 893 | WMITLV_TAG_STRUC_wmi_peer_add_wds_entry_cmd_fixed_param, |
| 894 | WMITLV_GET_STRUCT_TLVLEN |
| 895 | (wmi_peer_add_wds_entry_cmd_fixed_param)); |
| 896 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr); |
| 897 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 898 | cmd->flags = param->flags; |
| 899 | |
| 900 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 901 | WMI_PEER_ADD_WDS_ENTRY_CMDID); |
| 902 | } |
| 903 | |
| 904 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 905 | * 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] | 906 | * @wmi_handle: wmi handle |
| 907 | * @param: pointer holding peer details |
| 908 | * |
| 909 | * Return: 0 for success or error code |
| 910 | */ |
| 911 | static QDF_STATUS send_peer_del_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 912 | struct peer_del_wds_entry_params *param) |
| 913 | { |
| 914 | wmi_peer_remove_wds_entry_cmd_fixed_param *cmd; |
| 915 | wmi_buf_t buf; |
| 916 | int len = sizeof(*cmd); |
| 917 | |
| 918 | buf = wmi_buf_alloc(wmi_handle, len); |
| 919 | if (!buf) { |
| 920 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 921 | return QDF_STATUS_E_NOMEM; |
| 922 | } |
| 923 | cmd = (wmi_peer_remove_wds_entry_cmd_fixed_param *)wmi_buf_data(buf); |
| 924 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 925 | WMITLV_TAG_STRUC_wmi_peer_remove_wds_entry_cmd_fixed_param, |
| 926 | WMITLV_GET_STRUCT_TLVLEN |
| 927 | (wmi_peer_remove_wds_entry_cmd_fixed_param)); |
| 928 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr); |
| 929 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 930 | WMI_PEER_REMOVE_WDS_ENTRY_CMDID); |
| 931 | } |
| 932 | |
| 933 | /** |
| 934 | * send_peer_update_wds_entry_cmd_non_tlv() - send peer update command to fw |
| 935 | * @wmi_handle: wmi handle |
| 936 | * @param: pointer holding peer details |
| 937 | * |
| 938 | * Return: 0 for success or error code |
| 939 | */ |
| 940 | static QDF_STATUS send_peer_update_wds_entry_cmd_tlv(wmi_unified_t wmi_handle, |
| 941 | struct peer_update_wds_entry_params *param) |
| 942 | { |
| 943 | wmi_peer_update_wds_entry_cmd_fixed_param *cmd; |
| 944 | wmi_buf_t buf; |
| 945 | int len = sizeof(*cmd); |
| 946 | |
| 947 | buf = wmi_buf_alloc(wmi_handle, len); |
| 948 | if (!buf) { |
| 949 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 950 | return QDF_STATUS_E_NOMEM; |
| 951 | } |
| 952 | |
| 953 | /* wmi_buf_alloc returns zeroed command buffer */ |
| 954 | cmd = (wmi_peer_update_wds_entry_cmd_fixed_param *)wmi_buf_data(buf); |
| 955 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 956 | WMITLV_TAG_STRUC_wmi_peer_update_wds_entry_cmd_fixed_param, |
| 957 | WMITLV_GET_STRUCT_TLVLEN |
| 958 | (wmi_peer_update_wds_entry_cmd_fixed_param)); |
| 959 | cmd->flags = (param->flags) ? WMI_WDS_FLAG_STATIC : 0; |
| 960 | if (param->wds_macaddr) |
| 961 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->wds_macaddr, |
| 962 | &cmd->wds_macaddr); |
| 963 | if (param->peer_macaddr) |
| 964 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr, |
| 965 | &cmd->peer_macaddr); |
| 966 | return wmi_unified_cmd_send(wmi_handle, buf, len, |
| 967 | WMI_PEER_UPDATE_WDS_ENTRY_CMDID); |
| 968 | } |
| 969 | |
| 970 | |
| 971 | |
| 972 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 973 | * send_green_ap_ps_cmd_tlv() - enable green ap powersave command |
| 974 | * @wmi_handle: wmi handle |
| 975 | * @value: value |
| 976 | * @mac_id: mac id to have radio context |
| 977 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 978 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 979 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 980 | 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] | 981 | uint32_t value, uint8_t mac_id) |
| 982 | { |
| 983 | wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd; |
| 984 | wmi_buf_t buf; |
| 985 | int32_t len = sizeof(*cmd); |
| 986 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 987 | WMI_LOGD("Set Green AP PS val %d", value); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 988 | |
| 989 | buf = wmi_buf_alloc(wmi_handle, len); |
| 990 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 991 | WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 992 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 993 | } |
| 994 | |
| 995 | cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 996 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 997 | WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param, |
| 998 | WMITLV_GET_STRUCT_TLVLEN |
| 999 | (wmi_pdev_green_ap_ps_enable_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 1000 | 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] | 1001 | cmd->enable = value; |
| 1002 | |
| 1003 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1004 | WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1005 | WMI_LOGE("Set Green AP PS param Failed val %d", value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1006 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1007 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1008 | } |
| 1009 | |
| 1010 | return 0; |
| 1011 | } |
| 1012 | |
| 1013 | /** |
| 1014 | * send_pdev_utf_cmd_tlv() - send utf command to fw |
| 1015 | * @wmi_handle: wmi handle |
| 1016 | * @param: pointer to pdev_utf_params |
| 1017 | * @mac_id: mac id to have radio context |
| 1018 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1019 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1020 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1021 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1022 | send_pdev_utf_cmd_tlv(wmi_unified_t wmi_handle, |
| 1023 | struct pdev_utf_params *param, |
| 1024 | uint8_t mac_id) |
| 1025 | { |
| 1026 | wmi_buf_t buf; |
| 1027 | uint8_t *cmd; |
Houston Hoffman | cdd5eda | 2016-09-27 23:29:49 -0700 | [diff] [blame] | 1028 | /* if param->len is 0 no data is sent, return error */ |
| 1029 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1030 | static uint8_t msgref = 1; |
| 1031 | uint8_t segNumber = 0, segInfo, numSegments; |
| 1032 | uint16_t chunk_len, total_bytes; |
| 1033 | uint8_t *bufpos; |
| 1034 | struct seg_hdr_info segHdrInfo; |
| 1035 | |
| 1036 | bufpos = param->utf_payload; |
| 1037 | total_bytes = param->len; |
| 1038 | ASSERT(total_bytes / MAX_WMI_UTF_LEN == |
| 1039 | (uint8_t) (total_bytes / MAX_WMI_UTF_LEN)); |
| 1040 | numSegments = (uint8_t) (total_bytes / MAX_WMI_UTF_LEN); |
| 1041 | |
| 1042 | if (param->len - (numSegments * MAX_WMI_UTF_LEN)) |
| 1043 | numSegments++; |
| 1044 | |
| 1045 | while (param->len) { |
| 1046 | if (param->len > MAX_WMI_UTF_LEN) |
| 1047 | chunk_len = MAX_WMI_UTF_LEN; /* MAX messsage */ |
| 1048 | else |
| 1049 | chunk_len = param->len; |
| 1050 | |
| 1051 | buf = wmi_buf_alloc(wmi_handle, |
| 1052 | (chunk_len + sizeof(segHdrInfo) + |
| 1053 | WMI_TLV_HDR_SIZE)); |
| 1054 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1055 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1056 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1057 | } |
| 1058 | |
| 1059 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 1060 | |
| 1061 | segHdrInfo.len = total_bytes; |
| 1062 | segHdrInfo.msgref = msgref; |
| 1063 | segInfo = ((numSegments << 4) & 0xF0) | (segNumber & 0xF); |
| 1064 | segHdrInfo.segmentInfo = segInfo; |
| 1065 | segHdrInfo.pad = 0; |
| 1066 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1067 | WMI_LOGD("%s:segHdrInfo.len = %d, segHdrInfo.msgref = %d," |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1068 | " segHdrInfo.segmentInfo = %d", |
| 1069 | __func__, segHdrInfo.len, segHdrInfo.msgref, |
| 1070 | segHdrInfo.segmentInfo); |
| 1071 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1072 | WMI_LOGD("%s:total_bytes %d segNumber %d totalSegments %d" |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1073 | "chunk len %d", __func__, total_bytes, segNumber, |
| 1074 | numSegments, chunk_len); |
| 1075 | |
| 1076 | segNumber++; |
| 1077 | |
| 1078 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 1079 | (chunk_len + sizeof(segHdrInfo))); |
| 1080 | cmd += WMI_TLV_HDR_SIZE; |
| 1081 | memcpy(cmd, &segHdrInfo, sizeof(segHdrInfo)); /* 4 bytes */ |
| 1082 | memcpy(&cmd[sizeof(segHdrInfo)], bufpos, chunk_len); |
| 1083 | |
| 1084 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 1085 | (chunk_len + sizeof(segHdrInfo) + |
| 1086 | WMI_TLV_HDR_SIZE), |
| 1087 | WMI_PDEV_UTF_CMDID); |
| 1088 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1089 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1090 | WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1091 | wmi_buf_free(buf); |
| 1092 | break; |
| 1093 | } |
| 1094 | |
| 1095 | param->len -= chunk_len; |
| 1096 | bufpos += chunk_len; |
| 1097 | } |
| 1098 | |
| 1099 | msgref++; |
| 1100 | |
| 1101 | return ret; |
| 1102 | } |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1103 | #ifdef CONFIG_MCL |
| 1104 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1105 | uint32_t host_param) |
| 1106 | { |
| 1107 | return host_param; |
| 1108 | } |
| 1109 | #else |
| 1110 | static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle, |
| 1111 | uint32_t host_param) |
| 1112 | { |
| 1113 | if (host_param < wmi_pdev_param_max) |
| 1114 | return wmi_handle->pdev_param[host_param]; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1115 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1116 | return WMI_UNAVAILABLE_PARAM; |
| 1117 | } |
| 1118 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1119 | /** |
| 1120 | * send_pdev_param_cmd_tlv() - set pdev parameters |
| 1121 | * @wmi_handle: wmi handle |
| 1122 | * @param: pointer to pdev parameter |
| 1123 | * @mac_id: radio context |
| 1124 | * |
| 1125 | * Return: 0 on success, errno on failure |
| 1126 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1127 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1128 | send_pdev_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 1129 | struct pdev_params *param, |
| 1130 | uint8_t mac_id) |
| 1131 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1132 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1133 | wmi_pdev_set_param_cmd_fixed_param *cmd; |
| 1134 | wmi_buf_t buf; |
| 1135 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1136 | uint32_t pdev_param; |
| 1137 | |
| 1138 | pdev_param = convert_host_pdev_param_tlv(wmi_handle, param->param_id); |
| 1139 | if (pdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1140 | WMI_LOGW("%s: Unavailable param %d\n", |
| 1141 | __func__, param->param_id); |
| 1142 | return QDF_STATUS_E_INVAL; |
| 1143 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1144 | |
| 1145 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1146 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1147 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1148 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1149 | } |
| 1150 | cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1151 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1152 | WMITLV_TAG_STRUC_wmi_pdev_set_param_cmd_fixed_param, |
| 1153 | WMITLV_GET_STRUCT_TLVLEN |
| 1154 | (wmi_pdev_set_param_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 1155 | 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] | 1156 | cmd->param_id = pdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1157 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1158 | WMI_LOGD("Setting pdev param = %x, value = %u", param->param_id, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1159 | param->param_value); |
| 1160 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1161 | WMI_PDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1162 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1163 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1164 | wmi_buf_free(buf); |
| 1165 | } |
| 1166 | return ret; |
| 1167 | } |
| 1168 | |
| 1169 | /** |
| 1170 | * send_suspend_cmd_tlv() - WMI suspend function |
| 1171 | * @param wmi_handle : handle to WMI. |
| 1172 | * @param param : pointer to hold suspend parameter |
| 1173 | * @mac_id: radio context |
| 1174 | * |
| 1175 | * Return 0 on success and -ve on failure. |
| 1176 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1177 | static QDF_STATUS send_suspend_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1178 | struct suspend_params *param, |
| 1179 | uint8_t mac_id) |
| 1180 | { |
| 1181 | wmi_pdev_suspend_cmd_fixed_param *cmd; |
| 1182 | wmi_buf_t wmibuf; |
| 1183 | uint32_t len = sizeof(*cmd); |
| 1184 | int32_t ret; |
| 1185 | |
| 1186 | /* |
| 1187 | * send the comand to Target to ignore the |
| 1188 | * PCIE reset so as to ensure that Host and target |
| 1189 | * states are in sync |
| 1190 | */ |
| 1191 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 1192 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1193 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1194 | |
| 1195 | cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1196 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1197 | WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param, |
| 1198 | WMITLV_GET_STRUCT_TLVLEN |
| 1199 | (wmi_pdev_suspend_cmd_fixed_param)); |
| 1200 | if (param->disable_target_intr) |
| 1201 | cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR; |
| 1202 | else |
| 1203 | cmd->suspend_opt = WMI_PDEV_SUSPEND; |
Kiran Venkatappa | 330179c | 2017-06-13 20:44:54 +0530 | [diff] [blame] | 1204 | |
| 1205 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(mac_id); |
| 1206 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1207 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 1208 | WMI_PDEV_SUSPEND_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1209 | if (ret) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1210 | wmi_buf_free(wmibuf); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1211 | WMI_LOGE("Failed to send WMI_PDEV_SUSPEND_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1212 | } |
| 1213 | |
| 1214 | return ret; |
| 1215 | } |
| 1216 | |
| 1217 | /** |
| 1218 | * send_resume_cmd_tlv() - WMI resume function |
| 1219 | * @param wmi_handle : handle to WMI. |
| 1220 | * @mac_id: radio context |
| 1221 | * |
| 1222 | * Return: 0 on success and -ve on failure. |
| 1223 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1224 | static QDF_STATUS send_resume_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1225 | uint8_t mac_id) |
| 1226 | { |
| 1227 | wmi_buf_t wmibuf; |
| 1228 | wmi_pdev_resume_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1229 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1230 | |
| 1231 | wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1232 | if (wmibuf == NULL) |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1233 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1234 | cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf); |
| 1235 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1236 | WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param, |
| 1237 | WMITLV_GET_STRUCT_TLVLEN |
| 1238 | (wmi_pdev_resume_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 1239 | 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] | 1240 | ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd), |
| 1241 | WMI_PDEV_RESUME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1242 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1243 | WMI_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command"); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1244 | wmi_buf_free(wmibuf); |
| 1245 | } |
| 1246 | |
| 1247 | return ret; |
| 1248 | } |
| 1249 | |
| 1250 | /** |
| 1251 | * send_wow_enable_cmd_tlv() - WMI wow enable function |
| 1252 | * @param wmi_handle : handle to WMI. |
| 1253 | * @param param : pointer to hold wow enable parameter |
| 1254 | * @mac_id: radio context |
| 1255 | * |
| 1256 | * Return: 0 on success and -ve on failure. |
| 1257 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1258 | 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] | 1259 | struct wow_cmd_params *param, |
| 1260 | uint8_t mac_id) |
| 1261 | { |
| 1262 | wmi_wow_enable_cmd_fixed_param *cmd; |
| 1263 | wmi_buf_t buf; |
| 1264 | int32_t len; |
| 1265 | int32_t ret; |
| 1266 | |
| 1267 | len = sizeof(wmi_wow_enable_cmd_fixed_param); |
| 1268 | |
| 1269 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1270 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1271 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 1272 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1273 | } |
| 1274 | cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1275 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1276 | WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param, |
| 1277 | WMITLV_GET_STRUCT_TLVLEN |
| 1278 | (wmi_wow_enable_cmd_fixed_param)); |
| 1279 | cmd->enable = param->enable; |
| 1280 | if (param->can_suspend_link) |
| 1281 | cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED; |
| 1282 | else |
| 1283 | cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED; |
Dustin Brown | fc28c0e | 2016-11-10 11:25:36 -0800 | [diff] [blame] | 1284 | cmd->flags = param->flags; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1285 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1286 | WMI_LOGI("suspend type: %s", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1287 | cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ? |
| 1288 | "WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED"); |
| 1289 | |
| 1290 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1291 | WMI_WOW_ENABLE_CMDID); |
| 1292 | if (ret) |
| 1293 | wmi_buf_free(buf); |
| 1294 | |
| 1295 | return ret; |
| 1296 | } |
| 1297 | |
| 1298 | /** |
| 1299 | * send_set_ap_ps_param_cmd_tlv() - set ap powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1300 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1301 | * @peer_addr: peer mac address |
| 1302 | * @param: pointer to ap_ps parameter structure |
| 1303 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1304 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1305 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1306 | 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] | 1307 | uint8_t *peer_addr, |
| 1308 | struct ap_ps_params *param) |
| 1309 | { |
| 1310 | wmi_ap_ps_peer_cmd_fixed_param *cmd; |
| 1311 | wmi_buf_t buf; |
| 1312 | int32_t err; |
| 1313 | |
| 1314 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1315 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1316 | 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] | 1317 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1318 | } |
| 1319 | cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf); |
| 1320 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1321 | WMITLV_TAG_STRUC_wmi_ap_ps_peer_cmd_fixed_param, |
| 1322 | WMITLV_GET_STRUCT_TLVLEN |
| 1323 | (wmi_ap_ps_peer_cmd_fixed_param)); |
| 1324 | cmd->vdev_id = param->vdev_id; |
| 1325 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr); |
| 1326 | cmd->param = param->param; |
| 1327 | cmd->value = param->value; |
| 1328 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 1329 | sizeof(*cmd), WMI_AP_PS_PEER_PARAM_CMDID); |
| 1330 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1331 | WMI_LOGE("Failed to send set_ap_ps_param cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1332 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1333 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1334 | } |
| 1335 | |
| 1336 | return 0; |
| 1337 | } |
| 1338 | |
| 1339 | /** |
| 1340 | * send_set_sta_ps_param_cmd_tlv() - set sta powersave parameters |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1341 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1342 | * @peer_addr: peer mac address |
| 1343 | * @param: pointer to sta_ps parameter structure |
| 1344 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1345 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1346 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1347 | 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] | 1348 | struct sta_ps_params *param) |
| 1349 | { |
| 1350 | wmi_sta_powersave_param_cmd_fixed_param *cmd; |
| 1351 | wmi_buf_t buf; |
| 1352 | int32_t len = sizeof(*cmd); |
| 1353 | |
| 1354 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1355 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1356 | WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1357 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1358 | } |
| 1359 | |
| 1360 | cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1361 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1362 | WMITLV_TAG_STRUC_wmi_sta_powersave_param_cmd_fixed_param, |
| 1363 | WMITLV_GET_STRUCT_TLVLEN |
| 1364 | (wmi_sta_powersave_param_cmd_fixed_param)); |
| 1365 | cmd->vdev_id = param->vdev_id; |
| 1366 | cmd->param = param->param; |
| 1367 | cmd->value = param->value; |
| 1368 | |
| 1369 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1370 | WMI_STA_POWERSAVE_PARAM_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1371 | 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] | 1372 | param->vdev_id, param->param, param->value); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1373 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1374 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1375 | } |
| 1376 | |
| 1377 | return 0; |
| 1378 | } |
| 1379 | |
| 1380 | /** |
| 1381 | * send_crash_inject_cmd_tlv() - inject fw crash |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 1382 | * @wmi_handle: wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1383 | * @param: ponirt to crash inject paramter structure |
| 1384 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 1385 | * Return: QDF_STATUS_SUCCESS for success or return error |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1386 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1387 | 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] | 1388 | struct crash_inject *param) |
| 1389 | { |
| 1390 | int32_t ret = 0; |
| 1391 | WMI_FORCE_FW_HANG_CMD_fixed_param *cmd; |
| 1392 | uint16_t len = sizeof(*cmd); |
| 1393 | wmi_buf_t buf; |
| 1394 | |
| 1395 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1396 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1397 | WMI_LOGE("%s: wmi_buf_alloc failed!", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1398 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1399 | } |
| 1400 | |
| 1401 | cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf); |
| 1402 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1403 | WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param, |
| 1404 | WMITLV_GET_STRUCT_TLVLEN |
| 1405 | (WMI_FORCE_FW_HANG_CMD_fixed_param)); |
| 1406 | cmd->type = param->type; |
| 1407 | cmd->delay_time_ms = param->delay_time_ms; |
| 1408 | |
| 1409 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1410 | WMI_FORCE_FW_HANG_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1411 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1412 | WMI_LOGE("%s: Failed to send set param command, ret = %d", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1413 | __func__, ret); |
| 1414 | wmi_buf_free(buf); |
| 1415 | } |
| 1416 | |
| 1417 | return ret; |
| 1418 | } |
| 1419 | |
| 1420 | /** |
| 1421 | * send_dbglog_cmd_tlv() - set debug log level |
| 1422 | * @param wmi_handle : handle to WMI. |
| 1423 | * @param param : pointer to hold dbglog level parameter |
| 1424 | * |
| 1425 | * Return: 0 on success and -ve on failure. |
| 1426 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1427 | static QDF_STATUS |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1428 | send_dbglog_cmd_tlv(wmi_unified_t wmi_handle, |
| 1429 | struct dbglog_params *dbglog_param) |
| 1430 | { |
| 1431 | wmi_buf_t buf; |
| 1432 | wmi_debug_log_config_cmd_fixed_param *configmsg; |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 1433 | QDF_STATUS status; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1434 | int32_t i; |
| 1435 | int32_t len; |
| 1436 | int8_t *buf_ptr; |
| 1437 | int32_t *module_id_bitmap_array; /* Used to fomr the second tlv */ |
| 1438 | |
Alok Kumar | 240afea | 2017-08-30 14:45:34 +0530 | [diff] [blame] | 1439 | ASSERT(dbglog_param->bitmap_len < MAX_MODULE_ID_BITMAP_WORDS); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1440 | |
| 1441 | /* Allocate size for 2 tlvs - including tlv hdr space for second tlv */ |
| 1442 | len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE + |
| 1443 | (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1444 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1445 | if (buf == NULL) |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 1446 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1447 | |
| 1448 | configmsg = |
| 1449 | (wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf)); |
| 1450 | buf_ptr = (int8_t *) configmsg; |
| 1451 | WMITLV_SET_HDR(&configmsg->tlv_header, |
| 1452 | WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param, |
| 1453 | WMITLV_GET_STRUCT_TLVLEN |
| 1454 | (wmi_debug_log_config_cmd_fixed_param)); |
| 1455 | configmsg->dbg_log_param = dbglog_param->param; |
| 1456 | configmsg->value = dbglog_param->val; |
| 1457 | /* Filling in the data part of second tlv -- should |
| 1458 | * follow first tlv _ WMI_TLV_HDR_SIZE */ |
| 1459 | module_id_bitmap_array = (A_UINT32 *) (buf_ptr + |
| 1460 | sizeof |
| 1461 | (wmi_debug_log_config_cmd_fixed_param) |
| 1462 | + WMI_TLV_HDR_SIZE); |
| 1463 | WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param), |
| 1464 | WMITLV_TAG_ARRAY_UINT32, |
| 1465 | sizeof(A_UINT32) * MAX_MODULE_ID_BITMAP_WORDS); |
| 1466 | if (dbglog_param->module_id_bitmap) { |
| 1467 | for (i = 0; i < dbglog_param->bitmap_len; ++i) { |
| 1468 | module_id_bitmap_array[i] = |
| 1469 | dbglog_param->module_id_bitmap[i]; |
| 1470 | } |
| 1471 | } |
| 1472 | |
| 1473 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 1474 | len, WMI_DBGLOG_CFG_CMDID); |
| 1475 | |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 1476 | if (status != QDF_STATUS_SUCCESS) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 1477 | wmi_buf_free(buf); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1478 | |
| 1479 | return status; |
| 1480 | } |
| 1481 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1482 | #ifdef CONFIG_MCL |
| 1483 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1484 | uint32_t host_param) |
| 1485 | { |
| 1486 | return host_param; |
| 1487 | } |
| 1488 | #else |
| 1489 | static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle, |
| 1490 | uint32_t host_param) |
| 1491 | { |
| 1492 | if (host_param < wmi_vdev_param_max) |
| 1493 | return wmi_handle->vdev_param[host_param]; |
| 1494 | |
| 1495 | return WMI_UNAVAILABLE_PARAM; |
| 1496 | } |
| 1497 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1498 | /** |
| 1499 | * send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function |
| 1500 | * @param wmi_handle : handle to WMI. |
| 1501 | * @param macaddr : MAC address |
| 1502 | * @param param : pointer to hold vdev set parameter |
| 1503 | * |
| 1504 | * Return: 0 on success and -ve on failure. |
| 1505 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1506 | 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] | 1507 | struct vdev_set_params *param) |
| 1508 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1509 | QDF_STATUS ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1510 | wmi_vdev_set_param_cmd_fixed_param *cmd; |
| 1511 | wmi_buf_t buf; |
| 1512 | uint16_t len = sizeof(*cmd); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1513 | uint32_t vdev_param; |
| 1514 | |
| 1515 | vdev_param = convert_host_vdev_param_tlv(wmi_handle, param->param_id); |
| 1516 | if (vdev_param == WMI_UNAVAILABLE_PARAM) { |
| 1517 | WMI_LOGW("%s:Vdev param %d not available", __func__, |
| 1518 | param->param_id); |
| 1519 | return QDF_STATUS_E_INVAL; |
| 1520 | |
| 1521 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1522 | |
| 1523 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1524 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1525 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1526 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1527 | } |
| 1528 | cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 1529 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1530 | WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param, |
| 1531 | WMITLV_GET_STRUCT_TLVLEN |
| 1532 | (wmi_vdev_set_param_cmd_fixed_param)); |
| 1533 | cmd->vdev_id = param->if_id; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1534 | cmd->param_id = vdev_param; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1535 | cmd->param_value = param->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1536 | WMI_LOGD("Setting vdev %d param = %x, value = %u", |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1537 | param->if_id, param->param_id, param->param_value); |
| 1538 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1539 | WMI_VDEV_SET_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1540 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1541 | WMI_LOGE("Failed to send set param command ret = %d", ret); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1542 | wmi_buf_free(buf); |
| 1543 | } |
| 1544 | |
| 1545 | return ret; |
| 1546 | } |
| 1547 | |
| 1548 | /** |
| 1549 | * send_stats_request_cmd_tlv() - WMI request stats function |
| 1550 | * @param wmi_handle : handle to WMI. |
| 1551 | * @param macaddr : MAC address |
| 1552 | * @param param : pointer to hold stats request parameter |
| 1553 | * |
| 1554 | * Return: 0 on success and -ve on failure. |
| 1555 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1556 | 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] | 1557 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1558 | struct stats_request_params *param) |
| 1559 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1560 | int32_t ret; |
| 1561 | wmi_request_stats_cmd_fixed_param *cmd; |
| 1562 | wmi_buf_t buf; |
| 1563 | uint16_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 1564 | |
| 1565 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1566 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1567 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1568 | return -QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1569 | } |
| 1570 | |
| 1571 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 1572 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1573 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 1574 | WMITLV_GET_STRUCT_TLVLEN |
| 1575 | (wmi_request_stats_cmd_fixed_param)); |
| 1576 | cmd->stats_id = param->stats_id; |
| 1577 | cmd->vdev_id = param->vdev_id; |
Gurumoorthi Gnanasambandhan | 305aeae | 2017-08-10 22:12:36 +0530 | [diff] [blame] | 1578 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 1579 | param->pdev_id); |
| 1580 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1581 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1582 | WMI_REQUEST_STATS_CMDID); |
Gurumoorthi Gnanasambandhan | 305aeae | 2017-08-10 22:12:36 +0530 | [diff] [blame] | 1583 | WMI_LOGD("STATS REQ STATS_ID:%d VDEV_ID:%d PDEV_ID:%d-->", |
| 1584 | cmd->stats_id, cmd->vdev_id, cmd->pdev_id); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1585 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1586 | WMI_LOGE("Failed to send status request to fw =%d", ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1587 | wmi_buf_free(buf); |
| 1588 | } |
| 1589 | |
| 1590 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1591 | } |
| 1592 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1593 | #ifdef CONFIG_WIN |
| 1594 | /** |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1595 | * send_packet_log_enable_cmd_tlv() - Send WMI command to enable packet-log |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1596 | * @param wmi_handle : handle to WMI. |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1597 | * @param PKTLOG_EVENT : packet log event |
| 1598 | * @mac_id: mac id to have radio context |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1599 | * |
| 1600 | * Return: 0 on success and -ve on failure. |
| 1601 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1602 | static QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle, |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1603 | WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT, uint8_t mac_id) |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1604 | { |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1605 | int32_t ret; |
| 1606 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 1607 | wmi_buf_t buf; |
| 1608 | uint16_t len = sizeof(wmi_pdev_pktlog_enable_cmd_fixed_param); |
| 1609 | |
| 1610 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1611 | if (!buf) { |
| 1612 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1613 | return -QDF_STATUS_E_NOMEM; |
| 1614 | } |
| 1615 | |
| 1616 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1617 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1618 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 1619 | WMITLV_GET_STRUCT_TLVLEN |
| 1620 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 1621 | cmd->evlist = PKTLOG_EVENT; |
| 1622 | cmd->pdev_id = mac_id; |
| 1623 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1624 | WMI_PDEV_PKTLOG_ENABLE_CMDID); |
| 1625 | if (ret) { |
| 1626 | WMI_LOGE("Failed to send pktlog enable cmd to FW =%d", ret); |
| 1627 | wmi_buf_free(buf); |
| 1628 | } |
| 1629 | |
| 1630 | return ret; |
| 1631 | } |
| 1632 | |
| 1633 | /** |
| 1634 | * send_packet_log_disable_cmd_tlv() - Send WMI command to disable packet-log |
| 1635 | * @param wmi_handle : handle to WMI. |
| 1636 | * @mac_id: mac id to have radio context |
| 1637 | * |
| 1638 | * Return: 0 on success and -ve on failure. |
| 1639 | */ |
| 1640 | static QDF_STATUS send_packet_log_disable_cmd_tlv(wmi_unified_t wmi_handle, |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 1641 | uint8_t mac_id) |
Keyur Parekh | 7df8ca1 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 1642 | { |
| 1643 | int32_t ret; |
| 1644 | wmi_pdev_pktlog_disable_cmd_fixed_param *cmd; |
| 1645 | wmi_buf_t buf; |
| 1646 | uint16_t len = sizeof(wmi_pdev_pktlog_disable_cmd_fixed_param); |
| 1647 | |
| 1648 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1649 | if (!buf) { |
| 1650 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 1651 | return -QDF_STATUS_E_NOMEM; |
| 1652 | } |
| 1653 | |
| 1654 | cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) wmi_buf_data(buf); |
| 1655 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1656 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 1657 | WMITLV_GET_STRUCT_TLVLEN |
| 1658 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
| 1659 | cmd->pdev_id = mac_id; |
| 1660 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 1661 | WMI_PDEV_PKTLOG_DISABLE_CMDID); |
| 1662 | if (ret) { |
| 1663 | WMI_LOGE("Failed to send pktlog disable cmd to FW =%d", ret); |
| 1664 | wmi_buf_free(buf); |
| 1665 | } |
| 1666 | |
| 1667 | return ret; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1668 | } |
| 1669 | #else |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1670 | /** |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 1671 | * send_packet_log_enable_cmd_tlv() - Send WMI command to enable |
| 1672 | * packet-log |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1673 | * @param wmi_handle : handle to WMI. |
| 1674 | * @param macaddr : MAC address |
| 1675 | * @param param : pointer to hold stats request parameter |
| 1676 | * |
| 1677 | * Return: 0 on success and -ve on failure. |
| 1678 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1679 | 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] | 1680 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 1681 | struct packet_enable_params *param) |
| 1682 | { |
| 1683 | return 0; |
| 1684 | } |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 1685 | /** |
| 1686 | * send_packet_log_disable_cmd_tlv() - Send WMI command to disable |
| 1687 | * packet-log |
| 1688 | * @param wmi_handle : handle to WMI. |
| 1689 | * @mac_id: mac id to have radio context |
| 1690 | * |
| 1691 | * Return: 0 on success and -ve on failure. |
| 1692 | */ |
| 1693 | static QDF_STATUS send_packet_log_disable_cmd_tlv(wmi_unified_t wmi_handle, |
| 1694 | uint8_t mac_id) |
| 1695 | { |
| 1696 | return 0; |
| 1697 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1698 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1699 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1700 | 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] | 1701 | struct beacon_params *param) |
| 1702 | { |
Kiran Venkatappa | 9d59bd6 | 2017-04-21 14:42:32 +0530 | [diff] [blame] | 1703 | QDF_STATUS ret; |
| 1704 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 1705 | wmi_buf_t wmi_buf; |
| 1706 | qdf_dma_addr_t dma_addr; |
| 1707 | uint32_t dtim_flag = 0; |
| 1708 | |
| 1709 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 1710 | if (!wmi_buf) { |
| 1711 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1712 | return QDF_STATUS_E_NOMEM; |
| 1713 | } |
| 1714 | if (param->is_dtim_count_zero) { |
| 1715 | dtim_flag |= WMI_BCN_SEND_DTIM_ZERO; |
| 1716 | if (param->is_bitctl_reqd) { |
| 1717 | /* deliver CAB traffic in next DTIM beacon */ |
| 1718 | dtim_flag |= WMI_BCN_SEND_DTIM_BITCTL_SET; |
| 1719 | } |
| 1720 | } |
| 1721 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 1722 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1723 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 1724 | WMITLV_GET_STRUCT_TLVLEN |
| 1725 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 1726 | cmd->vdev_id = param->vdev_id; |
| 1727 | cmd->data_len = qdf_nbuf_len(param->wbuf); |
| 1728 | cmd->frame_ctrl = param->frame_ctrl; |
| 1729 | cmd->dtim_flag = dtim_flag; |
| 1730 | dma_addr = qdf_nbuf_get_frag_paddr(param->wbuf, 0); |
| 1731 | cmd->frag_ptr_lo = qdf_get_lower_32_bits(dma_addr); |
| 1732 | #if defined(HTT_PADDR64) |
| 1733 | cmd->frag_ptr_hi = qdf_get_upper_32_bits(dma_addr) & 0x1F; |
| 1734 | #endif |
| 1735 | cmd->bcn_antenna = param->bcn_txant; |
| 1736 | |
| 1737 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1738 | wmi_buf, sizeof(*cmd), WMI_PDEV_SEND_BCN_CMDID); |
| 1739 | if (ret != QDF_STATUS_SUCCESS) { |
| 1740 | WMI_LOGE("%s: Failed to send bcn: %d", __func__, ret); |
| 1741 | wmi_buf_free(wmi_buf); |
| 1742 | } |
| 1743 | |
| 1744 | return ret; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1745 | } |
| 1746 | |
| 1747 | /** |
| 1748 | * send_beacon_send_tmpl_cmd_tlv() - WMI beacon send function |
| 1749 | * @param wmi_handle : handle to WMI. |
| 1750 | * @param param : pointer to hold beacon send cmd parameter |
| 1751 | * |
| 1752 | * Return: 0 on success and -ve on failure. |
| 1753 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1754 | 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] | 1755 | struct beacon_tmpl_params *param) |
| 1756 | { |
| 1757 | int32_t ret; |
| 1758 | wmi_bcn_tmpl_cmd_fixed_param *cmd; |
| 1759 | wmi_bcn_prb_info *bcn_prb_info; |
| 1760 | wmi_buf_t wmi_buf; |
| 1761 | uint8_t *buf_ptr; |
| 1762 | uint32_t wmi_buf_len; |
| 1763 | |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1764 | WMI_LOGI("%s\n", __func__); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1765 | wmi_buf_len = sizeof(wmi_bcn_tmpl_cmd_fixed_param) + |
| 1766 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 1767 | param->tmpl_len_aligned; |
| 1768 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 1769 | if (!wmi_buf) { |
| 1770 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 1771 | return QDF_STATUS_E_NOMEM; |
| 1772 | } |
| 1773 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 1774 | cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr; |
| 1775 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1776 | WMITLV_TAG_STRUC_wmi_bcn_tmpl_cmd_fixed_param, |
| 1777 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_tmpl_cmd_fixed_param)); |
| 1778 | cmd->vdev_id = param->vdev_id; |
| 1779 | cmd->tim_ie_offset = param->tim_ie_offset; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1780 | cmd->csa_switch_count_offset = param->csa_switch_count_offset; |
| 1781 | cmd->ext_csa_switch_count_offset = param->ext_csa_switch_count_offset; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1782 | cmd->buf_len = param->tmpl_len; |
| 1783 | buf_ptr += sizeof(wmi_bcn_tmpl_cmd_fixed_param); |
| 1784 | |
| 1785 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 1786 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 1787 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 1788 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 1789 | bcn_prb_info->caps = 0; |
| 1790 | bcn_prb_info->erp = 0; |
| 1791 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 1792 | |
| 1793 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->tmpl_len_aligned); |
| 1794 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 1795 | qdf_mem_copy(buf_ptr, param->frm, param->tmpl_len); |
| 1796 | |
| 1797 | ret = wmi_unified_cmd_send(wmi_handle, |
| 1798 | wmi_buf, wmi_buf_len, WMI_BCN_TMPL_CMDID); |
| 1799 | if (ret) { |
| 1800 | WMI_LOGE("%s: Failed to send bcn tmpl: %d", __func__, ret); |
| 1801 | wmi_buf_free(wmi_buf); |
| 1802 | } |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 1803 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 1804 | return 0; |
| 1805 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1806 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1807 | #ifdef CONFIG_MCL |
| 1808 | static inline void copy_peer_flags_tlv( |
| 1809 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1810 | struct peer_assoc_params *param) |
| 1811 | { |
| 1812 | cmd->peer_flags = param->peer_flags; |
| 1813 | } |
| 1814 | #else |
| 1815 | static inline void copy_peer_flags_tlv( |
| 1816 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1817 | struct peer_assoc_params *param) |
| 1818 | { |
| 1819 | /* |
| 1820 | * The target only needs a subset of the flags maintained in the host. |
| 1821 | * Just populate those flags and send it down |
| 1822 | */ |
| 1823 | cmd->peer_flags = 0; |
| 1824 | |
| 1825 | /* |
| 1826 | * Do not enable HT/VHT if WMM/wme is disabled for vap. |
| 1827 | */ |
| 1828 | if (param->is_wme_set) { |
| 1829 | |
| 1830 | if (param->qos_flag) |
| 1831 | cmd->peer_flags |= WMI_PEER_QOS; |
| 1832 | if (param->apsd_flag) |
| 1833 | cmd->peer_flags |= WMI_PEER_APSD; |
| 1834 | if (param->ht_flag) |
| 1835 | cmd->peer_flags |= WMI_PEER_HT; |
| 1836 | if (param->bw_40) |
| 1837 | cmd->peer_flags |= WMI_PEER_40MHZ; |
| 1838 | if (param->bw_80) |
| 1839 | cmd->peer_flags |= WMI_PEER_80MHZ; |
| 1840 | if (param->bw_160) |
| 1841 | cmd->peer_flags |= WMI_PEER_160MHZ; |
| 1842 | |
| 1843 | /* Typically if STBC is enabled for VHT it should be enabled |
| 1844 | * for HT as well |
| 1845 | **/ |
| 1846 | if (param->stbc_flag) |
| 1847 | cmd->peer_flags |= WMI_PEER_STBC; |
| 1848 | |
| 1849 | /* Typically if LDPC is enabled for VHT it should be enabled |
| 1850 | * for HT as well |
| 1851 | **/ |
| 1852 | if (param->ldpc_flag) |
| 1853 | cmd->peer_flags |= WMI_PEER_LDPC; |
| 1854 | |
| 1855 | if (param->static_mimops_flag) |
| 1856 | cmd->peer_flags |= WMI_PEER_STATIC_MIMOPS; |
| 1857 | if (param->dynamic_mimops_flag) |
| 1858 | cmd->peer_flags |= WMI_PEER_DYN_MIMOPS; |
| 1859 | if (param->spatial_mux_flag) |
| 1860 | cmd->peer_flags |= WMI_PEER_SPATIAL_MUX; |
| 1861 | if (param->vht_flag) |
| 1862 | cmd->peer_flags |= WMI_PEER_VHT; |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 1863 | if (param->he_flag) |
| 1864 | cmd->peer_flags |= WMI_PEER_HE; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1865 | } |
Kris Muthusamy | e4b6b1c | 2017-02-20 20:21:04 -0800 | [diff] [blame] | 1866 | |
Gurumoorthi Gnanasambandhan | d18a061 | 2017-07-03 16:14:55 +0530 | [diff] [blame] | 1867 | if (param->is_pmf_enabled) |
| 1868 | cmd->peer_flags |= WMI_PEER_PMF; |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1869 | /* |
| 1870 | * Suppress authorization for all AUTH modes that need 4-way handshake |
| 1871 | * (during re-association). |
| 1872 | * Authorization will be done for these modes on key installation. |
| 1873 | */ |
| 1874 | if (param->auth_flag) |
| 1875 | cmd->peer_flags |= WMI_PEER_AUTH; |
| 1876 | if (param->need_ptk_4_way) |
| 1877 | cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY; |
| 1878 | else |
| 1879 | cmd->peer_flags &= ~WMI_PEER_NEED_PTK_4_WAY; |
| 1880 | if (param->need_gtk_2_way) |
| 1881 | cmd->peer_flags |= WMI_PEER_NEED_GTK_2_WAY; |
| 1882 | /* safe mode bypass the 4-way handshake */ |
| 1883 | if (param->safe_mode_enabled) |
| 1884 | cmd->peer_flags &= |
| 1885 | ~(WMI_PEER_NEED_PTK_4_WAY | WMI_PEER_NEED_GTK_2_WAY); |
| 1886 | /* Disable AMSDU for station transmit, if user configures it */ |
| 1887 | /* Disable AMSDU for AP transmit to 11n Stations, if user configures |
| 1888 | * it |
| 1889 | * if (param->amsdu_disable) Add after FW support |
| 1890 | **/ |
| 1891 | |
| 1892 | /* Target asserts if node is marked HT and all MCS is set to 0. |
| 1893 | * Mark the node as non-HT if all the mcs rates are disabled through |
| 1894 | * iwpriv |
| 1895 | **/ |
| 1896 | if (param->peer_ht_rates.num_rates == 0) |
| 1897 | cmd->peer_flags &= ~WMI_PEER_HT; |
| 1898 | } |
| 1899 | #endif |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1900 | |
| 1901 | #ifdef CONFIG_MCL |
| 1902 | static inline void copy_peer_mac_addr_tlv( |
| 1903 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1904 | struct peer_assoc_params *param) |
| 1905 | { |
| 1906 | qdf_mem_copy(&cmd->peer_macaddr, ¶m->peer_macaddr, |
| 1907 | sizeof(param->peer_macaddr)); |
| 1908 | } |
| 1909 | #else |
| 1910 | static inline void copy_peer_mac_addr_tlv( |
| 1911 | wmi_peer_assoc_complete_cmd_fixed_param * cmd, |
| 1912 | struct peer_assoc_params *param) |
| 1913 | { |
| 1914 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_mac, &cmd->peer_macaddr); |
| 1915 | } |
| 1916 | #endif |
| 1917 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1918 | /** |
| 1919 | * send_peer_assoc_cmd_tlv() - WMI peer assoc function |
| 1920 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 1921 | * @param param : pointer to peer assoc parameter |
| 1922 | * |
| 1923 | * Return: 0 on success and -ve on failure. |
| 1924 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 1925 | 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] | 1926 | struct peer_assoc_params *param) |
| 1927 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1928 | wmi_peer_assoc_complete_cmd_fixed_param *cmd; |
| 1929 | wmi_vht_rate_set *mcs; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1930 | wmi_he_rate_set *he_mcs; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1931 | wmi_buf_t buf; |
| 1932 | int32_t len; |
| 1933 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1934 | QDF_STATUS ret; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1935 | uint32_t peer_legacy_rates_align; |
| 1936 | uint32_t peer_ht_rates_align; |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1937 | int32_t i; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1938 | |
| 1939 | |
| 1940 | peer_legacy_rates_align = wmi_align(param->peer_legacy_rates.num_rates); |
| 1941 | peer_ht_rates_align = wmi_align(param->peer_ht_rates.num_rates); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1942 | |
| 1943 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 1944 | (peer_legacy_rates_align * sizeof(uint8_t)) + |
| 1945 | WMI_TLV_HDR_SIZE + |
| 1946 | (peer_ht_rates_align * sizeof(uint8_t)) + |
| 1947 | sizeof(wmi_vht_rate_set) + |
| 1948 | (sizeof(wmi_he_rate_set) * param->peer_he_mcs_count |
| 1949 | + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1950 | |
| 1951 | buf = wmi_buf_alloc(wmi_handle, len); |
| 1952 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1953 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 1954 | return QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1955 | } |
| 1956 | |
| 1957 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 1958 | cmd = (wmi_peer_assoc_complete_cmd_fixed_param *) buf_ptr; |
| 1959 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 1960 | WMITLV_TAG_STRUC_wmi_peer_assoc_complete_cmd_fixed_param, |
| 1961 | WMITLV_GET_STRUCT_TLVLEN |
| 1962 | (wmi_peer_assoc_complete_cmd_fixed_param)); |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1963 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1964 | cmd->vdev_id = param->vdev_id; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1965 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1966 | cmd->peer_new_assoc = param->peer_new_assoc; |
| 1967 | cmd->peer_associd = param->peer_associd; |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1968 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 1969 | copy_peer_flags_tlv(cmd, param); |
Pamidipati, Vijay | ad16a88 | 2016-11-29 01:44:25 +0530 | [diff] [blame] | 1970 | copy_peer_mac_addr_tlv(cmd, param); |
| 1971 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1972 | cmd->peer_rate_caps = param->peer_rate_caps; |
| 1973 | cmd->peer_caps = param->peer_caps; |
| 1974 | cmd->peer_listen_intval = param->peer_listen_intval; |
| 1975 | cmd->peer_ht_caps = param->peer_ht_caps; |
| 1976 | cmd->peer_max_mpdu = param->peer_max_mpdu; |
| 1977 | cmd->peer_mpdu_density = param->peer_mpdu_density; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1978 | cmd->peer_vht_caps = param->peer_vht_caps; |
| 1979 | cmd->peer_phymode = param->peer_phymode; |
| 1980 | |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 1981 | /* Update 11ax capabilities */ |
| 1982 | cmd->peer_he_cap_info = param->peer_he_cap_macinfo; |
| 1983 | cmd->peer_he_ops = param->peer_he_ops; |
Krishna Kumaar Natarajan | cc9d503 | 2016-09-29 14:20:54 -0700 | [diff] [blame] | 1984 | qdf_mem_copy(&cmd->peer_he_cap_phy, ¶m->peer_he_cap_phyinfo, |
| 1985 | sizeof(param->peer_he_cap_phyinfo)); |
| 1986 | qdf_mem_copy(&cmd->peer_ppet, ¶m->peer_ppet, |
| 1987 | sizeof(param->peer_ppet)); |
| 1988 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1989 | /* Update peer legacy rate information */ |
| 1990 | buf_ptr += sizeof(*cmd); |
| 1991 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1992 | peer_legacy_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1993 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 1994 | cmd->num_peer_legacy_rates = param->peer_legacy_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 1995 | qdf_mem_copy(buf_ptr, param->peer_legacy_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 1996 | param->peer_legacy_rates.num_rates); |
| 1997 | |
| 1998 | /* Update peer HT rate information */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 1999 | buf_ptr += peer_legacy_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2000 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2001 | peer_ht_rates_align); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2002 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 3419aea | 2016-03-28 22:02:42 +0530 | [diff] [blame] | 2003 | cmd->num_peer_ht_rates = param->peer_ht_rates.num_rates; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2004 | qdf_mem_copy(buf_ptr, param->peer_ht_rates.rates, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2005 | param->peer_ht_rates.num_rates); |
| 2006 | |
| 2007 | /* VHT Rates */ |
Sandeep Puligilla | f358b1a | 2016-09-26 10:07:19 -0700 | [diff] [blame] | 2008 | buf_ptr += peer_ht_rates_align; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2009 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_vht_rate_set, |
| 2010 | WMITLV_GET_STRUCT_TLVLEN(wmi_vht_rate_set)); |
| 2011 | |
| 2012 | cmd->peer_nss = param->peer_nss; |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2013 | |
| 2014 | /* Update bandwidth-NSS mapping */ |
| 2015 | cmd->peer_bw_rxnss_override = 0; |
| 2016 | cmd->peer_bw_rxnss_override |= param->peer_bw_rxnss_override; |
| 2017 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2018 | mcs = (wmi_vht_rate_set *) buf_ptr; |
| 2019 | if (param->vht_capable) { |
| 2020 | mcs->rx_max_rate = param->rx_max_rate; |
| 2021 | mcs->rx_mcs_set = param->rx_mcs_set; |
| 2022 | mcs->tx_max_rate = param->tx_max_rate; |
| 2023 | mcs->tx_mcs_set = param->tx_mcs_set; |
| 2024 | } |
| 2025 | |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2026 | /* HE Rates */ |
| 2027 | cmd->peer_he_mcs = param->peer_he_mcs_count; |
| 2028 | buf_ptr += sizeof(wmi_vht_rate_set); |
| 2029 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2030 | (param->peer_he_mcs_count * sizeof(wmi_he_rate_set))); |
| 2031 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2032 | |
| 2033 | /* Loop through the HE rate set */ |
| 2034 | for (i = 0; i < param->peer_he_mcs_count; i++) { |
| 2035 | he_mcs = (wmi_he_rate_set *) buf_ptr; |
| 2036 | WMITLV_SET_HDR(he_mcs, WMITLV_TAG_STRUC_wmi_he_rate_set, |
| 2037 | WMITLV_GET_STRUCT_TLVLEN(wmi_he_rate_set)); |
| 2038 | |
| 2039 | he_mcs->rx_mcs_set = param->peer_he_rx_mcs_set[i]; |
| 2040 | he_mcs->tx_mcs_set = param->peer_he_tx_mcs_set[i]; |
| 2041 | WMI_LOGD("%s:HE idx %d RxMCSmap %x TxMCSmap %x ", __func__, |
| 2042 | i, he_mcs->rx_mcs_set, he_mcs->tx_mcs_set); |
| 2043 | buf_ptr += sizeof(wmi_he_rate_set); |
| 2044 | } |
| 2045 | |
| 2046 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2047 | 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] | 2048 | "peer_caps %x listen_intval %d ht_caps %x max_mpdu %d " |
| 2049 | "nss %d phymode %d peer_mpdu_density %d " |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2050 | "cmd->peer_vht_caps %x " |
| 2051 | "HE cap_info %x ops %x " |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2052 | "HE phy %x %x %x " |
| 2053 | "peer_bw_rxnss_override %x", __func__, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2054 | cmd->vdev_id, cmd->peer_associd, cmd->peer_flags, |
| 2055 | cmd->peer_rate_caps, cmd->peer_caps, |
| 2056 | cmd->peer_listen_intval, cmd->peer_ht_caps, |
| 2057 | cmd->peer_max_mpdu, cmd->peer_nss, cmd->peer_phymode, |
| 2058 | cmd->peer_mpdu_density, |
Kris Muthusamy | 1cac4b5 | 2017-03-28 12:03:50 -0700 | [diff] [blame] | 2059 | cmd->peer_vht_caps, cmd->peer_he_cap_info, |
| 2060 | cmd->peer_he_ops, cmd->peer_he_cap_phy[0], |
Krishna Rao | 0b952ea | 2017-03-20 13:30:10 +0530 | [diff] [blame] | 2061 | cmd->peer_he_cap_phy[1], cmd->peer_he_cap_phy[2], |
| 2062 | cmd->peer_bw_rxnss_override); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2063 | |
| 2064 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2065 | WMI_PEER_ASSOC_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2066 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2067 | WMI_LOGP("%s: Failed to send peer assoc command ret = %d", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2068 | __func__, ret); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2069 | wmi_buf_free(buf); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2070 | } |
| 2071 | |
| 2072 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2073 | } |
| 2074 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2075 | /* copy_scan_notify_events() - Helper routine to copy scan notify events |
| 2076 | */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2077 | static inline void copy_scan_event_cntrl_flags( |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2078 | wmi_start_scan_cmd_fixed_param * cmd, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2079 | struct scan_req_params *param) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2080 | { |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2081 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2082 | /* Scan events subscription */ |
| 2083 | if (param->scan_ev_started) |
| 2084 | cmd->notify_scan_events |= WMI_SCAN_EVENT_STARTED; |
| 2085 | if (param->scan_ev_completed) |
| 2086 | cmd->notify_scan_events |= WMI_SCAN_EVENT_COMPLETED; |
| 2087 | if (param->scan_ev_bss_chan) |
| 2088 | cmd->notify_scan_events |= WMI_SCAN_EVENT_BSS_CHANNEL; |
| 2089 | if (param->scan_ev_foreign_chan) |
| 2090 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL; |
| 2091 | if (param->scan_ev_dequeued) |
| 2092 | cmd->notify_scan_events |= WMI_SCAN_EVENT_DEQUEUED; |
| 2093 | if (param->scan_ev_preempted) |
| 2094 | cmd->notify_scan_events |= WMI_SCAN_EVENT_PREEMPTED; |
| 2095 | if (param->scan_ev_start_failed) |
| 2096 | cmd->notify_scan_events |= WMI_SCAN_EVENT_START_FAILED; |
| 2097 | if (param->scan_ev_restarted) |
| 2098 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESTARTED; |
| 2099 | if (param->scan_ev_foreign_chn_exit) |
| 2100 | cmd->notify_scan_events |= WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT; |
| 2101 | if (param->scan_ev_suspended) |
| 2102 | cmd->notify_scan_events |= WMI_SCAN_EVENT_SUSPENDED; |
| 2103 | if (param->scan_ev_resumed) |
| 2104 | cmd->notify_scan_events |= WMI_SCAN_EVENT_RESUMED; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2105 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2106 | /** Set scan control flags */ |
| 2107 | cmd->scan_ctrl_flags = 0; |
| 2108 | if (param->scan_f_passive) |
| 2109 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE; |
| 2110 | if (param->scan_f_strict_passive_pch) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2111 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_STRICT_PASSIVE_ON_PCHN; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2112 | if (param->scan_f_promisc_mode) |
| 2113 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROMISCOUS; |
| 2114 | if (param->scan_f_capture_phy_err) |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2115 | cmd->scan_ctrl_flags |= WMI_SCAN_CAPTURE_PHY_ERROR; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2116 | if (param->scan_f_half_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2117 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_HALF_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2118 | if (param->scan_f_quarter_rate) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2119 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_QUARTER_RATE_SUPPORT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2120 | if (param->scan_f_cck_rates) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2121 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_CCK_RATES; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2122 | if (param->scan_f_ofdm_rates) |
| 2123 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_OFDM_RATES; |
| 2124 | if (param->scan_f_chan_stat_evnt) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2125 | cmd->scan_ctrl_flags |= WMI_SCAN_CHAN_STAT_EVENT; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2126 | if (param->scan_f_filter_prb_req) |
| 2127 | cmd->scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ; |
| 2128 | if (param->scan_f_bcast_probe) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2129 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_BCAST_PROBE_REQ; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2130 | if (param->scan_f_offchan_mgmt_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2131 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_MGMT_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2132 | if (param->scan_f_offchan_data_tx) |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2133 | cmd->scan_ctrl_flags |= WMI_SCAN_OFFCHAN_DATA_TX; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2134 | if (param->scan_f_force_active_dfs_chn) |
| 2135 | cmd->scan_ctrl_flags |= WMI_SCAN_FLAG_FORCE_ACTIVE_ON_DFS; |
| 2136 | if (param->scan_f_add_tpc_ie_in_probe) |
| 2137 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_TPC_IE_IN_PROBE_REQ; |
| 2138 | if (param->scan_f_add_ds_ie_in_probe) |
| 2139 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
| 2140 | if (param->scan_f_add_spoofed_mac_in_probe) |
| 2141 | cmd->scan_ctrl_flags |= WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ; |
| 2142 | if (param->scan_f_add_rand_seq_in_probe) |
| 2143 | cmd->scan_ctrl_flags |= WMI_SCAN_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 2144 | if (param->scan_f_en_ie_whitelist_in_probe) |
| 2145 | cmd->scan_ctrl_flags |= |
| 2146 | WMI_SCAN_ENABLE_IE_WHTELIST_IN_PROBE_REQ; |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2147 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2148 | /* for adaptive scan mode using 3 bits (21 - 23 bits) */ |
| 2149 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 2150 | param->adaptive_dwell_time_mode); |
| 2151 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2152 | |
| 2153 | /* scan_copy_ie_buffer() - Copy scan ie_data */ |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2154 | static inline void scan_copy_ie_buffer(uint8_t *buf_ptr, |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2155 | struct scan_req_params *params) |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2156 | { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2157 | qdf_mem_copy(buf_ptr, params->extraie.ptr, params->extraie.len); |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2158 | } |
Gurumoorthi Gnanasambandhan | eb60ce0 | 2017-02-07 15:25:18 +0530 | [diff] [blame] | 2159 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2160 | /* |
| 2161 | * get_pdev_wmi_handle() - Helper func to derive pdev wmi handle from vdev_id |
| 2162 | * @param wmi_handle : Handle to WMI |
| 2163 | * @param vdev_id : vdev identifier |
| 2164 | * |
| 2165 | * Return : void * |
| 2166 | */ |
| 2167 | static inline void *get_pdev_wmi_handle(wmi_unified_t wmi_handle, uint8_t vdev_id) |
| 2168 | { |
| 2169 | struct wlan_objmgr_vdev *vdev = NULL; |
| 2170 | struct wlan_objmgr_pdev *pdev = NULL; |
| 2171 | uint8_t pdev_id = 0; |
| 2172 | |
| 2173 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc( |
| 2174 | (struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc, |
| 2175 | vdev_id, WLAN_SCAN_ID); |
| 2176 | if (vdev) { |
| 2177 | wlan_objmgr_vdev_release_ref(vdev, WLAN_SCAN_ID); |
| 2178 | pdev = wlan_vdev_get_pdev(vdev); |
| 2179 | if (pdev) |
| 2180 | pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev); |
| 2181 | else { |
| 2182 | qdf_print("%s : Invalid PDEV, forcing pdev_id to 0\n", __func__); |
| 2183 | } |
| 2184 | } else { |
| 2185 | qdf_print("%s : Invalid VDEV, forcing pdev_id to 0\n", __func__); |
| 2186 | } |
| 2187 | |
| 2188 | return wmi_unified_get_pdev_handle(wmi_handle->soc, pdev_id); |
| 2189 | } |
| 2190 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2191 | /** |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 2192 | * wmi_copy_scan_random_mac() - To copy scan randomization attrs to wmi buffer |
| 2193 | * @mac: random mac addr |
| 2194 | * @mask: random mac mask |
| 2195 | * @mac_addr: wmi random mac |
| 2196 | * @mac_mask: wmi random mac mask |
| 2197 | * |
| 2198 | * Return None. |
| 2199 | */ |
| 2200 | static inline |
| 2201 | void wmi_copy_scan_random_mac(uint8_t *mac, uint8_t *mask, |
| 2202 | wmi_mac_addr *mac_addr, wmi_mac_addr *mac_mask) |
| 2203 | { |
| 2204 | WMI_CHAR_ARRAY_TO_MAC_ADDR(mac, mac_addr); |
| 2205 | WMI_CHAR_ARRAY_TO_MAC_ADDR(mask, mac_mask); |
| 2206 | } |
| 2207 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2208 | /* |
| 2209 | * wmi_fill_vendor_oui() - fill vendor OUIs |
| 2210 | * @buf_ptr: pointer to wmi tlv buffer |
| 2211 | * @num_vendor_oui: number of vendor OUIs to be filled |
| 2212 | * @param_voui: pointer to OUI buffer |
| 2213 | * |
| 2214 | * This function populates the wmi tlv buffer when vendor specific OUIs are |
| 2215 | * present. |
| 2216 | * |
| 2217 | * Return: None |
| 2218 | */ |
| 2219 | static inline |
| 2220 | void wmi_fill_vendor_oui(uint8_t *buf_ptr, uint32_t num_vendor_oui, |
| 2221 | uint32_t *pvoui) |
| 2222 | { |
| 2223 | wmi_vendor_oui *voui = NULL; |
| 2224 | uint32_t i; |
| 2225 | |
| 2226 | voui = (wmi_vendor_oui *)buf_ptr; |
| 2227 | |
| 2228 | for (i = 0; i < num_vendor_oui; i++) { |
| 2229 | WMITLV_SET_HDR(&voui[i].tlv_header, |
| 2230 | WMITLV_TAG_STRUC_wmi_vendor_oui, |
| 2231 | WMITLV_GET_STRUCT_TLVLEN(wmi_vendor_oui)); |
| 2232 | voui[i].oui_type_subtype = pvoui[i]; |
| 2233 | } |
| 2234 | } |
| 2235 | |
| 2236 | /* |
| 2237 | * wmi_fill_ie_whitelist_attrs() - fill IE whitelist attrs |
| 2238 | * @ie_bitmap: output pointer to ie bit map in cmd |
| 2239 | * @num_vendor_oui: output pointer to num vendor OUIs |
| 2240 | * @ie_whitelist: input parameter |
| 2241 | * |
| 2242 | * This function populates the IE whitelist attrs of scan, pno and |
| 2243 | * scan oui commands for ie_whitelist parameter. |
| 2244 | * |
| 2245 | * Return: None |
| 2246 | */ |
| 2247 | static inline |
| 2248 | void wmi_fill_ie_whitelist_attrs(uint32_t *ie_bitmap, |
| 2249 | uint32_t *num_vendor_oui, |
| 2250 | struct probe_req_whitelist_attr *ie_whitelist) |
| 2251 | { |
| 2252 | uint32_t i = 0; |
| 2253 | |
| 2254 | for (i = 0; i < PROBE_REQ_BITMAP_LEN; i++) |
| 2255 | ie_bitmap[i] = ie_whitelist->ie_bitmap[i]; |
| 2256 | |
| 2257 | *num_vendor_oui = ie_whitelist->num_vendor_oui; |
| 2258 | } |
| 2259 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 2260 | /** |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2261 | * send_scan_start_cmd_tlv() - WMI scan start function |
| 2262 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2263 | * @param param : pointer to hold scan start cmd parameter |
| 2264 | * |
| 2265 | * Return: 0 on success and -ve on failure. |
| 2266 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2267 | 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] | 2268 | struct scan_req_params *params) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2269 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2270 | int32_t ret = 0; |
| 2271 | int32_t i; |
| 2272 | wmi_buf_t wmi_buf; |
| 2273 | wmi_start_scan_cmd_fixed_param *cmd; |
| 2274 | uint8_t *buf_ptr; |
| 2275 | uint32_t *tmp_ptr; |
| 2276 | wmi_ssid *ssid = NULL; |
| 2277 | wmi_mac_addr *bssid; |
| 2278 | int len = sizeof(*cmd); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2279 | uint8_t extraie_len_with_pad = 0; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2280 | struct probe_req_whitelist_attr *ie_whitelist = ¶ms->ie_whitelist; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2281 | |
| 2282 | /* Length TLV placeholder for array of uint32_t */ |
| 2283 | len += WMI_TLV_HDR_SIZE; |
| 2284 | /* calculate the length of buffer required */ |
| 2285 | if (params->num_chan) |
| 2286 | len += params->num_chan * sizeof(uint32_t); |
| 2287 | |
| 2288 | /* Length TLV placeholder for array of wmi_ssid structures */ |
| 2289 | len += WMI_TLV_HDR_SIZE; |
| 2290 | if (params->num_ssids) |
| 2291 | len += params->num_ssids * sizeof(wmi_ssid); |
| 2292 | |
| 2293 | /* Length TLV placeholder for array of wmi_mac_addr structures */ |
| 2294 | len += WMI_TLV_HDR_SIZE; |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2295 | if (params->num_bssid) |
| 2296 | len += sizeof(wmi_mac_addr) * params->num_bssid; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2297 | |
| 2298 | /* Length TLV placeholder for array of bytes */ |
| 2299 | len += WMI_TLV_HDR_SIZE; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2300 | if (params->extraie.len) |
| 2301 | extraie_len_with_pad = |
| 2302 | roundup(params->extraie.len, sizeof(uint32_t)); |
| 2303 | len += extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2304 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2305 | len += WMI_TLV_HDR_SIZE; /* Length of TLV for array of wmi_vendor_oui */ |
| 2306 | if (ie_whitelist->num_vendor_oui) |
| 2307 | len += ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 2308 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2309 | /* Allocate the memory */ |
| 2310 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2311 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2312 | WMI_LOGP("%s: failed to allocate memory for start scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2313 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2314 | return QDF_STATUS_E_FAILURE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2315 | } |
| 2316 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 2317 | cmd = (wmi_start_scan_cmd_fixed_param *) buf_ptr; |
| 2318 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2319 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 2320 | WMITLV_GET_STRUCT_TLVLEN |
| 2321 | (wmi_start_scan_cmd_fixed_param)); |
| 2322 | |
| 2323 | cmd->scan_id = params->scan_id; |
| 2324 | cmd->scan_req_id = params->scan_req_id; |
| 2325 | cmd->vdev_id = params->vdev_id; |
| 2326 | cmd->scan_priority = params->scan_priority; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2327 | |
| 2328 | copy_scan_event_cntrl_flags(cmd, params); |
| 2329 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2330 | cmd->dwell_time_active = params->dwell_time_active; |
| 2331 | cmd->dwell_time_passive = params->dwell_time_passive; |
| 2332 | cmd->min_rest_time = params->min_rest_time; |
| 2333 | cmd->max_rest_time = params->max_rest_time; |
| 2334 | cmd->repeat_probe_time = params->repeat_probe_time; |
| 2335 | cmd->probe_spacing_time = params->probe_spacing_time; |
| 2336 | cmd->idle_time = params->idle_time; |
| 2337 | cmd->max_scan_time = params->max_scan_time; |
| 2338 | cmd->probe_delay = params->probe_delay; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2339 | cmd->burst_duration = params->burst_duration; |
| 2340 | cmd->num_chan = params->num_chan; |
| 2341 | cmd->num_bssid = params->num_bssid; |
| 2342 | cmd->num_ssids = params->num_ssids; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2343 | cmd->ie_len = params->extraie.len; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2344 | cmd->n_probes = params->n_probes; |
Nitesh Shah | 52323d0 | 2017-05-22 15:49:00 +0530 | [diff] [blame] | 2345 | cmd->scan_ctrl_flags_ext = params->scan_ctrl_flags_ext; |
| 2346 | |
| 2347 | WMI_LOGD("scan_ctrl_flags_ext = %x", cmd->scan_ctrl_flags_ext); |
| 2348 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 2349 | if (params->scan_random.randomize) |
| 2350 | wmi_copy_scan_random_mac(params->scan_random.mac_addr, |
| 2351 | params->scan_random.mac_mask, |
| 2352 | &cmd->mac_addr, |
| 2353 | &cmd->mac_mask); |
| 2354 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2355 | if (ie_whitelist->white_list) |
| 2356 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 2357 | &cmd->num_vendor_oui, |
| 2358 | ie_whitelist); |
| 2359 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2360 | buf_ptr += sizeof(*cmd); |
| 2361 | tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2362 | for (i = 0; i < params->num_chan; ++i) |
| 2363 | tmp_ptr[i] = params->chan_list[i]; |
| 2364 | |
| 2365 | WMITLV_SET_HDR(buf_ptr, |
| 2366 | WMITLV_TAG_ARRAY_UINT32, |
| 2367 | (params->num_chan * sizeof(uint32_t))); |
| 2368 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_chan * sizeof(uint32_t)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 2369 | if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2370 | WMI_LOGE("Invalid value for numSsid"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2371 | goto error; |
| 2372 | } |
| 2373 | |
| 2374 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2375 | (params->num_ssids * sizeof(wmi_ssid))); |
| 2376 | |
| 2377 | if (params->num_ssids) { |
| 2378 | ssid = (wmi_ssid *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 2379 | for (i = 0; i < params->num_ssids; ++i) { |
| 2380 | ssid->ssid_len = params->ssid[i].length; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2381 | qdf_mem_copy(ssid->ssid, params->ssid[i].ssid, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2382 | params->ssid[i].length); |
| 2383 | ssid++; |
| 2384 | } |
| 2385 | } |
| 2386 | buf_ptr += WMI_TLV_HDR_SIZE + (params->num_ssids * sizeof(wmi_ssid)); |
| 2387 | |
| 2388 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 2389 | (params->num_bssid * sizeof(wmi_mac_addr))); |
| 2390 | bssid = (wmi_mac_addr *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2391 | |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2392 | if (params->num_bssid) { |
| 2393 | for (i = 0; i < params->num_bssid; ++i) { |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2394 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 2395 | ¶ms->bssid_list[i].bytes[0], bssid); |
Kiran Venkatappa | 3c4f6a2 | 2016-11-07 23:23:56 +0530 | [diff] [blame] | 2396 | bssid++; |
| 2397 | } |
| 2398 | } |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2399 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2400 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 2401 | (params->num_bssid * sizeof(wmi_mac_addr)); |
| 2402 | |
| 2403 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, extraie_len_with_pad); |
| 2404 | if (params->extraie.len) |
| 2405 | scan_copy_ie_buffer(buf_ptr + WMI_TLV_HDR_SIZE, |
| 2406 | params); |
| 2407 | |
| 2408 | buf_ptr += WMI_TLV_HDR_SIZE + extraie_len_with_pad; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2409 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 2410 | /* probe req ie whitelisting */ |
| 2411 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 2412 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 2413 | |
| 2414 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 2415 | |
| 2416 | if (cmd->num_vendor_oui) { |
| 2417 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 2418 | ie_whitelist->voui); |
| 2419 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 2420 | } |
| 2421 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2422 | ret = wmi_unified_cmd_send( |
| 2423 | get_pdev_wmi_handle(wmi_handle, cmd->vdev_id), wmi_buf, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2424 | len, WMI_START_SCAN_CMDID); |
| 2425 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2426 | WMI_LOGE("%s: Failed to start scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2427 | wmi_buf_free(wmi_buf); |
| 2428 | } |
| 2429 | return ret; |
| 2430 | error: |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2431 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2432 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2433 | } |
| 2434 | |
| 2435 | /** |
| 2436 | * send_scan_stop_cmd_tlv() - WMI scan start function |
| 2437 | * @param wmi_handle : handle to WMI. |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2438 | * @param param : pointer to hold scan cancel cmd parameter |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2439 | * |
| 2440 | * Return: 0 on success and -ve on failure. |
| 2441 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2442 | 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] | 2443 | struct scan_cancel_param *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2444 | { |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2445 | wmi_stop_scan_cmd_fixed_param *cmd; |
| 2446 | int ret; |
| 2447 | int len = sizeof(*cmd); |
| 2448 | wmi_buf_t wmi_buf; |
| 2449 | |
| 2450 | /* Allocate the memory */ |
| 2451 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 2452 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2453 | WMI_LOGP("%s: failed to allocate memory for stop scan cmd", |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2454 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2455 | ret = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2456 | goto error; |
| 2457 | } |
| 2458 | |
| 2459 | cmd = (wmi_stop_scan_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 2460 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2461 | WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param, |
| 2462 | WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param)); |
| 2463 | cmd->vdev_id = param->vdev_id; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2464 | cmd->requestor = param->requester; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2465 | cmd->scan_id = param->scan_id; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2466 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2467 | param->pdev_id); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2468 | /* stop the scan with the corresponding scan_id */ |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2469 | if (param->req_type == WLAN_SCAN_CANCEL_PDEV_ALL) { |
| 2470 | /* Cancelling all scans */ |
| 2471 | cmd->req_type = WMI_SCAN_STOP_ALL; |
| 2472 | } else if (param->req_type == WLAN_SCAN_CANCEL_VDEV_ALL) { |
| 2473 | /* Cancelling VAP scans */ |
| 2474 | cmd->req_type = WMI_SCN_STOP_VAP_ALL; |
| 2475 | } else if (param->req_type == WLAN_SCAN_CANCEL_SINGLE) { |
| 2476 | /* Cancelling specific scan */ |
| 2477 | cmd->req_type = WMI_SCAN_STOP_ONE; |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2478 | } else { |
| 2479 | WMI_LOGE("%s: Invalid Command : ", __func__); |
| 2480 | wmi_buf_free(wmi_buf); |
| 2481 | return QDF_STATUS_E_INVAL; |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 2482 | } |
| 2483 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2484 | 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] | 2485 | len, WMI_STOP_SCAN_CMDID); |
| 2486 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2487 | WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2488 | wmi_buf_free(wmi_buf); |
| 2489 | } |
| 2490 | |
| 2491 | error: |
| 2492 | return ret; |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2493 | } |
| 2494 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2495 | #ifdef CONFIG_MCL |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2496 | /** |
| 2497 | * send_scan_chan_list_cmd_tlv() - WMI scan channel list function |
| 2498 | * @param wmi_handle : handle to WMI. |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2499 | * @param param : pointer to hold scan channel list parameter |
| 2500 | * |
| 2501 | * Return: 0 on success and -ve on failure. |
| 2502 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2503 | 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] | 2504 | struct scan_chan_list_params *chan_list) |
| 2505 | { |
| 2506 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2507 | QDF_STATUS qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2508 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2509 | int i; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2510 | uint8_t *buf_ptr; |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2511 | wmi_channel_param *chan_info, *tchan_info; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2512 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 2513 | |
| 2514 | len += sizeof(wmi_channel) * chan_list->num_scan_chans; |
| 2515 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2516 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2517 | WMI_LOGE("Failed to allocate memory"); |
| 2518 | qdf_status = QDF_STATUS_E_NOMEM; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2519 | goto end; |
| 2520 | } |
| 2521 | |
| 2522 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2523 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2524 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2525 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2526 | WMITLV_GET_STRUCT_TLVLEN |
| 2527 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2528 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2529 | 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] | 2530 | |
| 2531 | cmd->num_scan_chans = chan_list->num_scan_chans; |
| 2532 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2533 | WMITLV_TAG_ARRAY_STRUC, |
| 2534 | sizeof(wmi_channel) * chan_list->num_scan_chans); |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 2535 | chan_info = (wmi_channel_param *) |
| 2536 | (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2537 | tchan_info = chan_list->chan_info; |
| 2538 | |
| 2539 | for (i = 0; i < chan_list->num_scan_chans; ++i) { |
| 2540 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2541 | WMITLV_TAG_STRUC_wmi_channel, |
| 2542 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2543 | chan_info->mhz = tchan_info->mhz; |
| 2544 | chan_info->band_center_freq1 = |
| 2545 | tchan_info->band_center_freq1; |
| 2546 | chan_info->band_center_freq2 = |
| 2547 | tchan_info->band_center_freq2; |
| 2548 | chan_info->info = tchan_info->info; |
| 2549 | chan_info->reg_info_1 = tchan_info->reg_info_1; |
| 2550 | chan_info->reg_info_2 = tchan_info->reg_info_2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2551 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2552 | |
| 2553 | /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ |
| 2554 | /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ |
| 2555 | /*TODO: WMI_SET_CHANNEL_REG_CLASSID */ |
| 2556 | tchan_info++; |
| 2557 | chan_info++; |
| 2558 | } |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2559 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2560 | chan_list->pdev_id); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2561 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2562 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 2563 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2564 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2565 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2566 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2567 | wmi_buf_free(buf); |
| 2568 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2569 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2570 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2571 | return qdf_status; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2572 | } |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2573 | #else |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2574 | 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] | 2575 | struct scan_chan_list_params *chan_list) |
| 2576 | { |
| 2577 | wmi_buf_t buf; |
| 2578 | QDF_STATUS qdf_status; |
| 2579 | wmi_scan_chan_list_cmd_fixed_param *cmd; |
| 2580 | int i; |
| 2581 | uint8_t *buf_ptr; |
| 2582 | wmi_channel *chan_info; |
| 2583 | struct channel_param *tchan_info; |
| 2584 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2585 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2586 | len += sizeof(wmi_channel) * chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2587 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2588 | if (!buf) { |
| 2589 | WMI_LOGE("Failed to allocate memory"); |
| 2590 | qdf_status = QDF_STATUS_E_NOMEM; |
| 2591 | goto end; |
| 2592 | } |
| 2593 | |
| 2594 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 2595 | cmd = (wmi_scan_chan_list_cmd_fixed_param *) buf_ptr; |
| 2596 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2597 | WMITLV_TAG_STRUC_wmi_scan_chan_list_cmd_fixed_param, |
| 2598 | WMITLV_GET_STRUCT_TLVLEN |
| 2599 | (wmi_scan_chan_list_cmd_fixed_param)); |
| 2600 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2601 | WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2602 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2603 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2604 | chan_list->pdev_id); |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2605 | cmd->num_scan_chans = chan_list->nallchans; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2606 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), |
| 2607 | WMITLV_TAG_ARRAY_STRUC, |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2608 | sizeof(wmi_channel) * chan_list->nallchans); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2609 | chan_info = (wmi_channel *) (buf_ptr + sizeof(*cmd) + WMI_TLV_HDR_SIZE); |
| 2610 | tchan_info = &(chan_list->ch_param[0]); |
| 2611 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2612 | for (i = 0; i < chan_list->nallchans; ++i) { |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2613 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 2614 | WMITLV_TAG_STRUC_wmi_channel, |
| 2615 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 2616 | chan_info->mhz = tchan_info->mhz; |
| 2617 | chan_info->band_center_freq1 = |
| 2618 | tchan_info->cfreq1; |
| 2619 | chan_info->band_center_freq2 = |
| 2620 | tchan_info->cfreq2; |
| 2621 | |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 2622 | if (tchan_info->is_chan_passive) |
| 2623 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2624 | WMI_CHAN_FLAG_PASSIVE); |
| 2625 | |
| 2626 | if (tchan_info->allow_vht) |
| 2627 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2628 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 2629 | else if (tchan_info->allow_ht) |
| 2630 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 2631 | WMI_CHAN_FLAG_ALLOW_HT); |
| 2632 | WMI_SET_CHANNEL_MODE(chan_info, |
| 2633 | tchan_info->phy_mode); |
| 2634 | |
| 2635 | /* Add tchan_info->half_rate and tchan_info->quarter_rate later |
| 2636 | * after FW support |
| 2637 | */ |
| 2638 | |
| 2639 | /* also fill in power information */ |
| 2640 | WMI_SET_CHANNEL_MIN_POWER(chan_info, |
| 2641 | tchan_info->minpower); |
| 2642 | WMI_SET_CHANNEL_MAX_POWER(chan_info, |
| 2643 | tchan_info->maxpower); |
| 2644 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 2645 | tchan_info->maxregpower); |
| 2646 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, |
| 2647 | tchan_info->antennamax); |
| 2648 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, |
| 2649 | tchan_info->reg_class_id); |
| 2650 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2651 | WMI_LOGD("chan[%d] = %u", i, chan_info->mhz); |
| 2652 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2653 | tchan_info++; |
| 2654 | chan_info++; |
| 2655 | } |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 2656 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 2657 | chan_list->pdev_id); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2658 | |
Anish Nataraj | dd85515 | 2017-03-20 12:49:08 +0530 | [diff] [blame] | 2659 | qdf_status = wmi_unified_cmd_send( |
| 2660 | wmi_handle, |
| 2661 | buf, len, WMI_SCAN_CHAN_LIST_CMDID); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 2662 | |
| 2663 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 2664 | WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID"); |
| 2665 | wmi_buf_free(buf); |
| 2666 | } |
| 2667 | |
| 2668 | end: |
| 2669 | return qdf_status; |
| 2670 | } |
| 2671 | #endif |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2672 | |
| 2673 | /** |
| 2674 | * populate_tx_send_params - Populate TX param TLV for mgmt and offchan tx |
| 2675 | * |
| 2676 | * @bufp: Pointer to buffer |
| 2677 | * @param: Pointer to tx param |
| 2678 | * |
| 2679 | * Return: QDF_STATUS_SUCCESS for success and QDF_STATUS_E_FAILURE for failure |
| 2680 | */ |
| 2681 | static inline QDF_STATUS populate_tx_send_params(uint8_t *bufp, |
| 2682 | struct tx_send_params param) |
| 2683 | { |
| 2684 | wmi_tx_send_params *tx_param; |
| 2685 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2686 | |
| 2687 | if (!bufp) { |
| 2688 | status = QDF_STATUS_E_FAILURE; |
| 2689 | return status; |
| 2690 | } |
| 2691 | tx_param = (wmi_tx_send_params *)bufp; |
| 2692 | WMITLV_SET_HDR(&tx_param->tlv_header, |
| 2693 | WMITLV_TAG_STRUC_wmi_tx_send_params, |
| 2694 | WMITLV_GET_STRUCT_TLVLEN(wmi_tx_send_params)); |
| 2695 | WMI_TX_SEND_PARAM_PWR_SET(tx_param->tx_param_dword0, param.pwr); |
| 2696 | WMI_TX_SEND_PARAM_MCS_MASK_SET(tx_param->tx_param_dword0, |
| 2697 | param.mcs_mask); |
| 2698 | WMI_TX_SEND_PARAM_NSS_MASK_SET(tx_param->tx_param_dword0, |
| 2699 | param.nss_mask); |
| 2700 | WMI_TX_SEND_PARAM_RETRY_LIMIT_SET(tx_param->tx_param_dword0, |
| 2701 | param.retry_limit); |
| 2702 | WMI_TX_SEND_PARAM_CHAIN_MASK_SET(tx_param->tx_param_dword1, |
| 2703 | param.chain_mask); |
| 2704 | WMI_TX_SEND_PARAM_BW_MASK_SET(tx_param->tx_param_dword1, |
| 2705 | param.bw_mask); |
| 2706 | WMI_TX_SEND_PARAM_PREAMBLE_SET(tx_param->tx_param_dword1, |
| 2707 | param.preamble_type); |
| 2708 | WMI_TX_SEND_PARAM_FRAME_TYPE_SET(tx_param->tx_param_dword1, |
| 2709 | param.frame_type); |
| 2710 | |
| 2711 | return status; |
| 2712 | } |
| 2713 | |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2714 | /** |
| 2715 | * send_mgmt_cmd_tlv() - WMI scan start function |
| 2716 | * @wmi_handle : handle to WMI. |
| 2717 | * @param : pointer to hold mgmt cmd parameter |
| 2718 | * |
| 2719 | * Return: 0 on success and -ve on failure. |
| 2720 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2721 | static QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | d3156eb | 2016-02-26 17:50:39 +0530 | [diff] [blame] | 2722 | struct wmi_mgmt_params *param) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2723 | { |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2724 | wmi_buf_t buf; |
| 2725 | wmi_mgmt_tx_send_cmd_fixed_param *cmd; |
| 2726 | int32_t cmd_len; |
| 2727 | uint64_t dma_addr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2728 | void *qdf_ctx = param->qdf_ctx; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2729 | uint8_t *bufp; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2730 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2731 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : |
| 2732 | mgmt_tx_dl_frm_len; |
| 2733 | |
| 2734 | cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2735 | WMI_TLV_HDR_SIZE + |
| 2736 | roundup(bufp_len, sizeof(uint32_t)); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2737 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2738 | buf = wmi_buf_alloc(wmi_handle, sizeof(wmi_tx_send_params) + cmd_len); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2739 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2740 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2741 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2742 | } |
| 2743 | |
| 2744 | cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); |
| 2745 | bufp = (uint8_t *) cmd; |
| 2746 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2747 | WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, |
| 2748 | WMITLV_GET_STRUCT_TLVLEN |
| 2749 | (wmi_mgmt_tx_send_cmd_fixed_param)); |
| 2750 | |
| 2751 | cmd->vdev_id = param->vdev_id; |
| 2752 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 2753 | cmd->desc_id = param->desc_id; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2754 | cmd->chanfreq = param->chanfreq; |
| 2755 | bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); |
| 2756 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2757 | sizeof(uint32_t))); |
| 2758 | bufp += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2759 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
Himanshu Agarwal | e3d1374 | 2017-04-04 12:36:33 +0530 | [diff] [blame] | 2760 | |
| 2761 | status = qdf_nbuf_map_single(qdf_ctx, param->tx_frame, |
| 2762 | QDF_DMA_TO_DEVICE); |
| 2763 | if (status != QDF_STATUS_SUCCESS) { |
| 2764 | WMI_LOGE("%s: wmi buf map failed", __func__); |
| 2765 | goto err1; |
| 2766 | } |
| 2767 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2768 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2769 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
Orhan K AKYILDIZ | 271641f | 2017-01-29 15:17:12 -0800 | [diff] [blame] | 2770 | #if defined(HTT_PADDR64) |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2771 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2772 | #endif |
| 2773 | cmd->frame_len = param->frm_len; |
| 2774 | cmd->buf_len = bufp_len; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2775 | cmd->tx_params_valid = param->tx_params_valid; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2776 | |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2777 | wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, |
Sandeep Puligilla | 828a45f | 2016-07-19 13:20:57 -0700 | [diff] [blame] | 2778 | bufp, cmd->vdev_id, cmd->chanfreq); |
Sandeep Puligilla | b74958d | 2016-06-13 15:42:55 -0700 | [diff] [blame] | 2779 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2780 | bufp += roundup(bufp_len, sizeof(uint32_t)); |
| 2781 | if (param->tx_params_valid) { |
| 2782 | status = populate_tx_send_params(bufp, param->tx_param); |
| 2783 | if (status != QDF_STATUS_SUCCESS) { |
| 2784 | WMI_LOGE("%s: Populate TX send params failed", |
| 2785 | __func__); |
| 2786 | goto err1; |
| 2787 | } |
| 2788 | cmd_len += sizeof(wmi_tx_send_params); |
| 2789 | } |
| 2790 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2791 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2792 | WMI_MGMT_TX_SEND_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2793 | WMI_LOGE("%s: Failed to send mgmt Tx", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2794 | goto err1; |
| 2795 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2796 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2797 | |
| 2798 | err1: |
| 2799 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2800 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2801 | } |
| 2802 | |
| 2803 | /** |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2804 | * send_offchan_data_tx_send_cmd_tlv() - Send off-chan tx data |
| 2805 | * @wmi_handle : handle to WMI. |
| 2806 | * @param : pointer to offchan data tx cmd parameter |
| 2807 | * |
| 2808 | * Return: QDF_STATUS_SUCCESS on success and error on failure. |
| 2809 | */ |
| 2810 | static QDF_STATUS send_offchan_data_tx_cmd_tlv(wmi_unified_t wmi_handle, |
| 2811 | struct wmi_offchan_data_tx_params *param) |
| 2812 | { |
| 2813 | wmi_buf_t buf; |
| 2814 | wmi_offchan_data_tx_send_cmd_fixed_param *cmd; |
| 2815 | int32_t cmd_len; |
| 2816 | uint64_t dma_addr; |
| 2817 | void *qdf_ctx = param->qdf_ctx; |
| 2818 | uint8_t *bufp; |
| 2819 | int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? |
| 2820 | param->frm_len : mgmt_tx_dl_frm_len; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2821 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2822 | |
| 2823 | cmd_len = sizeof(wmi_offchan_data_tx_send_cmd_fixed_param) + |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2824 | WMI_TLV_HDR_SIZE + |
| 2825 | roundup(bufp_len, sizeof(uint32_t)); |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2826 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2827 | buf = wmi_buf_alloc(wmi_handle, sizeof(wmi_tx_send_params) + cmd_len); |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2828 | if (!buf) { |
| 2829 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 2830 | return QDF_STATUS_E_NOMEM; |
| 2831 | } |
| 2832 | |
| 2833 | cmd = (wmi_offchan_data_tx_send_cmd_fixed_param *) wmi_buf_data(buf); |
| 2834 | bufp = (uint8_t *) cmd; |
| 2835 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2836 | WMITLV_TAG_STRUC_wmi_offchan_data_tx_send_cmd_fixed_param, |
| 2837 | WMITLV_GET_STRUCT_TLVLEN |
| 2838 | (wmi_offchan_data_tx_send_cmd_fixed_param)); |
| 2839 | |
| 2840 | cmd->vdev_id = param->vdev_id; |
| 2841 | |
| 2842 | cmd->desc_id = param->desc_id; |
| 2843 | cmd->chanfreq = param->chanfreq; |
| 2844 | bufp += sizeof(wmi_offchan_data_tx_send_cmd_fixed_param); |
| 2845 | WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, |
| 2846 | sizeof(uint32_t))); |
| 2847 | bufp += WMI_TLV_HDR_SIZE; |
| 2848 | qdf_mem_copy(bufp, param->pdata, bufp_len); |
| 2849 | qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE); |
| 2850 | dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0); |
| 2851 | cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff); |
| 2852 | #if defined(HTT_PADDR64) |
| 2853 | cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F); |
| 2854 | #endif |
| 2855 | cmd->frame_len = param->frm_len; |
| 2856 | cmd->buf_len = bufp_len; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2857 | cmd->tx_params_valid = param->tx_params_valid; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2858 | |
| 2859 | wmi_mgmt_cmd_record(wmi_handle, WMI_OFFCHAN_DATA_TX_SEND_CMDID, |
| 2860 | bufp, cmd->vdev_id, cmd->chanfreq); |
| 2861 | |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2862 | bufp += roundup(bufp_len, sizeof(uint32_t)); |
| 2863 | if (param->tx_params_valid) { |
| 2864 | status = populate_tx_send_params(bufp, param->tx_param); |
| 2865 | if (status != QDF_STATUS_SUCCESS) { |
| 2866 | WMI_LOGE("%s: Populate TX send params failed", |
| 2867 | __func__); |
| 2868 | goto err1; |
| 2869 | } |
| 2870 | cmd_len += sizeof(wmi_tx_send_params); |
| 2871 | } |
| 2872 | |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2873 | if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 2874 | WMI_OFFCHAN_DATA_TX_SEND_CMDID)) { |
| 2875 | WMI_LOGE("%s: Failed to offchan data Tx", __func__); |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2876 | goto err1; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2877 | } |
| 2878 | |
| 2879 | return QDF_STATUS_SUCCESS; |
Sathish Kumar | 5b63693 | 2017-06-28 14:40:32 +0530 | [diff] [blame] | 2880 | |
| 2881 | err1: |
| 2882 | wmi_buf_free(buf); |
| 2883 | return QDF_STATUS_E_FAILURE; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 2884 | } |
| 2885 | |
| 2886 | /** |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2887 | * send_modem_power_state_cmd_tlv() - set modem power state to fw |
| 2888 | * @wmi_handle: wmi handle |
| 2889 | * @param_value: parameter value |
| 2890 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2891 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2892 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2893 | 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] | 2894 | uint32_t param_value) |
| 2895 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2896 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2897 | wmi_modem_power_state_cmd_param *cmd; |
| 2898 | wmi_buf_t buf; |
| 2899 | uint16_t len = sizeof(*cmd); |
| 2900 | |
| 2901 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2902 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2903 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2904 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2905 | } |
| 2906 | cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf); |
| 2907 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2908 | WMITLV_TAG_STRUC_wmi_modem_power_state_cmd_param, |
| 2909 | WMITLV_GET_STRUCT_TLVLEN |
| 2910 | (wmi_modem_power_state_cmd_param)); |
| 2911 | cmd->modem_power_state = param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2912 | WMI_LOGD("%s: Setting cmd->modem_power_state = %u", __func__, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2913 | param_value); |
| 2914 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2915 | WMI_MODEM_POWER_STATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2916 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2917 | WMI_LOGE("Failed to send notify cmd ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2918 | wmi_buf_free(buf); |
| 2919 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2920 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2921 | return ret; |
| 2922 | } |
| 2923 | |
| 2924 | /** |
| 2925 | * send_set_sta_ps_mode_cmd_tlv() - set sta powersave mode in fw |
| 2926 | * @wmi_handle: wmi handle |
| 2927 | * @vdev_id: vdev id |
| 2928 | * @val: value |
| 2929 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 2930 | * Return: QDF_STATUS_SUCCESS for success or error code. |
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_sta_ps_mode_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2933 | uint32_t vdev_id, uint8_t val) |
| 2934 | { |
| 2935 | wmi_sta_powersave_mode_cmd_fixed_param *cmd; |
| 2936 | wmi_buf_t buf; |
| 2937 | int32_t len = sizeof(*cmd); |
| 2938 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2939 | 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] | 2940 | |
| 2941 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2942 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2943 | WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2944 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2945 | } |
| 2946 | cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2947 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2948 | WMITLV_TAG_STRUC_wmi_sta_powersave_mode_cmd_fixed_param, |
| 2949 | WMITLV_GET_STRUCT_TLVLEN |
| 2950 | (wmi_sta_powersave_mode_cmd_fixed_param)); |
| 2951 | cmd->vdev_id = vdev_id; |
| 2952 | if (val) |
| 2953 | cmd->sta_ps_mode = WMI_STA_PS_MODE_ENABLED; |
| 2954 | else |
| 2955 | cmd->sta_ps_mode = WMI_STA_PS_MODE_DISABLED; |
| 2956 | |
| 2957 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 2958 | WMI_STA_POWERSAVE_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2959 | WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2960 | vdev_id, val); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 2961 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2962 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2963 | } |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 2964 | return 0; |
| 2965 | } |
| 2966 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2967 | /** |
| 2968 | * send_set_mimops_cmd_tlv() - set MIMO powersave |
| 2969 | * @wmi_handle: wmi handle |
| 2970 | * @vdev_id: vdev id |
| 2971 | * @value: value |
| 2972 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2973 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2974 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 2975 | 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] | 2976 | uint8_t vdev_id, int value) |
| 2977 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2978 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2979 | wmi_sta_smps_force_mode_cmd_fixed_param *cmd; |
| 2980 | wmi_buf_t buf; |
| 2981 | uint16_t len = sizeof(*cmd); |
| 2982 | |
| 2983 | buf = wmi_buf_alloc(wmi_handle, len); |
| 2984 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 2985 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 2986 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 2987 | } |
| 2988 | cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf); |
| 2989 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 2990 | WMITLV_TAG_STRUC_wmi_sta_smps_force_mode_cmd_fixed_param, |
| 2991 | WMITLV_GET_STRUCT_TLVLEN |
| 2992 | (wmi_sta_smps_force_mode_cmd_fixed_param)); |
| 2993 | |
| 2994 | cmd->vdev_id = vdev_id; |
| 2995 | |
Houston Hoffman | b516805 | 2016-04-14 02:18:01 -0700 | [diff] [blame] | 2996 | /* WMI_SMPS_FORCED_MODE values do not directly map |
| 2997 | * to SM power save values defined in the specification. |
| 2998 | * Make sure to send the right mapping. |
| 2999 | */ |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3000 | switch (value) { |
| 3001 | case 0: |
| 3002 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_NONE; |
| 3003 | break; |
| 3004 | case 1: |
| 3005 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DISABLED; |
| 3006 | break; |
| 3007 | case 2: |
| 3008 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_STATIC; |
| 3009 | break; |
| 3010 | case 3: |
| 3011 | cmd->forced_mode = WMI_SMPS_FORCED_MODE_DYNAMIC; |
| 3012 | break; |
| 3013 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3014 | WMI_LOGE("%s:INVALID Mimo PS CONFIG", __func__); |
| 3015 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3016 | } |
| 3017 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3018 | WMI_LOGD("Setting vdev %d value = %u", vdev_id, value); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3019 | |
| 3020 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3021 | WMI_STA_SMPS_FORCE_MODE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3022 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3023 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3024 | wmi_buf_free(buf); |
| 3025 | } |
| 3026 | |
| 3027 | return ret; |
| 3028 | } |
| 3029 | |
| 3030 | /** |
| 3031 | * send_set_smps_params_cmd_tlv() - set smps params |
| 3032 | * @wmi_handle: wmi handle |
| 3033 | * @vdev_id: vdev id |
| 3034 | * @value: value |
| 3035 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3036 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3037 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3038 | 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] | 3039 | int value) |
| 3040 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3041 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3042 | wmi_sta_smps_param_cmd_fixed_param *cmd; |
| 3043 | wmi_buf_t buf; |
| 3044 | uint16_t len = sizeof(*cmd); |
| 3045 | |
| 3046 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3047 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3048 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3049 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3050 | } |
| 3051 | cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 3052 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3053 | WMITLV_TAG_STRUC_wmi_sta_smps_param_cmd_fixed_param, |
| 3054 | WMITLV_GET_STRUCT_TLVLEN |
| 3055 | (wmi_sta_smps_param_cmd_fixed_param)); |
| 3056 | |
| 3057 | cmd->vdev_id = vdev_id; |
| 3058 | cmd->value = value & WMI_SMPS_MASK_LOWER_16BITS; |
| 3059 | cmd->param = |
| 3060 | (value >> WMI_SMPS_PARAM_VALUE_S) & WMI_SMPS_MASK_UPPER_3BITS; |
| 3061 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3062 | 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] | 3063 | cmd->param); |
| 3064 | |
| 3065 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3066 | WMI_STA_SMPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3067 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3068 | WMI_LOGE("Failed to send set Mimo PS ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3069 | wmi_buf_free(buf); |
| 3070 | } |
| 3071 | |
| 3072 | return ret; |
| 3073 | } |
| 3074 | |
| 3075 | /** |
| 3076 | * send_set_p2pgo_noa_req_cmd_tlv() - send p2p go noa request to fw |
| 3077 | * @wmi_handle: wmi handle |
| 3078 | * @noa: p2p power save parameters |
| 3079 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3080 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3081 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3082 | 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] | 3083 | struct p2p_ps_params *noa) |
| 3084 | { |
| 3085 | wmi_p2p_set_noa_cmd_fixed_param *cmd; |
| 3086 | wmi_p2p_noa_descriptor *noa_discriptor; |
| 3087 | wmi_buf_t buf; |
| 3088 | uint8_t *buf_ptr; |
| 3089 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3090 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3091 | uint32_t duration; |
| 3092 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3093 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3094 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*noa_discriptor); |
| 3095 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3096 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3097 | WMI_LOGE("Failed to allocate memory"); |
| 3098 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3099 | goto end; |
| 3100 | } |
| 3101 | |
| 3102 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3103 | cmd = (wmi_p2p_set_noa_cmd_fixed_param *) buf_ptr; |
| 3104 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3105 | WMITLV_TAG_STRUC_wmi_p2p_set_noa_cmd_fixed_param, |
| 3106 | WMITLV_GET_STRUCT_TLVLEN |
| 3107 | (wmi_p2p_set_noa_cmd_fixed_param)); |
| 3108 | duration = (noa->count == 1) ? noa->single_noa_duration : noa->duration; |
| 3109 | cmd->vdev_id = noa->session_id; |
| 3110 | cmd->enable = (duration) ? true : false; |
| 3111 | cmd->num_noa = 1; |
| 3112 | |
| 3113 | WMITLV_SET_HDR((buf_ptr + sizeof(wmi_p2p_set_noa_cmd_fixed_param)), |
| 3114 | WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_p2p_noa_descriptor)); |
| 3115 | noa_discriptor = (wmi_p2p_noa_descriptor *) (buf_ptr + |
| 3116 | sizeof |
| 3117 | (wmi_p2p_set_noa_cmd_fixed_param) |
| 3118 | + WMI_TLV_HDR_SIZE); |
| 3119 | WMITLV_SET_HDR(&noa_discriptor->tlv_header, |
| 3120 | WMITLV_TAG_STRUC_wmi_p2p_noa_descriptor, |
| 3121 | WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_noa_descriptor)); |
| 3122 | noa_discriptor->type_count = noa->count; |
| 3123 | noa_discriptor->duration = duration; |
| 3124 | noa_discriptor->interval = noa->interval; |
| 3125 | noa_discriptor->start_time = 0; |
| 3126 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3127 | 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] | 3128 | cmd->vdev_id, noa->count, noa_discriptor->duration, |
| 3129 | noa->interval); |
| 3130 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3131 | WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3132 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3133 | WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3134 | wmi_buf_free(buf); |
| 3135 | } |
| 3136 | |
| 3137 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3138 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3139 | return status; |
| 3140 | } |
| 3141 | |
| 3142 | |
| 3143 | /** |
| 3144 | * send_set_p2pgo_oppps_req_cmd_tlv() - send p2p go opp power save request to fw |
| 3145 | * @wmi_handle: wmi handle |
| 3146 | * @noa: p2p opp power save parameters |
| 3147 | * |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3148 | * Return: CDF status |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3149 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3150 | 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] | 3151 | struct p2p_ps_params *oppps) |
| 3152 | { |
| 3153 | wmi_p2p_set_oppps_cmd_fixed_param *cmd; |
| 3154 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3155 | QDF_STATUS status; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3156 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3157 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3158 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 3159 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3160 | WMI_LOGE("Failed to allocate memory"); |
| 3161 | status = QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3162 | goto end; |
| 3163 | } |
| 3164 | |
| 3165 | cmd = (wmi_p2p_set_oppps_cmd_fixed_param *) wmi_buf_data(buf); |
| 3166 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3167 | WMITLV_TAG_STRUC_wmi_p2p_set_oppps_cmd_fixed_param, |
| 3168 | WMITLV_GET_STRUCT_TLVLEN |
| 3169 | (wmi_p2p_set_oppps_cmd_fixed_param)); |
| 3170 | cmd->vdev_id = oppps->session_id; |
| 3171 | if (oppps->ctwindow) |
| 3172 | WMI_UNIFIED_OPPPS_ATTR_ENABLED_SET(cmd); |
| 3173 | |
| 3174 | WMI_UNIFIED_OPPPS_ATTR_CTWIN_SET(cmd, oppps->ctwindow); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3175 | WMI_LOGI("SET P2P GO OPPPS:vdev_id:%d ctwindow:%d", |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3176 | cmd->vdev_id, oppps->ctwindow); |
| 3177 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 3178 | WMI_P2P_SET_OPPPS_PARAM_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3179 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3180 | WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID"); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3181 | wmi_buf_free(buf); |
| 3182 | } |
| 3183 | |
| 3184 | end: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3185 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3186 | return status; |
| 3187 | } |
| 3188 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 3189 | #ifdef CONVERGED_P2P_ENABLE |
| 3190 | /** |
| 3191 | * send_p2p_lo_start_cmd_tlv() - send p2p lo start request to fw |
| 3192 | * @wmi_handle: wmi handle |
| 3193 | * @param: p2p listen offload start parameters |
| 3194 | * |
| 3195 | * Return: QDF status |
| 3196 | */ |
| 3197 | static QDF_STATUS send_p2p_lo_start_cmd_tlv(wmi_unified_t wmi_handle, |
| 3198 | struct p2p_lo_start *param) |
| 3199 | { |
| 3200 | wmi_buf_t buf; |
| 3201 | wmi_p2p_lo_start_cmd_fixed_param *cmd; |
| 3202 | int32_t len = sizeof(*cmd); |
| 3203 | uint8_t *buf_ptr; |
| 3204 | QDF_STATUS status; |
| 3205 | int device_types_len_aligned; |
| 3206 | int probe_resp_len_aligned; |
| 3207 | |
| 3208 | if (!param) { |
| 3209 | WMI_LOGE("lo start param is null"); |
| 3210 | return QDF_STATUS_E_INVAL; |
| 3211 | } |
| 3212 | |
| 3213 | WMI_LOGD("%s: vdev_id:%d", __func__, param->vdev_id); |
| 3214 | |
| 3215 | device_types_len_aligned = |
| 3216 | qdf_roundup(param->dev_types_len, |
| 3217 | sizeof(A_UINT32)); |
| 3218 | probe_resp_len_aligned = |
| 3219 | qdf_roundup(param->probe_resp_len, |
| 3220 | sizeof(A_UINT32)); |
| 3221 | |
| 3222 | len += 2 * WMI_TLV_HDR_SIZE + device_types_len_aligned + |
| 3223 | probe_resp_len_aligned; |
| 3224 | |
| 3225 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3226 | if (!buf) { |
| 3227 | WMI_LOGE("%s: Failed to allocate memory for p2p lo start", |
| 3228 | __func__); |
| 3229 | return QDF_STATUS_E_NOMEM; |
| 3230 | } |
| 3231 | |
| 3232 | cmd = (wmi_p2p_lo_start_cmd_fixed_param *)wmi_buf_data(buf); |
| 3233 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3234 | |
| 3235 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3236 | WMITLV_TAG_STRUC_wmi_p2p_lo_start_cmd_fixed_param, |
| 3237 | WMITLV_GET_STRUCT_TLVLEN( |
| 3238 | wmi_p2p_lo_start_cmd_fixed_param)); |
| 3239 | |
| 3240 | cmd->vdev_id = param->vdev_id; |
| 3241 | cmd->ctl_flags = param->ctl_flags; |
| 3242 | cmd->channel = param->freq; |
| 3243 | cmd->period = param->period; |
| 3244 | cmd->interval = param->interval; |
| 3245 | cmd->count = param->count; |
| 3246 | cmd->device_types_len = param->dev_types_len; |
| 3247 | cmd->prob_resp_len = param->probe_resp_len; |
| 3248 | |
| 3249 | buf_ptr += sizeof(wmi_p2p_lo_start_cmd_fixed_param); |
| 3250 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3251 | device_types_len_aligned); |
| 3252 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3253 | qdf_mem_copy(buf_ptr, param->device_types, |
| 3254 | param->dev_types_len); |
| 3255 | |
| 3256 | buf_ptr += device_types_len_aligned; |
| 3257 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3258 | probe_resp_len_aligned); |
| 3259 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3260 | qdf_mem_copy(buf_ptr, param->probe_resp_tmplt, |
| 3261 | param->probe_resp_len); |
| 3262 | |
| 3263 | WMI_LOGD("%s: Sending WMI_P2P_LO_START command, channel=%d, period=%d, interval=%d, count=%d", __func__, |
| 3264 | cmd->channel, cmd->period, cmd->interval, cmd->count); |
| 3265 | |
| 3266 | status = wmi_unified_cmd_send(wmi_handle, |
| 3267 | buf, len, |
| 3268 | WMI_P2P_LISTEN_OFFLOAD_START_CMDID); |
| 3269 | if (status != QDF_STATUS_SUCCESS) { |
| 3270 | WMI_LOGE("%s: Failed to send p2p lo start: %d", |
| 3271 | __func__, status); |
| 3272 | wmi_buf_free(buf); |
| 3273 | return status; |
| 3274 | } |
| 3275 | |
| 3276 | WMI_LOGD("%s: Successfully sent WMI_P2P_LO_START", __func__); |
| 3277 | |
| 3278 | return QDF_STATUS_SUCCESS; |
| 3279 | } |
| 3280 | |
| 3281 | /** |
| 3282 | * send_p2p_lo_stop_cmd_tlv() - send p2p lo stop request to fw |
| 3283 | * @wmi_handle: wmi handle |
| 3284 | * @param: p2p listen offload stop parameters |
| 3285 | * |
| 3286 | * Return: QDF status |
| 3287 | */ |
| 3288 | static QDF_STATUS send_p2p_lo_stop_cmd_tlv(wmi_unified_t wmi_handle, |
| 3289 | uint8_t vdev_id) |
| 3290 | { |
| 3291 | wmi_buf_t buf; |
| 3292 | wmi_p2p_lo_stop_cmd_fixed_param *cmd; |
| 3293 | int32_t len; |
| 3294 | QDF_STATUS status; |
| 3295 | |
| 3296 | WMI_LOGD("%s: vdev_id:%d", __func__, vdev_id); |
| 3297 | |
| 3298 | len = sizeof(*cmd); |
| 3299 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3300 | if (!buf) { |
| 3301 | qdf_print("%s: Failed to allocate memory for p2p lo stop", |
| 3302 | __func__); |
| 3303 | return QDF_STATUS_E_NOMEM; |
| 3304 | } |
| 3305 | cmd = (wmi_p2p_lo_stop_cmd_fixed_param *)wmi_buf_data(buf); |
| 3306 | |
| 3307 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3308 | WMITLV_TAG_STRUC_wmi_p2p_lo_stop_cmd_fixed_param, |
| 3309 | WMITLV_GET_STRUCT_TLVLEN( |
| 3310 | wmi_p2p_lo_stop_cmd_fixed_param)); |
| 3311 | |
| 3312 | cmd->vdev_id = vdev_id; |
| 3313 | |
| 3314 | WMI_LOGD("%s: Sending WMI_P2P_LO_STOP command", __func__); |
| 3315 | |
| 3316 | status = wmi_unified_cmd_send(wmi_handle, |
| 3317 | buf, len, |
| 3318 | WMI_P2P_LISTEN_OFFLOAD_STOP_CMDID); |
| 3319 | if (status != QDF_STATUS_SUCCESS) { |
| 3320 | WMI_LOGE("%s: Failed to send p2p lo stop: %d", |
| 3321 | __func__, status); |
| 3322 | wmi_buf_free(buf); |
| 3323 | return status; |
| 3324 | } |
| 3325 | |
| 3326 | WMI_LOGD("%s: Successfully sent WMI_P2P_LO_STOP", __func__); |
| 3327 | |
| 3328 | return QDF_STATUS_SUCCESS; |
| 3329 | } |
| 3330 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 3331 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3332 | /** |
| 3333 | * send_get_temperature_cmd_tlv() - get pdev temperature req |
| 3334 | * @wmi_handle: wmi handle |
| 3335 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3336 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3337 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3338 | 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] | 3339 | { |
| 3340 | wmi_pdev_get_temperature_cmd_fixed_param *cmd; |
| 3341 | wmi_buf_t wmi_buf; |
| 3342 | uint32_t len = sizeof(wmi_pdev_get_temperature_cmd_fixed_param); |
| 3343 | uint8_t *buf_ptr; |
| 3344 | |
| 3345 | if (!wmi_handle) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3346 | WMI_LOGE(FL("WMI is closed, can not issue cmd")); |
| 3347 | return QDF_STATUS_E_INVAL; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3348 | } |
| 3349 | |
| 3350 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 3351 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3352 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3353 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3354 | } |
| 3355 | |
| 3356 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 3357 | |
| 3358 | cmd = (wmi_pdev_get_temperature_cmd_fixed_param *) buf_ptr; |
| 3359 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3360 | WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, |
| 3361 | WMITLV_GET_STRUCT_TLVLEN |
| 3362 | (wmi_pdev_get_temperature_cmd_fixed_param)); |
| 3363 | |
| 3364 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 3365 | WMI_PDEV_GET_TEMPERATURE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3366 | WMI_LOGE(FL("failed to send get temperature command")); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3367 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3368 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3369 | } |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3370 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3371 | return QDF_STATUS_SUCCESS; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3372 | } |
| 3373 | |
| 3374 | /** |
| 3375 | * send_set_sta_uapsd_auto_trig_cmd_tlv() - set uapsd auto trigger command |
| 3376 | * @wmi_handle: wmi handle |
| 3377 | * @vdevid: vdev id |
| 3378 | * @peer_addr: peer mac address |
| 3379 | * @auto_triggerparam: auto trigger parameters |
| 3380 | * @num_ac: number of access category |
| 3381 | * |
| 3382 | * This function sets the trigger |
| 3383 | * uapsd params such as service interval, delay interval |
| 3384 | * and suspend interval which will be used by the firmware |
| 3385 | * to send trigger frames periodically when there is no |
| 3386 | * traffic on the transmit side. |
| 3387 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 3388 | * Return: QDF_STATUS_SUCCESS for success or error code. |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3389 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3390 | 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] | 3391 | struct sta_uapsd_trig_params *param) |
| 3392 | { |
| 3393 | wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3394 | QDF_STATUS ret; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3395 | uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param); |
| 3396 | uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE; |
| 3397 | uint32_t i; |
| 3398 | wmi_buf_t buf; |
| 3399 | uint8_t *buf_ptr; |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3400 | struct sta_uapsd_params *uapsd_param; |
| 3401 | wmi_sta_uapsd_auto_trig_param *trig_param; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3402 | |
| 3403 | buf = wmi_buf_alloc(wmi_handle, cmd_len); |
| 3404 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3405 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3406 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3407 | } |
| 3408 | |
| 3409 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 3410 | cmd = (wmi_sta_uapsd_auto_trig_cmd_fixed_param *) buf_ptr; |
| 3411 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3412 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_cmd_fixed_param, |
| 3413 | WMITLV_GET_STRUCT_TLVLEN |
| 3414 | (wmi_sta_uapsd_auto_trig_cmd_fixed_param)); |
| 3415 | cmd->vdev_id = param->vdevid; |
| 3416 | cmd->num_ac = param->num_ac; |
| 3417 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr); |
| 3418 | |
| 3419 | /* TLV indicating array of structures to follow */ |
| 3420 | buf_ptr += sizeof(*cmd); |
| 3421 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, param_len); |
| 3422 | |
| 3423 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3424 | |
| 3425 | /* |
| 3426 | * Update tag and length for uapsd auto trigger params (this will take |
| 3427 | * care of updating tag and length if it is not pre-filled by caller). |
| 3428 | */ |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3429 | uapsd_param = (struct sta_uapsd_params *)param->auto_triggerparam; |
| 3430 | trig_param = (wmi_sta_uapsd_auto_trig_param *)buf_ptr; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3431 | for (i = 0; i < param->num_ac; i++) { |
| 3432 | WMITLV_SET_HDR((buf_ptr + |
| 3433 | (i * sizeof(wmi_sta_uapsd_auto_trig_param))), |
| 3434 | WMITLV_TAG_STRUC_wmi_sta_uapsd_auto_trig_param, |
| 3435 | WMITLV_GET_STRUCT_TLVLEN |
| 3436 | (wmi_sta_uapsd_auto_trig_param)); |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 3437 | trig_param->wmm_ac = uapsd_param->wmm_ac; |
| 3438 | trig_param->user_priority = uapsd_param->user_priority; |
| 3439 | trig_param->service_interval = uapsd_param->service_interval; |
| 3440 | trig_param->suspend_interval = uapsd_param->suspend_interval; |
| 3441 | trig_param->delay_interval = uapsd_param->delay_interval; |
| 3442 | trig_param++; |
| 3443 | uapsd_param++; |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3444 | } |
| 3445 | |
| 3446 | ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len, |
| 3447 | WMI_STA_UAPSD_AUTO_TRIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3448 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3449 | WMI_LOGE("Failed to send set uapsd param ret = %d", ret); |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3450 | wmi_buf_free(buf); |
| 3451 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 3452 | |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 3453 | return ret; |
| 3454 | } |
| 3455 | |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3456 | /** |
| 3457 | * send_ocb_set_utc_time_cmd() - send the UTC time to the firmware |
| 3458 | * @wmi_handle: pointer to the wmi handle |
| 3459 | * @utc: pointer to the UTC time struct |
| 3460 | * |
| 3461 | * Return: 0 on succes |
| 3462 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3463 | 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] | 3464 | struct ocb_utc_param *utc) |
| 3465 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3466 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3467 | wmi_ocb_set_utc_time_cmd_fixed_param *cmd; |
| 3468 | uint8_t *buf_ptr; |
| 3469 | uint32_t len, i; |
| 3470 | wmi_buf_t buf; |
| 3471 | |
| 3472 | len = sizeof(*cmd); |
| 3473 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3474 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3475 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3476 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3477 | } |
| 3478 | |
| 3479 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3480 | cmd = (wmi_ocb_set_utc_time_cmd_fixed_param *)buf_ptr; |
| 3481 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3482 | WMITLV_TAG_STRUC_wmi_ocb_set_utc_time_cmd_fixed_param, |
| 3483 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_utc_time_cmd_fixed_param)); |
| 3484 | cmd->vdev_id = utc->vdev_id; |
| 3485 | |
| 3486 | for (i = 0; i < SIZE_UTC_TIME; i++) |
| 3487 | WMI_UTC_TIME_SET(cmd, i, utc->utc_time[i]); |
| 3488 | |
| 3489 | for (i = 0; i < SIZE_UTC_TIME_ERROR; i++) |
| 3490 | WMI_TIME_ERROR_SET(cmd, i, utc->time_error[i]); |
| 3491 | |
| 3492 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3493 | WMI_OCB_SET_UTC_TIME_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3494 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3495 | WMI_LOGE(FL("Failed to set OCB UTC time")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3496 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3497 | } |
| 3498 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3499 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3500 | } |
| 3501 | |
| 3502 | /** |
| 3503 | * send_ocb_start_timing_advert_cmd_tlv() - start sending the timing advertisement |
| 3504 | * frames on a channel |
| 3505 | * @wmi_handle: pointer to the wmi handle |
| 3506 | * @timing_advert: pointer to the timing advertisement struct |
| 3507 | * |
| 3508 | * Return: 0 on succes |
| 3509 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3510 | 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] | 3511 | struct ocb_timing_advert_param *timing_advert) |
| 3512 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3513 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3514 | wmi_ocb_start_timing_advert_cmd_fixed_param *cmd; |
| 3515 | uint8_t *buf_ptr; |
| 3516 | uint32_t len, len_template; |
| 3517 | wmi_buf_t buf; |
| 3518 | |
| 3519 | len = sizeof(*cmd) + |
| 3520 | WMI_TLV_HDR_SIZE; |
| 3521 | |
| 3522 | len_template = timing_advert->template_length; |
| 3523 | /* Add padding to the template if needed */ |
| 3524 | if (len_template % 4 != 0) |
| 3525 | len_template += 4 - (len_template % 4); |
| 3526 | len += len_template; |
| 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 = (uint8_t *)wmi_buf_data(buf); |
| 3535 | cmd = (wmi_ocb_start_timing_advert_cmd_fixed_param *)buf_ptr; |
| 3536 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3537 | WMITLV_TAG_STRUC_wmi_ocb_start_timing_advert_cmd_fixed_param, |
| 3538 | WMITLV_GET_STRUCT_TLVLEN( |
| 3539 | wmi_ocb_start_timing_advert_cmd_fixed_param)); |
| 3540 | cmd->vdev_id = timing_advert->vdev_id; |
| 3541 | cmd->repeat_rate = timing_advert->repeat_rate; |
| 3542 | cmd->channel_freq = timing_advert->chan_freq; |
| 3543 | cmd->timestamp_offset = timing_advert->timestamp_offset; |
| 3544 | cmd->time_value_offset = timing_advert->time_value_offset; |
| 3545 | cmd->timing_advert_template_length = timing_advert->template_length; |
| 3546 | buf_ptr += sizeof(*cmd); |
| 3547 | |
| 3548 | /* Add the timing advert template */ |
| 3549 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 3550 | len_template); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3551 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3552 | (uint8_t *)timing_advert->template_value, |
| 3553 | timing_advert->template_length); |
| 3554 | |
| 3555 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3556 | WMI_OCB_START_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3557 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3558 | WMI_LOGE(FL("Failed to start OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3559 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3560 | } |
| 3561 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3562 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3563 | } |
| 3564 | |
| 3565 | /** |
| 3566 | * send_ocb_stop_timing_advert_cmd_tlv() - stop sending the timing advertisement frames |
| 3567 | * on a channel |
| 3568 | * @wmi_handle: pointer to the wmi handle |
| 3569 | * @timing_advert: pointer to the timing advertisement struct |
| 3570 | * |
| 3571 | * Return: 0 on succes |
| 3572 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3573 | 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] | 3574 | struct ocb_timing_advert_param *timing_advert) |
| 3575 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3576 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3577 | wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd; |
| 3578 | uint8_t *buf_ptr; |
| 3579 | uint32_t len; |
| 3580 | wmi_buf_t buf; |
| 3581 | |
| 3582 | len = sizeof(*cmd); |
| 3583 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3584 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3585 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3586 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3587 | } |
| 3588 | |
| 3589 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3590 | cmd = (wmi_ocb_stop_timing_advert_cmd_fixed_param *)buf_ptr; |
| 3591 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3592 | WMITLV_TAG_STRUC_wmi_ocb_stop_timing_advert_cmd_fixed_param, |
| 3593 | WMITLV_GET_STRUCT_TLVLEN( |
| 3594 | wmi_ocb_stop_timing_advert_cmd_fixed_param)); |
| 3595 | cmd->vdev_id = timing_advert->vdev_id; |
| 3596 | cmd->channel_freq = timing_advert->chan_freq; |
| 3597 | |
| 3598 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3599 | WMI_OCB_STOP_TIMING_ADVERT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3600 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3601 | WMI_LOGE(FL("Failed to stop OCB timing advert")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3602 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3603 | } |
| 3604 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3605 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3606 | } |
| 3607 | |
| 3608 | /** |
| 3609 | * send_ocb_get_tsf_timer_cmd_tlv() - get ocb tsf timer val |
| 3610 | * @wmi_handle: pointer to the wmi handle |
| 3611 | * @request: pointer to the request |
| 3612 | * |
| 3613 | * Return: 0 on succes |
| 3614 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3615 | 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] | 3616 | uint8_t vdev_id) |
| 3617 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3618 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3619 | wmi_ocb_get_tsf_timer_cmd_fixed_param *cmd; |
| 3620 | uint8_t *buf_ptr; |
| 3621 | wmi_buf_t buf; |
| 3622 | int32_t len; |
| 3623 | |
| 3624 | len = sizeof(*cmd); |
| 3625 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3626 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3627 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3628 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3629 | } |
| 3630 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3631 | |
| 3632 | cmd = (wmi_ocb_get_tsf_timer_cmd_fixed_param *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3633 | qdf_mem_zero(cmd, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3634 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3635 | WMITLV_TAG_STRUC_wmi_ocb_get_tsf_timer_cmd_fixed_param, |
| 3636 | WMITLV_GET_STRUCT_TLVLEN( |
| 3637 | wmi_ocb_get_tsf_timer_cmd_fixed_param)); |
| 3638 | cmd->vdev_id = vdev_id; |
| 3639 | |
| 3640 | /* Send the WMI command */ |
| 3641 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3642 | WMI_OCB_GET_TSF_TIMER_CMDID); |
| 3643 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3644 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3645 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3646 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3647 | } |
| 3648 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3649 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3650 | } |
| 3651 | |
| 3652 | /** |
| 3653 | * send_dcc_get_stats_cmd_tlv() - get the DCC channel stats |
| 3654 | * @wmi_handle: pointer to the wmi handle |
| 3655 | * @get_stats_param: pointer to the dcc stats |
| 3656 | * |
| 3657 | * Return: 0 on succes |
| 3658 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3659 | 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] | 3660 | struct dcc_get_stats_param *get_stats_param) |
| 3661 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3662 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3663 | wmi_dcc_get_stats_cmd_fixed_param *cmd; |
| 3664 | wmi_dcc_channel_stats_request *channel_stats_array; |
| 3665 | wmi_buf_t buf; |
| 3666 | uint8_t *buf_ptr; |
| 3667 | uint32_t len; |
| 3668 | uint32_t i; |
| 3669 | |
| 3670 | /* Validate the input */ |
| 3671 | if (get_stats_param->request_array_len != |
| 3672 | get_stats_param->channel_count * sizeof(*channel_stats_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3673 | WMI_LOGE(FL("Invalid parameter")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3674 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3675 | } |
| 3676 | |
| 3677 | /* Allocate memory for the WMI command */ |
| 3678 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 3679 | get_stats_param->request_array_len; |
| 3680 | |
| 3681 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3682 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3683 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 3684 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3685 | } |
| 3686 | |
| 3687 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3688 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3689 | |
| 3690 | /* Populate the WMI command */ |
| 3691 | cmd = (wmi_dcc_get_stats_cmd_fixed_param *)buf_ptr; |
| 3692 | buf_ptr += sizeof(*cmd); |
| 3693 | |
| 3694 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3695 | WMITLV_TAG_STRUC_wmi_dcc_get_stats_cmd_fixed_param, |
| 3696 | WMITLV_GET_STRUCT_TLVLEN( |
| 3697 | wmi_dcc_get_stats_cmd_fixed_param)); |
| 3698 | cmd->vdev_id = get_stats_param->vdev_id; |
| 3699 | cmd->num_channels = get_stats_param->channel_count; |
| 3700 | |
| 3701 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3702 | get_stats_param->request_array_len); |
| 3703 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3704 | |
| 3705 | channel_stats_array = (wmi_dcc_channel_stats_request *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3706 | qdf_mem_copy(channel_stats_array, get_stats_param->request_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3707 | get_stats_param->request_array_len); |
| 3708 | for (i = 0; i < cmd->num_channels; i++) |
| 3709 | WMITLV_SET_HDR(&channel_stats_array[i].tlv_header, |
| 3710 | WMITLV_TAG_STRUC_wmi_dcc_channel_stats_request, |
| 3711 | WMITLV_GET_STRUCT_TLVLEN( |
| 3712 | wmi_dcc_channel_stats_request)); |
| 3713 | |
| 3714 | /* Send the WMI command */ |
| 3715 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3716 | WMI_DCC_GET_STATS_CMDID); |
| 3717 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3718 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3719 | WMI_LOGE(FL("Failed to send WMI message: %d"), ret); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3720 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3721 | } |
| 3722 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3723 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3724 | } |
| 3725 | |
| 3726 | /** |
| 3727 | * send_dcc_clear_stats_cmd_tlv() - command to clear the DCC stats |
| 3728 | * @wmi_handle: pointer to the wmi handle |
| 3729 | * @vdev_id: vdev id |
| 3730 | * @dcc_stats_bitmap: dcc status bitmap |
| 3731 | * |
| 3732 | * Return: 0 on succes |
| 3733 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3734 | 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] | 3735 | uint32_t vdev_id, uint32_t dcc_stats_bitmap) |
| 3736 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3737 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3738 | wmi_dcc_clear_stats_cmd_fixed_param *cmd; |
| 3739 | wmi_buf_t buf; |
| 3740 | uint8_t *buf_ptr; |
| 3741 | uint32_t len; |
| 3742 | |
| 3743 | /* Allocate memory for the WMI command */ |
| 3744 | len = sizeof(*cmd); |
| 3745 | |
| 3746 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3747 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3748 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3749 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3750 | } |
| 3751 | |
| 3752 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3753 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3754 | |
| 3755 | /* Populate the WMI command */ |
| 3756 | cmd = (wmi_dcc_clear_stats_cmd_fixed_param *)buf_ptr; |
| 3757 | |
| 3758 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3759 | WMITLV_TAG_STRUC_wmi_dcc_clear_stats_cmd_fixed_param, |
| 3760 | WMITLV_GET_STRUCT_TLVLEN( |
| 3761 | wmi_dcc_clear_stats_cmd_fixed_param)); |
| 3762 | cmd->vdev_id = vdev_id; |
| 3763 | cmd->dcc_stats_bitmap = dcc_stats_bitmap; |
| 3764 | |
| 3765 | /* Send the WMI command */ |
| 3766 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 3767 | WMI_DCC_CLEAR_STATS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3768 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3769 | WMI_LOGE(FL("Failed to send the WMI command")); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3770 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3771 | } |
| 3772 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3773 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3774 | } |
| 3775 | |
| 3776 | /** |
| 3777 | * send_dcc_update_ndl_cmd_tlv() - command to update the NDL data |
| 3778 | * @wmi_handle: pointer to the wmi handle |
| 3779 | * @update_ndl_param: pointer to the request parameters |
| 3780 | * |
| 3781 | * Return: 0 on success |
| 3782 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3783 | 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] | 3784 | struct dcc_update_ndl_param *update_ndl_param) |
| 3785 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3786 | QDF_STATUS qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3787 | wmi_dcc_update_ndl_cmd_fixed_param *cmd; |
| 3788 | wmi_dcc_ndl_chan *ndl_chan_array; |
| 3789 | wmi_dcc_ndl_active_state_config *ndl_active_state_array; |
| 3790 | uint32_t active_state_count; |
| 3791 | wmi_buf_t buf; |
| 3792 | uint8_t *buf_ptr; |
| 3793 | uint32_t len; |
| 3794 | uint32_t i; |
| 3795 | |
| 3796 | /* validate the input */ |
| 3797 | if (update_ndl_param->dcc_ndl_chan_list_len != |
| 3798 | update_ndl_param->channel_count * sizeof(*ndl_chan_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3799 | WMI_LOGE(FL("Invalid parameter")); |
| 3800 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3801 | } |
| 3802 | active_state_count = 0; |
| 3803 | ndl_chan_array = update_ndl_param->dcc_ndl_chan_list; |
| 3804 | for (i = 0; i < update_ndl_param->channel_count; i++) |
| 3805 | active_state_count += |
| 3806 | WMI_NDL_NUM_ACTIVE_STATE_GET(&ndl_chan_array[i]); |
| 3807 | if (update_ndl_param->dcc_ndl_active_state_list_len != |
| 3808 | active_state_count * sizeof(*ndl_active_state_array)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3809 | WMI_LOGE(FL("Invalid parameter")); |
| 3810 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3811 | } |
| 3812 | |
| 3813 | /* Allocate memory for the WMI command */ |
| 3814 | len = sizeof(*cmd) + |
| 3815 | WMI_TLV_HDR_SIZE + update_ndl_param->dcc_ndl_chan_list_len + |
| 3816 | WMI_TLV_HDR_SIZE + |
| 3817 | update_ndl_param->dcc_ndl_active_state_list_len; |
| 3818 | |
| 3819 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3820 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3821 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3822 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3823 | } |
| 3824 | |
| 3825 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3826 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3827 | |
| 3828 | /* Populate the WMI command */ |
| 3829 | cmd = (wmi_dcc_update_ndl_cmd_fixed_param *)buf_ptr; |
| 3830 | buf_ptr += sizeof(*cmd); |
| 3831 | |
| 3832 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3833 | WMITLV_TAG_STRUC_wmi_dcc_update_ndl_cmd_fixed_param, |
| 3834 | WMITLV_GET_STRUCT_TLVLEN( |
| 3835 | wmi_dcc_update_ndl_cmd_fixed_param)); |
| 3836 | cmd->vdev_id = update_ndl_param->vdev_id; |
| 3837 | cmd->num_channel = update_ndl_param->channel_count; |
| 3838 | |
| 3839 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3840 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3841 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3842 | |
| 3843 | ndl_chan_array = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3844 | 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] | 3845 | update_ndl_param->dcc_ndl_chan_list_len); |
| 3846 | for (i = 0; i < cmd->num_channel; i++) |
| 3847 | WMITLV_SET_HDR(&ndl_chan_array[i].tlv_header, |
| 3848 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 3849 | WMITLV_GET_STRUCT_TLVLEN( |
| 3850 | wmi_dcc_ndl_chan)); |
| 3851 | buf_ptr += update_ndl_param->dcc_ndl_chan_list_len; |
| 3852 | |
| 3853 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3854 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3855 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3856 | |
| 3857 | ndl_active_state_array = (wmi_dcc_ndl_active_state_config *) buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3858 | qdf_mem_copy(ndl_active_state_array, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3859 | update_ndl_param->dcc_ndl_active_state_list, |
| 3860 | update_ndl_param->dcc_ndl_active_state_list_len); |
| 3861 | for (i = 0; i < active_state_count; i++) { |
| 3862 | WMITLV_SET_HDR(&ndl_active_state_array[i].tlv_header, |
| 3863 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 3864 | WMITLV_GET_STRUCT_TLVLEN( |
| 3865 | wmi_dcc_ndl_active_state_config)); |
| 3866 | } |
| 3867 | buf_ptr += update_ndl_param->dcc_ndl_active_state_list_len; |
| 3868 | |
| 3869 | /* Send the WMI command */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3870 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3871 | WMI_DCC_UPDATE_NDL_CMDID); |
| 3872 | /* If there is an error, set the completion event */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3873 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3874 | WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3875 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3876 | } |
| 3877 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3878 | return qdf_status; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3879 | } |
| 3880 | |
| 3881 | /** |
| 3882 | * send_ocb_set_config_cmd_tlv() - send the OCB config to the FW |
| 3883 | * @wmi_handle: pointer to the wmi handle |
| 3884 | * @config: the OCB configuration |
| 3885 | * |
| 3886 | * Return: 0 on success |
| 3887 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 3888 | 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] | 3889 | struct ocb_config_param *config, uint32_t *ch_mhz) |
| 3890 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3891 | QDF_STATUS ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3892 | wmi_ocb_set_config_cmd_fixed_param *cmd; |
| 3893 | wmi_channel *chan; |
| 3894 | wmi_ocb_channel *ocb_chan; |
| 3895 | wmi_qos_parameter *qos_param; |
| 3896 | wmi_dcc_ndl_chan *ndl_chan; |
| 3897 | wmi_dcc_ndl_active_state_config *ndl_active_config; |
| 3898 | wmi_ocb_schedule_element *sched_elem; |
| 3899 | uint8_t *buf_ptr; |
| 3900 | wmi_buf_t buf; |
| 3901 | int32_t len; |
| 3902 | int32_t i, j, active_state_count; |
| 3903 | |
| 3904 | /* |
| 3905 | * Validate the dcc_ndl_chan_list_len and count the number of active |
| 3906 | * states. Validate dcc_ndl_active_state_list_len. |
| 3907 | */ |
| 3908 | active_state_count = 0; |
| 3909 | if (config->dcc_ndl_chan_list_len) { |
| 3910 | if (!config->dcc_ndl_chan_list || |
| 3911 | config->dcc_ndl_chan_list_len != |
| 3912 | config->channel_count * sizeof(wmi_dcc_ndl_chan)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3913 | WMI_LOGE(FL("NDL channel is invalid. List len: %d"), |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3914 | config->dcc_ndl_chan_list_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3915 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3916 | } |
| 3917 | |
| 3918 | for (i = 0, ndl_chan = config->dcc_ndl_chan_list; |
| 3919 | i < config->channel_count; ++i, ++ndl_chan) |
| 3920 | active_state_count += |
| 3921 | WMI_NDL_NUM_ACTIVE_STATE_GET(ndl_chan); |
| 3922 | |
| 3923 | if (active_state_count) { |
| 3924 | if (!config->dcc_ndl_active_state_list || |
| 3925 | config->dcc_ndl_active_state_list_len != |
| 3926 | active_state_count * |
| 3927 | sizeof(wmi_dcc_ndl_active_state_config)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3928 | WMI_LOGE(FL("NDL active state is invalid.")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3929 | return QDF_STATUS_E_INVAL; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3930 | } |
| 3931 | } |
| 3932 | } |
| 3933 | |
| 3934 | len = sizeof(*cmd) + |
| 3935 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3936 | sizeof(wmi_channel) + |
| 3937 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3938 | sizeof(wmi_ocb_channel) + |
| 3939 | WMI_TLV_HDR_SIZE + config->channel_count * |
| 3940 | sizeof(wmi_qos_parameter) * WMI_MAX_NUM_AC + |
| 3941 | WMI_TLV_HDR_SIZE + config->dcc_ndl_chan_list_len + |
| 3942 | WMI_TLV_HDR_SIZE + active_state_count * |
| 3943 | sizeof(wmi_dcc_ndl_active_state_config) + |
| 3944 | WMI_TLV_HDR_SIZE + config->schedule_size * |
| 3945 | sizeof(wmi_ocb_schedule_element); |
| 3946 | buf = wmi_buf_alloc(wmi_handle, len); |
| 3947 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 3948 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 3949 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 3950 | } |
| 3951 | |
| 3952 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 3953 | cmd = (wmi_ocb_set_config_cmd_fixed_param *)buf_ptr; |
| 3954 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 3955 | WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param, |
| 3956 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param)); |
| 3957 | cmd->vdev_id = config->session_id; |
| 3958 | cmd->channel_count = config->channel_count; |
| 3959 | cmd->schedule_size = config->schedule_size; |
| 3960 | cmd->flags = config->flags; |
| 3961 | buf_ptr += sizeof(*cmd); |
| 3962 | |
| 3963 | /* Add the wmi_channel info */ |
| 3964 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3965 | config->channel_count*sizeof(wmi_channel)); |
| 3966 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3967 | for (i = 0; i < config->channel_count; i++) { |
| 3968 | chan = (wmi_channel *)buf_ptr; |
| 3969 | WMITLV_SET_HDR(&chan->tlv_header, |
| 3970 | WMITLV_TAG_STRUC_wmi_channel, |
| 3971 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 3972 | chan->mhz = config->channels[i].chan_freq; |
| 3973 | chan->band_center_freq1 = config->channels[i].chan_freq; |
| 3974 | chan->band_center_freq2 = 0; |
| 3975 | chan->info = 0; |
| 3976 | |
| 3977 | WMI_SET_CHANNEL_MODE(chan, ch_mhz[i]); |
| 3978 | WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr); |
| 3979 | WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr); |
| 3980 | WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr); |
| 3981 | WMI_SET_CHANNEL_REG_POWER(chan, config->channels[i].reg_pwr); |
| 3982 | WMI_SET_CHANNEL_ANTENNA_MAX(chan, |
| 3983 | config->channels[i].antenna_max); |
| 3984 | |
| 3985 | if (config->channels[i].bandwidth < 10) |
| 3986 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE); |
| 3987 | else if (config->channels[i].bandwidth < 20) |
| 3988 | WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE); |
| 3989 | buf_ptr += sizeof(*chan); |
| 3990 | } |
| 3991 | |
| 3992 | /* Add the wmi_ocb_channel info */ |
| 3993 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 3994 | config->channel_count*sizeof(wmi_ocb_channel)); |
| 3995 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 3996 | for (i = 0; i < config->channel_count; i++) { |
| 3997 | ocb_chan = (wmi_ocb_channel *)buf_ptr; |
| 3998 | WMITLV_SET_HDR(&ocb_chan->tlv_header, |
| 3999 | WMITLV_TAG_STRUC_wmi_ocb_channel, |
| 4000 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_channel)); |
| 4001 | ocb_chan->bandwidth = config->channels[i].bandwidth; |
| 4002 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 4003 | config->channels[i].mac_address.bytes, |
| 4004 | &ocb_chan->mac_address); |
| 4005 | buf_ptr += sizeof(*ocb_chan); |
| 4006 | } |
| 4007 | |
| 4008 | /* Add the wmi_qos_parameter info */ |
| 4009 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4010 | config->channel_count * sizeof(wmi_qos_parameter)*WMI_MAX_NUM_AC); |
| 4011 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4012 | /* WMI_MAX_NUM_AC parameters for each channel */ |
| 4013 | for (i = 0; i < config->channel_count; i++) { |
| 4014 | for (j = 0; j < WMI_MAX_NUM_AC; j++) { |
| 4015 | qos_param = (wmi_qos_parameter *)buf_ptr; |
| 4016 | WMITLV_SET_HDR(&qos_param->tlv_header, |
| 4017 | WMITLV_TAG_STRUC_wmi_qos_parameter, |
| 4018 | WMITLV_GET_STRUCT_TLVLEN(wmi_qos_parameter)); |
| 4019 | qos_param->aifsn = |
| 4020 | config->channels[i].qos_params[j].aifsn; |
| 4021 | qos_param->cwmin = |
| 4022 | config->channels[i].qos_params[j].cwmin; |
| 4023 | qos_param->cwmax = |
| 4024 | config->channels[i].qos_params[j].cwmax; |
| 4025 | buf_ptr += sizeof(*qos_param); |
| 4026 | } |
| 4027 | } |
| 4028 | |
| 4029 | /* Add the wmi_dcc_ndl_chan (per channel) */ |
| 4030 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4031 | config->dcc_ndl_chan_list_len); |
| 4032 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4033 | if (config->dcc_ndl_chan_list_len) { |
| 4034 | ndl_chan = (wmi_dcc_ndl_chan *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4035 | qdf_mem_copy(ndl_chan, config->dcc_ndl_chan_list, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4036 | config->dcc_ndl_chan_list_len); |
| 4037 | for (i = 0; i < config->channel_count; i++) |
| 4038 | WMITLV_SET_HDR(&(ndl_chan[i].tlv_header), |
| 4039 | WMITLV_TAG_STRUC_wmi_dcc_ndl_chan, |
| 4040 | WMITLV_GET_STRUCT_TLVLEN(wmi_dcc_ndl_chan)); |
| 4041 | buf_ptr += config->dcc_ndl_chan_list_len; |
| 4042 | } |
| 4043 | |
| 4044 | /* Add the wmi_dcc_ndl_active_state_config */ |
| 4045 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, active_state_count * |
| 4046 | sizeof(wmi_dcc_ndl_active_state_config)); |
| 4047 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4048 | if (active_state_count) { |
| 4049 | ndl_active_config = (wmi_dcc_ndl_active_state_config *)buf_ptr; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4050 | qdf_mem_copy(ndl_active_config, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4051 | config->dcc_ndl_active_state_list, |
| 4052 | active_state_count * sizeof(*ndl_active_config)); |
| 4053 | for (i = 0; i < active_state_count; ++i) |
| 4054 | WMITLV_SET_HDR(&(ndl_active_config[i].tlv_header), |
| 4055 | WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config, |
| 4056 | WMITLV_GET_STRUCT_TLVLEN( |
| 4057 | wmi_dcc_ndl_active_state_config)); |
| 4058 | buf_ptr += active_state_count * |
| 4059 | sizeof(*ndl_active_config); |
| 4060 | } |
| 4061 | |
| 4062 | /* Add the wmi_ocb_schedule_element info */ |
| 4063 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4064 | config->schedule_size * sizeof(wmi_ocb_schedule_element)); |
| 4065 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4066 | for (i = 0; i < config->schedule_size; i++) { |
| 4067 | sched_elem = (wmi_ocb_schedule_element *)buf_ptr; |
| 4068 | WMITLV_SET_HDR(&sched_elem->tlv_header, |
| 4069 | WMITLV_TAG_STRUC_wmi_ocb_schedule_element, |
| 4070 | WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_schedule_element)); |
| 4071 | sched_elem->channel_freq = config->schedule[i].chan_freq; |
| 4072 | sched_elem->total_duration = config->schedule[i].total_duration; |
| 4073 | sched_elem->guard_interval = config->schedule[i].guard_interval; |
| 4074 | buf_ptr += sizeof(*sched_elem); |
| 4075 | } |
| 4076 | |
| 4077 | |
| 4078 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4079 | WMI_OCB_SET_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4080 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4081 | WMI_LOGE("Failed to set OCB config"); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4082 | wmi_buf_free(buf); |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4083 | } |
| 4084 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4085 | return ret; |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 4086 | } |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4087 | |
| 4088 | /** |
| 4089 | * send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable mcc scheduler |
| 4090 | * @wmi_handle: wmi handle |
| 4091 | * @mcc_adaptive_scheduler: enable/disable |
| 4092 | * |
| 4093 | * This function enable/disable mcc adaptive scheduler in fw. |
| 4094 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4095 | * Return: QDF_STATUS_SUCCESS for sucess or error code |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4096 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4097 | static QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv( |
Govind Singh | 4df4714 | 2016-04-16 19:24:23 -0700 | [diff] [blame] | 4098 | wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler, |
| 4099 | uint32_t pdev_id) |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4100 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4101 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4102 | wmi_buf_t buf = 0; |
| 4103 | wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL; |
| 4104 | uint16_t len = |
| 4105 | sizeof(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param); |
| 4106 | |
| 4107 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4108 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4109 | WMI_LOGP("%s : wmi_buf_alloc failed", __func__); |
| 4110 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4111 | } |
| 4112 | cmd = (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *) |
| 4113 | wmi_buf_data(buf); |
| 4114 | |
| 4115 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4116 | WMITLV_TAG_STRUC_wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param, |
| 4117 | WMITLV_GET_STRUCT_TLVLEN |
| 4118 | (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param)); |
| 4119 | cmd->enable = mcc_adaptive_scheduler; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 4120 | 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] | 4121 | |
| 4122 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4123 | WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4124 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4125 | WMI_LOGP("%s: Failed to send enable/disable MCC" |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4126 | " adaptive scheduler command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4127 | wmi_buf_free(buf); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4128 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4129 | |
| 4130 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4131 | } |
| 4132 | |
| 4133 | /** |
| 4134 | * send_set_mcc_channel_time_latency_cmd_tlv() -set MCC channel time latency |
| 4135 | * @wmi: wmi handle |
| 4136 | * @mcc_channel: mcc channel |
| 4137 | * @mcc_channel_time_latency: MCC channel time latency. |
| 4138 | * |
| 4139 | * Currently used to set time latency for an MCC vdev/adapter using operating |
| 4140 | * channel of it and channel number. The info is provided run time using |
| 4141 | * iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>. |
| 4142 | * |
| 4143 | * Return: CDF status |
| 4144 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4145 | 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] | 4146 | uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency) |
| 4147 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4148 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4149 | wmi_buf_t buf = 0; |
| 4150 | wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL; |
| 4151 | uint16_t len = 0; |
| 4152 | uint8_t *buf_ptr = NULL; |
| 4153 | wmi_resmgr_chan_latency chan_latency; |
| 4154 | /* Note: we only support MCC time latency for a single channel */ |
| 4155 | uint32_t num_channels = 1; |
| 4156 | uint32_t chan1_freq = mcc_channel_freq; |
| 4157 | uint32_t latency_chan1 = mcc_channel_time_latency; |
| 4158 | |
| 4159 | |
| 4160 | /* If 0ms latency is provided, then FW will set to a default. |
| 4161 | * Otherwise, latency must be at least 30ms. |
| 4162 | */ |
| 4163 | if ((latency_chan1 > 0) && |
| 4164 | (latency_chan1 < WMI_MCC_MIN_NON_ZERO_CHANNEL_LATENCY)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4165 | WMI_LOGE("%s: Invalid time latency for Channel #1 = %dms " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4166 | "Minimum is 30ms (or 0 to use default value by " |
| 4167 | "firmware)", __func__, latency_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4168 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4169 | } |
| 4170 | |
| 4171 | /* Set WMI CMD for channel time latency here */ |
| 4172 | len = sizeof(wmi_resmgr_set_chan_latency_cmd_fixed_param) + |
| 4173 | WMI_TLV_HDR_SIZE + /*Place holder for chan_time_latency array */ |
| 4174 | num_channels * sizeof(wmi_resmgr_chan_latency); |
| 4175 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4176 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4177 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 4178 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4179 | } |
| 4180 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4181 | cmdTL = (wmi_resmgr_set_chan_latency_cmd_fixed_param *) |
| 4182 | wmi_buf_data(buf); |
| 4183 | WMITLV_SET_HDR(&cmdTL->tlv_header, |
| 4184 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_latency_cmd_fixed_param, |
| 4185 | WMITLV_GET_STRUCT_TLVLEN |
| 4186 | (wmi_resmgr_set_chan_latency_cmd_fixed_param)); |
| 4187 | cmdTL->num_chans = num_channels; |
| 4188 | /* Update channel time latency information for home channel(s) */ |
| 4189 | buf_ptr += sizeof(*cmdTL); |
| 4190 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4191 | num_channels * sizeof(wmi_resmgr_chan_latency)); |
| 4192 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4193 | chan_latency.chan_mhz = chan1_freq; |
| 4194 | chan_latency.latency = latency_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4195 | qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4196 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4197 | WMI_RESMGR_SET_CHAN_LATENCY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4198 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4199 | WMI_LOGE("%s: Failed to send MCC Channel Time Latency command", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4200 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4201 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4202 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4203 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4204 | |
| 4205 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4206 | } |
| 4207 | |
| 4208 | /** |
| 4209 | * send_set_mcc_channel_time_quota_cmd_tlv() -set MCC channel time quota |
| 4210 | * @wmi: wmi handle |
| 4211 | * @adapter_1_chan_number: adapter 1 channel number |
| 4212 | * @adapter_1_quota: adapter 1 quota |
| 4213 | * @adapter_2_chan_number: adapter 2 channel number |
| 4214 | * |
| 4215 | * Return: CDF status |
| 4216 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4217 | 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] | 4218 | uint32_t adapter_1_chan_freq, |
| 4219 | uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq) |
| 4220 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4221 | QDF_STATUS ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4222 | wmi_buf_t buf = 0; |
| 4223 | uint16_t len = 0; |
| 4224 | uint8_t *buf_ptr = NULL; |
| 4225 | wmi_resmgr_set_chan_time_quota_cmd_fixed_param *cmdTQ = NULL; |
| 4226 | wmi_resmgr_chan_time_quota chan_quota; |
| 4227 | uint32_t quota_chan1 = adapter_1_quota; |
| 4228 | /* Knowing quota of 1st chan., derive quota for 2nd chan. */ |
| 4229 | uint32_t quota_chan2 = 100 - quota_chan1; |
| 4230 | /* Note: setting time quota for MCC requires info for 2 channels */ |
| 4231 | uint32_t num_channels = 2; |
| 4232 | uint32_t chan1_freq = adapter_1_chan_freq; |
| 4233 | uint32_t chan2_freq = adapter_2_chan_freq; |
| 4234 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4235 | WMI_LOGD("%s: freq1:%dMHz, Quota1:%dms, " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4236 | "freq2:%dMHz, Quota2:%dms", __func__, |
| 4237 | chan1_freq, quota_chan1, chan2_freq, |
| 4238 | quota_chan2); |
| 4239 | |
| 4240 | /* |
| 4241 | * Perform sanity check on time quota values provided. |
| 4242 | */ |
| 4243 | if (quota_chan1 < WMI_MCC_MIN_CHANNEL_QUOTA || |
| 4244 | quota_chan1 > WMI_MCC_MAX_CHANNEL_QUOTA) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4245 | WMI_LOGE("%s: Invalid time quota for Channel #1=%dms. Minimum " |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4246 | "is 20ms & maximum is 80ms", __func__, quota_chan1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4247 | return QDF_STATUS_E_INVAL; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4248 | } |
| 4249 | /* Set WMI CMD for channel time quota here */ |
| 4250 | len = sizeof(wmi_resmgr_set_chan_time_quota_cmd_fixed_param) + |
| 4251 | WMI_TLV_HDR_SIZE + /* Place holder for chan_time_quota array */ |
| 4252 | num_channels * sizeof(wmi_resmgr_chan_time_quota); |
| 4253 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4254 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4255 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 4256 | QDF_ASSERT(0); |
| 4257 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4258 | } |
| 4259 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4260 | cmdTQ = (wmi_resmgr_set_chan_time_quota_cmd_fixed_param *) |
| 4261 | wmi_buf_data(buf); |
| 4262 | WMITLV_SET_HDR(&cmdTQ->tlv_header, |
| 4263 | WMITLV_TAG_STRUC_wmi_resmgr_set_chan_time_quota_cmd_fixed_param, |
| 4264 | WMITLV_GET_STRUCT_TLVLEN |
| 4265 | (wmi_resmgr_set_chan_time_quota_cmd_fixed_param)); |
| 4266 | cmdTQ->num_chans = num_channels; |
| 4267 | |
| 4268 | /* Update channel time quota information for home channel(s) */ |
| 4269 | buf_ptr += sizeof(*cmdTQ); |
| 4270 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4271 | num_channels * sizeof(wmi_resmgr_chan_time_quota)); |
| 4272 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 4273 | chan_quota.chan_mhz = chan1_freq; |
| 4274 | chan_quota.channel_time_quota = quota_chan1; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4275 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4276 | /* Construct channel and quota record for the 2nd MCC mode. */ |
| 4277 | buf_ptr += sizeof(chan_quota); |
| 4278 | chan_quota.chan_mhz = chan2_freq; |
| 4279 | chan_quota.channel_time_quota = quota_chan2; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4280 | qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota)); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4281 | |
| 4282 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4283 | WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4284 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4285 | WMI_LOGE("Failed to send MCC Channel Time Quota command"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4286 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4287 | QDF_ASSERT(0); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4288 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4289 | |
| 4290 | return ret; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4291 | } |
| 4292 | |
| 4293 | /** |
| 4294 | * send_set_thermal_mgmt_cmd_tlv() - set thermal mgmt command to fw |
| 4295 | * @wmi_handle: Pointer to wmi handle |
| 4296 | * @thermal_info: Thermal command information |
| 4297 | * |
| 4298 | * This function sends the thermal management command |
| 4299 | * to the firmware |
| 4300 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4301 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4302 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4303 | 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] | 4304 | struct thermal_cmd_params *thermal_info) |
| 4305 | { |
| 4306 | wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL; |
| 4307 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4308 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4309 | uint32_t len = 0; |
| 4310 | |
| 4311 | len = sizeof(*cmd); |
| 4312 | |
| 4313 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4314 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4315 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 4316 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4317 | } |
| 4318 | |
| 4319 | cmd = (wmi_thermal_mgmt_cmd_fixed_param *) wmi_buf_data(buf); |
| 4320 | |
| 4321 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4322 | WMITLV_TAG_STRUC_wmi_thermal_mgmt_cmd_fixed_param, |
| 4323 | WMITLV_GET_STRUCT_TLVLEN |
| 4324 | (wmi_thermal_mgmt_cmd_fixed_param)); |
| 4325 | |
| 4326 | cmd->lower_thresh_degreeC = thermal_info->min_temp; |
| 4327 | cmd->upper_thresh_degreeC = thermal_info->max_temp; |
| 4328 | cmd->enable = thermal_info->thermal_enable; |
| 4329 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4330 | 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] | 4331 | cmd->lower_thresh_degreeC, cmd->upper_thresh_degreeC, cmd->enable); |
| 4332 | |
| 4333 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4334 | WMI_THERMAL_MGMT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4335 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4336 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4337 | WMI_LOGE("%s:Failed to send thermal mgmt command", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4338 | } |
| 4339 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4340 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4341 | } |
| 4342 | |
| 4343 | |
| 4344 | /** |
| 4345 | * send_lro_config_cmd_tlv() - process the LRO config command |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4346 | * @wmi_handle: Pointer to WMI handle |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4347 | * @wmi_lro_cmd: Pointer to LRO configuration parameters |
| 4348 | * |
| 4349 | * This function sends down the LRO configuration parameters to |
| 4350 | * the firmware to enable LRO, sets the TCP flags and sets the |
| 4351 | * seed values for the toeplitz hash generation |
| 4352 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4353 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4354 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4355 | 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] | 4356 | struct wmi_lro_config_cmd_t *wmi_lro_cmd) |
| 4357 | { |
| 4358 | wmi_lro_info_cmd_fixed_param *cmd; |
| 4359 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4360 | QDF_STATUS status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4361 | |
| 4362 | |
| 4363 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4364 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4365 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 4366 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4367 | } |
| 4368 | |
| 4369 | cmd = (wmi_lro_info_cmd_fixed_param *) wmi_buf_data(buf); |
| 4370 | |
| 4371 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4372 | WMITLV_TAG_STRUC_wmi_lro_info_cmd_fixed_param, |
| 4373 | WMITLV_GET_STRUCT_TLVLEN(wmi_lro_info_cmd_fixed_param)); |
| 4374 | |
| 4375 | cmd->lro_enable = wmi_lro_cmd->lro_enable; |
| 4376 | WMI_LRO_INFO_TCP_FLAG_VALS_SET(cmd->tcp_flag_u32, |
| 4377 | wmi_lro_cmd->tcp_flag); |
| 4378 | WMI_LRO_INFO_TCP_FLAGS_MASK_SET(cmd->tcp_flag_u32, |
| 4379 | wmi_lro_cmd->tcp_flag_mask); |
| 4380 | cmd->toeplitz_hash_ipv4_0_3 = |
| 4381 | wmi_lro_cmd->toeplitz_hash_ipv4[0]; |
| 4382 | cmd->toeplitz_hash_ipv4_4_7 = |
| 4383 | wmi_lro_cmd->toeplitz_hash_ipv4[1]; |
| 4384 | cmd->toeplitz_hash_ipv4_8_11 = |
| 4385 | wmi_lro_cmd->toeplitz_hash_ipv4[2]; |
| 4386 | cmd->toeplitz_hash_ipv4_12_15 = |
| 4387 | wmi_lro_cmd->toeplitz_hash_ipv4[3]; |
| 4388 | cmd->toeplitz_hash_ipv4_16 = |
| 4389 | wmi_lro_cmd->toeplitz_hash_ipv4[4]; |
| 4390 | |
| 4391 | cmd->toeplitz_hash_ipv6_0_3 = |
| 4392 | wmi_lro_cmd->toeplitz_hash_ipv6[0]; |
| 4393 | cmd->toeplitz_hash_ipv6_4_7 = |
| 4394 | wmi_lro_cmd->toeplitz_hash_ipv6[1]; |
| 4395 | cmd->toeplitz_hash_ipv6_8_11 = |
| 4396 | wmi_lro_cmd->toeplitz_hash_ipv6[2]; |
| 4397 | cmd->toeplitz_hash_ipv6_12_15 = |
| 4398 | wmi_lro_cmd->toeplitz_hash_ipv6[3]; |
| 4399 | cmd->toeplitz_hash_ipv6_16_19 = |
| 4400 | wmi_lro_cmd->toeplitz_hash_ipv6[4]; |
| 4401 | cmd->toeplitz_hash_ipv6_20_23 = |
| 4402 | wmi_lro_cmd->toeplitz_hash_ipv6[5]; |
| 4403 | cmd->toeplitz_hash_ipv6_24_27 = |
| 4404 | wmi_lro_cmd->toeplitz_hash_ipv6[6]; |
| 4405 | cmd->toeplitz_hash_ipv6_28_31 = |
| 4406 | wmi_lro_cmd->toeplitz_hash_ipv6[7]; |
| 4407 | cmd->toeplitz_hash_ipv6_32_35 = |
| 4408 | wmi_lro_cmd->toeplitz_hash_ipv6[8]; |
| 4409 | cmd->toeplitz_hash_ipv6_36_39 = |
| 4410 | wmi_lro_cmd->toeplitz_hash_ipv6[9]; |
| 4411 | cmd->toeplitz_hash_ipv6_40 = |
| 4412 | wmi_lro_cmd->toeplitz_hash_ipv6[10]; |
| 4413 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4414 | WMI_LOGD("WMI_LRO_CONFIG: lro_enable %d, tcp_flag 0x%x", |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4415 | cmd->lro_enable, cmd->tcp_flag_u32); |
| 4416 | |
| 4417 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 4418 | sizeof(*cmd), WMI_LRO_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4419 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4420 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4421 | WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__); |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4422 | } |
| 4423 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4424 | return status; |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 4425 | } |
| 4426 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4427 | /** |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4428 | * send_peer_rate_report_cmd_tlv() - process the peer rate report command |
| 4429 | * @wmi_handle: Pointer to wmi handle |
| 4430 | * @rate_report_params: Pointer to peer rate report parameters |
| 4431 | * |
| 4432 | * |
| 4433 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
| 4434 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4435 | 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] | 4436 | struct wmi_peer_rate_report_params *rate_report_params) |
| 4437 | { |
| 4438 | wmi_peer_set_rate_report_condition_fixed_param *cmd = NULL; |
| 4439 | wmi_buf_t buf = NULL; |
| 4440 | QDF_STATUS status = 0; |
| 4441 | uint32_t len = 0; |
| 4442 | uint32_t i, j; |
| 4443 | |
| 4444 | len = sizeof(*cmd); |
| 4445 | |
| 4446 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4447 | if (!buf) { |
| 4448 | WMI_LOGE("Failed to alloc buf to peer_set_condition cmd\n"); |
| 4449 | return QDF_STATUS_E_FAILURE; |
| 4450 | } |
| 4451 | |
| 4452 | cmd = (wmi_peer_set_rate_report_condition_fixed_param *) |
| 4453 | wmi_buf_data(buf); |
| 4454 | |
| 4455 | WMITLV_SET_HDR( |
| 4456 | &cmd->tlv_header, |
| 4457 | WMITLV_TAG_STRUC_wmi_peer_set_rate_report_condition_fixed_param, |
| 4458 | WMITLV_GET_STRUCT_TLVLEN( |
| 4459 | wmi_peer_set_rate_report_condition_fixed_param)); |
| 4460 | |
| 4461 | cmd->enable_rate_report = rate_report_params->rate_report_enable; |
| 4462 | cmd->report_backoff_time = rate_report_params->backoff_time; |
| 4463 | cmd->report_timer_period = rate_report_params->timer_period; |
| 4464 | for (i = 0; i < PEER_RATE_REPORT_COND_MAX_NUM; i++) { |
| 4465 | cmd->cond_per_phy[i].val_cond_flags = |
| 4466 | rate_report_params->report_per_phy[i].cond_flags; |
| 4467 | cmd->cond_per_phy[i].rate_delta.min_delta = |
| 4468 | rate_report_params->report_per_phy[i].delta.delta_min; |
| 4469 | cmd->cond_per_phy[i].rate_delta.percentage = |
| 4470 | rate_report_params->report_per_phy[i].delta.percent; |
| 4471 | for (j = 0; j < MAX_NUM_OF_RATE_THRESH; j++) { |
| 4472 | cmd->cond_per_phy[i].rate_threshold[j] = |
| 4473 | rate_report_params->report_per_phy[i]. |
| 4474 | report_rate_threshold[j]; |
| 4475 | } |
| 4476 | } |
| 4477 | |
| 4478 | WMI_LOGE("%s enable %d backoff_time %d period %d\n", __func__, |
| 4479 | cmd->enable_rate_report, |
| 4480 | cmd->report_backoff_time, cmd->report_timer_period); |
| 4481 | |
| 4482 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4483 | WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); |
| 4484 | if (QDF_IS_STATUS_ERROR(status)) { |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4485 | wmi_buf_free(buf); |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 4486 | WMI_LOGE("%s:Failed to send peer_set_report_cond command", |
| 4487 | __func__); |
| 4488 | } |
| 4489 | return status; |
| 4490 | } |
| 4491 | |
| 4492 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4493 | * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL |
| 4494 | * @wmi_handle: wmi handle |
| 4495 | * @param: bcn ll cmd parameter |
| 4496 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4497 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4498 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4499 | 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] | 4500 | wmi_bcn_send_from_host_cmd_fixed_param *param) |
| 4501 | { |
| 4502 | wmi_bcn_send_from_host_cmd_fixed_param *cmd; |
| 4503 | wmi_buf_t wmi_buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4504 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4505 | |
| 4506 | wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 4507 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4508 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4509 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4510 | } |
| 4511 | |
| 4512 | cmd = (wmi_bcn_send_from_host_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 4513 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4514 | WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param, |
| 4515 | WMITLV_GET_STRUCT_TLVLEN |
| 4516 | (wmi_bcn_send_from_host_cmd_fixed_param)); |
| 4517 | cmd->vdev_id = param->vdev_id; |
| 4518 | cmd->data_len = param->data_len; |
| 4519 | cmd->frame_ctrl = param->frame_ctrl; |
| 4520 | cmd->frag_ptr = param->frag_ptr; |
| 4521 | cmd->dtim_flag = param->dtim_flag; |
| 4522 | |
| 4523 | ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), |
| 4524 | WMI_PDEV_SEND_BCN_CMDID); |
| 4525 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4526 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4527 | WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4528 | wmi_buf_free(wmi_buf); |
| 4529 | } |
| 4530 | |
| 4531 | return ret; |
| 4532 | } |
| 4533 | |
| 4534 | /** |
| 4535 | * send_set_sta_sa_query_param_cmd_tlv() - set sta sa query parameters |
| 4536 | * @wmi_handle: wmi handle |
| 4537 | * @vdev_id: vdev id |
| 4538 | * @max_retries: max retries |
| 4539 | * @retry_interval: retry interval |
| 4540 | * This function sets sta query related parameters in fw. |
| 4541 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4542 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4543 | */ |
| 4544 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4545 | 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] | 4546 | uint8_t vdev_id, uint32_t max_retries, |
| 4547 | uint32_t retry_interval) |
| 4548 | { |
| 4549 | wmi_buf_t buf; |
| 4550 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *cmd; |
| 4551 | int len; |
| 4552 | |
| 4553 | len = sizeof(*cmd); |
| 4554 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4555 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4556 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 4557 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4558 | } |
| 4559 | |
| 4560 | cmd = (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param *)wmi_buf_data(buf); |
| 4561 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4562 | WMITLV_TAG_STRUC_WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param, |
| 4563 | WMITLV_GET_STRUCT_TLVLEN |
| 4564 | (WMI_PMF_OFFLOAD_SET_SA_QUERY_CMD_fixed_param)); |
| 4565 | |
| 4566 | |
| 4567 | cmd->vdev_id = vdev_id; |
| 4568 | cmd->sa_query_max_retry_count = max_retries; |
| 4569 | cmd->sa_query_retry_interval = retry_interval; |
| 4570 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4571 | 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] | 4572 | vdev_id, retry_interval, max_retries); |
| 4573 | |
| 4574 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4575 | WMI_PMF_OFFLOAD_SET_SA_QUERY_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4576 | WMI_LOGE(FL("Failed to offload STA SA Query")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4577 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4578 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4579 | } |
| 4580 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4581 | WMI_LOGD(FL("Exit :")); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4582 | return 0; |
| 4583 | } |
| 4584 | |
| 4585 | /** |
| 4586 | * send_set_sta_keep_alive_cmd_tlv() - set sta keep alive parameters |
| 4587 | * @wmi_handle: wmi handle |
| 4588 | * @params: sta keep alive parameter |
| 4589 | * |
| 4590 | * This function sets keep alive related parameters in fw. |
| 4591 | * |
| 4592 | * Return: CDF status |
| 4593 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4594 | 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] | 4595 | struct sta_params *params) |
| 4596 | { |
| 4597 | wmi_buf_t buf; |
| 4598 | WMI_STA_KEEPALIVE_CMD_fixed_param *cmd; |
| 4599 | WMI_STA_KEEPALVE_ARP_RESPONSE *arp_rsp; |
| 4600 | uint8_t *buf_ptr; |
| 4601 | int len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4602 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4603 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4604 | WMI_LOGD("%s: Enter", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4605 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4606 | len = sizeof(*cmd) + sizeof(*arp_rsp); |
| 4607 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4608 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4609 | WMI_LOGE("wmi_buf_alloc failed"); |
| 4610 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4611 | } |
| 4612 | |
| 4613 | cmd = (WMI_STA_KEEPALIVE_CMD_fixed_param *) wmi_buf_data(buf); |
| 4614 | buf_ptr = (uint8_t *) cmd; |
| 4615 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4616 | WMITLV_TAG_STRUC_WMI_STA_KEEPALIVE_CMD_fixed_param, |
| 4617 | WMITLV_GET_STRUCT_TLVLEN |
| 4618 | (WMI_STA_KEEPALIVE_CMD_fixed_param)); |
| 4619 | cmd->interval = params->timeperiod; |
| 4620 | cmd->enable = (params->timeperiod) ? 1 : 0; |
| 4621 | cmd->vdev_id = params->vdev_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4622 | 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] | 4623 | params->timeperiod, params->method); |
| 4624 | arp_rsp = (WMI_STA_KEEPALVE_ARP_RESPONSE *) (buf_ptr + sizeof(*cmd)); |
| 4625 | WMITLV_SET_HDR(&arp_rsp->tlv_header, |
| 4626 | WMITLV_TAG_STRUC_WMI_STA_KEEPALVE_ARP_RESPONSE, |
| 4627 | WMITLV_GET_STRUCT_TLVLEN(WMI_STA_KEEPALVE_ARP_RESPONSE)); |
| 4628 | |
| 4629 | if (params->method == WMI_KEEP_ALIVE_UNSOLICIT_ARP_RSP) { |
| 4630 | if ((NULL == params->hostv4addr) || |
| 4631 | (NULL == params->destv4addr) || |
| 4632 | (NULL == params->destmac)) { |
Jeff Johnson | 58fd0c6 | 2017-09-18 10:05:06 -0700 | [diff] [blame] | 4633 | WMI_LOGE("%s: received null pointer, hostv4addr:%pK " |
| 4634 | "destv4addr:%pK destmac:%pK ", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4635 | params->hostv4addr, params->destv4addr, params->destmac); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4636 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4637 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4638 | } |
| 4639 | cmd->method = WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4640 | qdf_mem_copy(&arp_rsp->sender_prot_addr, params->hostv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4641 | WMI_IPV4_ADDR_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4642 | qdf_mem_copy(&arp_rsp->target_prot_addr, params->destv4addr, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4643 | WMI_IPV4_ADDR_LEN); |
| 4644 | WMI_CHAR_ARRAY_TO_MAC_ADDR(params->destmac, &arp_rsp->dest_mac_addr); |
| 4645 | } else { |
| 4646 | cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME; |
| 4647 | } |
| 4648 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4649 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4650 | WMI_STA_KEEPALIVE_CMDID); |
| 4651 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4652 | WMI_LOGE("Failed to set KeepAlive"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4653 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4654 | } |
| 4655 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4656 | WMI_LOGD("%s: Exit", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4657 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4658 | } |
| 4659 | |
| 4660 | /** |
| 4661 | * send_vdev_set_gtx_cfg_cmd_tlv() - set GTX params |
| 4662 | * @wmi_handle: wmi handle |
| 4663 | * @if_id: vdev id |
| 4664 | * @gtx_info: GTX config params |
| 4665 | * |
| 4666 | * This function set GTX related params in firmware. |
| 4667 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4668 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4669 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4670 | 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] | 4671 | struct wmi_gtx_config *gtx_info) |
| 4672 | { |
| 4673 | wmi_vdev_set_gtx_params_cmd_fixed_param *cmd; |
| 4674 | wmi_buf_t buf; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4675 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4676 | int len = sizeof(wmi_vdev_set_gtx_params_cmd_fixed_param); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4677 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4678 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4679 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4680 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4681 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4682 | } |
| 4683 | cmd = (wmi_vdev_set_gtx_params_cmd_fixed_param *) wmi_buf_data(buf); |
| 4684 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4685 | WMITLV_TAG_STRUC_wmi_vdev_set_gtx_params_cmd_fixed_param, |
| 4686 | WMITLV_GET_STRUCT_TLVLEN |
| 4687 | (wmi_vdev_set_gtx_params_cmd_fixed_param)); |
| 4688 | cmd->vdev_id = if_id; |
| 4689 | |
| 4690 | cmd->gtxRTMask[0] = gtx_info->gtx_rt_mask[0]; |
| 4691 | cmd->gtxRTMask[1] = gtx_info->gtx_rt_mask[1]; |
| 4692 | cmd->userGtxMask = gtx_info->gtx_usrcfg; |
| 4693 | cmd->gtxPERThreshold = gtx_info->gtx_threshold; |
| 4694 | cmd->gtxPERMargin = gtx_info->gtx_margin; |
| 4695 | cmd->gtxTPCstep = gtx_info->gtx_tpcstep; |
| 4696 | cmd->gtxTPCMin = gtx_info->gtx_tpcmin; |
| 4697 | cmd->gtxBWMask = gtx_info->gtx_bwmask; |
| 4698 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4699 | 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] | 4700 | gtxPERThreshold %d, gtxPERMargin %d, gtxTPCstep %d, gtxTPCMin %d, \ |
| 4701 | gtxBWMask 0x%x.", if_id, cmd->gtxRTMask[0], cmd->gtxRTMask[1], |
| 4702 | cmd->userGtxMask, cmd->gtxPERThreshold, cmd->gtxPERMargin, |
| 4703 | cmd->gtxTPCstep, cmd->gtxTPCMin, cmd->gtxBWMask); |
| 4704 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4705 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4706 | WMI_VDEV_SET_GTX_PARAMS_CMDID); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4707 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 4708 | WMI_LOGE("Failed to set GTX PARAMS"); |
| 4709 | wmi_buf_free(buf); |
| 4710 | } |
| 4711 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4712 | } |
| 4713 | |
| 4714 | /** |
| 4715 | * send_process_update_edca_param_cmd_tlv() - update EDCA params |
| 4716 | * @wmi_handle: wmi handle |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 4717 | * @vdev_id: vdev id. |
| 4718 | * @wmm_vparams: edca parameters |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4719 | * |
| 4720 | * This function updates EDCA parameters to the target |
| 4721 | * |
| 4722 | * Return: CDF Status |
| 4723 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4724 | 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] | 4725 | uint8_t vdev_id, |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 4726 | struct wmi_host_wme_vparams wmm_vparams[WMI_MAX_NUM_AC]) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4727 | { |
| 4728 | uint8_t *buf_ptr; |
| 4729 | wmi_buf_t buf; |
| 4730 | wmi_vdev_set_wmm_params_cmd_fixed_param *cmd; |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 4731 | wmi_wmm_vparams *wmm_param; |
| 4732 | struct wmi_host_wme_vparams *twmm_param; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4733 | int len = sizeof(*cmd); |
| 4734 | int ac; |
| 4735 | |
| 4736 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4737 | |
| 4738 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4739 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 4740 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4741 | } |
| 4742 | |
| 4743 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4744 | cmd = (wmi_vdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 4745 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4746 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 4747 | WMITLV_GET_STRUCT_TLVLEN |
| 4748 | (wmi_vdev_set_wmm_params_cmd_fixed_param)); |
| 4749 | cmd->vdev_id = vdev_id; |
| 4750 | |
| 4751 | for (ac = 0; ac < WMI_MAX_NUM_AC; ac++) { |
| 4752 | wmm_param = (wmi_wmm_vparams *) (&cmd->wmm_params[ac]); |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 4753 | twmm_param = (struct wmi_host_wme_vparams *) (&wmm_vparams[ac]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4754 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 4755 | WMITLV_TAG_STRUC_wmi_vdev_set_wmm_params_cmd_fixed_param, |
| 4756 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_vparams)); |
| 4757 | wmm_param->cwmin = twmm_param->cwmin; |
| 4758 | wmm_param->cwmax = twmm_param->cwmax; |
| 4759 | wmm_param->aifs = twmm_param->aifs; |
| 4760 | wmm_param->txoplimit = twmm_param->txoplimit; |
| 4761 | wmm_param->acm = twmm_param->acm; |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 4762 | wmm_param->no_ack = twmm_param->noackpolicy; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4763 | } |
| 4764 | |
| 4765 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4766 | WMI_VDEV_SET_WMM_PARAMS_CMDID)) |
| 4767 | goto fail; |
| 4768 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4769 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4770 | |
| 4771 | fail: |
| 4772 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4773 | WMI_LOGE("%s: Failed to set WMM Paremeters", __func__); |
| 4774 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4775 | } |
| 4776 | |
| 4777 | /** |
| 4778 | * send_probe_rsp_tmpl_send_cmd_tlv() - send probe response template to fw |
| 4779 | * @wmi_handle: wmi handle |
| 4780 | * @vdev_id: vdev id |
| 4781 | * @probe_rsp_info: probe response info |
| 4782 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4783 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4784 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4785 | 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] | 4786 | uint8_t vdev_id, |
| 4787 | struct wmi_probe_resp_params *probe_rsp_info, |
| 4788 | uint8_t *frm) |
| 4789 | { |
| 4790 | wmi_prb_tmpl_cmd_fixed_param *cmd; |
| 4791 | wmi_bcn_prb_info *bcn_prb_info; |
| 4792 | wmi_buf_t wmi_buf; |
| 4793 | uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len; |
| 4794 | uint8_t *buf_ptr; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4795 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4796 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4797 | WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4798 | |
| 4799 | tmpl_len = probe_rsp_info->probeRespTemplateLen; |
| 4800 | tmpl_len_aligned = roundup(tmpl_len, sizeof(A_UINT32)); |
| 4801 | |
| 4802 | wmi_buf_len = sizeof(wmi_prb_tmpl_cmd_fixed_param) + |
| 4803 | sizeof(wmi_bcn_prb_info) + WMI_TLV_HDR_SIZE + |
| 4804 | tmpl_len_aligned; |
| 4805 | |
| 4806 | if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4807 | 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] | 4808 | wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4809 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4810 | } |
| 4811 | |
| 4812 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 4813 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4814 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4815 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4816 | } |
| 4817 | |
| 4818 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 4819 | |
| 4820 | cmd = (wmi_prb_tmpl_cmd_fixed_param *) buf_ptr; |
| 4821 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4822 | WMITLV_TAG_STRUC_wmi_prb_tmpl_cmd_fixed_param, |
| 4823 | WMITLV_GET_STRUCT_TLVLEN(wmi_prb_tmpl_cmd_fixed_param)); |
| 4824 | cmd->vdev_id = vdev_id; |
| 4825 | cmd->buf_len = tmpl_len; |
| 4826 | buf_ptr += sizeof(wmi_prb_tmpl_cmd_fixed_param); |
| 4827 | |
| 4828 | bcn_prb_info = (wmi_bcn_prb_info *) buf_ptr; |
| 4829 | WMITLV_SET_HDR(&bcn_prb_info->tlv_header, |
| 4830 | WMITLV_TAG_STRUC_wmi_bcn_prb_info, |
| 4831 | WMITLV_GET_STRUCT_TLVLEN(wmi_bcn_prb_info)); |
| 4832 | bcn_prb_info->caps = 0; |
| 4833 | bcn_prb_info->erp = 0; |
| 4834 | buf_ptr += sizeof(wmi_bcn_prb_info); |
| 4835 | |
| 4836 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, tmpl_len_aligned); |
| 4837 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4838 | qdf_mem_copy(buf_ptr, frm, tmpl_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4839 | |
| 4840 | ret = wmi_unified_cmd_send(wmi_handle, |
| 4841 | wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4842 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 4843 | WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 4844 | wmi_buf_free(wmi_buf); |
| 4845 | } |
| 4846 | |
| 4847 | return ret; |
| 4848 | } |
| 4849 | |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 4850 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4851 | #define WPI_IV_LEN 16 |
| 4852 | |
| 4853 | /** |
| 4854 | * wmi_update_wpi_key_counter() - update WAPI tsc and rsc key counters |
| 4855 | * |
| 4856 | * @dest_tx: destination address of tsc key counter |
| 4857 | * @src_tx: source address of tsc key counter |
| 4858 | * @dest_rx: destination address of rsc key counter |
| 4859 | * @src_rx: source address of rsc key counter |
| 4860 | * |
| 4861 | * This function copies WAPI tsc and rsc key counters in the wmi buffer. |
| 4862 | * |
| 4863 | * Return: None |
| 4864 | * |
| 4865 | */ |
| 4866 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4867 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4868 | { |
| 4869 | qdf_mem_copy(dest_tx, src_tx, WPI_IV_LEN); |
| 4870 | qdf_mem_copy(dest_rx, src_rx, WPI_IV_LEN); |
| 4871 | } |
| 4872 | #else |
| 4873 | static void wmi_update_wpi_key_counter(uint8_t *dest_tx, uint8_t *src_tx, |
| 4874 | uint8_t *dest_rx, uint8_t *src_rx) |
| 4875 | { |
| 4876 | return; |
| 4877 | } |
| 4878 | #endif |
| 4879 | |
| 4880 | /** |
| 4881 | * send_setup_install_key_cmd_tlv() - set key parameters |
| 4882 | * @wmi_handle: wmi handle |
| 4883 | * @key_params: key parameters |
| 4884 | * |
| 4885 | * This function fills structure from information |
| 4886 | * passed in key_params. |
| 4887 | * |
| 4888 | * Return: QDF_STATUS_SUCCESS - success |
| 4889 | * QDF_STATUS_E_FAILURE - failure |
| 4890 | * QDF_STATUS_E_NOMEM - not able to allocate buffer |
| 4891 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 4892 | 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] | 4893 | struct set_key_params *key_params) |
| 4894 | { |
| 4895 | wmi_vdev_install_key_cmd_fixed_param *cmd; |
| 4896 | wmi_buf_t buf; |
| 4897 | uint8_t *buf_ptr; |
| 4898 | uint32_t len; |
| 4899 | uint8_t *key_data; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4900 | QDF_STATUS status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4901 | |
| 4902 | len = sizeof(*cmd) + roundup(key_params->key_len, sizeof(uint32_t)) + |
| 4903 | WMI_TLV_HDR_SIZE; |
| 4904 | |
| 4905 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4906 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 4907 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4908 | return QDF_STATUS_E_NOMEM; |
| 4909 | } |
| 4910 | |
| 4911 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4912 | cmd = (wmi_vdev_install_key_cmd_fixed_param *) buf_ptr; |
| 4913 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4914 | WMITLV_TAG_STRUC_wmi_vdev_install_key_cmd_fixed_param, |
| 4915 | WMITLV_GET_STRUCT_TLVLEN |
| 4916 | (wmi_vdev_install_key_cmd_fixed_param)); |
| 4917 | cmd->vdev_id = key_params->vdev_id; |
| 4918 | cmd->key_ix = key_params->key_idx; |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 4919 | |
Nandha Kishore Easwaran | 0bc57af | 2016-12-22 19:05:58 +0530 | [diff] [blame] | 4920 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4921 | WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr); |
| 4922 | cmd->key_flags |= key_params->key_flags; |
| 4923 | cmd->key_cipher = key_params->key_cipher; |
| 4924 | if ((key_params->key_txmic_len) && |
| 4925 | (key_params->key_rxmic_len)) { |
| 4926 | cmd->key_txmic_len = key_params->key_txmic_len; |
| 4927 | cmd->key_rxmic_len = key_params->key_rxmic_len; |
| 4928 | } |
Gurumoorthi Gnanasambandhan | bdee340 | 2017-01-10 20:51:02 +0530 | [diff] [blame] | 4929 | #if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI) |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4930 | wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter, |
| 4931 | key_params->tx_iv, |
| 4932 | cmd->wpi_key_rsc_counter, |
| 4933 | key_params->rx_iv); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 4934 | #endif |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4935 | buf_ptr += sizeof(wmi_vdev_install_key_cmd_fixed_param); |
| 4936 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 4937 | roundup(key_params->key_len, sizeof(uint32_t))); |
| 4938 | key_data = (A_UINT8 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4939 | qdf_mem_copy((void *)key_data, |
| 4940 | (const void *)key_params->key_data, key_params->key_len); |
| 4941 | cmd->key_len = key_params->key_len; |
| 4942 | |
| 4943 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 4944 | WMI_VDEV_INSTALL_KEY_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4945 | if (QDF_IS_STATUS_ERROR(status)) |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 4946 | wmi_buf_free(buf); |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4947 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 4948 | return status; |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 4949 | } |
| 4950 | |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 4951 | /** |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 4952 | * send_sar_limit_cmd_tlv() - send sar limit cmd to fw |
| 4953 | * @wmi_handle: wmi handle |
| 4954 | * @params: sar limit params |
| 4955 | * |
| 4956 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 4957 | */ |
| 4958 | static QDF_STATUS send_sar_limit_cmd_tlv(wmi_unified_t wmi_handle, |
| 4959 | struct sar_limit_cmd_params *sar_limit_params) |
| 4960 | { |
| 4961 | wmi_buf_t buf; |
| 4962 | QDF_STATUS qdf_status; |
| 4963 | wmi_sar_limits_cmd_fixed_param *cmd; |
| 4964 | int i; |
| 4965 | uint8_t *buf_ptr; |
| 4966 | wmi_sar_limit_cmd_row *wmi_sar_rows_list; |
| 4967 | struct sar_limit_cmd_row *sar_rows_list; |
| 4968 | uint32_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 4969 | |
| 4970 | len += sizeof(wmi_sar_limit_cmd_row) * sar_limit_params->num_limit_rows; |
| 4971 | buf = wmi_buf_alloc(wmi_handle, len); |
| 4972 | if (!buf) { |
| 4973 | WMI_LOGE("Failed to allocate memory"); |
| 4974 | qdf_status = QDF_STATUS_E_NOMEM; |
| 4975 | goto end; |
| 4976 | } |
| 4977 | |
| 4978 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 4979 | cmd = (wmi_sar_limits_cmd_fixed_param *) buf_ptr; |
| 4980 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 4981 | WMITLV_TAG_STRUC_wmi_sar_limits_cmd_fixed_param, |
| 4982 | WMITLV_GET_STRUCT_TLVLEN |
| 4983 | (wmi_sar_limits_cmd_fixed_param)); |
| 4984 | cmd->sar_enable = sar_limit_params->sar_enable; |
| 4985 | cmd->commit_limits = sar_limit_params->commit_limits; |
| 4986 | cmd->num_limit_rows = sar_limit_params->num_limit_rows; |
| 4987 | |
| 4988 | WMI_LOGD("no of sar rows = %d, len = %d", |
| 4989 | sar_limit_params->num_limit_rows, len); |
| 4990 | buf_ptr += sizeof(*cmd); |
| 4991 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 4992 | sizeof(wmi_sar_limit_cmd_row) * |
| 4993 | sar_limit_params->num_limit_rows); |
| 4994 | if (cmd->num_limit_rows == 0) |
| 4995 | goto send_sar_limits; |
| 4996 | |
| 4997 | wmi_sar_rows_list = (wmi_sar_limit_cmd_row *) |
| 4998 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 4999 | sar_rows_list = sar_limit_params->sar_limit_row_list; |
| 5000 | |
| 5001 | for (i = 0; i < sar_limit_params->num_limit_rows; i++) { |
| 5002 | WMITLV_SET_HDR(&wmi_sar_rows_list->tlv_header, |
| 5003 | WMITLV_TAG_STRUC_wmi_sar_limit_cmd_row, |
| 5004 | WMITLV_GET_STRUCT_TLVLEN(wmi_sar_limit_cmd_row)); |
| 5005 | wmi_sar_rows_list->band_id = sar_rows_list->band_id; |
| 5006 | wmi_sar_rows_list->chain_id = sar_rows_list->chain_id; |
| 5007 | wmi_sar_rows_list->mod_id = sar_rows_list->mod_id; |
| 5008 | wmi_sar_rows_list->limit_value = sar_rows_list->limit_value; |
| 5009 | wmi_sar_rows_list->validity_bitmap = |
| 5010 | sar_rows_list->validity_bitmap; |
| 5011 | WMI_LOGD("row %d, band_id = %d, chain_id = %d, mod_id = %d, limit_value = %d, validity_bitmap = %d", |
| 5012 | i, wmi_sar_rows_list->band_id, |
| 5013 | wmi_sar_rows_list->chain_id, |
| 5014 | wmi_sar_rows_list->mod_id, |
| 5015 | wmi_sar_rows_list->limit_value, |
| 5016 | wmi_sar_rows_list->validity_bitmap); |
| 5017 | sar_rows_list++; |
| 5018 | wmi_sar_rows_list++; |
| 5019 | } |
| 5020 | send_sar_limits: |
| 5021 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5022 | WMI_SAR_LIMITS_CMDID); |
| 5023 | |
| 5024 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 5025 | WMI_LOGE("Failed to send WMI_SAR_LIMITS_CMDID"); |
| 5026 | wmi_buf_free(buf); |
| 5027 | } |
| 5028 | |
| 5029 | end: |
| 5030 | return qdf_status; |
| 5031 | } |
| 5032 | |
| 5033 | /** |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 5034 | * send_encrypt_decrypt_send_cmd() - send encrypt/decrypt cmd to fw |
| 5035 | * @wmi_handle: wmi handle |
| 5036 | * @params: encrypt/decrypt params |
| 5037 | * |
| 5038 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 5039 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 5040 | static |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 5041 | QDF_STATUS send_encrypt_decrypt_send_cmd_tlv(wmi_unified_t wmi_handle, |
| 5042 | struct encrypt_decrypt_req_params *encrypt_decrypt_params) |
| 5043 | { |
| 5044 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *cmd; |
| 5045 | wmi_buf_t wmi_buf; |
| 5046 | uint8_t *buf_ptr; |
| 5047 | QDF_STATUS ret; |
| 5048 | uint32_t len; |
| 5049 | |
| 5050 | WMI_LOGD(FL("Send encrypt decrypt cmd")); |
| 5051 | |
| 5052 | len = sizeof(*cmd) + |
| 5053 | roundup(encrypt_decrypt_params->data_len, sizeof(A_UINT32)) + |
| 5054 | WMI_TLV_HDR_SIZE; |
| 5055 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5056 | if (!wmi_buf) { |
| 5057 | WMI_LOGP("%s: failed to allocate memory for encrypt/decrypt msg", |
| 5058 | __func__); |
| 5059 | return QDF_STATUS_E_NOMEM; |
| 5060 | } |
| 5061 | |
| 5062 | buf_ptr = wmi_buf_data(wmi_buf); |
| 5063 | cmd = (wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param *)buf_ptr; |
| 5064 | |
| 5065 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5066 | WMITLV_TAG_STRUC_wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param, |
| 5067 | WMITLV_GET_STRUCT_TLVLEN( |
| 5068 | wmi_vdev_encrypt_decrypt_data_req_cmd_fixed_param)); |
| 5069 | |
| 5070 | cmd->vdev_id = encrypt_decrypt_params->vdev_id; |
| 5071 | cmd->key_flag = encrypt_decrypt_params->key_flag; |
| 5072 | cmd->key_idx = encrypt_decrypt_params->key_idx; |
| 5073 | cmd->key_cipher = encrypt_decrypt_params->key_cipher; |
| 5074 | cmd->key_len = encrypt_decrypt_params->key_len; |
| 5075 | cmd->key_txmic_len = encrypt_decrypt_params->key_txmic_len; |
| 5076 | cmd->key_rxmic_len = encrypt_decrypt_params->key_rxmic_len; |
| 5077 | |
| 5078 | qdf_mem_copy(cmd->key_data, encrypt_decrypt_params->key_data, |
| 5079 | encrypt_decrypt_params->key_len); |
| 5080 | |
| 5081 | qdf_mem_copy(cmd->mac_hdr, encrypt_decrypt_params->mac_header, |
| 5082 | MAX_MAC_HEADER_LEN); |
| 5083 | |
| 5084 | cmd->data_len = encrypt_decrypt_params->data_len; |
| 5085 | |
| 5086 | if (cmd->data_len) { |
| 5087 | buf_ptr += sizeof(*cmd); |
| 5088 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5089 | roundup(encrypt_decrypt_params->data_len, |
| 5090 | sizeof(A_UINT32))); |
| 5091 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5092 | qdf_mem_copy(buf_ptr, encrypt_decrypt_params->data, |
| 5093 | encrypt_decrypt_params->data_len); |
| 5094 | } |
| 5095 | |
| 5096 | /* This conversion is to facilitate data to FW in little endian */ |
| 5097 | cmd->pn[5] = encrypt_decrypt_params->pn[0]; |
| 5098 | cmd->pn[4] = encrypt_decrypt_params->pn[1]; |
| 5099 | cmd->pn[3] = encrypt_decrypt_params->pn[2]; |
| 5100 | cmd->pn[2] = encrypt_decrypt_params->pn[3]; |
| 5101 | cmd->pn[1] = encrypt_decrypt_params->pn[4]; |
| 5102 | cmd->pn[0] = encrypt_decrypt_params->pn[5]; |
| 5103 | |
| 5104 | ret = wmi_unified_cmd_send(wmi_handle, |
| 5105 | wmi_buf, len, |
| 5106 | WMI_VDEV_ENCRYPT_DECRYPT_DATA_REQ_CMDID); |
| 5107 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 5108 | WMI_LOGE("Failed to send ENCRYPT DECRYPT cmd: %d", ret); |
| 5109 | wmi_buf_free(wmi_buf); |
| 5110 | } |
| 5111 | |
| 5112 | return ret; |
| 5113 | } |
| 5114 | |
| 5115 | |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 5116 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5117 | /** |
| 5118 | * send_p2p_go_set_beacon_ie_cmd_tlv() - set beacon IE for p2p go |
| 5119 | * @wmi_handle: wmi handle |
| 5120 | * @vdev_id: vdev id |
| 5121 | * @p2p_ie: p2p IE |
| 5122 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5123 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5124 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5125 | 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] | 5126 | A_UINT32 vdev_id, uint8_t *p2p_ie) |
| 5127 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5128 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5129 | wmi_p2p_go_set_beacon_ie_fixed_param *cmd; |
| 5130 | wmi_buf_t wmi_buf; |
| 5131 | uint32_t ie_len, ie_len_aligned, wmi_buf_len; |
| 5132 | uint8_t *buf_ptr; |
| 5133 | |
| 5134 | ie_len = (uint32_t) (p2p_ie[1] + 2); |
| 5135 | |
| 5136 | /* More than one P2P IE may be included in a single frame. |
| 5137 | If multiple P2P IEs are present, the complete P2P attribute |
| 5138 | data consists of the concatenation of the P2P Attribute |
| 5139 | fields of the P2P IEs. The P2P Attributes field of each |
| 5140 | P2P IE may be any length up to the maximum (251 octets). |
| 5141 | In this case host sends one P2P IE to firmware so the length |
| 5142 | should not exceed more than 251 bytes |
| 5143 | */ |
| 5144 | if (ie_len > 251) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5145 | WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5146 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5147 | } |
| 5148 | |
| 5149 | ie_len_aligned = roundup(ie_len, sizeof(A_UINT32)); |
| 5150 | |
| 5151 | wmi_buf_len = |
| 5152 | sizeof(wmi_p2p_go_set_beacon_ie_fixed_param) + ie_len_aligned + |
| 5153 | WMI_TLV_HDR_SIZE; |
| 5154 | |
| 5155 | wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len); |
| 5156 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5157 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5158 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5159 | } |
| 5160 | |
| 5161 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5162 | |
| 5163 | cmd = (wmi_p2p_go_set_beacon_ie_fixed_param *) buf_ptr; |
| 5164 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5165 | WMITLV_TAG_STRUC_wmi_p2p_go_set_beacon_ie_fixed_param, |
| 5166 | WMITLV_GET_STRUCT_TLVLEN |
| 5167 | (wmi_p2p_go_set_beacon_ie_fixed_param)); |
| 5168 | cmd->vdev_id = vdev_id; |
| 5169 | cmd->ie_buf_len = ie_len; |
| 5170 | |
| 5171 | buf_ptr += sizeof(wmi_p2p_go_set_beacon_ie_fixed_param); |
| 5172 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 5173 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5174 | qdf_mem_copy(buf_ptr, p2p_ie, ie_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5175 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5176 | WMI_LOGI("%s: Sending WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5177 | |
| 5178 | ret = wmi_unified_cmd_send(wmi_handle, |
| 5179 | wmi_buf, wmi_buf_len, |
| 5180 | WMI_P2P_GO_SET_BEACON_IE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5181 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5182 | WMI_LOGE("Failed to send bcn tmpl: %d", ret); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5183 | wmi_buf_free(wmi_buf); |
| 5184 | } |
| 5185 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5186 | WMI_LOGI("%s: Successfully sent WMI_P2P_GO_SET_BEACON_IE", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5187 | return ret; |
| 5188 | } |
| 5189 | |
| 5190 | /** |
| 5191 | * send_set_gateway_params_cmd_tlv() - set gateway parameters |
| 5192 | * @wmi_handle: wmi handle |
| 5193 | * @req: gateway parameter update request structure |
| 5194 | * |
| 5195 | * This function reads the incoming @req and fill in the destination |
| 5196 | * WMI structure and sends down the gateway configs down to the firmware |
| 5197 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5198 | * Return: QDF_STATUS |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5199 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5200 | 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] | 5201 | struct gateway_update_req_param *req) |
| 5202 | { |
| 5203 | wmi_roam_subnet_change_config_fixed_param *cmd; |
| 5204 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5205 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5206 | int len = sizeof(*cmd); |
| 5207 | |
| 5208 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5209 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5210 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 5211 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5212 | } |
| 5213 | |
| 5214 | cmd = (wmi_roam_subnet_change_config_fixed_param *) wmi_buf_data(buf); |
| 5215 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5216 | WMITLV_TAG_STRUC_wmi_roam_subnet_change_config_fixed_param, |
| 5217 | WMITLV_GET_STRUCT_TLVLEN( |
| 5218 | wmi_roam_subnet_change_config_fixed_param)); |
| 5219 | |
| 5220 | cmd->vdev_id = req->session_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5221 | qdf_mem_copy(&cmd->inet_gw_ip_v4_addr, req->ipv4_addr, |
| 5222 | QDF_IPV4_ADDR_SIZE); |
| 5223 | qdf_mem_copy(&cmd->inet_gw_ip_v6_addr, req->ipv6_addr, |
| 5224 | QDF_IPV6_ADDR_SIZE); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5225 | WMI_CHAR_ARRAY_TO_MAC_ADDR(req->gw_mac_addr.bytes, |
| 5226 | &cmd->inet_gw_mac_addr); |
| 5227 | cmd->max_retries = req->max_retries; |
| 5228 | cmd->timeout = req->timeout; |
| 5229 | cmd->num_skip_subnet_change_detection_bssid_list = 0; |
| 5230 | cmd->flag = 0; |
| 5231 | if (req->ipv4_addr_type) |
| 5232 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP4_ENABLED(cmd->flag); |
| 5233 | |
| 5234 | if (req->ipv6_addr_type) |
| 5235 | WMI_SET_ROAM_SUBNET_CHANGE_FLAG_IP6_ENABLED(cmd->flag); |
| 5236 | |
| 5237 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5238 | WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5239 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5240 | WMI_LOGE("Failed to send gw config parameter to fw, ret: %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5241 | ret); |
| 5242 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5243 | } |
| 5244 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5245 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5246 | } |
| 5247 | |
| 5248 | /** |
| 5249 | * send_set_rssi_monitoring_cmd_tlv() - set rssi monitoring |
| 5250 | * @wmi_handle: wmi handle |
| 5251 | * @req: rssi monitoring request structure |
| 5252 | * |
| 5253 | * This function reads the incoming @req and fill in the destination |
| 5254 | * WMI structure and send down the rssi monitoring configs down to the firmware |
| 5255 | * |
| 5256 | * Return: 0 on success; error number otherwise |
| 5257 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5258 | 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] | 5259 | struct rssi_monitor_param *req) |
| 5260 | { |
| 5261 | wmi_rssi_breach_monitor_config_fixed_param *cmd; |
| 5262 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5263 | QDF_STATUS ret; |
| 5264 | uint32_t len = sizeof(*cmd); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5265 | |
| 5266 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5267 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5268 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 5269 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5270 | } |
| 5271 | |
| 5272 | cmd = (wmi_rssi_breach_monitor_config_fixed_param *) wmi_buf_data(buf); |
| 5273 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5274 | WMITLV_TAG_STRUC_wmi_rssi_breach_monitor_config_fixed_param, |
| 5275 | WMITLV_GET_STRUCT_TLVLEN( |
| 5276 | wmi_rssi_breach_monitor_config_fixed_param)); |
| 5277 | |
| 5278 | cmd->vdev_id = req->session_id; |
| 5279 | cmd->request_id = req->request_id; |
| 5280 | cmd->lo_rssi_reenable_hysteresis = 0; |
| 5281 | cmd->hi_rssi_reenable_histeresis = 0; |
| 5282 | cmd->min_report_interval = 0; |
| 5283 | cmd->max_num_report = 1; |
| 5284 | if (req->control) { |
| 5285 | /* enable one threshold for each min/max */ |
| 5286 | cmd->enabled_bitmap = 0x09; |
| 5287 | cmd->low_rssi_breach_threshold[0] = req->min_rssi; |
| 5288 | cmd->hi_rssi_breach_threshold[0] = req->max_rssi; |
| 5289 | } else { |
| 5290 | cmd->enabled_bitmap = 0; |
| 5291 | cmd->low_rssi_breach_threshold[0] = 0; |
| 5292 | cmd->hi_rssi_breach_threshold[0] = 0; |
| 5293 | } |
| 5294 | |
| 5295 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5296 | WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5297 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5298 | WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID"); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5299 | wmi_buf_free(buf); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5300 | } |
| 5301 | |
Rajeev Kumar | ca1de3e | 2017-06-14 10:34:00 -0700 | [diff] [blame] | 5302 | WMI_LOGD("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW"); |
| 5303 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5304 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5305 | } |
| 5306 | |
| 5307 | /** |
| 5308 | * send_scan_probe_setoui_cmd_tlv() - set scan probe OUI |
| 5309 | * @wmi_handle: wmi handle |
| 5310 | * @psetoui: OUI parameters |
| 5311 | * |
| 5312 | * set scan probe OUI parameters in firmware |
| 5313 | * |
| 5314 | * Return: CDF status |
| 5315 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5316 | 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] | 5317 | struct scan_mac_oui *psetoui) |
| 5318 | { |
| 5319 | wmi_scan_prob_req_oui_cmd_fixed_param *cmd; |
| 5320 | wmi_buf_t wmi_buf; |
| 5321 | uint32_t len; |
| 5322 | uint8_t *buf_ptr; |
| 5323 | uint32_t *oui_buf; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 5324 | struct probe_req_whitelist_attr *ie_whitelist = &psetoui->ie_whitelist; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5325 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 5326 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 5327 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 5328 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5329 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 5330 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5331 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 5332 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5333 | } |
| 5334 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 5335 | cmd = (wmi_scan_prob_req_oui_cmd_fixed_param *) buf_ptr; |
| 5336 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5337 | WMITLV_TAG_STRUC_wmi_scan_prob_req_oui_cmd_fixed_param, |
| 5338 | WMITLV_GET_STRUCT_TLVLEN |
| 5339 | (wmi_scan_prob_req_oui_cmd_fixed_param)); |
| 5340 | |
| 5341 | oui_buf = &cmd->prob_req_oui; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5342 | qdf_mem_zero(oui_buf, sizeof(cmd->prob_req_oui)); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5343 | *oui_buf = psetoui->oui[0] << 16 | psetoui->oui[1] << 8 |
| 5344 | | psetoui->oui[2]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5345 | WMI_LOGD("%s: wmi:oui received from hdd %08x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5346 | cmd->prob_req_oui); |
| 5347 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 5348 | cmd->vdev_id = psetoui->vdev_id; |
| 5349 | cmd->flags = WMI_SCAN_PROBE_OUI_SPOOFED_MAC_IN_PROBE_REQ; |
| 5350 | if (psetoui->enb_probe_req_sno_randomization) |
| 5351 | cmd->flags |= WMI_SCAN_PROBE_OUI_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 5352 | |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 5353 | if (ie_whitelist->white_list) { |
| 5354 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 5355 | &cmd->num_vendor_oui, |
| 5356 | ie_whitelist); |
| 5357 | cmd->flags |= |
| 5358 | WMI_SCAN_PROBE_OUI_ENABLE_IE_WHITELIST_IN_PROBE_REQ; |
| 5359 | } |
| 5360 | |
| 5361 | buf_ptr += sizeof(*cmd); |
| 5362 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5363 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 5364 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5365 | |
| 5366 | if (cmd->num_vendor_oui != 0) { |
| 5367 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 5368 | ie_whitelist->voui); |
| 5369 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 5370 | } |
| 5371 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5372 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 5373 | WMI_SCAN_PROB_REQ_OUI_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5374 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 5375 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5376 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5377 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5378 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5379 | } |
| 5380 | |
| 5381 | /** |
| 5382 | * send_reset_passpoint_network_list_cmd_tlv() - reset passpoint network list |
| 5383 | * @wmi_handle: wmi handle |
| 5384 | * @req: passpoint network request structure |
| 5385 | * |
| 5386 | * This function sends down WMI command with network id set to wildcard id. |
| 5387 | * firmware shall clear all the config entries |
| 5388 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5389 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5390 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5391 | 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] | 5392 | struct wifi_passpoint_req_param *req) |
| 5393 | { |
| 5394 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 5395 | wmi_buf_t buf; |
| 5396 | uint32_t len; |
| 5397 | int ret; |
| 5398 | |
| 5399 | len = sizeof(*cmd); |
| 5400 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5401 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5402 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5403 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5404 | } |
| 5405 | |
| 5406 | cmd = (wmi_passpoint_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 5407 | |
| 5408 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5409 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 5410 | WMITLV_GET_STRUCT_TLVLEN( |
| 5411 | wmi_passpoint_config_cmd_fixed_param)); |
| 5412 | cmd->id = WMI_PASSPOINT_NETWORK_ID_WILDCARD; |
| 5413 | |
| 5414 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5415 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 5416 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5417 | WMI_LOGE("%s: Failed to send reset passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5418 | __func__); |
| 5419 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5420 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5421 | } |
| 5422 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5423 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5424 | } |
| 5425 | |
| 5426 | /** |
| 5427 | * send_set_passpoint_network_list_cmd_tlv() - set passpoint network list |
| 5428 | * @wmi_handle: wmi handle |
| 5429 | * @req: passpoint network request structure |
| 5430 | * |
| 5431 | * This function reads the incoming @req and fill in the destination |
| 5432 | * WMI structure and send down the passpoint configs down to the firmware |
| 5433 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5434 | * Return: QDF_STATUS enumeration |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5435 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5436 | 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] | 5437 | struct wifi_passpoint_req_param *req) |
| 5438 | { |
| 5439 | wmi_passpoint_config_cmd_fixed_param *cmd; |
| 5440 | u_int8_t i, j, *bytes; |
| 5441 | wmi_buf_t buf; |
| 5442 | uint32_t len; |
| 5443 | int ret; |
| 5444 | |
| 5445 | len = sizeof(*cmd); |
| 5446 | for (i = 0; i < req->num_networks; i++) { |
| 5447 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5448 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5449 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 5450 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5451 | } |
| 5452 | |
| 5453 | cmd = (wmi_passpoint_config_cmd_fixed_param *) |
| 5454 | wmi_buf_data(buf); |
| 5455 | |
| 5456 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 5457 | WMITLV_TAG_STRUC_wmi_passpoint_config_cmd_fixed_param, |
| 5458 | WMITLV_GET_STRUCT_TLVLEN( |
| 5459 | wmi_passpoint_config_cmd_fixed_param)); |
| 5460 | cmd->id = req->networks[i].id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5461 | WMI_LOGD("%s: network id: %u", __func__, cmd->id); |
| 5462 | qdf_mem_copy(cmd->realm, req->networks[i].realm, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5463 | strlen(req->networks[i].realm) + 1); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5464 | WMI_LOGD("%s: realm: %s", __func__, cmd->realm); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5465 | for (j = 0; j < PASSPOINT_ROAMING_CONSORTIUM_ID_NUM; j++) { |
| 5466 | bytes = (uint8_t *) &req->networks[i].roaming_consortium_ids[j]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5467 | 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] | 5468 | j, bytes[0], bytes[1], bytes[2], bytes[3], |
| 5469 | bytes[4], bytes[5], bytes[6], bytes[7]); |
| 5470 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5471 | qdf_mem_copy(&cmd->roaming_consortium_ids[j], |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5472 | &req->networks[i].roaming_consortium_ids[j], |
| 5473 | PASSPOINT_ROAMING_CONSORTIUM_ID_LEN); |
| 5474 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5475 | qdf_mem_copy(cmd->plmn, req->networks[i].plmn, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5476 | PASSPOINT_PLMN_ID_LEN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5477 | WMI_LOGD("%s: plmn: %02x:%02x:%02x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5478 | cmd->plmn[0], cmd->plmn[1], cmd->plmn[2]); |
| 5479 | |
| 5480 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 5481 | WMI_PASSPOINT_LIST_CONFIG_CMDID); |
| 5482 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5483 | WMI_LOGE("%s: Failed to send set passpoint network list wmi cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5484 | __func__); |
| 5485 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5486 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5487 | } |
| 5488 | } |
| 5489 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 5490 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 5491 | } |
| 5492 | |
Sridhar Selvaraj | 411833a | 2017-08-21 16:35:45 +0530 | [diff] [blame] | 5493 | #if defined(WLAN_FEATURE_FILS_SK) && defined(WLAN_FEATURE_ROAM_OFFLOAD) |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 5494 | /** |
| 5495 | * wmi_add_fils_tlv() - Add FILS TLV to roam scan offload command |
| 5496 | * @wmi_handle: wmi handle |
| 5497 | * @roam_req: Roam scan offload params |
| 5498 | * @buf_ptr: command buffer to send |
| 5499 | * @fils_tlv_len: fils tlv length |
| 5500 | * |
| 5501 | * Return: Updated buffer pointer |
| 5502 | */ |
| 5503 | static uint8_t *wmi_add_fils_tlv(wmi_unified_t wmi_handle, |
| 5504 | struct roam_offload_scan_params *roam_req, |
| 5505 | uint8_t *buf_ptr, uint32_t fils_tlv_len) |
| 5506 | { |
| 5507 | wmi_roam_fils_offload_tlv_param *fils_tlv; |
| 5508 | wmi_erp_info *erp_info; |
| 5509 | struct roam_fils_params *roam_fils_params; |
| 5510 | |
| 5511 | if (!roam_req->add_fils_tlv) |
| 5512 | return buf_ptr; |
| 5513 | |
| 5514 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5515 | sizeof(*fils_tlv)); |
| 5516 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5517 | |
| 5518 | fils_tlv = (wmi_roam_fils_offload_tlv_param *)buf_ptr; |
| 5519 | WMITLV_SET_HDR(&fils_tlv->tlv_header, |
| 5520 | WMITLV_TAG_STRUC_wmi_roam_fils_offload_tlv_param, |
| 5521 | WMITLV_GET_STRUCT_TLVLEN |
| 5522 | (wmi_roam_fils_offload_tlv_param)); |
| 5523 | |
| 5524 | roam_fils_params = &roam_req->roam_fils_params; |
| 5525 | erp_info = (wmi_erp_info *)(&fils_tlv->vdev_erp_info); |
| 5526 | |
| 5527 | erp_info->username_length = roam_fils_params->username_length; |
| 5528 | qdf_mem_copy(erp_info->username, roam_fils_params->username, |
| 5529 | erp_info->username_length); |
| 5530 | |
| 5531 | erp_info->next_erp_seq_num = roam_fils_params->next_erp_seq_num; |
| 5532 | |
| 5533 | erp_info->rRk_length = roam_fils_params->rrk_length; |
| 5534 | qdf_mem_copy(erp_info->rRk, roam_fils_params->rrk, |
| 5535 | erp_info->rRk_length); |
| 5536 | |
| 5537 | erp_info->rIk_length = roam_fils_params->rik_length; |
| 5538 | qdf_mem_copy(erp_info->rIk, roam_fils_params->rik, |
| 5539 | erp_info->rIk_length); |
| 5540 | |
| 5541 | erp_info->realm_len = roam_fils_params->realm_len; |
| 5542 | qdf_mem_copy(erp_info->realm, roam_fils_params->realm, |
| 5543 | erp_info->realm_len); |
| 5544 | |
| 5545 | buf_ptr += sizeof(*fils_tlv); |
| 5546 | return buf_ptr; |
| 5547 | } |
| 5548 | #else |
| 5549 | static inline uint8_t *wmi_add_fils_tlv(wmi_unified_t wmi_handle, |
| 5550 | struct roam_offload_scan_params *roam_req, |
| 5551 | uint8_t *buf_ptr, uint32_t fils_tlv_len) |
| 5552 | { |
| 5553 | return buf_ptr; |
| 5554 | } |
| 5555 | #endif |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5556 | /** |
| 5557 | * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw |
| 5558 | * @wmi_handle: wmi handle |
| 5559 | * @scan_cmd_fp: start scan command ptr |
| 5560 | * @roam_req: roam request param |
| 5561 | * |
| 5562 | * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback |
| 5563 | * of WMI_ROAM_SCAN_MODE. |
| 5564 | * |
| 5565 | * Return: QDF status |
| 5566 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5567 | 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] | 5568 | wmi_start_scan_cmd_fixed_param * |
| 5569 | scan_cmd_fp, |
| 5570 | struct roam_offload_scan_params *roam_req) |
| 5571 | { |
| 5572 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5573 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5574 | int len; |
| 5575 | uint8_t *buf_ptr; |
| 5576 | wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5577 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5578 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5579 | int auth_mode = roam_req->auth_mode; |
| 5580 | wmi_roam_offload_tlv_param *roam_offload_params; |
| 5581 | wmi_roam_11i_offload_tlv_param *roam_offload_11i; |
| 5582 | wmi_roam_11r_offload_tlv_param *roam_offload_11r; |
| 5583 | wmi_roam_ese_offload_tlv_param *roam_offload_ese; |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5584 | wmi_tlv_buf_len_param *assoc_ies; |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 5585 | uint32_t fils_tlv_len = 0; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5586 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5587 | /* Need to create a buf with roam_scan command at |
| 5588 | * front and piggyback with scan command */ |
| 5589 | len = sizeof(wmi_roam_scan_mode_fixed_param) + |
| 5590 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5591 | (2 * WMI_TLV_HDR_SIZE) + |
| 5592 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5593 | sizeof(wmi_start_scan_cmd_fixed_param); |
| 5594 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | 1339928 | 2017-09-21 21:10:43 -0700 | [diff] [blame] | 5595 | WMI_LOGD("auth_mode = %d", auth_mode); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5596 | if (roam_req->is_roam_req_valid && |
| 5597 | roam_req->roam_offload_enabled) { |
| 5598 | len += sizeof(wmi_roam_offload_tlv_param); |
| 5599 | len += WMI_TLV_HDR_SIZE; |
| 5600 | if ((auth_mode != WMI_AUTH_NONE) && |
| 5601 | ((auth_mode != WMI_AUTH_OPEN) || |
| 5602 | (auth_mode == WMI_AUTH_OPEN && |
| 5603 | roam_req->mdid.mdie_present) || |
| 5604 | roam_req->is_ese_assoc)) { |
| 5605 | len += WMI_TLV_HDR_SIZE; |
| 5606 | if (roam_req->is_ese_assoc) |
| 5607 | len += |
| 5608 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 5609 | else if (auth_mode == WMI_AUTH_FT_RSNA || |
| 5610 | auth_mode == WMI_AUTH_FT_RSNA_PSK || |
| 5611 | (auth_mode == WMI_AUTH_OPEN && |
| 5612 | roam_req->mdid.mdie_present)) |
| 5613 | len += |
| 5614 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 5615 | else |
| 5616 | len += |
| 5617 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 5618 | } else { |
| 5619 | len += WMI_TLV_HDR_SIZE; |
| 5620 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5621 | |
| 5622 | len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE) |
| 5623 | + roundup(roam_req->assoc_ie_length, |
| 5624 | sizeof(uint32_t))); |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 5625 | |
| 5626 | if (roam_req->add_fils_tlv) { |
| 5627 | fils_tlv_len = sizeof( |
| 5628 | wmi_roam_fils_offload_tlv_param); |
| 5629 | len += WMI_TLV_HDR_SIZE + fils_tlv_len; |
| 5630 | } |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5631 | } else { |
| 5632 | if (roam_req->is_roam_req_valid) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5633 | WMI_LOGD("%s : roam offload = %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5634 | __func__, roam_req->roam_offload_enabled); |
| 5635 | else |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5636 | WMI_LOGD("%s : roam_req is NULL", __func__); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5637 | len += (4 * WMI_TLV_HDR_SIZE); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5638 | } |
| 5639 | if (roam_req->is_roam_req_valid && |
| 5640 | roam_req->roam_offload_enabled) { |
| 5641 | roam_req->mode = roam_req->mode | |
| 5642 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; |
| 5643 | } |
| 5644 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5645 | |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5646 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 5647 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 5648 | len = sizeof(wmi_roam_scan_mode_fixed_param); |
| 5649 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5650 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5651 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5652 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5653 | return QDF_STATUS_E_NOMEM; |
| 5654 | } |
| 5655 | |
| 5656 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5657 | roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr; |
| 5658 | WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, |
| 5659 | WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, |
| 5660 | WMITLV_GET_STRUCT_TLVLEN |
| 5661 | (wmi_roam_scan_mode_fixed_param)); |
| 5662 | |
| 5663 | roam_scan_mode_fp->roam_scan_mode = roam_req->mode; |
| 5664 | roam_scan_mode_fp->vdev_id = roam_req->vdev_id; |
Sreelakshmi Konamki | 400a40d | 2017-02-24 14:28:34 +0530 | [diff] [blame] | 5665 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE | |
| 5666 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) { |
| 5667 | roam_scan_mode_fp->flags |= |
| 5668 | WMI_ROAM_SCAN_MODE_FLAG_REPORT_STATUS; |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5669 | goto send_roam_scan_mode_cmd; |
Sreelakshmi Konamki | 400a40d | 2017-02-24 14:28:34 +0530 | [diff] [blame] | 5670 | } |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5671 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5672 | /* Fill in scan parameters suitable for roaming scan */ |
| 5673 | buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param); |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5674 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5675 | qdf_mem_copy(buf_ptr, scan_cmd_fp, |
| 5676 | sizeof(wmi_start_scan_cmd_fixed_param)); |
| 5677 | /* Ensure there is no additional IEs */ |
| 5678 | scan_cmd_fp->ie_len = 0; |
| 5679 | WMITLV_SET_HDR(buf_ptr, |
| 5680 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 5681 | WMITLV_GET_STRUCT_TLVLEN |
| 5682 | (wmi_start_scan_cmd_fixed_param)); |
| 5683 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5684 | buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); |
| 5685 | if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { |
| 5686 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5687 | sizeof(wmi_roam_offload_tlv_param)); |
| 5688 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5689 | roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr; |
| 5690 | WMITLV_SET_HDR(buf_ptr, |
| 5691 | WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param, |
| 5692 | WMITLV_GET_STRUCT_TLVLEN |
| 5693 | (wmi_roam_offload_tlv_param)); |
| 5694 | roam_offload_params->prefer_5g = roam_req->prefer_5ghz; |
| 5695 | roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap; |
| 5696 | roam_offload_params->select_5g_margin = |
| 5697 | roam_req->select_5ghz_margin; |
| 5698 | roam_offload_params->reassoc_failure_timeout = |
| 5699 | roam_req->reassoc_failure_timeout; |
| 5700 | |
| 5701 | /* Fill the capabilities */ |
| 5702 | roam_offload_params->capability = |
| 5703 | roam_req->roam_offload_params.capability; |
| 5704 | roam_offload_params->ht_caps_info = |
| 5705 | roam_req->roam_offload_params.ht_caps_info; |
| 5706 | roam_offload_params->ampdu_param = |
| 5707 | roam_req->roam_offload_params.ampdu_param; |
| 5708 | roam_offload_params->ht_ext_cap = |
| 5709 | roam_req->roam_offload_params.ht_ext_cap; |
| 5710 | roam_offload_params->ht_txbf = |
| 5711 | roam_req->roam_offload_params.ht_txbf; |
| 5712 | roam_offload_params->asel_cap = |
| 5713 | roam_req->roam_offload_params.asel_cap; |
| 5714 | roam_offload_params->qos_caps = |
| 5715 | roam_req->roam_offload_params.qos_caps; |
Naveen Rawat | 1dcabaf | 2016-11-18 17:27:29 -0800 | [diff] [blame] | 5716 | roam_offload_params->qos_enabled = |
| 5717 | roam_req->roam_offload_params.qos_enabled; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5718 | roam_offload_params->wmm_caps = |
| 5719 | roam_req->roam_offload_params.wmm_caps; |
| 5720 | qdf_mem_copy((uint8_t *)roam_offload_params->mcsset, |
| 5721 | (uint8_t *)roam_req->roam_offload_params.mcsset, |
| 5722 | ROAM_OFFLOAD_NUM_MCS_SET); |
| 5723 | |
| 5724 | buf_ptr += sizeof(wmi_roam_offload_tlv_param); |
| 5725 | /* The TLV's are in the order of 11i, 11R, ESE. Hence, |
| 5726 | * they are filled in the same order.Depending on the |
| 5727 | * authentication type, the other mode TLV's are nullified |
| 5728 | * and only headers are filled.*/ |
| 5729 | if ((auth_mode != WMI_AUTH_NONE) && |
| 5730 | ((auth_mode != WMI_AUTH_OPEN) || |
| 5731 | (auth_mode == WMI_AUTH_OPEN |
| 5732 | && roam_req->mdid.mdie_present) || |
| 5733 | roam_req->is_ese_assoc)) { |
| 5734 | if (roam_req->is_ese_assoc) { |
| 5735 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5736 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5737 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5738 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5739 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5740 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5741 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5742 | sizeof(wmi_roam_ese_offload_tlv_param)); |
| 5743 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5744 | roam_offload_ese = |
| 5745 | (wmi_roam_ese_offload_tlv_param *) buf_ptr; |
| 5746 | qdf_mem_copy(roam_offload_ese->krk, |
| 5747 | roam_req->krk, |
| 5748 | sizeof(roam_req->krk)); |
| 5749 | qdf_mem_copy(roam_offload_ese->btk, |
| 5750 | roam_req->btk, |
| 5751 | sizeof(roam_req->btk)); |
| 5752 | WMITLV_SET_HDR(&roam_offload_ese->tlv_header, |
| 5753 | WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param, |
| 5754 | WMITLV_GET_STRUCT_TLVLEN |
| 5755 | (wmi_roam_ese_offload_tlv_param)); |
| 5756 | buf_ptr += |
| 5757 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 5758 | } else if (auth_mode == WMI_AUTH_FT_RSNA |
| 5759 | || auth_mode == WMI_AUTH_FT_RSNA_PSK |
| 5760 | || (auth_mode == WMI_AUTH_OPEN |
| 5761 | && roam_req->mdid.mdie_present)) { |
| 5762 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5763 | 0); |
| 5764 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5765 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5766 | sizeof(wmi_roam_11r_offload_tlv_param)); |
| 5767 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5768 | roam_offload_11r = |
| 5769 | (wmi_roam_11r_offload_tlv_param *) buf_ptr; |
| 5770 | roam_offload_11r->r0kh_id_len = |
| 5771 | roam_req->rokh_id_length; |
| 5772 | qdf_mem_copy(roam_offload_11r->r0kh_id, |
| 5773 | roam_req->rokh_id, |
| 5774 | roam_offload_11r->r0kh_id_len); |
| 5775 | qdf_mem_copy(roam_offload_11r->psk_msk, |
| 5776 | roam_req->psk_pmk, |
| 5777 | sizeof(roam_req->psk_pmk)); |
| 5778 | roam_offload_11r->psk_msk_len = |
| 5779 | roam_req->pmk_len; |
| 5780 | roam_offload_11r->mdie_present = |
| 5781 | roam_req->mdid.mdie_present; |
| 5782 | roam_offload_11r->mdid = |
| 5783 | roam_req->mdid.mobility_domain; |
| 5784 | if (auth_mode == WMI_AUTH_OPEN) { |
| 5785 | /* If FT-Open ensure pmk length |
| 5786 | and r0khid len are zero */ |
| 5787 | roam_offload_11r->r0kh_id_len = 0; |
| 5788 | roam_offload_11r->psk_msk_len = 0; |
| 5789 | } |
| 5790 | WMITLV_SET_HDR(&roam_offload_11r->tlv_header, |
| 5791 | WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param, |
| 5792 | WMITLV_GET_STRUCT_TLVLEN |
| 5793 | (wmi_roam_11r_offload_tlv_param)); |
| 5794 | buf_ptr += |
| 5795 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 5796 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5797 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5798 | buf_ptr += WMI_TLV_HDR_SIZE; |
Varun Reddy Yeturu | 1339928 | 2017-09-21 21:10:43 -0700 | [diff] [blame] | 5799 | WMI_LOGD("psk_msk_len = %d", |
| 5800 | roam_offload_11r->psk_msk_len); |
| 5801 | if (roam_offload_11r->psk_msk_len) |
| 5802 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, |
| 5803 | QDF_TRACE_LEVEL_DEBUG, |
| 5804 | roam_offload_11r->psk_msk, |
| 5805 | roam_offload_11r->psk_msk_len); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5806 | } else { |
| 5807 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5808 | sizeof(wmi_roam_11i_offload_tlv_param)); |
| 5809 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5810 | roam_offload_11i = |
| 5811 | (wmi_roam_11i_offload_tlv_param *) buf_ptr; |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 5812 | |
Deepak Dhamdhere | 70504a1 | 2016-08-22 18:04:00 -0700 | [diff] [blame] | 5813 | if (roam_req->roam_key_mgmt_offload_enabled && |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 5814 | roam_req->fw_okc) { |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5815 | WMI_SET_ROAM_OFFLOAD_OKC_ENABLED |
| 5816 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 5817 | WMI_LOGI("LFR3:OKC enabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5818 | } else { |
| 5819 | WMI_SET_ROAM_OFFLOAD_OKC_DISABLED |
| 5820 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 5821 | WMI_LOGI("LFR3:OKC disabled"); |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 5822 | } |
| 5823 | if (roam_req->roam_key_mgmt_offload_enabled && |
| 5824 | roam_req->fw_pmksa_cache) { |
| 5825 | WMI_SET_ROAM_OFFLOAD_PMK_CACHE_ENABLED |
| 5826 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 5827 | WMI_LOGI("LFR3:PMKSA caching enabled"); |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 5828 | } else { |
| 5829 | WMI_SET_ROAM_OFFLOAD_PMK_CACHE_DISABLED |
| 5830 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 5831 | WMI_LOGI("LFR3:PMKSA caching disabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5832 | } |
| 5833 | |
| 5834 | qdf_mem_copy(roam_offload_11i->pmk, |
| 5835 | roam_req->psk_pmk, |
| 5836 | sizeof(roam_req->psk_pmk)); |
| 5837 | roam_offload_11i->pmk_len = roam_req->pmk_len; |
| 5838 | WMITLV_SET_HDR(&roam_offload_11i->tlv_header, |
| 5839 | WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param, |
| 5840 | WMITLV_GET_STRUCT_TLVLEN |
| 5841 | (wmi_roam_11i_offload_tlv_param)); |
| 5842 | buf_ptr += |
| 5843 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 5844 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5845 | 0); |
| 5846 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5847 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5848 | 0); |
| 5849 | buf_ptr += WMI_TLV_HDR_SIZE; |
Varun Reddy Yeturu | 1339928 | 2017-09-21 21:10:43 -0700 | [diff] [blame] | 5850 | WMI_LOGD("pmk_len = %d", |
| 5851 | roam_offload_11i->pmk_len); |
| 5852 | if (roam_offload_11i->pmk_len) |
| 5853 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, |
| 5854 | QDF_TRACE_LEVEL_DEBUG, |
| 5855 | roam_offload_11i->pmk, |
| 5856 | roam_offload_11i->pmk_len); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5857 | } |
| 5858 | } else { |
| 5859 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5860 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5861 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5862 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5863 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5864 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5865 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5866 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5867 | buf_ptr += WMI_TLV_HDR_SIZE; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5868 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5869 | |
| 5870 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5871 | sizeof(*assoc_ies)); |
| 5872 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5873 | |
| 5874 | assoc_ies = (wmi_tlv_buf_len_param *) buf_ptr; |
| 5875 | WMITLV_SET_HDR(&assoc_ies->tlv_header, |
| 5876 | WMITLV_TAG_STRUC_wmi_tlv_buf_len_param, |
| 5877 | WMITLV_GET_STRUCT_TLVLEN(wmi_tlv_buf_len_param)); |
| 5878 | assoc_ies->buf_len = roam_req->assoc_ie_length; |
| 5879 | |
| 5880 | buf_ptr += sizeof(*assoc_ies); |
| 5881 | |
| 5882 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5883 | roundup(assoc_ies->buf_len, sizeof(uint32_t))); |
| 5884 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5885 | |
| 5886 | if (assoc_ies->buf_len != 0) { |
| 5887 | qdf_mem_copy(buf_ptr, roam_req->assoc_ie, |
| 5888 | assoc_ies->buf_len); |
| 5889 | } |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 5890 | buf_ptr += qdf_roundup(assoc_ies->buf_len, sizeof(uint32_t)); |
| 5891 | buf_ptr = wmi_add_fils_tlv(wmi_handle, roam_req, |
| 5892 | buf_ptr, fils_tlv_len); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5893 | } else { |
| 5894 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5895 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5896 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5897 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5898 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5899 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5900 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5901 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5902 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5903 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5904 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5905 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5906 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5907 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5908 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5909 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5910 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5911 | } |
| 5912 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5913 | |
| 5914 | send_roam_scan_mode_cmd: |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5915 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5916 | len, WMI_ROAM_SCAN_MODE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5917 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5918 | WMI_LOGE( |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5919 | "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", |
| 5920 | status); |
| 5921 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5922 | } |
| 5923 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5924 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5925 | } |
| 5926 | |
Varun Reddy Yeturu | 412601c | 2017-07-20 09:45:01 -0700 | [diff] [blame] | 5927 | static QDF_STATUS send_roam_mawc_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 5928 | struct wmi_mawc_roam_params *params) |
| 5929 | { |
| 5930 | wmi_buf_t buf = NULL; |
| 5931 | QDF_STATUS status; |
| 5932 | int len; |
| 5933 | uint8_t *buf_ptr; |
| 5934 | wmi_roam_configure_mawc_cmd_fixed_param *wmi_roam_mawc_params; |
| 5935 | |
| 5936 | len = sizeof(*wmi_roam_mawc_params); |
| 5937 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5938 | if (!buf) { |
| 5939 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 5940 | return QDF_STATUS_E_NOMEM; |
| 5941 | } |
| 5942 | |
| 5943 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5944 | wmi_roam_mawc_params = |
| 5945 | (wmi_roam_configure_mawc_cmd_fixed_param *) buf_ptr; |
| 5946 | WMITLV_SET_HDR(&wmi_roam_mawc_params->tlv_header, |
| 5947 | WMITLV_TAG_STRUC_wmi_roam_configure_mawc_cmd_fixed_param, |
| 5948 | WMITLV_GET_STRUCT_TLVLEN |
| 5949 | (wmi_roam_configure_mawc_cmd_fixed_param)); |
| 5950 | wmi_roam_mawc_params->vdev_id = params->vdev_id; |
| 5951 | if (params->enable) |
| 5952 | wmi_roam_mawc_params->enable = 1; |
| 5953 | else |
| 5954 | wmi_roam_mawc_params->enable = 0; |
| 5955 | wmi_roam_mawc_params->traffic_load_threshold = |
| 5956 | params->traffic_load_threshold; |
| 5957 | wmi_roam_mawc_params->best_ap_rssi_threshold = |
| 5958 | params->best_ap_rssi_threshold; |
| 5959 | wmi_roam_mawc_params->rssi_stationary_high_adjust = |
| 5960 | params->rssi_stationary_high_adjust; |
| 5961 | wmi_roam_mawc_params->rssi_stationary_low_adjust = |
| 5962 | params->rssi_stationary_low_adjust; |
Varun Reddy Yeturu | 7a8c337 | 2017-08-21 10:28:13 -0700 | [diff] [blame] | 5963 | WMI_LOGD(FL("MAWC roam en=%d, vdev=%d, tr=%d, ap=%d, high=%d, low=%d"), |
| 5964 | wmi_roam_mawc_params->enable, wmi_roam_mawc_params->vdev_id, |
| 5965 | wmi_roam_mawc_params->traffic_load_threshold, |
| 5966 | wmi_roam_mawc_params->best_ap_rssi_threshold, |
| 5967 | wmi_roam_mawc_params->rssi_stationary_high_adjust, |
| 5968 | wmi_roam_mawc_params->rssi_stationary_low_adjust); |
Varun Reddy Yeturu | 412601c | 2017-07-20 09:45:01 -0700 | [diff] [blame] | 5969 | |
| 5970 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5971 | len, WMI_ROAM_CONFIGURE_MAWC_CMDID); |
| 5972 | if (QDF_IS_STATUS_ERROR(status)) { |
| 5973 | WMI_LOGE("WMI_ROAM_CONFIGURE_MAWC_CMDID failed, Error %d", |
| 5974 | status); |
| 5975 | wmi_buf_free(buf); |
| 5976 | return status; |
| 5977 | } |
Varun Reddy Yeturu | 412601c | 2017-07-20 09:45:01 -0700 | [diff] [blame] | 5978 | |
| 5979 | return QDF_STATUS_SUCCESS; |
| 5980 | } |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5981 | |
| 5982 | /** |
| 5983 | * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload |
| 5984 | * rssi threashold |
| 5985 | * @wmi_handle: wmi handle |
| 5986 | * @roam_req: Roaming request buffer |
| 5987 | * |
| 5988 | * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware |
| 5989 | * |
| 5990 | * Return: QDF status |
| 5991 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5992 | 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] | 5993 | struct roam_offload_scan_rssi_params *roam_req) |
| 5994 | { |
| 5995 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5996 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5997 | int len; |
| 5998 | uint8_t *buf_ptr; |
| 5999 | wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; |
| 6000 | wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; |
| 6001 | wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL; |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 6002 | wmi_roam_dense_thres_param *dense_thresholds = NULL; |
Varun Reddy Yeturu | 7f4cff8 | 2017-07-26 10:59:39 -0700 | [diff] [blame] | 6003 | wmi_roam_bg_scan_roaming_param *bg_scan_params = NULL; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6004 | |
| 6005 | len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 6006 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 6007 | len += sizeof(wmi_roam_scan_extended_threshold_param); |
| 6008 | len += WMI_TLV_HDR_SIZE; |
| 6009 | len += sizeof(wmi_roam_earlystop_rssi_thres_param); |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 6010 | len += WMI_TLV_HDR_SIZE; /* TLV for dense thresholds*/ |
| 6011 | len += sizeof(wmi_roam_dense_thres_param); |
Varun Reddy Yeturu | 7f4cff8 | 2017-07-26 10:59:39 -0700 | [diff] [blame] | 6012 | len += WMI_TLV_HDR_SIZE; /* TLV for BG Scan*/ |
| 6013 | len += sizeof(wmi_roam_bg_scan_roaming_param); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6014 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6015 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6016 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6017 | return QDF_STATUS_E_NOMEM; |
| 6018 | } |
| 6019 | |
| 6020 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6021 | rssi_threshold_fp = |
| 6022 | (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr; |
| 6023 | WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header, |
| 6024 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param, |
| 6025 | WMITLV_GET_STRUCT_TLVLEN |
| 6026 | (wmi_roam_scan_rssi_threshold_fixed_param)); |
| 6027 | /* fill in threshold values */ |
| 6028 | rssi_threshold_fp->vdev_id = roam_req->session_id; |
| 6029 | rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh; |
| 6030 | rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff; |
| 6031 | rssi_threshold_fp->hirssi_scan_max_count = |
| 6032 | roam_req->hi_rssi_scan_max_count; |
| 6033 | rssi_threshold_fp->hirssi_scan_delta = |
| 6034 | roam_req->hi_rssi_scan_rssi_delta; |
| 6035 | rssi_threshold_fp->hirssi_upper_bound = roam_req->hi_rssi_scan_rssi_ub; |
Varun Reddy Yeturu | 6ef9a65 | 2017-06-26 13:53:17 -0700 | [diff] [blame] | 6036 | rssi_threshold_fp->rssi_thresh_offset_5g = |
| 6037 | roam_req->rssi_thresh_offset_5g; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6038 | |
| 6039 | buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 6040 | WMITLV_SET_HDR(buf_ptr, |
| 6041 | WMITLV_TAG_ARRAY_STRUC, |
| 6042 | sizeof(wmi_roam_scan_extended_threshold_param)); |
| 6043 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6044 | ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; |
| 6045 | |
| 6046 | ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g; |
| 6047 | if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT) |
| 6048 | ext_thresholds->boost_threshold_5g = |
| 6049 | roam_req->boost_threshold_5g; |
| 6050 | |
| 6051 | ext_thresholds->boost_algorithm_5g = |
| 6052 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 6053 | ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g; |
| 6054 | ext_thresholds->penalty_algorithm_5g = |
| 6055 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 6056 | ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g; |
| 6057 | ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g; |
| 6058 | ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g; |
| 6059 | ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold; |
| 6060 | |
| 6061 | WMITLV_SET_HDR(&ext_thresholds->tlv_header, |
| 6062 | WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, |
| 6063 | WMITLV_GET_STRUCT_TLVLEN |
| 6064 | (wmi_roam_scan_extended_threshold_param)); |
| 6065 | buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param); |
| 6066 | WMITLV_SET_HDR(buf_ptr, |
| 6067 | WMITLV_TAG_ARRAY_STRUC, |
| 6068 | sizeof(wmi_roam_earlystop_rssi_thres_param)); |
| 6069 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6070 | early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr; |
| 6071 | early_stop_thresholds->roam_earlystop_thres_min = |
| 6072 | roam_req->roam_earlystop_thres_min; |
| 6073 | early_stop_thresholds->roam_earlystop_thres_max = |
| 6074 | roam_req->roam_earlystop_thres_max; |
| 6075 | WMITLV_SET_HDR(&early_stop_thresholds->tlv_header, |
| 6076 | WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param, |
| 6077 | WMITLV_GET_STRUCT_TLVLEN |
| 6078 | (wmi_roam_earlystop_rssi_thres_param)); |
| 6079 | |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 6080 | buf_ptr += sizeof(wmi_roam_earlystop_rssi_thres_param); |
| 6081 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6082 | sizeof(wmi_roam_dense_thres_param)); |
| 6083 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6084 | dense_thresholds = (wmi_roam_dense_thres_param *) buf_ptr; |
| 6085 | dense_thresholds->roam_dense_rssi_thres_offset = |
| 6086 | roam_req->dense_rssi_thresh_offset; |
| 6087 | dense_thresholds->roam_dense_min_aps = roam_req->dense_min_aps_cnt; |
| 6088 | dense_thresholds->roam_dense_traffic_thres = |
| 6089 | roam_req->traffic_threshold; |
| 6090 | dense_thresholds->roam_dense_status = roam_req->initial_dense_status; |
| 6091 | WMITLV_SET_HDR(&dense_thresholds->tlv_header, |
| 6092 | WMITLV_TAG_STRUC_wmi_roam_dense_thres_param, |
| 6093 | WMITLV_GET_STRUCT_TLVLEN |
| 6094 | (wmi_roam_dense_thres_param)); |
| 6095 | |
Varun Reddy Yeturu | 7f4cff8 | 2017-07-26 10:59:39 -0700 | [diff] [blame] | 6096 | buf_ptr += sizeof(wmi_roam_dense_thres_param); |
| 6097 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6098 | sizeof(wmi_roam_bg_scan_roaming_param)); |
| 6099 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6100 | bg_scan_params = (wmi_roam_bg_scan_roaming_param *) buf_ptr; |
| 6101 | bg_scan_params->roam_bg_scan_bad_rssi_thresh = |
| 6102 | roam_req->bg_scan_bad_rssi_thresh; |
| 6103 | bg_scan_params->roam_bg_scan_client_bitmap = |
| 6104 | roam_req->bg_scan_client_bitmap; |
Vignesh Viswanathan | 5f1ccf6 | 2017-09-07 18:58:08 +0530 | [diff] [blame] | 6105 | bg_scan_params->bad_rssi_thresh_offset_2g = |
| 6106 | roam_req->roam_bad_rssi_thresh_offset_2g; |
| 6107 | bg_scan_params->flags = roam_req->flags; |
Varun Reddy Yeturu | 7f4cff8 | 2017-07-26 10:59:39 -0700 | [diff] [blame] | 6108 | WMITLV_SET_HDR(&bg_scan_params->tlv_header, |
| 6109 | WMITLV_TAG_STRUC_wmi_roam_bg_scan_roaming_param, |
| 6110 | WMITLV_GET_STRUCT_TLVLEN |
| 6111 | (wmi_roam_bg_scan_roaming_param)); |
| 6112 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6113 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6114 | len, WMI_ROAM_SCAN_RSSI_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6115 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6116 | WMI_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6117 | status); |
| 6118 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6119 | } |
| 6120 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6121 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6122 | } |
| 6123 | |
| 6124 | /** |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6125 | * send_adapt_dwelltime_params_cmd_tlv() - send wmi cmd of adaptive dwelltime |
| 6126 | * configuration params |
| 6127 | * @wma_handle: wma handler |
| 6128 | * @dwelltime_params: pointer to dwelltime_params |
| 6129 | * |
| 6130 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 6131 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 6132 | static |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6133 | QDF_STATUS send_adapt_dwelltime_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 6134 | struct wmi_adaptive_dwelltime_params *dwelltime_params) |
| 6135 | { |
| 6136 | wmi_scan_adaptive_dwell_config_fixed_param *dwell_param; |
| 6137 | wmi_scan_adaptive_dwell_parameters_tlv *cmd; |
| 6138 | wmi_buf_t buf; |
| 6139 | uint8_t *buf_ptr; |
| 6140 | int32_t err; |
| 6141 | int len; |
| 6142 | |
| 6143 | len = sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 6144 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 6145 | len += sizeof(wmi_scan_adaptive_dwell_parameters_tlv); |
| 6146 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6147 | if (!buf) { |
| 6148 | WMI_LOGE("%s :Failed to allocate buffer to send cmd", |
| 6149 | __func__); |
| 6150 | return QDF_STATUS_E_NOMEM; |
| 6151 | } |
| 6152 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6153 | dwell_param = (wmi_scan_adaptive_dwell_config_fixed_param *) buf_ptr; |
| 6154 | WMITLV_SET_HDR(&dwell_param->tlv_header, |
| 6155 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_config_fixed_param, |
| 6156 | WMITLV_GET_STRUCT_TLVLEN |
| 6157 | (wmi_scan_adaptive_dwell_config_fixed_param)); |
| 6158 | |
| 6159 | dwell_param->enable = dwelltime_params->is_enabled; |
| 6160 | buf_ptr += sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 6161 | WMITLV_SET_HDR(buf_ptr, |
| 6162 | WMITLV_TAG_ARRAY_STRUC, |
| 6163 | sizeof(wmi_scan_adaptive_dwell_parameters_tlv)); |
| 6164 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6165 | |
| 6166 | cmd = (wmi_scan_adaptive_dwell_parameters_tlv *) buf_ptr; |
| 6167 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6168 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_parameters_tlv, |
| 6169 | WMITLV_GET_STRUCT_TLVLEN( |
| 6170 | wmi_scan_adaptive_dwell_parameters_tlv)); |
| 6171 | |
| 6172 | cmd->default_adaptive_dwell_mode = dwelltime_params->dwelltime_mode; |
| 6173 | cmd->adapative_lpf_weight = dwelltime_params->lpf_weight; |
| 6174 | cmd->passive_monitor_interval_ms = dwelltime_params->passive_mon_intval; |
| 6175 | cmd->wifi_activity_threshold_pct = dwelltime_params->wifi_act_threshold; |
| 6176 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 6177 | len, WMI_SCAN_ADAPTIVE_DWELL_CONFIG_CMDID); |
| 6178 | if (err) { |
| 6179 | WMI_LOGE("Failed to send adapt dwelltime cmd err=%d", err); |
| 6180 | wmi_buf_free(buf); |
| 6181 | return QDF_STATUS_E_FAILURE; |
| 6182 | } |
| 6183 | |
| 6184 | return QDF_STATUS_SUCCESS; |
| 6185 | } |
| 6186 | |
Nitesh Shah | 52323d0 | 2017-05-22 15:49:00 +0530 | [diff] [blame] | 6187 | /** |
| 6188 | * send_dbs_scan_sel_params_cmd_tlv() - send wmi cmd of DBS scan selection |
| 6189 | * configuration params |
| 6190 | * @wmi_handle: wmi handler |
| 6191 | * @dbs_scan_params: pointer to wmi_dbs_scan_sel_params |
| 6192 | * |
| 6193 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 6194 | */ |
| 6195 | static QDF_STATUS send_dbs_scan_sel_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 6196 | struct wmi_dbs_scan_sel_params *dbs_scan_params) |
| 6197 | { |
| 6198 | wmi_scan_dbs_duty_cycle_fixed_param *dbs_scan_param; |
| 6199 | wmi_scan_dbs_duty_cycle_tlv_param *cmd; |
| 6200 | wmi_buf_t buf; |
| 6201 | uint8_t *buf_ptr; |
| 6202 | QDF_STATUS err; |
| 6203 | uint32_t i; |
| 6204 | int len; |
| 6205 | |
| 6206 | len = sizeof(*dbs_scan_param); |
| 6207 | len += WMI_TLV_HDR_SIZE; |
| 6208 | len += dbs_scan_params->num_clients * sizeof(*cmd); |
| 6209 | |
| 6210 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6211 | if (!buf) { |
| 6212 | WMI_LOGE("%s:Failed to allocate buffer to send cmd", __func__); |
| 6213 | return QDF_STATUS_E_NOMEM; |
| 6214 | } |
| 6215 | |
| 6216 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6217 | dbs_scan_param = (wmi_scan_dbs_duty_cycle_fixed_param *) buf_ptr; |
| 6218 | WMITLV_SET_HDR(&dbs_scan_param->tlv_header, |
| 6219 | WMITLV_TAG_STRUC_wmi_scan_dbs_duty_cycle_fixed_param, |
| 6220 | WMITLV_GET_STRUCT_TLVLEN |
| 6221 | (wmi_scan_dbs_duty_cycle_fixed_param)); |
| 6222 | |
| 6223 | dbs_scan_param->num_clients = dbs_scan_params->num_clients; |
| 6224 | dbs_scan_param->pdev_id = dbs_scan_params->pdev_id; |
| 6225 | buf_ptr += sizeof(*dbs_scan_param); |
| 6226 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6227 | (sizeof(*cmd) * dbs_scan_params->num_clients)); |
| 6228 | buf_ptr = buf_ptr + (uint8_t) WMI_TLV_HDR_SIZE; |
| 6229 | |
| 6230 | for (i = 0; i < dbs_scan_params->num_clients; i++) { |
| 6231 | cmd = (wmi_scan_dbs_duty_cycle_tlv_param *) buf_ptr; |
| 6232 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6233 | WMITLV_TAG_STRUC_wmi_scan_dbs_duty_cycle_param_tlv, |
| 6234 | WMITLV_GET_STRUCT_TLVLEN( |
| 6235 | wmi_scan_dbs_duty_cycle_tlv_param)); |
| 6236 | cmd->module_id = dbs_scan_params->module_id[i]; |
| 6237 | cmd->num_dbs_scans = dbs_scan_params->num_dbs_scans[i]; |
| 6238 | cmd->num_non_dbs_scans = dbs_scan_params->num_non_dbs_scans[i]; |
| 6239 | buf_ptr = buf_ptr + (uint8_t) sizeof(*cmd); |
| 6240 | } |
| 6241 | |
| 6242 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 6243 | len, WMI_SET_SCAN_DBS_DUTY_CYCLE_CMDID); |
| 6244 | if (QDF_IS_STATUS_ERROR(err)) { |
| 6245 | WMI_LOGE("Failed to send dbs scan selection cmd err=%d", err); |
| 6246 | wmi_buf_free(buf); |
| 6247 | return QDF_STATUS_E_FAILURE; |
| 6248 | } |
| 6249 | |
| 6250 | return QDF_STATUS_SUCCESS; |
| 6251 | } |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6252 | |
| 6253 | /** |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6254 | * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming |
| 6255 | * @wmi_handle: wmi handle |
| 6256 | * @roam_req: Request which contains the filters |
| 6257 | * |
| 6258 | * There are filters such as whitelist, blacklist and preferred |
| 6259 | * list that need to be applied to the scan results to form the |
| 6260 | * probable candidates for roaming. |
| 6261 | * |
| 6262 | * Return: Return success upon succesfully passing the |
| 6263 | * parameters to the firmware, otherwise failure. |
| 6264 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6265 | 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] | 6266 | struct roam_scan_filter_params *roam_req) |
| 6267 | { |
| 6268 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6269 | QDF_STATUS status; |
| 6270 | uint32_t i; |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6271 | uint32_t len, blist_len = 0; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6272 | uint8_t *buf_ptr; |
| 6273 | wmi_roam_filter_fixed_param *roam_filter; |
| 6274 | uint8_t *bssid_src_ptr = NULL; |
| 6275 | wmi_mac_addr *bssid_dst_ptr = NULL; |
| 6276 | wmi_ssid *ssid_ptr = NULL; |
| 6277 | uint32_t *bssid_preferred_factor_ptr = NULL; |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6278 | wmi_roam_lca_disallow_config_tlv_param *blist_param; |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6279 | wmi_roam_rssi_rejection_oce_config_param *rssi_rej; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6280 | |
| 6281 | len = sizeof(wmi_roam_filter_fixed_param); |
Abhishek Singh | 54aa620 | 2017-07-06 11:25:15 +0530 | [diff] [blame] | 6282 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6283 | len += WMI_TLV_HDR_SIZE; |
Abhishek Singh | 54aa620 | 2017-07-06 11:25:15 +0530 | [diff] [blame] | 6284 | if (roam_req->num_bssid_black_list) |
| 6285 | len += roam_req->num_bssid_black_list * sizeof(wmi_mac_addr); |
| 6286 | len += WMI_TLV_HDR_SIZE; |
| 6287 | if (roam_req->num_ssid_white_list) |
| 6288 | len += roam_req->num_ssid_white_list * sizeof(wmi_ssid); |
| 6289 | len += 2 * WMI_TLV_HDR_SIZE; |
| 6290 | if (roam_req->num_bssid_preferred_list) { |
| 6291 | len += roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr); |
| 6292 | len += roam_req->num_bssid_preferred_list * sizeof(A_UINT32); |
| 6293 | } |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6294 | len += WMI_TLV_HDR_SIZE; |
| 6295 | if (roam_req->lca_disallow_config_present) { |
| 6296 | len += sizeof(*blist_param); |
| 6297 | blist_len = sizeof(*blist_param); |
| 6298 | } |
| 6299 | |
| 6300 | len += WMI_TLV_HDR_SIZE; |
| 6301 | if (roam_req->num_rssi_rejection_ap) |
| 6302 | len += roam_req->num_rssi_rejection_ap * sizeof(*rssi_rej); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6303 | |
| 6304 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6305 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6306 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6307 | return QDF_STATUS_E_NOMEM; |
| 6308 | } |
| 6309 | |
| 6310 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 6311 | roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; |
| 6312 | WMITLV_SET_HDR(&roam_filter->tlv_header, |
| 6313 | WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, |
| 6314 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); |
| 6315 | /* fill in fixed values */ |
| 6316 | roam_filter->vdev_id = roam_req->session_id; |
| 6317 | roam_filter->flags = 0; |
| 6318 | roam_filter->op_bitmap = roam_req->op_bitmap; |
| 6319 | roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list; |
| 6320 | roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list; |
| 6321 | roam_filter->num_bssid_preferred_list = |
| 6322 | roam_req->num_bssid_preferred_list; |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6323 | roam_filter->num_rssi_rejection_ap = |
| 6324 | roam_req->num_rssi_rejection_ap; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6325 | buf_ptr += sizeof(wmi_roam_filter_fixed_param); |
| 6326 | |
| 6327 | WMITLV_SET_HDR((buf_ptr), |
| 6328 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6329 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr))); |
| 6330 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list; |
| 6331 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6332 | for (i = 0; i < roam_req->num_bssid_black_list; i++) { |
| 6333 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr); |
| 6334 | bssid_src_ptr += ATH_MAC_LEN; |
| 6335 | bssid_dst_ptr++; |
| 6336 | } |
| 6337 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6338 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)); |
| 6339 | WMITLV_SET_HDR((buf_ptr), |
| 6340 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6341 | (roam_req->num_ssid_white_list * sizeof(wmi_ssid))); |
| 6342 | ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6343 | for (i = 0; i < roam_req->num_ssid_white_list; i++) { |
| 6344 | qdf_mem_copy(&ssid_ptr->ssid, |
| 6345 | &roam_req->ssid_allowed_list[i].mac_ssid, |
| 6346 | roam_req->ssid_allowed_list[i].length); |
| 6347 | ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length; |
| 6348 | ssid_ptr++; |
| 6349 | } |
| 6350 | buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list * |
| 6351 | sizeof(wmi_ssid)); |
| 6352 | WMITLV_SET_HDR((buf_ptr), |
| 6353 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6354 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr))); |
| 6355 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored; |
| 6356 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6357 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 6358 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, |
| 6359 | (wmi_mac_addr *)bssid_dst_ptr); |
| 6360 | bssid_src_ptr += ATH_MAC_LEN; |
| 6361 | bssid_dst_ptr++; |
| 6362 | } |
| 6363 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6364 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)); |
| 6365 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6366 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t))); |
| 6367 | bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6368 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 6369 | *bssid_preferred_factor_ptr = |
| 6370 | roam_req->bssid_favored_factor[i]; |
| 6371 | bssid_preferred_factor_ptr++; |
| 6372 | } |
| 6373 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6374 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t)); |
| 6375 | |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6376 | WMITLV_SET_HDR(buf_ptr, |
| 6377 | WMITLV_TAG_ARRAY_STRUC, blist_len); |
| 6378 | buf_ptr += WMI_TLV_HDR_SIZE; |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6379 | if (roam_req->lca_disallow_config_present) { |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6380 | blist_param = |
| 6381 | (wmi_roam_lca_disallow_config_tlv_param *) buf_ptr; |
| 6382 | WMITLV_SET_HDR(&blist_param->tlv_header, |
| 6383 | WMITLV_TAG_STRUC_wmi_roam_lca_disallow_config_tlv_param, |
| 6384 | WMITLV_GET_STRUCT_TLVLEN( |
| 6385 | wmi_roam_lca_disallow_config_tlv_param)); |
| 6386 | |
| 6387 | blist_param->disallow_duration = roam_req->disallow_duration; |
| 6388 | blist_param->rssi_channel_penalization = |
| 6389 | roam_req->rssi_channel_penalization; |
| 6390 | blist_param->num_disallowed_aps = roam_req->num_disallowed_aps; |
Vignesh Viswanathan | a9497fc | 2017-09-14 17:47:48 +0530 | [diff] [blame] | 6391 | blist_param->disallow_lca_enable_source_bitmap = |
| 6392 | (WMI_ROAM_LCA_DISALLOW_SOURCE_PER | |
| 6393 | WMI_ROAM_LCA_DISALLOW_SOURCE_BACKGROUND); |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6394 | buf_ptr += (sizeof(wmi_roam_lca_disallow_config_tlv_param)); |
| 6395 | } |
| 6396 | |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6397 | WMITLV_SET_HDR(buf_ptr, |
| 6398 | WMITLV_TAG_ARRAY_STRUC, |
| 6399 | (roam_req->num_rssi_rejection_ap * sizeof(*rssi_rej))); |
| 6400 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6401 | for (i = 0; i < roam_req->num_rssi_rejection_ap; i++) { |
| 6402 | rssi_rej = |
| 6403 | (wmi_roam_rssi_rejection_oce_config_param *) buf_ptr; |
| 6404 | WMITLV_SET_HDR(&rssi_rej->tlv_header, |
| 6405 | WMITLV_TAG_STRUC_wmi_roam_rssi_rejection_oce_config_param, |
| 6406 | WMITLV_GET_STRUCT_TLVLEN( |
| 6407 | wmi_roam_rssi_rejection_oce_config_param)); |
| 6408 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 6409 | roam_req->rssi_rejection_ap[i].bssid.bytes, |
| 6410 | &rssi_rej->bssid); |
| 6411 | rssi_rej->remaining_disallow_duration = |
| 6412 | roam_req->rssi_rejection_ap[i].remaining_duration; |
| 6413 | rssi_rej->requested_rssi = |
| 6414 | (A_INT32)roam_req->rssi_rejection_ap[i].expected_rssi; |
| 6415 | buf_ptr += |
| 6416 | (sizeof(wmi_roam_rssi_rejection_oce_config_param)); |
| 6417 | } |
| 6418 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6419 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6420 | len, WMI_ROAM_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6421 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6422 | WMI_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6423 | status); |
| 6424 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6425 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6426 | |
| 6427 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6428 | } |
| 6429 | |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 6430 | #if defined(WLAN_FEATURE_FILS_SK) |
| 6431 | static QDF_STATUS send_roam_scan_send_hlp_cmd_tlv(wmi_unified_t wmi_handle, |
| 6432 | struct hlp_params *params) |
| 6433 | { |
| 6434 | uint32_t len; |
| 6435 | uint8_t *buf_ptr; |
| 6436 | wmi_buf_t buf = NULL; |
| 6437 | wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param *hlp_params; |
| 6438 | |
| 6439 | len = sizeof(wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param); |
| 6440 | len += WMI_TLV_HDR_SIZE; |
| 6441 | len += qdf_roundup(params->hlp_ie_len, sizeof(uint32_t)); |
| 6442 | |
| 6443 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6444 | if (!buf) { |
| 6445 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 6446 | return QDF_STATUS_E_NOMEM; |
| 6447 | } |
| 6448 | |
| 6449 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6450 | hlp_params = (wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param *) buf_ptr; |
| 6451 | WMITLV_SET_HDR(&hlp_params->tlv_header, |
| 6452 | WMITLV_TAG_STRUC_wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param, |
| 6453 | WMITLV_GET_STRUCT_TLVLEN( |
| 6454 | wmi_pdev_update_fils_hlp_pkt_cmd_fixed_param)); |
| 6455 | |
| 6456 | hlp_params->vdev_id = params->vdev_id; |
| 6457 | hlp_params->size = params->hlp_ie_len; |
| 6458 | hlp_params->pkt_type = WMI_FILS_HLP_PKT_TYPE_DHCP_DISCOVER; |
| 6459 | |
| 6460 | buf_ptr += sizeof(*hlp_params); |
| 6461 | |
| 6462 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 6463 | round_up(params->hlp_ie_len, |
| 6464 | sizeof(uint32_t))); |
| 6465 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6466 | qdf_mem_copy(buf_ptr, params->hlp_ie, params->hlp_ie_len); |
| 6467 | |
| 6468 | WMI_LOGD(FL("send FILS HLP pkt vdev %d len %d"), |
| 6469 | hlp_params->vdev_id, hlp_params->size); |
| 6470 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6471 | WMI_PDEV_UPDATE_FILS_HLP_PKT_CMDID)) { |
| 6472 | WMI_LOGE(FL("Failed to send FILS HLP pkt cmd")); |
| 6473 | wmi_buf_free(buf); |
| 6474 | return QDF_STATUS_E_FAILURE; |
| 6475 | } |
| 6476 | |
| 6477 | return QDF_STATUS_SUCCESS; |
| 6478 | } |
| 6479 | #endif |
| 6480 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6481 | /** send_set_epno_network_list_cmd_tlv() - set epno network list |
| 6482 | * @wmi_handle: wmi handle |
| 6483 | * @req: epno config params request structure |
| 6484 | * |
| 6485 | * This function reads the incoming epno config request structure |
| 6486 | * and constructs the WMI message to the firmware. |
| 6487 | * |
| 6488 | * Returns: 0 on success, error number otherwise |
| 6489 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6490 | 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] | 6491 | struct wifi_enhanched_pno_params *req) |
| 6492 | { |
| 6493 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6494 | nlo_configured_parameters *nlo_list; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6495 | enlo_candidate_score_params *cand_score_params; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6496 | u_int8_t i, *buf_ptr; |
| 6497 | wmi_buf_t buf; |
| 6498 | uint32_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6499 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6500 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6501 | /* Fixed Params */ |
| 6502 | len = sizeof(*cmd); |
| 6503 | if (req->num_networks) { |
| 6504 | /* TLV place holder for array of structures |
| 6505 | * then each nlo_configured_parameters(nlo_list) TLV. |
| 6506 | */ |
| 6507 | len += WMI_TLV_HDR_SIZE; |
| 6508 | len += (sizeof(nlo_configured_parameters) |
| 6509 | * QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS)); |
| 6510 | /* TLV for array of uint32 channel_list */ |
| 6511 | len += WMI_TLV_HDR_SIZE; |
| 6512 | /* TLV for nlo_channel_prediction_cfg */ |
| 6513 | len += WMI_TLV_HDR_SIZE; |
| 6514 | /* TLV for candidate score params */ |
| 6515 | len += sizeof(enlo_candidate_score_params); |
| 6516 | } |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6517 | |
| 6518 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6519 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6520 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6521 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6522 | } |
| 6523 | |
| 6524 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6525 | |
| 6526 | buf_ptr = (u_int8_t *) cmd; |
| 6527 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6528 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6529 | WMITLV_GET_STRUCT_TLVLEN( |
| 6530 | wmi_nlo_config_cmd_fixed_param)); |
| 6531 | cmd->vdev_id = req->session_id; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6532 | |
| 6533 | /* set flag to reset if num of networks are 0 */ |
| 6534 | cmd->flags = (req->num_networks == 0 ? |
| 6535 | WMI_NLO_CONFIG_ENLO_RESET : WMI_NLO_CONFIG_ENLO); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6536 | |
| 6537 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 6538 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6539 | 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] | 6540 | WMI_LOGD("SSID count: %d flags: %d", |
| 6541 | cmd->no_of_ssids, cmd->flags); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6542 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6543 | /* Fill nlo_config only when num_networks are non zero */ |
| 6544 | if (cmd->no_of_ssids) { |
| 6545 | /* Fill networks */ |
| 6546 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6547 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 6548 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6549 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6550 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 6551 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 6552 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 6553 | WMITLV_TAG_ARRAY_BYTE, |
| 6554 | WMITLV_GET_STRUCT_TLVLEN( |
| 6555 | nlo_configured_parameters)); |
| 6556 | /* Copy ssid and it's length */ |
| 6557 | nlo_list[i].ssid.valid = true; |
| 6558 | nlo_list[i].ssid.ssid.ssid_len = |
| 6559 | req->networks[i].ssid.length; |
| 6560 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
| 6561 | req->networks[i].ssid.mac_ssid, |
| 6562 | nlo_list[i].ssid.ssid.ssid_len); |
| 6563 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
| 6564 | nlo_list[i].ssid.ssid.ssid_len, |
| 6565 | (char *) nlo_list[i].ssid.ssid.ssid, |
| 6566 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6567 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6568 | /* Copy pno flags */ |
| 6569 | nlo_list[i].bcast_nw_type.valid = true; |
| 6570 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 6571 | req->networks[i].flags; |
| 6572 | WMI_LOGD("PNO flags (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6573 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 6574 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6575 | /* Copy auth bit field */ |
| 6576 | nlo_list[i].auth_type.valid = true; |
| 6577 | nlo_list[i].auth_type.auth_type = |
| 6578 | req->networks[i].auth_bit_field; |
| 6579 | WMI_LOGD("Auth bit field (%u)", |
| 6580 | nlo_list[i].auth_type.auth_type); |
| 6581 | } |
| 6582 | |
| 6583 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 6584 | /* Fill the channel list */ |
| 6585 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 6586 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6587 | |
| 6588 | /* Fill prediction_param */ |
| 6589 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6590 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6591 | |
| 6592 | /* Fill epno candidate score params */ |
| 6593 | cand_score_params = (enlo_candidate_score_params *) buf_ptr; |
| 6594 | WMITLV_SET_HDR(buf_ptr, |
| 6595 | WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 6596 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 6597 | cand_score_params->min5GHz_rssi = |
| 6598 | req->min_5ghz_rssi; |
| 6599 | cand_score_params->min24GHz_rssi = |
| 6600 | req->min_24ghz_rssi; |
| 6601 | cand_score_params->initial_score_max = |
| 6602 | req->initial_score_max; |
| 6603 | cand_score_params->current_connection_bonus = |
| 6604 | req->current_connection_bonus; |
| 6605 | cand_score_params->same_network_bonus = |
| 6606 | req->same_network_bonus; |
| 6607 | cand_score_params->secure_bonus = |
| 6608 | req->secure_bonus; |
| 6609 | cand_score_params->band5GHz_bonus = |
| 6610 | req->band_5ghz_bonus; |
| 6611 | buf_ptr += sizeof(enlo_candidate_score_params); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6612 | } |
| 6613 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6614 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6615 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6616 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6617 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6618 | wmi_buf_free(buf); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6619 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6620 | } |
| 6621 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6622 | WMI_LOGD("set ePNO list request sent successfully for vdev %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6623 | req->session_id); |
| 6624 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6625 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6626 | } |
| 6627 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6628 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6629 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 6630 | * @wmi_handle: wmi handle |
| 6631 | * @ipa_offload: ipa offload control parameter |
| 6632 | * |
| 6633 | * Returns: 0 on success, error number otherwise |
| 6634 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6635 | 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] | 6636 | struct ipa_offload_control_params *ipa_offload) |
| 6637 | { |
| 6638 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 6639 | wmi_buf_t wmi_buf; |
| 6640 | uint32_t len; |
| 6641 | u_int8_t *buf_ptr; |
| 6642 | |
| 6643 | len = sizeof(*cmd); |
| 6644 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6645 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6646 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 6647 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6648 | } |
| 6649 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 6650 | WMI_LOGD("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6651 | ipa_offload->offload_type, ipa_offload->enable); |
| 6652 | |
| 6653 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 6654 | |
| 6655 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 6656 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6657 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 6658 | WMITLV_GET_STRUCT_TLVLEN( |
| 6659 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 6660 | |
| 6661 | cmd->offload_type = ipa_offload->offload_type; |
| 6662 | cmd->vdev_id = ipa_offload->vdev_id; |
| 6663 | cmd->enable = ipa_offload->enable; |
| 6664 | |
| 6665 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6666 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6667 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6668 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6669 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6670 | } |
| 6671 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6672 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6673 | } |
| 6674 | |
| 6675 | /** |
| 6676 | * send_extscan_get_capabilities_cmd_tlv() - extscan get capabilities |
| 6677 | * @wmi_handle: wmi handle |
| 6678 | * @pgetcapab: get capabilities params |
| 6679 | * |
| 6680 | * This function send request to fw to get extscan capabilities. |
| 6681 | * |
| 6682 | * Return: CDF status |
| 6683 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6684 | 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] | 6685 | struct extscan_capabilities_params *pgetcapab) |
| 6686 | { |
| 6687 | wmi_extscan_get_capabilities_cmd_fixed_param *cmd; |
| 6688 | wmi_buf_t wmi_buf; |
| 6689 | uint32_t len; |
| 6690 | uint8_t *buf_ptr; |
| 6691 | |
| 6692 | len = sizeof(*cmd); |
| 6693 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6694 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6695 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6696 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6697 | } |
| 6698 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6699 | |
| 6700 | cmd = (wmi_extscan_get_capabilities_cmd_fixed_param *) buf_ptr; |
| 6701 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6702 | WMITLV_TAG_STRUC_wmi_extscan_get_capabilities_cmd_fixed_param, |
| 6703 | WMITLV_GET_STRUCT_TLVLEN |
| 6704 | (wmi_extscan_get_capabilities_cmd_fixed_param)); |
| 6705 | |
| 6706 | cmd->request_id = pgetcapab->request_id; |
| 6707 | |
| 6708 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6709 | WMI_EXTSCAN_GET_CAPABILITIES_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6710 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6711 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6712 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6713 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6714 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6715 | } |
| 6716 | |
| 6717 | /** |
| 6718 | * send_extscan_get_cached_results_cmd_tlv() - extscan get cached results |
| 6719 | * @wmi_handle: wmi handle |
| 6720 | * @pcached_results: cached results parameters |
| 6721 | * |
| 6722 | * This function send request to fw to get cached results. |
| 6723 | * |
| 6724 | * Return: CDF status |
| 6725 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6726 | 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] | 6727 | struct extscan_cached_result_params *pcached_results) |
| 6728 | { |
| 6729 | wmi_extscan_get_cached_results_cmd_fixed_param *cmd; |
| 6730 | wmi_buf_t wmi_buf; |
| 6731 | uint32_t len; |
| 6732 | uint8_t *buf_ptr; |
| 6733 | |
| 6734 | len = sizeof(*cmd); |
| 6735 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6736 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6737 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6738 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6739 | } |
| 6740 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6741 | |
| 6742 | cmd = (wmi_extscan_get_cached_results_cmd_fixed_param *) buf_ptr; |
| 6743 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6744 | WMITLV_TAG_STRUC_wmi_extscan_get_cached_results_cmd_fixed_param, |
| 6745 | WMITLV_GET_STRUCT_TLVLEN |
| 6746 | (wmi_extscan_get_cached_results_cmd_fixed_param)); |
| 6747 | |
| 6748 | cmd->request_id = pcached_results->request_id; |
| 6749 | cmd->vdev_id = pcached_results->session_id; |
| 6750 | cmd->control_flags = pcached_results->flush; |
| 6751 | |
| 6752 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6753 | WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6754 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6755 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6756 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6757 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6758 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6759 | } |
| 6760 | |
| 6761 | /** |
| 6762 | * send_extscan_stop_change_monitor_cmd_tlv() - send stop change monitor cmd |
| 6763 | * @wmi_handle: wmi handle |
| 6764 | * @reset_req: Reset change request params |
| 6765 | * |
| 6766 | * This function sends stop change monitor request to fw. |
| 6767 | * |
| 6768 | * Return: CDF status |
| 6769 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6770 | 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] | 6771 | struct extscan_capabilities_reset_params *reset_req) |
| 6772 | { |
| 6773 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 6774 | wmi_buf_t wmi_buf; |
| 6775 | uint32_t len; |
| 6776 | uint8_t *buf_ptr; |
| 6777 | int change_list = 0; |
| 6778 | |
| 6779 | len = sizeof(*cmd); |
| 6780 | |
| 6781 | /* reset significant change tlv is set to 0 */ |
| 6782 | len += WMI_TLV_HDR_SIZE; |
| 6783 | len += change_list * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 6784 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6785 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6786 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6787 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6788 | } |
| 6789 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6790 | |
| 6791 | cmd = (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 6792 | buf_ptr; |
| 6793 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6794 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 6795 | WMITLV_GET_STRUCT_TLVLEN |
| 6796 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 6797 | |
| 6798 | cmd->request_id = reset_req->request_id; |
| 6799 | cmd->vdev_id = reset_req->session_id; |
| 6800 | cmd->mode = 0; |
| 6801 | |
| 6802 | buf_ptr += sizeof(*cmd); |
| 6803 | WMITLV_SET_HDR(buf_ptr, |
| 6804 | WMITLV_TAG_ARRAY_STRUC, |
| 6805 | change_list * |
| 6806 | sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6807 | buf_ptr += WMI_TLV_HDR_SIZE + (change_list * |
| 6808 | sizeof |
| 6809 | (wmi_extscan_wlan_change_bssid_param)); |
| 6810 | |
| 6811 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6812 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6813 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6814 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6815 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6816 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6817 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6818 | } |
| 6819 | |
| 6820 | /** |
| 6821 | * wmi_get_buf_extscan_change_monitor_cmd() - fill change monitor request |
| 6822 | * @wmi_handle: wmi handle |
| 6823 | * @psigchange: change monitor request params |
| 6824 | * @buf: wmi buffer |
| 6825 | * @buf_len: buffer length |
| 6826 | * |
| 6827 | * This function fills elements of change monitor request buffer. |
| 6828 | * |
| 6829 | * Return: CDF status |
| 6830 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6831 | 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] | 6832 | struct extscan_set_sig_changereq_params |
| 6833 | *psigchange, wmi_buf_t *buf, int *buf_len) |
| 6834 | { |
| 6835 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 6836 | wmi_extscan_wlan_change_bssid_param *dest_chglist; |
| 6837 | uint8_t *buf_ptr; |
| 6838 | int j; |
| 6839 | int len = sizeof(*cmd); |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 6840 | uint32_t numap = psigchange->num_ap; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6841 | struct ap_threshold_params *src_ap = psigchange->ap; |
| 6842 | |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 6843 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_SIGNIFICANT_CHANGE_APS)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6844 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 6845 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6846 | } |
| 6847 | len += WMI_TLV_HDR_SIZE; |
| 6848 | len += numap * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 6849 | |
| 6850 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 6851 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6852 | WMI_LOGP("%s: failed to allocate memory for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6853 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6854 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6855 | } |
| 6856 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 6857 | cmd = |
| 6858 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 6859 | buf_ptr; |
| 6860 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6861 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 6862 | WMITLV_GET_STRUCT_TLVLEN |
| 6863 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 6864 | |
| 6865 | cmd->request_id = psigchange->request_id; |
| 6866 | cmd->vdev_id = psigchange->session_id; |
| 6867 | cmd->total_entries = numap; |
| 6868 | cmd->mode = 1; |
| 6869 | cmd->num_entries_in_page = numap; |
| 6870 | cmd->lost_ap_scan_count = psigchange->lostap_sample_size; |
| 6871 | cmd->max_rssi_samples = psigchange->rssi_sample_size; |
| 6872 | cmd->rssi_averaging_samples = psigchange->rssi_sample_size; |
| 6873 | cmd->max_out_of_range_count = psigchange->min_breaching; |
| 6874 | |
| 6875 | buf_ptr += sizeof(*cmd); |
| 6876 | WMITLV_SET_HDR(buf_ptr, |
| 6877 | WMITLV_TAG_ARRAY_STRUC, |
| 6878 | numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6879 | dest_chglist = (wmi_extscan_wlan_change_bssid_param *) |
| 6880 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6881 | |
| 6882 | for (j = 0; j < numap; j++) { |
| 6883 | WMITLV_SET_HDR(dest_chglist, |
| 6884 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 6885 | WMITLV_GET_STRUCT_TLVLEN |
| 6886 | (wmi_extscan_wlan_change_bssid_param)); |
| 6887 | |
| 6888 | dest_chglist->lower_rssi_limit = src_ap->low; |
| 6889 | dest_chglist->upper_rssi_limit = src_ap->high; |
| 6890 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 6891 | &dest_chglist->bssid); |
| 6892 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6893 | WMI_LOGD("%s: min_rssi %d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6894 | dest_chglist->lower_rssi_limit); |
| 6895 | dest_chglist++; |
| 6896 | src_ap++; |
| 6897 | } |
| 6898 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6899 | (numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6900 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6901 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6902 | } |
| 6903 | |
| 6904 | /** |
| 6905 | * send_extscan_start_change_monitor_cmd_tlv() - send start change monitor cmd |
| 6906 | * @wmi_handle: wmi handle |
| 6907 | * @psigchange: change monitor request params |
| 6908 | * |
| 6909 | * This function sends start change monitor request to fw. |
| 6910 | * |
| 6911 | * Return: CDF status |
| 6912 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6913 | 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] | 6914 | struct extscan_set_sig_changereq_params * |
| 6915 | psigchange) |
| 6916 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6917 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6918 | wmi_buf_t buf; |
| 6919 | int len; |
| 6920 | |
| 6921 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6922 | qdf_status = wmi_get_buf_extscan_change_monitor_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6923 | psigchange, &buf, |
| 6924 | &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6925 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6926 | WMI_LOGE("%s: Failed to get buffer for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6927 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6928 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6929 | } |
| 6930 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6931 | WMI_LOGE("%s: Failed to get buffer", __func__); |
| 6932 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6933 | } |
| 6934 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6935 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6936 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6937 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6938 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6939 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6940 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6941 | } |
| 6942 | |
| 6943 | /** |
| 6944 | * send_extscan_stop_hotlist_monitor_cmd_tlv() - stop hotlist monitor |
| 6945 | * @wmi_handle: wmi handle |
| 6946 | * @photlist_reset: hotlist reset params |
| 6947 | * |
| 6948 | * This function configures hotlist monitor to stop in fw. |
| 6949 | * |
| 6950 | * Return: CDF status |
| 6951 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6952 | 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] | 6953 | struct extscan_bssid_hotlist_reset_params *photlist_reset) |
| 6954 | { |
| 6955 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd; |
| 6956 | wmi_buf_t wmi_buf; |
| 6957 | uint32_t len; |
| 6958 | uint8_t *buf_ptr; |
| 6959 | int hotlist_entries = 0; |
| 6960 | |
| 6961 | len = sizeof(*cmd); |
| 6962 | |
| 6963 | /* reset bssid hotlist with tlv set to 0 */ |
| 6964 | len += WMI_TLV_HDR_SIZE; |
| 6965 | len += hotlist_entries * sizeof(wmi_extscan_hotlist_entry); |
| 6966 | |
| 6967 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6968 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6969 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6970 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6971 | } |
| 6972 | |
| 6973 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6974 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 6975 | buf_ptr; |
| 6976 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6977 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 6978 | WMITLV_GET_STRUCT_TLVLEN |
| 6979 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 6980 | |
| 6981 | cmd->request_id = photlist_reset->request_id; |
| 6982 | cmd->vdev_id = photlist_reset->session_id; |
| 6983 | cmd->mode = 0; |
| 6984 | |
| 6985 | buf_ptr += sizeof(*cmd); |
| 6986 | WMITLV_SET_HDR(buf_ptr, |
| 6987 | WMITLV_TAG_ARRAY_STRUC, |
| 6988 | hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 6989 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6990 | (hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 6991 | |
| 6992 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6993 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6994 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6995 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6996 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6997 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6998 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6999 | } |
| 7000 | |
| 7001 | /** |
| 7002 | * send_stop_extscan_cmd_tlv() - stop extscan command to fw. |
| 7003 | * @wmi_handle: wmi handle |
| 7004 | * @pstopcmd: stop scan command request params |
| 7005 | * |
| 7006 | * This function sends stop extscan request to fw. |
| 7007 | * |
| 7008 | * Return: CDF Status. |
| 7009 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7010 | 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] | 7011 | struct extscan_stop_req_params *pstopcmd) |
| 7012 | { |
| 7013 | wmi_extscan_stop_cmd_fixed_param *cmd; |
| 7014 | wmi_buf_t wmi_buf; |
| 7015 | uint32_t len; |
| 7016 | uint8_t *buf_ptr; |
| 7017 | |
| 7018 | len = sizeof(*cmd); |
| 7019 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 7020 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7021 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 7022 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7023 | } |
| 7024 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 7025 | cmd = (wmi_extscan_stop_cmd_fixed_param *) buf_ptr; |
| 7026 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7027 | WMITLV_TAG_STRUC_wmi_extscan_stop_cmd_fixed_param, |
| 7028 | WMITLV_GET_STRUCT_TLVLEN |
| 7029 | (wmi_extscan_stop_cmd_fixed_param)); |
| 7030 | |
| 7031 | cmd->request_id = pstopcmd->request_id; |
| 7032 | cmd->vdev_id = pstopcmd->session_id; |
| 7033 | |
| 7034 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 7035 | WMI_EXTSCAN_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7036 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7037 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7038 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7039 | } |
| 7040 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7041 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7042 | } |
| 7043 | |
| 7044 | /** |
| 7045 | * wmi_get_buf_extscan_start_cmd() - Fill extscan start request |
| 7046 | * @wmi_handle: wmi handle |
| 7047 | * @pstart: scan command request params |
| 7048 | * @buf: event buffer |
| 7049 | * @buf_len: length of buffer |
| 7050 | * |
| 7051 | * This function fills individual elements of extscan request and |
| 7052 | * TLV for buckets, channel list. |
| 7053 | * |
| 7054 | * Return: CDF Status. |
| 7055 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 7056 | static |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7057 | 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] | 7058 | struct wifi_scan_cmd_req_params *pstart, |
| 7059 | wmi_buf_t *buf, int *buf_len) |
| 7060 | { |
| 7061 | wmi_extscan_start_cmd_fixed_param *cmd; |
| 7062 | wmi_extscan_bucket *dest_blist; |
| 7063 | wmi_extscan_bucket_channel *dest_clist; |
| 7064 | struct wifi_scan_bucket_params *src_bucket = pstart->buckets; |
| 7065 | struct wifi_scan_channelspec_params *src_channel = src_bucket->channels; |
| 7066 | struct wifi_scan_channelspec_params save_channel[WMI_WLAN_EXTSCAN_MAX_CHANNELS]; |
| 7067 | |
| 7068 | uint8_t *buf_ptr; |
| 7069 | int i, k, count = 0; |
| 7070 | int len = sizeof(*cmd); |
| 7071 | int nbuckets = pstart->numBuckets; |
| 7072 | int nchannels = 0; |
| 7073 | |
| 7074 | /* These TLV's are are NULL by default */ |
| 7075 | uint32_t ie_len_with_pad = 0; |
| 7076 | int num_ssid = 0; |
| 7077 | int num_bssid = 0; |
| 7078 | int ie_len = 0; |
| 7079 | |
| 7080 | uint32_t base_period = pstart->basePeriod; |
| 7081 | |
| 7082 | /* TLV placeholder for ssid_list (NULL) */ |
| 7083 | len += WMI_TLV_HDR_SIZE; |
| 7084 | len += num_ssid * sizeof(wmi_ssid); |
| 7085 | |
| 7086 | /* TLV placeholder for bssid_list (NULL) */ |
| 7087 | len += WMI_TLV_HDR_SIZE; |
| 7088 | len += num_bssid * sizeof(wmi_mac_addr); |
| 7089 | |
| 7090 | /* TLV placeholder for ie_data (NULL) */ |
| 7091 | len += WMI_TLV_HDR_SIZE; |
| 7092 | len += ie_len * sizeof(uint32_t); |
| 7093 | |
| 7094 | /* TLV placeholder for bucket */ |
| 7095 | len += WMI_TLV_HDR_SIZE; |
| 7096 | len += nbuckets * sizeof(wmi_extscan_bucket); |
| 7097 | |
| 7098 | /* TLV channel placeholder */ |
| 7099 | len += WMI_TLV_HDR_SIZE; |
| 7100 | for (i = 0; i < nbuckets; i++) { |
| 7101 | nchannels += src_bucket->numChannels; |
| 7102 | src_bucket++; |
| 7103 | } |
| 7104 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7105 | WMI_LOGD("%s: Total buckets: %d total #of channels is %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7106 | __func__, nbuckets, nchannels); |
| 7107 | len += nchannels * sizeof(wmi_extscan_bucket_channel); |
| 7108 | /* Allocate the memory */ |
| 7109 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 7110 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7111 | WMI_LOGP("%s: failed to allocate memory" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7112 | " for start extscan cmd", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7113 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7114 | } |
| 7115 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 7116 | cmd = (wmi_extscan_start_cmd_fixed_param *) buf_ptr; |
| 7117 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7118 | WMITLV_TAG_STRUC_wmi_extscan_start_cmd_fixed_param, |
| 7119 | WMITLV_GET_STRUCT_TLVLEN |
| 7120 | (wmi_extscan_start_cmd_fixed_param)); |
| 7121 | |
| 7122 | cmd->request_id = pstart->requestId; |
| 7123 | cmd->vdev_id = pstart->sessionId; |
| 7124 | cmd->base_period = pstart->basePeriod; |
| 7125 | cmd->num_buckets = nbuckets; |
| 7126 | cmd->configuration_flags = 0; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 7127 | if (pstart->configuration_flags & WMI_EXTSCAN_LP_EXTENDED_BATCHING) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7128 | cmd->configuration_flags |= WMI_EXTSCAN_EXTENDED_BATCHING_EN; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7129 | WMI_LOGI("%s: configuration_flags: 0x%x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7130 | cmd->configuration_flags); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7131 | #ifdef FEATURE_WLAN_EXTSCAN |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7132 | cmd->min_rest_time = WMI_EXTSCAN_REST_TIME; |
| 7133 | cmd->max_rest_time = WMI_EXTSCAN_REST_TIME; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7134 | cmd->max_scan_time = WMI_EXTSCAN_MAX_SCAN_TIME; |
| 7135 | cmd->burst_duration = WMI_EXTSCAN_BURST_DURATION; |
| 7136 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7137 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 7138 | |
| 7139 | /* The max dwell time is retrieved from the first channel |
| 7140 | * of the first bucket and kept common for all channels. |
| 7141 | */ |
| 7142 | cmd->min_dwell_time_active = pstart->min_dwell_time_active; |
| 7143 | cmd->max_dwell_time_active = pstart->max_dwell_time_active; |
| 7144 | cmd->min_dwell_time_passive = pstart->min_dwell_time_passive; |
| 7145 | cmd->max_dwell_time_passive = pstart->max_dwell_time_passive; |
| 7146 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 7147 | cmd->max_table_usage = pstart->report_threshold_percent; |
| 7148 | cmd->report_threshold_num_scans = pstart->report_threshold_num_scans; |
| 7149 | |
| 7150 | cmd->repeat_probe_time = cmd->max_dwell_time_active / |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7151 | WMI_SCAN_NPROBES_DEFAULT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7152 | cmd->probe_delay = 0; |
| 7153 | cmd->probe_spacing_time = 0; |
| 7154 | cmd->idle_time = 0; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7155 | cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | |
| 7156 | WMI_SCAN_ADD_CCK_RATES | |
| 7157 | WMI_SCAN_ADD_OFDM_RATES | |
| 7158 | WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ | |
| 7159 | WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 7160 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 7161 | pstart->extscan_adaptive_dwell_mode); |
Kapil Gupta | 4a95ef2 | 2016-09-29 18:07:01 +0530 | [diff] [blame] | 7162 | cmd->scan_priority = WMI_SCAN_PRIORITY_VERY_LOW; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7163 | cmd->num_ssids = 0; |
| 7164 | cmd->num_bssid = 0; |
| 7165 | cmd->ie_len = 0; |
| 7166 | cmd->n_probes = (cmd->repeat_probe_time > 0) ? |
| 7167 | cmd->max_dwell_time_active / cmd->repeat_probe_time : 0; |
| 7168 | |
| 7169 | buf_ptr += sizeof(*cmd); |
| 7170 | WMITLV_SET_HDR(buf_ptr, |
| 7171 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 7172 | num_ssid * sizeof(wmi_ssid)); |
| 7173 | buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid * sizeof(wmi_ssid)); |
| 7174 | |
| 7175 | WMITLV_SET_HDR(buf_ptr, |
| 7176 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 7177 | num_bssid * sizeof(wmi_mac_addr)); |
| 7178 | buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid * sizeof(wmi_mac_addr)); |
| 7179 | |
| 7180 | ie_len_with_pad = 0; |
| 7181 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 7182 | ie_len_with_pad); |
| 7183 | buf_ptr += WMI_TLV_HDR_SIZE + ie_len_with_pad; |
| 7184 | |
| 7185 | WMITLV_SET_HDR(buf_ptr, |
| 7186 | WMITLV_TAG_ARRAY_STRUC, |
| 7187 | nbuckets * sizeof(wmi_extscan_bucket)); |
| 7188 | dest_blist = (wmi_extscan_bucket *) |
| 7189 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 7190 | src_bucket = pstart->buckets; |
| 7191 | |
| 7192 | /* Retrieve scanning information from each bucket and |
| 7193 | * channels and send it to the target |
| 7194 | */ |
| 7195 | for (i = 0; i < nbuckets; i++) { |
| 7196 | WMITLV_SET_HDR(dest_blist, |
| 7197 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 7198 | WMITLV_GET_STRUCT_TLVLEN(wmi_extscan_bucket)); |
| 7199 | |
| 7200 | dest_blist->bucket_id = src_bucket->bucket; |
| 7201 | dest_blist->base_period_multiplier = |
| 7202 | src_bucket->period / base_period; |
| 7203 | dest_blist->min_period = src_bucket->period; |
| 7204 | dest_blist->max_period = src_bucket->max_period; |
| 7205 | dest_blist->exp_backoff = src_bucket->exponent; |
| 7206 | dest_blist->exp_max_step_count = src_bucket->step_count; |
| 7207 | dest_blist->channel_band = src_bucket->band; |
| 7208 | dest_blist->num_channels = src_bucket->numChannels; |
| 7209 | dest_blist->notify_extscan_events = 0; |
| 7210 | |
| 7211 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_EACH_SCAN) |
| 7212 | dest_blist->notify_extscan_events = |
Deepak Dhamdhere | 583283c | 2016-09-02 00:03:12 -0700 | [diff] [blame] | 7213 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT | |
| 7214 | WMI_EXTSCAN_CYCLE_STARTED_EVENT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7215 | |
| 7216 | if (src_bucket->reportEvents & |
| 7217 | WMI_EXTSCAN_REPORT_EVENTS_FULL_RESULTS) { |
| 7218 | dest_blist->forwarding_flags = |
| 7219 | WMI_EXTSCAN_FORWARD_FRAME_TO_HOST; |
| 7220 | dest_blist->notify_extscan_events |= |
| 7221 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT | |
| 7222 | WMI_EXTSCAN_CYCLE_STARTED_EVENT | |
| 7223 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT; |
| 7224 | } else { |
| 7225 | dest_blist->forwarding_flags = |
| 7226 | WMI_EXTSCAN_NO_FORWARDING; |
| 7227 | } |
| 7228 | |
| 7229 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_NO_BATCH) |
| 7230 | dest_blist->configuration_flags = 0; |
| 7231 | else |
| 7232 | dest_blist->configuration_flags = |
| 7233 | WMI_EXTSCAN_BUCKET_CACHE_RESULTS; |
| 7234 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7235 | 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] | 7236 | __func__, dest_blist->notify_extscan_events, |
| 7237 | dest_blist->configuration_flags, |
| 7238 | dest_blist->forwarding_flags); |
| 7239 | |
| 7240 | dest_blist->min_dwell_time_active = |
| 7241 | src_bucket->min_dwell_time_active; |
| 7242 | dest_blist->max_dwell_time_active = |
| 7243 | src_bucket->max_dwell_time_active; |
| 7244 | dest_blist->min_dwell_time_passive = |
| 7245 | src_bucket->min_dwell_time_passive; |
| 7246 | dest_blist->max_dwell_time_passive = |
| 7247 | src_bucket->max_dwell_time_passive; |
| 7248 | src_channel = src_bucket->channels; |
| 7249 | |
| 7250 | /* save the channel info to later populate |
| 7251 | * the channel TLV |
| 7252 | */ |
| 7253 | for (k = 0; k < src_bucket->numChannels; k++) { |
| 7254 | save_channel[count++].channel = src_channel->channel; |
| 7255 | src_channel++; |
| 7256 | } |
| 7257 | dest_blist++; |
| 7258 | src_bucket++; |
| 7259 | } |
| 7260 | buf_ptr += WMI_TLV_HDR_SIZE + (nbuckets * sizeof(wmi_extscan_bucket)); |
| 7261 | WMITLV_SET_HDR(buf_ptr, |
| 7262 | WMITLV_TAG_ARRAY_STRUC, |
| 7263 | nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 7264 | dest_clist = (wmi_extscan_bucket_channel *) |
| 7265 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 7266 | |
| 7267 | /* Active or passive scan is based on the bucket dwell time |
| 7268 | * and channel specific active,passive scans are not |
| 7269 | * supported yet |
| 7270 | */ |
| 7271 | for (i = 0; i < nchannels; i++) { |
| 7272 | WMITLV_SET_HDR(dest_clist, |
| 7273 | WMITLV_TAG_STRUC_wmi_extscan_bucket_channel_event_fixed_param, |
| 7274 | WMITLV_GET_STRUCT_TLVLEN |
| 7275 | (wmi_extscan_bucket_channel)); |
| 7276 | dest_clist->channel = save_channel[i].channel; |
| 7277 | dest_clist++; |
| 7278 | } |
| 7279 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 7280 | (nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 7281 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7282 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7283 | } |
| 7284 | |
| 7285 | /** |
| 7286 | * send_start_extscan_cmd_tlv() - start extscan command to fw. |
| 7287 | * @wmi_handle: wmi handle |
| 7288 | * @pstart: scan command request params |
| 7289 | * |
| 7290 | * This function sends start extscan request to fw. |
| 7291 | * |
| 7292 | * Return: CDF Status. |
| 7293 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7294 | 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] | 7295 | struct wifi_scan_cmd_req_params *pstart) |
| 7296 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7297 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7298 | wmi_buf_t buf; |
| 7299 | int len; |
| 7300 | |
| 7301 | /* Fill individual elements of extscan request and |
| 7302 | * TLV for buckets, channel list. |
| 7303 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7304 | qdf_status = wmi_get_buf_extscan_start_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7305 | pstart, &buf, &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7306 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 7307 | WMI_LOGE("%s: Failed to get buffer for ext scan cmd", __func__); |
| 7308 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7309 | } |
| 7310 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7311 | WMI_LOGE("%s:Failed to get buffer" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7312 | "for current extscan info", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7313 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7314 | } |
| 7315 | if (wmi_unified_cmd_send(wmi_handle, buf, |
| 7316 | len, WMI_EXTSCAN_START_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7317 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7318 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7319 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7320 | } |
| 7321 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7322 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7323 | } |
| 7324 | |
| 7325 | /** |
| 7326 | * send_plm_stop_cmd_tlv() - plm stop request |
| 7327 | * @wmi_handle: wmi handle |
| 7328 | * @plm: plm request parameters |
| 7329 | * |
| 7330 | * This function request FW to stop PLM. |
| 7331 | * |
| 7332 | * Return: CDF status |
| 7333 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7334 | 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] | 7335 | const struct plm_req_params *plm) |
| 7336 | { |
| 7337 | wmi_vdev_plmreq_stop_cmd_fixed_param *cmd; |
| 7338 | int32_t len; |
| 7339 | wmi_buf_t buf; |
| 7340 | uint8_t *buf_ptr; |
| 7341 | int ret; |
| 7342 | |
| 7343 | len = sizeof(*cmd); |
| 7344 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7345 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7346 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7347 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7348 | } |
| 7349 | |
| 7350 | cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 7351 | |
| 7352 | buf_ptr = (uint8_t *) cmd; |
| 7353 | |
| 7354 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7355 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param, |
| 7356 | WMITLV_GET_STRUCT_TLVLEN |
| 7357 | (wmi_vdev_plmreq_stop_cmd_fixed_param)); |
| 7358 | |
| 7359 | cmd->vdev_id = plm->session_id; |
| 7360 | |
| 7361 | cmd->meas_token = plm->meas_token; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7362 | 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] | 7363 | |
| 7364 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7365 | WMI_VDEV_PLMREQ_STOP_CMDID); |
| 7366 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7367 | WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7368 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7369 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7370 | } |
| 7371 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7372 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7373 | } |
| 7374 | |
| 7375 | /** |
| 7376 | * send_plm_start_cmd_tlv() - plm start request |
| 7377 | * @wmi_handle: wmi handle |
| 7378 | * @plm: plm request parameters |
| 7379 | * |
| 7380 | * This function request FW to start PLM. |
| 7381 | * |
| 7382 | * Return: CDF status |
| 7383 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7384 | 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] | 7385 | const struct plm_req_params *plm, |
| 7386 | uint32_t *gchannel_list) |
| 7387 | { |
| 7388 | wmi_vdev_plmreq_start_cmd_fixed_param *cmd; |
| 7389 | uint32_t *channel_list; |
| 7390 | int32_t len; |
| 7391 | wmi_buf_t buf; |
| 7392 | uint8_t *buf_ptr; |
| 7393 | uint8_t count; |
| 7394 | int ret; |
| 7395 | |
| 7396 | /* TLV place holder for channel_list */ |
| 7397 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 7398 | len += sizeof(uint32_t) * plm->plm_num_ch; |
| 7399 | |
| 7400 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7401 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7402 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7403 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7404 | } |
| 7405 | cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf); |
| 7406 | |
| 7407 | buf_ptr = (uint8_t *) cmd; |
| 7408 | |
| 7409 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7410 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param, |
| 7411 | WMITLV_GET_STRUCT_TLVLEN |
| 7412 | (wmi_vdev_plmreq_start_cmd_fixed_param)); |
| 7413 | |
| 7414 | cmd->vdev_id = plm->session_id; |
| 7415 | |
| 7416 | cmd->meas_token = plm->meas_token; |
| 7417 | cmd->dialog_token = plm->diag_token; |
| 7418 | cmd->number_bursts = plm->num_bursts; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7419 | cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7420 | cmd->off_duration = plm->meas_duration; |
| 7421 | cmd->burst_cycle = plm->burst_len; |
| 7422 | cmd->tx_power = plm->desired_tx_pwr; |
| 7423 | WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac); |
| 7424 | cmd->num_chans = plm->plm_num_ch; |
| 7425 | |
| 7426 | buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param); |
| 7427 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7428 | WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token); |
| 7429 | WMI_LOGD("dialog_token: %d", cmd->dialog_token); |
| 7430 | WMI_LOGD("number_bursts: %d", cmd->number_bursts); |
| 7431 | WMI_LOGD("burst_interval: %d", cmd->burst_interval); |
| 7432 | WMI_LOGD("off_duration: %d", cmd->off_duration); |
| 7433 | WMI_LOGD("burst_cycle: %d", cmd->burst_cycle); |
| 7434 | WMI_LOGD("tx_power: %d", cmd->tx_power); |
| 7435 | WMI_LOGD("Number of channels : %d", cmd->num_chans); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7436 | |
| 7437 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 7438 | (cmd->num_chans * sizeof(uint32_t))); |
| 7439 | |
| 7440 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7441 | if (cmd->num_chans) { |
| 7442 | channel_list = (uint32_t *) buf_ptr; |
| 7443 | for (count = 0; count < cmd->num_chans; count++) { |
| 7444 | channel_list[count] = plm->plm_ch_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7445 | if (channel_list[count] < WMI_NLO_FREQ_THRESH) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7446 | channel_list[count] = |
| 7447 | gchannel_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7448 | WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7449 | } |
| 7450 | buf_ptr += cmd->num_chans * sizeof(uint32_t); |
| 7451 | } |
| 7452 | |
| 7453 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7454 | WMI_VDEV_PLMREQ_START_CMDID); |
| 7455 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7456 | WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7457 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7458 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7459 | } |
| 7460 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7461 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7462 | } |
| 7463 | |
| 7464 | /** |
| 7465 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 7466 | * @wmi_handle: wmi handle |
| 7467 | * @vdev_id: vdev id |
| 7468 | * |
| 7469 | * This function request FW to stop ongoing PNO operation. |
| 7470 | * |
| 7471 | * Return: CDF status |
| 7472 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7473 | 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] | 7474 | { |
| 7475 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 7476 | int32_t len = sizeof(*cmd); |
| 7477 | wmi_buf_t buf; |
| 7478 | uint8_t *buf_ptr; |
| 7479 | int ret; |
| 7480 | |
| 7481 | /* |
| 7482 | * TLV place holder for array of structures nlo_configured_parameters |
| 7483 | * TLV place holder for array of uint32_t channel_list |
| 7484 | * TLV place holder for chnl prediction cfg |
| 7485 | */ |
| 7486 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 7487 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7488 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7489 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7490 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7491 | } |
| 7492 | |
| 7493 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 7494 | buf_ptr = (uint8_t *) cmd; |
| 7495 | |
| 7496 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7497 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 7498 | WMITLV_GET_STRUCT_TLVLEN |
| 7499 | (wmi_nlo_config_cmd_fixed_param)); |
| 7500 | |
| 7501 | cmd->vdev_id = vdev_id; |
| 7502 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 7503 | buf_ptr += sizeof(*cmd); |
| 7504 | |
| 7505 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7506 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7507 | |
| 7508 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 7509 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7510 | |
| 7511 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7512 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7513 | |
| 7514 | |
| 7515 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7516 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 7517 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7518 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7519 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7520 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7521 | } |
| 7522 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7523 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7524 | } |
| 7525 | |
| 7526 | /** |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7527 | * wmi_set_pno_channel_prediction() - Set PNO channel prediction |
| 7528 | * @buf_ptr: Buffer passed by upper layers |
| 7529 | * @pno: Buffer to be sent to the firmware |
| 7530 | * |
| 7531 | * Copy the PNO Channel prediction configuration parameters |
| 7532 | * passed by the upper layers to a WMI format TLV and send it |
| 7533 | * down to the firmware. |
| 7534 | * |
| 7535 | * Return: None |
| 7536 | */ |
| 7537 | static void wmi_set_pno_channel_prediction(uint8_t *buf_ptr, |
| 7538 | struct pno_scan_req_params *pno) |
| 7539 | { |
| 7540 | nlo_channel_prediction_cfg *channel_prediction_cfg = |
| 7541 | (nlo_channel_prediction_cfg *) buf_ptr; |
| 7542 | WMITLV_SET_HDR(&channel_prediction_cfg->tlv_header, |
| 7543 | WMITLV_TAG_ARRAY_BYTE, |
| 7544 | WMITLV_GET_STRUCT_TLVLEN(nlo_channel_prediction_cfg)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7545 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7546 | channel_prediction_cfg->enable = pno->pno_channel_prediction; |
| 7547 | channel_prediction_cfg->top_k_num = pno->top_k_num_of_channels; |
| 7548 | channel_prediction_cfg->stationary_threshold = pno->stationary_thresh; |
| 7549 | channel_prediction_cfg->full_scan_period_ms = |
| 7550 | pno->channel_prediction_full_scan; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7551 | #endif |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7552 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
| 7553 | WMI_LOGD("enable: %d, top_k_num: %d, stat_thresh: %d, full_scan: %d", |
| 7554 | channel_prediction_cfg->enable, |
| 7555 | channel_prediction_cfg->top_k_num, |
| 7556 | channel_prediction_cfg->stationary_threshold, |
| 7557 | channel_prediction_cfg->full_scan_period_ms); |
| 7558 | } |
| 7559 | |
| 7560 | /** |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 7561 | * send_nlo_mawc_cmd_tlv() - Send MAWC NLO configuration |
| 7562 | * @wmi_handle: wmi handle |
| 7563 | * @params: configuration parameters |
| 7564 | * |
| 7565 | * Return: QDF_STATUS |
| 7566 | */ |
| 7567 | static QDF_STATUS send_nlo_mawc_cmd_tlv(wmi_unified_t wmi_handle, |
| 7568 | struct nlo_mawc_params *params) |
| 7569 | { |
| 7570 | wmi_buf_t buf = NULL; |
| 7571 | QDF_STATUS status; |
| 7572 | int len; |
| 7573 | uint8_t *buf_ptr; |
| 7574 | wmi_nlo_configure_mawc_cmd_fixed_param *wmi_nlo_mawc_params; |
| 7575 | |
| 7576 | len = sizeof(*wmi_nlo_mawc_params); |
| 7577 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7578 | if (!buf) { |
| 7579 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7580 | return QDF_STATUS_E_NOMEM; |
| 7581 | } |
| 7582 | |
| 7583 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7584 | wmi_nlo_mawc_params = |
| 7585 | (wmi_nlo_configure_mawc_cmd_fixed_param *) buf_ptr; |
| 7586 | WMITLV_SET_HDR(&wmi_nlo_mawc_params->tlv_header, |
| 7587 | WMITLV_TAG_STRUC_wmi_nlo_configure_mawc_cmd_fixed_param, |
| 7588 | WMITLV_GET_STRUCT_TLVLEN |
| 7589 | (wmi_nlo_configure_mawc_cmd_fixed_param)); |
| 7590 | wmi_nlo_mawc_params->vdev_id = params->vdev_id; |
| 7591 | if (params->enable) |
| 7592 | wmi_nlo_mawc_params->enable = 1; |
| 7593 | else |
| 7594 | wmi_nlo_mawc_params->enable = 0; |
| 7595 | wmi_nlo_mawc_params->exp_backoff_ratio = params->exp_backoff_ratio; |
| 7596 | wmi_nlo_mawc_params->init_scan_interval = params->init_scan_interval; |
| 7597 | wmi_nlo_mawc_params->max_scan_interval = params->max_scan_interval; |
Varun Reddy Yeturu | 7a8c337 | 2017-08-21 10:28:13 -0700 | [diff] [blame] | 7598 | WMI_LOGD(FL("MAWC NLO en=%d, vdev=%d, ratio=%d, SCAN init=%d, max=%d"), |
| 7599 | wmi_nlo_mawc_params->enable, wmi_nlo_mawc_params->vdev_id, |
| 7600 | wmi_nlo_mawc_params->exp_backoff_ratio, |
| 7601 | wmi_nlo_mawc_params->init_scan_interval, |
| 7602 | wmi_nlo_mawc_params->max_scan_interval); |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 7603 | |
| 7604 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7605 | len, WMI_NLO_CONFIGURE_MAWC_CMDID); |
| 7606 | if (QDF_IS_STATUS_ERROR(status)) { |
| 7607 | WMI_LOGE("WMI_NLO_CONFIGURE_MAWC_CMDID failed, Error %d", |
| 7608 | status); |
| 7609 | wmi_buf_free(buf); |
| 7610 | return QDF_STATUS_E_FAILURE; |
| 7611 | } |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 7612 | |
| 7613 | return QDF_STATUS_SUCCESS; |
| 7614 | } |
| 7615 | |
| 7616 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7617 | * send_pno_start_cmd_tlv() - PNO start request |
| 7618 | * @wmi_handle: wmi handle |
| 7619 | * @pno: PNO request |
| 7620 | * |
| 7621 | * This function request FW to start PNO request. |
| 7622 | * Request: CDF status |
| 7623 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7624 | 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] | 7625 | struct pno_scan_req_params *pno) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7626 | { |
| 7627 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 7628 | nlo_configured_parameters *nlo_list; |
| 7629 | uint32_t *channel_list; |
| 7630 | int32_t len; |
| 7631 | wmi_buf_t buf; |
| 7632 | uint8_t *buf_ptr; |
| 7633 | uint8_t i; |
| 7634 | int ret; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7635 | struct probe_req_whitelist_attr *ie_whitelist = &pno->ie_whitelist; |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7636 | connected_nlo_rssi_params *nlo_relative_rssi; |
| 7637 | connected_nlo_bss_band_rssi_pref *nlo_band_rssi; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7638 | |
| 7639 | /* |
| 7640 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 7641 | * TLV place holder for array of uint32_t channel_list |
| 7642 | * TLV place holder for chnnl prediction cfg |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7643 | * TLV place holder for array of wmi_vendor_oui |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7644 | * TLV place holder for array of connected_nlo_bss_band_rssi_pref |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7645 | */ |
| 7646 | len = sizeof(*cmd) + |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7647 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7648 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7649 | |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7650 | len += sizeof(uint32_t) * QDF_MIN(pno->networks_list[0].channel_cnt, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7651 | WMI_NLO_MAX_CHAN); |
| 7652 | len += sizeof(nlo_configured_parameters) * |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7653 | QDF_MIN(pno->networks_cnt, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7654 | len += sizeof(nlo_channel_prediction_cfg); |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7655 | len += sizeof(enlo_candidate_score_params); |
| 7656 | len += sizeof(wmi_vendor_oui) * ie_whitelist->num_vendor_oui; |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7657 | len += sizeof(connected_nlo_rssi_params); |
| 7658 | len += sizeof(connected_nlo_bss_band_rssi_pref); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7659 | |
| 7660 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7661 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7662 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7663 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7664 | } |
| 7665 | |
| 7666 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 7667 | |
| 7668 | buf_ptr = (uint8_t *) cmd; |
| 7669 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7670 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 7671 | WMITLV_GET_STRUCT_TLVLEN |
| 7672 | (wmi_nlo_config_cmd_fixed_param)); |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7673 | cmd->vdev_id = pno->vdev_id; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7674 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 7675 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7676 | #ifdef FEATURE_WLAN_SCAN_PNO |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 7677 | WMI_SCAN_SET_DWELL_MODE(cmd->flags, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7678 | pno->adaptive_dwell_mode); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7679 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7680 | /* Current FW does not support min-max range for dwell time */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7681 | cmd->active_dwell_time = pno->active_dwell_time; |
| 7682 | cmd->passive_dwell_time = pno->passive_dwell_time; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7683 | |
Manjeet Singh | cd2dc06 | 2016-08-11 15:31:34 +0530 | [diff] [blame] | 7684 | if (pno->do_passive_scan) |
| 7685 | cmd->flags |= WMI_NLO_CONFIG_SCAN_PASSIVE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7686 | /* Copy scan interval */ |
| 7687 | cmd->fast_scan_period = pno->fast_scan_period; |
| 7688 | cmd->slow_scan_period = pno->slow_scan_period; |
Arif Hussain | 17ff203 | 2017-03-02 11:56:04 -0800 | [diff] [blame] | 7689 | cmd->delay_start_time = WMI_SEC_TO_MSEC(pno->delay_start_time); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7690 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Dustin Brown | 9d86564 | 2017-04-24 10:47:42 -0700 | [diff] [blame] | 7691 | cmd->scan_backoff_multiplier = pno->scan_backoff_multiplier; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7692 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7693 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7694 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7695 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 7696 | /* mac randomization attributes */ |
| 7697 | if (pno->scan_random.randomize) { |
| 7698 | cmd->flags |= WMI_NLO_CONFIG_SPOOFED_MAC_IN_PROBE_REQ | |
| 7699 | WMI_NLO_CONFIG_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 7700 | wmi_copy_scan_random_mac(pno->scan_random.mac_addr, |
| 7701 | pno->scan_random.mac_mask, |
| 7702 | &cmd->mac_addr, |
| 7703 | &cmd->mac_mask); |
| 7704 | } |
| 7705 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7706 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 7707 | |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7708 | 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] | 7709 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7710 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7711 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 7712 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7713 | |
| 7714 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 7715 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 7716 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 7717 | WMITLV_TAG_ARRAY_BYTE, |
| 7718 | WMITLV_GET_STRUCT_TLVLEN |
| 7719 | (nlo_configured_parameters)); |
| 7720 | /* Copy ssid and it's length */ |
| 7721 | nlo_list[i].ssid.valid = true; |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7722 | nlo_list[i].ssid.ssid.ssid_len = |
| 7723 | pno->networks_list[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7724 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7725 | pno->networks_list[i].ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7726 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7727 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7728 | nlo_list[i].ssid.ssid.ssid_len, |
| 7729 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 7730 | nlo_list[i].ssid.ssid.ssid_len); |
| 7731 | |
| 7732 | /* Copy rssi threshold */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7733 | if (pno->networks_list[i].rssi_thresh && |
| 7734 | pno->networks_list[i].rssi_thresh > |
| 7735 | WMI_RSSI_THOLD_DEFAULT) { |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7736 | nlo_list[i].rssi_cond.valid = true; |
| 7737 | nlo_list[i].rssi_cond.rssi = |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7738 | pno->networks_list[i].rssi_thresh; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7739 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7740 | nlo_list[i].rssi_cond.rssi); |
| 7741 | } |
| 7742 | nlo_list[i].bcast_nw_type.valid = true; |
| 7743 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7744 | pno->networks_list[i].bc_new_type; |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 7745 | WMI_LOGD("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7746 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 7747 | } |
| 7748 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 7749 | |
| 7750 | /* Copy channel info */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7751 | cmd->num_of_channels = QDF_MIN(pno->networks_list[0].channel_cnt, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7752 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7753 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7754 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 7755 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 7756 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7757 | |
| 7758 | channel_list = (uint32_t *) buf_ptr; |
| 7759 | for (i = 0; i < cmd->num_of_channels; i++) { |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7760 | channel_list[i] = pno->networks_list[0].channels[i]; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7761 | |
| 7762 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7763 | channel_list[i] = |
| 7764 | wlan_chan_to_freq(pno-> |
| 7765 | networks_list[0].channels[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7766 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7767 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7768 | } |
| 7769 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 7770 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7771 | sizeof(nlo_channel_prediction_cfg)); |
| 7772 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7773 | wmi_set_pno_channel_prediction(buf_ptr, pno); |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7774 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7775 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 7776 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 7777 | */ |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7778 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 7779 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 7780 | buf_ptr += sizeof(enlo_candidate_score_params); |
| 7781 | |
| 7782 | if (ie_whitelist->white_list) { |
| 7783 | cmd->flags |= WMI_NLO_CONFIG_ENABLE_IE_WHITELIST_IN_PROBE_REQ; |
| 7784 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 7785 | &cmd->num_vendor_oui, |
| 7786 | ie_whitelist); |
| 7787 | } |
| 7788 | |
| 7789 | /* ie white list */ |
| 7790 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7791 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 7792 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7793 | if (cmd->num_vendor_oui != 0) { |
| 7794 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 7795 | ie_whitelist->voui); |
| 7796 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 7797 | } |
| 7798 | |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7799 | if (pno->relative_rssi_set) |
| 7800 | cmd->flags |= WMI_NLO_CONFIG_ENABLE_CNLO_RSSI_CONFIG; |
| 7801 | |
| 7802 | /* |
| 7803 | * Firmware calculation using connected PNO params: |
| 7804 | * New AP's RSSI >= (Connected AP's RSSI + relative_rssi +/- rssi_pref) |
| 7805 | * deduction of rssi_pref for chosen band_pref and |
| 7806 | * addition of rssi_pref for remaining bands (other than chosen band). |
| 7807 | */ |
| 7808 | nlo_relative_rssi = (connected_nlo_rssi_params *) buf_ptr; |
| 7809 | WMITLV_SET_HDR(&nlo_relative_rssi->tlv_header, |
| 7810 | WMITLV_TAG_STRUC_wmi_connected_nlo_rssi_params, |
| 7811 | WMITLV_GET_STRUCT_TLVLEN(connected_nlo_rssi_params)); |
| 7812 | nlo_relative_rssi->relative_rssi = pno->relative_rssi; |
| 7813 | WMI_LOGD("relative_rssi %d", nlo_relative_rssi->relative_rssi); |
| 7814 | buf_ptr += sizeof(*nlo_relative_rssi); |
| 7815 | |
| 7816 | /* |
| 7817 | * As of now Kernel and Host supports one band and rssi preference. |
| 7818 | * Firmware supports array of band and rssi preferences |
| 7819 | */ |
| 7820 | cmd->num_cnlo_band_pref = 1; |
| 7821 | WMITLV_SET_HDR(buf_ptr, |
| 7822 | WMITLV_TAG_ARRAY_STRUC, |
| 7823 | cmd->num_cnlo_band_pref * |
| 7824 | sizeof(connected_nlo_bss_band_rssi_pref)); |
| 7825 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7826 | |
| 7827 | nlo_band_rssi = (connected_nlo_bss_band_rssi_pref *) buf_ptr; |
| 7828 | for (i = 0; i < cmd->num_cnlo_band_pref; i++) { |
| 7829 | WMITLV_SET_HDR(&nlo_band_rssi[i].tlv_header, |
| 7830 | WMITLV_TAG_STRUC_wmi_connected_nlo_bss_band_rssi_pref, |
| 7831 | WMITLV_GET_STRUCT_TLVLEN( |
| 7832 | connected_nlo_bss_band_rssi_pref)); |
| 7833 | nlo_band_rssi[i].band = pno->band_rssi_pref.band; |
| 7834 | nlo_band_rssi[i].rssi_pref = pno->band_rssi_pref.rssi; |
| 7835 | WMI_LOGI("band_pref %d, rssi_pref %d", |
| 7836 | nlo_band_rssi[i].band, |
| 7837 | nlo_band_rssi[i].rssi_pref); |
| 7838 | } |
| 7839 | buf_ptr += cmd->num_cnlo_band_pref * sizeof(*nlo_band_rssi); |
| 7840 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7841 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7842 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 7843 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7844 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7845 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7846 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7847 | } |
| 7848 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7849 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7850 | } |
| 7851 | |
| 7852 | /* send_set_ric_req_cmd_tlv() - set ric request element |
| 7853 | * @wmi_handle: wmi handle |
| 7854 | * @msg: message |
| 7855 | * @is_add_ts: is addts required |
| 7856 | * |
| 7857 | * This function sets ric request element for 11r roaming. |
| 7858 | * |
| 7859 | * Return: CDF status |
| 7860 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7861 | 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] | 7862 | void *msg, uint8_t is_add_ts) |
| 7863 | { |
| 7864 | wmi_ric_request_fixed_param *cmd; |
| 7865 | wmi_ric_tspec *tspec_param; |
| 7866 | wmi_buf_t buf; |
| 7867 | uint8_t *buf_ptr; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7868 | struct mac_tspec_ie *ptspecIE = NULL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7869 | int32_t len = sizeof(wmi_ric_request_fixed_param) + |
| 7870 | WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec); |
| 7871 | |
| 7872 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7873 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7874 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 7875 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7876 | } |
| 7877 | |
| 7878 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7879 | |
| 7880 | cmd = (wmi_ric_request_fixed_param *) buf_ptr; |
| 7881 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7882 | WMITLV_TAG_STRUC_wmi_ric_request_fixed_param, |
| 7883 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param)); |
| 7884 | if (is_add_ts) |
Deepak Dhamdhere | 990df85 | 2017-04-24 16:17:48 -0700 | [diff] [blame] | 7885 | cmd->vdev_id = ((struct add_ts_param *) msg)->sme_session_id; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7886 | else |
| 7887 | cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId; |
| 7888 | cmd->num_ric_request = 1; |
| 7889 | cmd->is_add_ric = is_add_ts; |
| 7890 | |
| 7891 | buf_ptr += sizeof(wmi_ric_request_fixed_param); |
| 7892 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec)); |
| 7893 | |
| 7894 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7895 | tspec_param = (wmi_ric_tspec *) buf_ptr; |
| 7896 | WMITLV_SET_HDR(&tspec_param->tlv_header, |
| 7897 | WMITLV_TAG_STRUC_wmi_ric_tspec, |
| 7898 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec)); |
| 7899 | |
| 7900 | if (is_add_ts) |
| 7901 | ptspecIE = &(((struct add_ts_param *) msg)->tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7902 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7903 | else |
| 7904 | ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7905 | #endif |
| 7906 | if (ptspecIE) { |
| 7907 | /* Fill the tsinfo in the format expected by firmware */ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7908 | #ifndef ANI_LITTLE_BIT_ENDIAN |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7909 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1, |
| 7910 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7911 | #else |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7912 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info), |
| 7913 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7914 | #endif /* ANI_LITTLE_BIT_ENDIAN */ |
| 7915 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7916 | tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz; |
| 7917 | tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz; |
| 7918 | tspec_param->min_service_interval = ptspecIE->minSvcInterval; |
| 7919 | tspec_param->max_service_interval = ptspecIE->maxSvcInterval; |
| 7920 | tspec_param->inactivity_interval = ptspecIE->inactInterval; |
| 7921 | tspec_param->suspension_interval = ptspecIE->suspendInterval; |
| 7922 | tspec_param->svc_start_time = ptspecIE->svcStartTime; |
| 7923 | tspec_param->min_data_rate = ptspecIE->minDataRate; |
| 7924 | tspec_param->mean_data_rate = ptspecIE->meanDataRate; |
| 7925 | tspec_param->peak_data_rate = ptspecIE->peakDataRate; |
| 7926 | tspec_param->max_burst_size = ptspecIE->maxBurstSz; |
| 7927 | tspec_param->delay_bound = ptspecIE->delayBound; |
| 7928 | tspec_param->min_phy_rate = ptspecIE->minPhyRate; |
| 7929 | tspec_param->surplus_bw_allowance = ptspecIE->surplusBw; |
| 7930 | tspec_param->medium_time = 0; |
| 7931 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7932 | 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] | 7933 | |
| 7934 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7935 | WMI_ROAM_SET_RIC_REQUEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7936 | WMI_LOGP("%s: Failed to send vdev Set RIC Req command", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7937 | __func__); |
| 7938 | if (is_add_ts) |
| 7939 | ((struct add_ts_param *) msg)->status = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7940 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7941 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7942 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7943 | } |
| 7944 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7945 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7946 | } |
| 7947 | |
| 7948 | /** |
| 7949 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 7950 | * @wmi_handle: wmi handle |
| 7951 | * @clear_req: ll stats clear request command params |
| 7952 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7953 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7954 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7955 | 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] | 7956 | const struct ll_stats_clear_params *clear_req, |
| 7957 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7958 | { |
| 7959 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 7960 | int32_t len; |
| 7961 | wmi_buf_t buf; |
| 7962 | uint8_t *buf_ptr; |
| 7963 | int ret; |
| 7964 | |
| 7965 | len = sizeof(*cmd); |
| 7966 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7967 | |
| 7968 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7969 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7970 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7971 | } |
| 7972 | |
| 7973 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7974 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7975 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 7976 | |
| 7977 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7978 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 7979 | WMITLV_GET_STRUCT_TLVLEN |
| 7980 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 7981 | |
| 7982 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 7983 | cmd->vdev_id = clear_req->sta_id; |
| 7984 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 7985 | |
| 7986 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 7987 | &cmd->peer_macaddr); |
| 7988 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7989 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
| 7990 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 7991 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
| 7992 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 7993 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7994 | cmd->peer_macaddr); */ |
| 7995 | |
| 7996 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7997 | WMI_CLEAR_LINK_STATS_CMDID); |
| 7998 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7999 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8000 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8001 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8002 | } |
| 8003 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8004 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 8005 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8006 | } |
| 8007 | |
| 8008 | /** |
| 8009 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 8010 | * @wmi_handle: wmi handle |
| 8011 | * @setReq: ll stats set request command params |
| 8012 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8013 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8014 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8015 | 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] | 8016 | const struct ll_stats_set_params *set_req) |
| 8017 | { |
| 8018 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 8019 | int32_t len; |
| 8020 | wmi_buf_t buf; |
| 8021 | uint8_t *buf_ptr; |
| 8022 | int ret; |
| 8023 | |
| 8024 | len = sizeof(*cmd); |
| 8025 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8026 | |
| 8027 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8028 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8029 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8030 | } |
| 8031 | |
| 8032 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8033 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8034 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 8035 | |
| 8036 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8037 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 8038 | WMITLV_GET_STRUCT_TLVLEN |
| 8039 | (wmi_start_link_stats_cmd_fixed_param)); |
| 8040 | |
| 8041 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 8042 | cmd->aggressive_statistics_gathering = |
| 8043 | set_req->aggressive_statistics_gathering; |
| 8044 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8045 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 8046 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 8047 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8048 | |
| 8049 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8050 | WMI_START_LINK_STATS_CMDID); |
| 8051 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8052 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8053 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8054 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8055 | } |
| 8056 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8057 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8058 | } |
| 8059 | |
| 8060 | /** |
| 8061 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 8062 | * @wmi_handle:wmi handle |
| 8063 | * @get_req:ll stats get request command params |
| 8064 | * @addr: mac address |
| 8065 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8066 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8067 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8068 | 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] | 8069 | const struct ll_stats_get_params *get_req, |
| 8070 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 8071 | { |
| 8072 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 8073 | int32_t len; |
| 8074 | wmi_buf_t buf; |
| 8075 | uint8_t *buf_ptr; |
| 8076 | int ret; |
| 8077 | |
| 8078 | len = sizeof(*cmd); |
| 8079 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8080 | |
Himanshu Agarwal | ac3869b | 2016-06-30 18:04:14 +0530 | [diff] [blame] | 8081 | if (!buf) { |
| 8082 | WMI_LOGE("%s: buf allocation failed", __func__); |
| 8083 | return QDF_STATUS_E_NOMEM; |
| 8084 | } |
| 8085 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8086 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8087 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8088 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 8089 | |
| 8090 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8091 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 8092 | WMITLV_GET_STRUCT_TLVLEN |
| 8093 | (wmi_request_link_stats_cmd_fixed_param)); |
| 8094 | |
| 8095 | cmd->request_id = get_req->req_id; |
| 8096 | cmd->stats_type = get_req->param_id_mask; |
| 8097 | cmd->vdev_id = get_req->sta_id; |
| 8098 | |
| 8099 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 8100 | &cmd->peer_macaddr); |
| 8101 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8102 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
Krishna Kumaar Natarajan | f6a996c | 2017-03-10 17:24:55 -0800 | [diff] [blame] | 8103 | WMI_LOGD("Request ID : %u", cmd->request_id); |
| 8104 | WMI_LOGD("Stats Type : %0x", cmd->stats_type); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8105 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
| 8106 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8107 | |
| 8108 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8109 | WMI_REQUEST_LINK_STATS_CMDID); |
| 8110 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8111 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8112 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8113 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8114 | } |
| 8115 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8116 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8117 | } |
| 8118 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 8119 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8120 | /** |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 8121 | * send_congestion_cmd_tlv() - send request to fw to get CCA |
| 8122 | * @wmi_handle: wmi handle |
| 8123 | * @vdev_id: vdev id |
| 8124 | * |
| 8125 | * Return: CDF status |
| 8126 | */ |
| 8127 | static QDF_STATUS send_congestion_cmd_tlv(wmi_unified_t wmi_handle, |
| 8128 | A_UINT8 vdev_id) |
| 8129 | { |
| 8130 | wmi_buf_t buf; |
| 8131 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8132 | uint8_t len; |
| 8133 | uint8_t *buf_ptr; |
| 8134 | |
| 8135 | len = sizeof(*cmd); |
| 8136 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8137 | if (!buf) { |
| 8138 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 8139 | return QDF_STATUS_E_FAILURE; |
| 8140 | } |
| 8141 | |
| 8142 | buf_ptr = wmi_buf_data(buf); |
| 8143 | cmd = (wmi_request_stats_cmd_fixed_param *)buf_ptr; |
| 8144 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8145 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8146 | WMITLV_GET_STRUCT_TLVLEN |
| 8147 | (wmi_request_stats_cmd_fixed_param)); |
| 8148 | |
| 8149 | cmd->stats_id = WMI_REQUEST_CONGESTION_STAT; |
| 8150 | cmd->vdev_id = vdev_id; |
| 8151 | WMI_LOGD("STATS REQ VDEV_ID:%d stats_id %d -->", |
| 8152 | cmd->vdev_id, cmd->stats_id); |
| 8153 | |
| 8154 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8155 | WMI_REQUEST_STATS_CMDID)) { |
| 8156 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
| 8157 | __func__); |
| 8158 | wmi_buf_free(buf); |
| 8159 | return QDF_STATUS_E_FAILURE; |
| 8160 | } |
| 8161 | |
| 8162 | return QDF_STATUS_SUCCESS; |
| 8163 | } |
| 8164 | |
| 8165 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8166 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 8167 | * @wmi_handle: wmi handle |
| 8168 | * @rssi_req: get RSSI request |
| 8169 | * |
| 8170 | * Return: CDF status |
| 8171 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8172 | 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] | 8173 | { |
| 8174 | wmi_buf_t buf; |
| 8175 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8176 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 8177 | |
| 8178 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8179 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8180 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8181 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8182 | } |
| 8183 | |
| 8184 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 8185 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8186 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8187 | WMITLV_GET_STRUCT_TLVLEN |
| 8188 | (wmi_request_stats_cmd_fixed_param)); |
| 8189 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 8190 | if (wmi_unified_cmd_send |
| 8191 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8192 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8193 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8194 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8195 | } |
| 8196 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8197 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8198 | } |
| 8199 | |
| 8200 | /** |
| 8201 | * send_snr_cmd_tlv() - get RSSI from fw |
| 8202 | * @wmi_handle: wmi handle |
| 8203 | * @vdev_id: vdev id |
| 8204 | * |
| 8205 | * Return: CDF status |
| 8206 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8207 | 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] | 8208 | { |
| 8209 | wmi_buf_t buf; |
| 8210 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8211 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 8212 | |
| 8213 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8214 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8215 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8216 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8217 | } |
| 8218 | |
| 8219 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 8220 | cmd->vdev_id = vdev_id; |
| 8221 | |
| 8222 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8223 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8224 | WMITLV_GET_STRUCT_TLVLEN |
| 8225 | (wmi_request_stats_cmd_fixed_param)); |
| 8226 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 8227 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8228 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8229 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8230 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8231 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8232 | } |
| 8233 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8234 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8235 | } |
| 8236 | |
| 8237 | /** |
| 8238 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 8239 | * @wmi_handle: wmi handle |
| 8240 | * @link_status: get link params |
| 8241 | * |
| 8242 | * Return: CDF status |
| 8243 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8244 | 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] | 8245 | struct link_status_params *link_status) |
| 8246 | { |
| 8247 | wmi_buf_t buf; |
| 8248 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8249 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 8250 | |
| 8251 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8252 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8253 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8254 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8255 | } |
| 8256 | |
| 8257 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 8258 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8259 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8260 | WMITLV_GET_STRUCT_TLVLEN |
| 8261 | (wmi_request_stats_cmd_fixed_param)); |
| 8262 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 8263 | cmd->vdev_id = link_status->session_id; |
| 8264 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8265 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8266 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8267 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8268 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8269 | } |
| 8270 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8271 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8272 | } |
| 8273 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8274 | /** |
| 8275 | * send_process_dhcp_ind_cmd_tlv() - process dhcp indication from SME |
| 8276 | * @wmi_handle: wmi handle |
| 8277 | * @ta_dhcp_ind: DHCP indication parameter |
| 8278 | * |
| 8279 | * Return: CDF Status |
| 8280 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8281 | 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] | 8282 | wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind) |
| 8283 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8284 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8285 | wmi_buf_t buf = NULL; |
| 8286 | uint8_t *buf_ptr; |
| 8287 | wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp; |
| 8288 | int len = sizeof(wmi_peer_set_param_cmd_fixed_param); |
| 8289 | |
| 8290 | |
| 8291 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8292 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8293 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8294 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8295 | } |
| 8296 | |
| 8297 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8298 | peer_set_param_fp = (wmi_peer_set_param_cmd_fixed_param *) buf_ptr; |
| 8299 | WMITLV_SET_HDR(&peer_set_param_fp->tlv_header, |
| 8300 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 8301 | WMITLV_GET_STRUCT_TLVLEN |
| 8302 | (wmi_peer_set_param_cmd_fixed_param)); |
| 8303 | |
| 8304 | /* fill in values */ |
| 8305 | peer_set_param_fp->vdev_id = ta_dhcp_ind->vdev_id; |
| 8306 | peer_set_param_fp->param_id = ta_dhcp_ind->param_id; |
| 8307 | peer_set_param_fp->param_value = ta_dhcp_ind->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8308 | qdf_mem_copy(&peer_set_param_fp->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8309 | &ta_dhcp_ind->peer_macaddr, |
| 8310 | sizeof(ta_dhcp_ind->peer_macaddr)); |
| 8311 | |
| 8312 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8313 | len, WMI_PEER_SET_PARAM_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 8314 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8315 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8316 | " returned Error %d", __func__, status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 8317 | wmi_buf_free(buf); |
| 8318 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8319 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8320 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8321 | } |
| 8322 | |
| 8323 | /** |
| 8324 | * send_get_link_speed_cmd_tlv() -send command to get linkspeed |
| 8325 | * @wmi_handle: wmi handle |
| 8326 | * @pLinkSpeed: link speed info |
| 8327 | * |
| 8328 | * Return: CDF status |
| 8329 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8330 | 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] | 8331 | wmi_mac_addr peer_macaddr) |
| 8332 | { |
| 8333 | wmi_peer_get_estimated_linkspeed_cmd_fixed_param *cmd; |
| 8334 | wmi_buf_t wmi_buf; |
| 8335 | uint32_t len; |
| 8336 | uint8_t *buf_ptr; |
| 8337 | |
| 8338 | len = sizeof(wmi_peer_get_estimated_linkspeed_cmd_fixed_param); |
| 8339 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8340 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8341 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8342 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8343 | } |
| 8344 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 8345 | |
| 8346 | cmd = (wmi_peer_get_estimated_linkspeed_cmd_fixed_param *) buf_ptr; |
| 8347 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8348 | WMITLV_TAG_STRUC_wmi_peer_get_estimated_linkspeed_cmd_fixed_param, |
| 8349 | WMITLV_GET_STRUCT_TLVLEN |
| 8350 | (wmi_peer_get_estimated_linkspeed_cmd_fixed_param)); |
| 8351 | |
| 8352 | /* Copy the peer macaddress to the wma buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8353 | qdf_mem_copy(&cmd->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8354 | &peer_macaddr, |
| 8355 | sizeof(peer_macaddr)); |
| 8356 | |
| 8357 | |
| 8358 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8359 | WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8360 | WMI_LOGE("%s: failed to send link speed command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8361 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8362 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8363 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8364 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8365 | } |
| 8366 | |
| 8367 | /** |
| 8368 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 8369 | * @wmi_handle: wmi handler |
| 8370 | * @egap_params: pointer to egap_params |
| 8371 | * |
| 8372 | * Return: 0 for success, otherwise appropriate error code |
| 8373 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8374 | 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] | 8375 | wmi_ap_ps_egap_param_cmd_fixed_param *egap_params) |
| 8376 | { |
| 8377 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 8378 | wmi_buf_t buf; |
| 8379 | int32_t err; |
| 8380 | |
| 8381 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8382 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8383 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 8384 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8385 | } |
| 8386 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 8387 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8388 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 8389 | WMITLV_GET_STRUCT_TLVLEN( |
| 8390 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 8391 | |
| 8392 | cmd->enable = egap_params->enable; |
| 8393 | cmd->inactivity_time = egap_params->inactivity_time; |
| 8394 | cmd->wait_time = egap_params->wait_time; |
| 8395 | cmd->flags = egap_params->flags; |
| 8396 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 8397 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 8398 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8399 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8400 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8401 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8402 | } |
| 8403 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8404 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8405 | } |
| 8406 | |
| 8407 | /** |
| 8408 | * send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW |
| 8409 | * @wmi_handl: wmi handle |
| 8410 | * @cmd: Profiling command index |
| 8411 | * @value1: parameter1 value |
| 8412 | * @value2: parameter2 value |
| 8413 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8414 | * Return: QDF_STATUS_SUCCESS for success else error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8415 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8416 | 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] | 8417 | uint32_t cmd, uint32_t value1, uint32_t value2) |
| 8418 | { |
| 8419 | wmi_buf_t buf; |
| 8420 | int32_t len = 0; |
| 8421 | int ret; |
| 8422 | wmi_wlan_profile_trigger_cmd_fixed_param *prof_trig_cmd; |
| 8423 | wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *hist_intvl_cmd; |
| 8424 | wmi_wlan_profile_enable_profile_id_cmd_fixed_param *profile_enable_cmd; |
| 8425 | wmi_wlan_profile_get_prof_data_cmd_fixed_param *profile_getdata_cmd; |
| 8426 | |
| 8427 | switch (cmd) { |
| 8428 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
| 8429 | len = sizeof(wmi_wlan_profile_trigger_cmd_fixed_param); |
| 8430 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8431 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8432 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8433 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8434 | } |
| 8435 | prof_trig_cmd = |
| 8436 | (wmi_wlan_profile_trigger_cmd_fixed_param *) |
| 8437 | wmi_buf_data(buf); |
| 8438 | WMITLV_SET_HDR(&prof_trig_cmd->tlv_header, |
| 8439 | WMITLV_TAG_STRUC_wmi_wlan_profile_trigger_cmd_fixed_param, |
| 8440 | WMITLV_GET_STRUCT_TLVLEN |
| 8441 | (wmi_wlan_profile_trigger_cmd_fixed_param)); |
| 8442 | prof_trig_cmd->enable = value1; |
| 8443 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8444 | WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 8445 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8446 | WMI_LOGE("PROFILE_TRIGGER cmd Failed with value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8447 | value1); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8448 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8449 | return ret; |
| 8450 | } |
| 8451 | break; |
| 8452 | |
| 8453 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
| 8454 | len = sizeof(wmi_wlan_profile_get_prof_data_cmd_fixed_param); |
| 8455 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8456 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8457 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8458 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8459 | } |
| 8460 | profile_getdata_cmd = |
| 8461 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param *) |
| 8462 | wmi_buf_data(buf); |
| 8463 | WMITLV_SET_HDR(&profile_getdata_cmd->tlv_header, |
| 8464 | WMITLV_TAG_STRUC_wmi_wlan_profile_get_prof_data_cmd_fixed_param, |
| 8465 | WMITLV_GET_STRUCT_TLVLEN |
| 8466 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param)); |
| 8467 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8468 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 8469 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8470 | WMI_LOGE("PROFILE_DATA cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8471 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8472 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8473 | return ret; |
| 8474 | } |
| 8475 | break; |
| 8476 | |
| 8477 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
| 8478 | len = sizeof(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param); |
| 8479 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8480 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8481 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8482 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8483 | } |
| 8484 | hist_intvl_cmd = |
| 8485 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *) |
| 8486 | wmi_buf_data(buf); |
| 8487 | WMITLV_SET_HDR(&hist_intvl_cmd->tlv_header, |
| 8488 | WMITLV_TAG_STRUC_wmi_wlan_profile_set_hist_intvl_cmd_fixed_param, |
| 8489 | WMITLV_GET_STRUCT_TLVLEN |
| 8490 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param)); |
| 8491 | hist_intvl_cmd->profile_id = value1; |
| 8492 | hist_intvl_cmd->value = value2; |
| 8493 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8494 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 8495 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8496 | WMI_LOGE("HIST_INTVL cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8497 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8498 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8499 | return ret; |
| 8500 | } |
| 8501 | break; |
| 8502 | |
| 8503 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
| 8504 | len = |
| 8505 | sizeof(wmi_wlan_profile_enable_profile_id_cmd_fixed_param); |
| 8506 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8507 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8508 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8509 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8510 | } |
| 8511 | profile_enable_cmd = |
| 8512 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param *) |
| 8513 | wmi_buf_data(buf); |
| 8514 | WMITLV_SET_HDR(&profile_enable_cmd->tlv_header, |
| 8515 | WMITLV_TAG_STRUC_wmi_wlan_profile_enable_profile_id_cmd_fixed_param, |
| 8516 | WMITLV_GET_STRUCT_TLVLEN |
| 8517 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param)); |
| 8518 | profile_enable_cmd->profile_id = value1; |
| 8519 | profile_enable_cmd->enable = value2; |
| 8520 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8521 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 8522 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8523 | WMI_LOGE("enable cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8524 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8525 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8526 | return ret; |
| 8527 | } |
| 8528 | break; |
| 8529 | |
| 8530 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8531 | WMI_LOGD("%s: invalid profiling command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8532 | break; |
| 8533 | } |
| 8534 | |
| 8535 | return 0; |
| 8536 | } |
| 8537 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8538 | /** |
| 8539 | * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter |
| 8540 | * @wmi_handle: wmi handle |
| 8541 | * @vdev_id: vdev id |
| 8542 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8543 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8544 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8545 | 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] | 8546 | { |
| 8547 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *cmd; |
| 8548 | wmi_buf_t buf; |
| 8549 | int32_t len = sizeof(*cmd); |
| 8550 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8551 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8552 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8553 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8554 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8555 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8556 | } |
| 8557 | cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *) |
| 8558 | wmi_buf_data(buf); |
| 8559 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8560 | WMITLV_TAG_STRUC_WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param, |
| 8561 | WMITLV_GET_STRUCT_TLVLEN |
| 8562 | (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param)); |
| 8563 | cmd->vdev_id = vdev_id; |
| 8564 | cmd->action = IPSEC_NATKEEPALIVE_FILTER_ENABLE; |
| 8565 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8566 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8567 | WMI_LOGP("%s: Failed to send NAT keepalive enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8568 | __func__); |
| 8569 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8570 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8571 | } |
| 8572 | |
| 8573 | return 0; |
| 8574 | } |
| 8575 | |
| 8576 | /** |
| 8577 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 8578 | * @wmi_handle: wmi handle |
| 8579 | * @vdev_id: vdev id |
| 8580 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8581 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8582 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8583 | 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] | 8584 | uint8_t vdev_id) |
| 8585 | { |
| 8586 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 8587 | wmi_buf_t buf; |
| 8588 | int32_t len = sizeof(*cmd); |
| 8589 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8590 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8591 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8592 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8593 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8594 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8595 | } |
| 8596 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 8597 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8598 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 8599 | WMITLV_GET_STRUCT_TLVLEN |
| 8600 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 8601 | cmd->vdev_id = vdev_id; |
| 8602 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
| 8603 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8604 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8605 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8606 | __func__); |
| 8607 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8608 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8609 | } |
| 8610 | |
| 8611 | return 0; |
| 8612 | } |
| 8613 | |
Naveen Rawat | 42cd1e6 | 2017-05-13 15:56:57 -0700 | [diff] [blame] | 8614 | #ifdef WLAN_FEATURE_CIF_CFR |
| 8615 | /** |
| 8616 | * send_oem_dma_cfg_cmd_tlv() - configure OEM DMA rings |
| 8617 | * @wmi_handle: wmi handle |
| 8618 | * @data_len: len of dma cfg req |
| 8619 | * @data: dma cfg req |
| 8620 | * |
| 8621 | * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure |
| 8622 | */ |
| 8623 | static QDF_STATUS send_oem_dma_cfg_cmd_tlv(wmi_unified_t wmi_handle, |
| 8624 | wmi_oem_dma_ring_cfg_req_fixed_param *cfg) |
| 8625 | { |
| 8626 | wmi_buf_t buf; |
| 8627 | uint8_t *cmd; |
| 8628 | QDF_STATUS ret; |
| 8629 | |
| 8630 | WMITLV_SET_HDR(cfg, |
| 8631 | WMITLV_TAG_STRUC_wmi_oem_dma_ring_cfg_req_fixed_param, |
| 8632 | (sizeof(*cfg) - WMI_TLV_HDR_SIZE)); |
| 8633 | |
| 8634 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cfg)); |
| 8635 | if (!buf) { |
| 8636 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 8637 | return QDF_STATUS_E_FAILURE; |
| 8638 | } |
| 8639 | |
| 8640 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 8641 | qdf_mem_copy(cmd, cfg, sizeof(*cfg)); |
| 8642 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %lu"), |
| 8643 | sizeof(*cfg)); |
| 8644 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cfg), |
| 8645 | WMI_OEM_DMA_RING_CFG_REQ_CMDID); |
| 8646 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 8647 | WMI_LOGE(FL(":wmi cmd send failed")); |
| 8648 | wmi_buf_free(buf); |
| 8649 | } |
| 8650 | |
| 8651 | return ret; |
| 8652 | } |
| 8653 | #endif |
| 8654 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8655 | /** |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 8656 | * send_start_11d_scan_cmd_tlv() - start 11d scan request |
| 8657 | * @wmi_handle: wmi handle |
| 8658 | * @start_11d_scan: 11d scan start request parameters |
| 8659 | * |
| 8660 | * This function request FW to start 11d scan. |
| 8661 | * |
| 8662 | * Return: QDF status |
| 8663 | */ |
| 8664 | static QDF_STATUS send_start_11d_scan_cmd_tlv(wmi_unified_t wmi_handle, |
| 8665 | struct reg_start_11d_scan_req *start_11d_scan) |
| 8666 | { |
| 8667 | wmi_11d_scan_start_cmd_fixed_param *cmd; |
| 8668 | int32_t len; |
| 8669 | wmi_buf_t buf; |
| 8670 | int ret; |
| 8671 | |
| 8672 | len = sizeof(*cmd); |
| 8673 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8674 | if (!buf) { |
| 8675 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8676 | return QDF_STATUS_E_NOMEM; |
| 8677 | } |
| 8678 | |
| 8679 | cmd = (wmi_11d_scan_start_cmd_fixed_param *)wmi_buf_data(buf); |
| 8680 | |
| 8681 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8682 | WMITLV_TAG_STRUC_wmi_11d_scan_start_cmd_fixed_param, |
| 8683 | WMITLV_GET_STRUCT_TLVLEN |
| 8684 | (wmi_11d_scan_start_cmd_fixed_param)); |
| 8685 | |
| 8686 | cmd->vdev_id = start_11d_scan->vdev_id; |
| 8687 | cmd->scan_period_msec = start_11d_scan->scan_period_msec; |
| 8688 | cmd->start_interval_msec = start_11d_scan->start_interval_msec; |
| 8689 | |
| 8690 | WMI_LOGD("vdev %d sending 11D scan start req", cmd->vdev_id); |
| 8691 | |
| 8692 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8693 | WMI_11D_SCAN_START_CMDID); |
| 8694 | if (ret) { |
| 8695 | WMI_LOGE("%s: Failed to send start 11d scan wmi cmd", __func__); |
| 8696 | wmi_buf_free(buf); |
| 8697 | return QDF_STATUS_E_FAILURE; |
| 8698 | } |
| 8699 | |
| 8700 | return QDF_STATUS_SUCCESS; |
| 8701 | } |
| 8702 | |
| 8703 | /** |
| 8704 | * send_stop_11d_scan_cmd_tlv() - stop 11d scan request |
| 8705 | * @wmi_handle: wmi handle |
| 8706 | * @start_11d_scan: 11d scan stop request parameters |
| 8707 | * |
| 8708 | * This function request FW to stop 11d scan. |
| 8709 | * |
| 8710 | * Return: QDF status |
| 8711 | */ |
| 8712 | static QDF_STATUS send_stop_11d_scan_cmd_tlv(wmi_unified_t wmi_handle, |
| 8713 | struct reg_stop_11d_scan_req *stop_11d_scan) |
| 8714 | { |
| 8715 | wmi_11d_scan_stop_cmd_fixed_param *cmd; |
| 8716 | int32_t len; |
| 8717 | wmi_buf_t buf; |
| 8718 | int ret; |
| 8719 | |
| 8720 | len = sizeof(*cmd); |
| 8721 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8722 | if (!buf) { |
| 8723 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8724 | return QDF_STATUS_E_NOMEM; |
| 8725 | } |
| 8726 | |
| 8727 | cmd = (wmi_11d_scan_stop_cmd_fixed_param *)wmi_buf_data(buf); |
| 8728 | |
| 8729 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8730 | WMITLV_TAG_STRUC_wmi_11d_scan_stop_cmd_fixed_param, |
| 8731 | WMITLV_GET_STRUCT_TLVLEN |
| 8732 | (wmi_11d_scan_stop_cmd_fixed_param)); |
| 8733 | |
| 8734 | cmd->vdev_id = stop_11d_scan->vdev_id; |
| 8735 | |
| 8736 | WMI_LOGD("vdev %d sending 11D scan stop req", cmd->vdev_id); |
| 8737 | |
| 8738 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8739 | WMI_11D_SCAN_STOP_CMDID); |
| 8740 | if (ret) { |
| 8741 | WMI_LOGE("%s: Failed to send stop 11d scan wmi cmd", __func__); |
| 8742 | wmi_buf_free(buf); |
| 8743 | return QDF_STATUS_E_FAILURE; |
| 8744 | } |
| 8745 | |
| 8746 | return QDF_STATUS_SUCCESS; |
| 8747 | } |
| 8748 | |
| 8749 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8750 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 8751 | * @wmi_handle: wmi handle |
| 8752 | * @startOemDataReq: start request params |
| 8753 | * |
| 8754 | * Return: CDF status |
| 8755 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8756 | 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] | 8757 | uint32_t data_len, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8758 | uint8_t *data) |
| 8759 | { |
| 8760 | wmi_buf_t buf; |
| 8761 | uint8_t *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8762 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8763 | |
| 8764 | buf = wmi_buf_alloc(wmi_handle, |
| 8765 | (data_len + WMI_TLV_HDR_SIZE)); |
| 8766 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8767 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 8768 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8769 | } |
| 8770 | |
| 8771 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 8772 | |
| 8773 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 8774 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8775 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8776 | data_len); |
| 8777 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 8778 | WMI_LOGD(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8779 | data_len); |
| 8780 | |
| 8781 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 8782 | (data_len + |
| 8783 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 8784 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8785 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8786 | WMI_LOGE(FL(":wmi cmd send failed")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8787 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8788 | } |
| 8789 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8790 | return ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8791 | } |
| 8792 | |
| 8793 | /** |
| 8794 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 8795 | * @wmi_handle: wmi handle |
| 8796 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 8797 | * |
| 8798 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 8799 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 8800 | * to firmware based on phyerr filtering |
| 8801 | * offload status. |
| 8802 | * |
| 8803 | * Return: 1 success, 0 failure |
| 8804 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8805 | static QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8806 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 8807 | bool dfs_phyerr_filter_offload) |
| 8808 | { |
| 8809 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 8810 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 8811 | wmi_buf_t buf; |
| 8812 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8813 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8814 | |
| 8815 | |
Arif Hussain | 4ab1c4c | 2016-06-30 15:57:49 -0700 | [diff] [blame] | 8816 | if (false == dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8817 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8818 | __func__); |
| 8819 | len = sizeof(*disable_phyerr_offload_cmd); |
| 8820 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8821 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8822 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8823 | return 0; |
| 8824 | } |
| 8825 | disable_phyerr_offload_cmd = |
| 8826 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 8827 | wmi_buf_data(buf); |
| 8828 | |
| 8829 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 8830 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 8831 | WMITLV_GET_STRUCT_TLVLEN |
| 8832 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 8833 | |
| 8834 | /* |
| 8835 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 8836 | * to the firmware to disable the phyerror |
| 8837 | * filtering offload. |
| 8838 | */ |
| 8839 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8840 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8841 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8842 | 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] | 8843 | __func__, ret); |
| 8844 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8845 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8846 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8847 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8848 | __func__); |
| 8849 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8850 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8851 | __func__); |
| 8852 | |
| 8853 | len = sizeof(*enable_phyerr_offload_cmd); |
| 8854 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8855 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8856 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8857 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8858 | } |
| 8859 | |
| 8860 | enable_phyerr_offload_cmd = |
| 8861 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 8862 | wmi_buf_data(buf); |
| 8863 | |
| 8864 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 8865 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 8866 | WMITLV_GET_STRUCT_TLVLEN |
| 8867 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 8868 | |
| 8869 | /* |
| 8870 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 8871 | * to the firmware to enable the phyerror |
| 8872 | * filtering offload. |
| 8873 | */ |
| 8874 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8875 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 8876 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8877 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8878 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8879 | __func__, ret); |
| 8880 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8881 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8882 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8883 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8884 | __func__); |
| 8885 | } |
| 8886 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8887 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8888 | } |
| 8889 | |
| 8890 | #if !defined(REMOVE_PKT_LOG) |
| 8891 | /** |
| 8892 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 8893 | * @wmi_handle: wmi handle |
| 8894 | * @pktlog_event: pktlog event |
| 8895 | * @cmd_id: pktlog cmd id |
| 8896 | * |
| 8897 | * Return: CDF status |
| 8898 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8899 | 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] | 8900 | WMI_PKTLOG_EVENT pktlog_event, |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 8901 | WMI_CMD_ID cmd_id, uint8_t user_triggered) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8902 | { |
| 8903 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 8904 | WMI_CMD_ID CMD_ID; |
| 8905 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 8906 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 8907 | int len = 0; |
| 8908 | wmi_buf_t buf; |
| 8909 | |
| 8910 | PKTLOG_EVENT = pktlog_event; |
| 8911 | CMD_ID = cmd_id; |
| 8912 | |
| 8913 | switch (CMD_ID) { |
| 8914 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 8915 | len = sizeof(*cmd); |
| 8916 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8917 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8918 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8919 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8920 | } |
| 8921 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 8922 | wmi_buf_data(buf); |
| 8923 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8924 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 8925 | WMITLV_GET_STRUCT_TLVLEN |
| 8926 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 8927 | cmd->evlist = PKTLOG_EVENT; |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 8928 | cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE |
| 8929 | : WMI_PKTLOG_ENABLE_AUTO; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 8930 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 8931 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8932 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8933 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8934 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8935 | goto wmi_send_failed; |
| 8936 | } |
| 8937 | break; |
| 8938 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 8939 | len = sizeof(*disable_cmd); |
| 8940 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8941 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8942 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8943 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8944 | } |
| 8945 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 8946 | wmi_buf_data(buf); |
| 8947 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 8948 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 8949 | WMITLV_GET_STRUCT_TLVLEN |
| 8950 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 8951 | disable_cmd->pdev_id = |
| 8952 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 8953 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8954 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8955 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8956 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8957 | goto wmi_send_failed; |
| 8958 | } |
| 8959 | break; |
| 8960 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8961 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8962 | break; |
| 8963 | } |
| 8964 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8965 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8966 | |
| 8967 | wmi_send_failed: |
| 8968 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8969 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8970 | } |
| 8971 | #endif /* REMOVE_PKT_LOG */ |
| 8972 | |
| 8973 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8974 | * send_wow_delete_pattern_cmd_tlv() - delete wow pattern in target |
| 8975 | * @wmi_handle: wmi handle |
| 8976 | * @ptrn_id: pattern id |
| 8977 | * @vdev_id: vdev id |
| 8978 | * |
| 8979 | * Return: CDF status |
| 8980 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 8981 | static QDF_STATUS send_wow_delete_pattern_cmd_tlv(wmi_unified_t wmi_handle, |
| 8982 | uint8_t ptrn_id, uint8_t vdev_id) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8983 | { |
| 8984 | WMI_WOW_DEL_PATTERN_CMD_fixed_param *cmd; |
| 8985 | wmi_buf_t buf; |
| 8986 | int32_t len; |
| 8987 | int ret; |
| 8988 | |
| 8989 | len = sizeof(WMI_WOW_DEL_PATTERN_CMD_fixed_param); |
| 8990 | |
| 8991 | |
| 8992 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8993 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8994 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8995 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8996 | } |
| 8997 | |
| 8998 | cmd = (WMI_WOW_DEL_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 8999 | |
| 9000 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9001 | WMITLV_TAG_STRUC_WMI_WOW_DEL_PATTERN_CMD_fixed_param, |
| 9002 | WMITLV_GET_STRUCT_TLVLEN( |
| 9003 | WMI_WOW_DEL_PATTERN_CMD_fixed_param)); |
| 9004 | cmd->vdev_id = vdev_id; |
| 9005 | cmd->pattern_id = ptrn_id; |
| 9006 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 9007 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9008 | WMI_LOGI("Deleting pattern id: %d vdev id %d in fw", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9009 | cmd->pattern_id, vdev_id); |
| 9010 | |
| 9011 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9012 | WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 9013 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9014 | WMI_LOGE("%s: Failed to delete wow ptrn from fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9015 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9016 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9017 | } |
| 9018 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9019 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9020 | } |
| 9021 | |
| 9022 | /** |
| 9023 | * send_host_wakeup_ind_to_fw_cmd_tlv() - send wakeup ind to fw |
| 9024 | * @wmi_handle: wmi handle |
| 9025 | * |
| 9026 | * Sends host wakeup indication to FW. On receiving this indication, |
| 9027 | * FW will come out of WOW. |
| 9028 | * |
| 9029 | * Return: CDF status |
| 9030 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9031 | 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] | 9032 | { |
| 9033 | wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *cmd; |
| 9034 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9035 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9036 | int32_t len; |
| 9037 | int ret; |
| 9038 | |
| 9039 | len = sizeof(wmi_wow_hostwakeup_from_sleep_cmd_fixed_param); |
| 9040 | |
| 9041 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9042 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9043 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9044 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9045 | } |
| 9046 | |
| 9047 | cmd = (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *) |
| 9048 | wmi_buf_data(buf); |
| 9049 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9050 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_from_sleep_cmd_fixed_param, |
| 9051 | WMITLV_GET_STRUCT_TLVLEN |
| 9052 | (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param)); |
| 9053 | |
| 9054 | |
| 9055 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9056 | WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 9057 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9058 | WMI_LOGE("Failed to send host wakeup indication to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9059 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9060 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9061 | } |
| 9062 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9063 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9064 | } |
| 9065 | |
| 9066 | /** |
| 9067 | * send_del_ts_cmd_tlv() - send DELTS request to fw |
| 9068 | * @wmi_handle: wmi handle |
| 9069 | * @msg: delts params |
| 9070 | * |
| 9071 | * Return: CDF status |
| 9072 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9073 | 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] | 9074 | uint8_t ac) |
| 9075 | { |
| 9076 | wmi_vdev_wmm_delts_cmd_fixed_param *cmd; |
| 9077 | wmi_buf_t buf; |
| 9078 | int32_t len = sizeof(*cmd); |
| 9079 | |
| 9080 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9081 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9082 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9083 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9084 | } |
| 9085 | cmd = (wmi_vdev_wmm_delts_cmd_fixed_param *) wmi_buf_data(buf); |
| 9086 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9087 | WMITLV_TAG_STRUC_wmi_vdev_wmm_delts_cmd_fixed_param, |
| 9088 | WMITLV_GET_STRUCT_TLVLEN |
| 9089 | (wmi_vdev_wmm_delts_cmd_fixed_param)); |
| 9090 | cmd->vdev_id = vdev_id; |
| 9091 | cmd->ac = ac; |
| 9092 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9093 | WMI_LOGD("Delts vdev:%d, ac:%d, %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9094 | cmd->vdev_id, cmd->ac, __func__, __LINE__); |
| 9095 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9096 | WMI_VDEV_WMM_DELTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9097 | WMI_LOGP("%s: Failed to send vdev DELTS command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9098 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9099 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9100 | } |
| 9101 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9102 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9103 | } |
| 9104 | |
| 9105 | /** |
| 9106 | * send_aggr_qos_cmd_tlv() - send aggr qos request to fw |
| 9107 | * @wmi_handle: handle to wmi |
| 9108 | * @aggr_qos_rsp_msg - combined struct for all ADD_TS requests. |
| 9109 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9110 | * A function to handle WMI_AGGR_QOS_REQ. This will send out |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9111 | * ADD_TS requestes to firmware in loop for all the ACs with |
| 9112 | * active flow. |
| 9113 | * |
| 9114 | * Return: CDF status |
| 9115 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9116 | 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] | 9117 | struct aggr_add_ts_param *aggr_qos_rsp_msg) |
| 9118 | { |
| 9119 | int i = 0; |
| 9120 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 9121 | wmi_buf_t buf; |
| 9122 | int32_t len = sizeof(*cmd); |
| 9123 | |
| 9124 | for (i = 0; i < WMI_QOS_NUM_AC_MAX; i++) { |
| 9125 | /* if flow in this AC is active */ |
| 9126 | if (((1 << i) & aggr_qos_rsp_msg->tspecIdx)) { |
| 9127 | /* |
| 9128 | * as per implementation of wma_add_ts_req() we |
| 9129 | * are not waiting any response from firmware so |
| 9130 | * apart from sending ADDTS to firmware just send |
| 9131 | * success to upper layers |
| 9132 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9133 | aggr_qos_rsp_msg->status[i] = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9134 | |
| 9135 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9136 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9137 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9138 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9139 | } |
| 9140 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) |
| 9141 | wmi_buf_data(buf); |
| 9142 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9143 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 9144 | WMITLV_GET_STRUCT_TLVLEN |
| 9145 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 9146 | cmd->vdev_id = aggr_qos_rsp_msg->sessionId; |
| 9147 | cmd->ac = |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9148 | WMI_TID_TO_AC(aggr_qos_rsp_msg->tspec[i].tsinfo. |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9149 | traffic.userPrio); |
| 9150 | cmd->medium_time_us = |
| 9151 | aggr_qos_rsp_msg->tspec[i].mediumTime * 32; |
| 9152 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DEPRIO; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9153 | 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] | 9154 | __func__, __LINE__, cmd->vdev_id, cmd->ac, |
| 9155 | cmd->medium_time_us, cmd->downgrade_type); |
| 9156 | if (wmi_unified_cmd_send |
| 9157 | (wmi_handle, buf, len, |
| 9158 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9159 | WMI_LOGP("%s: Failed to send vdev ADDTS command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9160 | __func__); |
| 9161 | aggr_qos_rsp_msg->status[i] = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9162 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9163 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9164 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9165 | } |
| 9166 | } |
| 9167 | } |
| 9168 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9169 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9170 | } |
| 9171 | |
| 9172 | /** |
| 9173 | * send_add_ts_cmd_tlv() - send ADDTS request to fw |
| 9174 | * @wmi_handle: wmi handle |
| 9175 | * @msg: ADDTS params |
| 9176 | * |
| 9177 | * Return: CDF status |
| 9178 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9179 | 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] | 9180 | struct add_ts_param *msg) |
| 9181 | { |
| 9182 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 9183 | wmi_buf_t buf; |
| 9184 | int32_t len = sizeof(*cmd); |
| 9185 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9186 | msg->status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9187 | |
| 9188 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9189 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9190 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9191 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9192 | } |
| 9193 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) wmi_buf_data(buf); |
| 9194 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9195 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 9196 | WMITLV_GET_STRUCT_TLVLEN |
| 9197 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 9198 | cmd->vdev_id = msg->sme_session_id; |
| 9199 | cmd->ac = msg->tspec.tsinfo.traffic.userPrio; |
| 9200 | cmd->medium_time_us = msg->tspec.mediumTime * 32; |
| 9201 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DROP; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9202 | 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] | 9203 | cmd->vdev_id, cmd->ac, cmd->medium_time_us, |
| 9204 | cmd->downgrade_type, __func__, __LINE__); |
| 9205 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9206 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9207 | WMI_LOGP("%s: Failed to send vdev ADDTS command", __func__); |
| 9208 | msg->status = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9209 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9210 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9211 | } |
| 9212 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9213 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9214 | } |
| 9215 | |
| 9216 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9217 | * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn |
| 9218 | * @wmi_handle: wmi handle |
| 9219 | * @pAddPeriodicTxPtrnParams: tx ptrn params |
| 9220 | * |
| 9221 | * Retrun: CDF status |
| 9222 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9223 | 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] | 9224 | struct periodic_tx_pattern * |
| 9225 | pAddPeriodicTxPtrnParams, |
| 9226 | uint8_t vdev_id) |
| 9227 | { |
| 9228 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 9229 | wmi_buf_t wmi_buf; |
| 9230 | uint32_t len; |
| 9231 | uint8_t *buf_ptr; |
| 9232 | uint32_t ptrn_len, ptrn_len_aligned; |
| 9233 | int j; |
| 9234 | |
| 9235 | ptrn_len = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 9236 | ptrn_len_aligned = roundup(ptrn_len, sizeof(uint32_t)); |
| 9237 | len = sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param) + |
| 9238 | WMI_TLV_HDR_SIZE + ptrn_len_aligned; |
| 9239 | |
| 9240 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9241 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9242 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9243 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9244 | } |
| 9245 | |
| 9246 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9247 | |
| 9248 | cmd = (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) buf_ptr; |
| 9249 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9250 | WMITLV_TAG_STRUC_WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 9251 | WMITLV_GET_STRUCT_TLVLEN |
| 9252 | (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 9253 | |
| 9254 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 9255 | cmd->vdev_id = vdev_id; |
| 9256 | cmd->pattern_id = pAddPeriodicTxPtrnParams->ucPtrnId; |
| 9257 | cmd->timeout = pAddPeriodicTxPtrnParams->usPtrnIntervalMs; |
| 9258 | cmd->length = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 9259 | |
| 9260 | /* Pattern info */ |
| 9261 | buf_ptr += sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 9262 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ptrn_len_aligned); |
| 9263 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9264 | qdf_mem_copy(buf_ptr, pAddPeriodicTxPtrnParams->ucPattern, ptrn_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9265 | for (j = 0; j < pAddPeriodicTxPtrnParams->ucPtrnSize; j++) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9266 | WMI_LOGD("%s: Add Ptrn: %02x", __func__, buf_ptr[j] & 0xff); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9267 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9268 | WMI_LOGD("%s: Add ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9269 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 9270 | |
| 9271 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9272 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9273 | WMI_LOGE("%s: failed to add pattern set state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9274 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9275 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9276 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9277 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9278 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9279 | } |
| 9280 | |
| 9281 | /** |
| 9282 | * send_process_del_periodic_tx_ptrn_cmd_tlv - del periodic tx ptrn |
| 9283 | * @wmi_handle: wmi handle |
| 9284 | * @vdev_id: vdev id |
| 9285 | * @pattern_id: pattern id |
| 9286 | * |
| 9287 | * Retrun: CDF status |
| 9288 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9289 | 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] | 9290 | uint8_t vdev_id, |
| 9291 | uint8_t pattern_id) |
| 9292 | { |
| 9293 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 9294 | wmi_buf_t wmi_buf; |
| 9295 | uint32_t len = |
| 9296 | sizeof(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 9297 | |
| 9298 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9299 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9300 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9301 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9302 | } |
| 9303 | |
| 9304 | cmd = (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) |
| 9305 | wmi_buf_data(wmi_buf); |
| 9306 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9307 | WMITLV_TAG_STRUC_WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 9308 | WMITLV_GET_STRUCT_TLVLEN |
| 9309 | (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 9310 | |
| 9311 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 9312 | cmd->vdev_id = vdev_id; |
| 9313 | cmd->pattern_id = pattern_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9314 | WMI_LOGD("%s: Del ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9315 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 9316 | |
| 9317 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9318 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9319 | WMI_LOGE("%s: failed to send del pattern command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9320 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9321 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9322 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9323 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9324 | } |
| 9325 | |
| 9326 | /** |
| 9327 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 9328 | * @wmi_handle: wmi handle |
| 9329 | * @preq: stats ext params |
| 9330 | * |
| 9331 | * Return: CDF status |
| 9332 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9333 | 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] | 9334 | struct stats_ext_params *preq) |
| 9335 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9336 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9337 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 9338 | wmi_buf_t buf; |
| 9339 | uint16_t len; |
| 9340 | uint8_t *buf_ptr; |
| 9341 | |
| 9342 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 9343 | |
| 9344 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9345 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9346 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9347 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9348 | } |
| 9349 | |
| 9350 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9351 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 9352 | |
| 9353 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9354 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 9355 | WMITLV_GET_STRUCT_TLVLEN |
| 9356 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 9357 | cmd->vdev_id = preq->vdev_id; |
| 9358 | cmd->data_len = preq->request_data_len; |
| 9359 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9360 | 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] | 9361 | __func__, preq->request_data_len, preq->vdev_id); |
| 9362 | |
| 9363 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 9364 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 9365 | |
| 9366 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9367 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9368 | |
| 9369 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9370 | WMI_REQUEST_STATS_EXT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9371 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9372 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9373 | ret); |
| 9374 | wmi_buf_free(buf); |
| 9375 | } |
| 9376 | |
| 9377 | return ret; |
| 9378 | } |
| 9379 | |
| 9380 | /** |
| 9381 | * send_enable_ext_wow_cmd_tlv() - enable ext wow in fw |
| 9382 | * @wmi_handle: wmi handle |
| 9383 | * @params: ext wow params |
| 9384 | * |
| 9385 | * Return:0 for success or error code |
| 9386 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9387 | 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] | 9388 | struct ext_wow_params *params) |
| 9389 | { |
| 9390 | wmi_extwow_enable_cmd_fixed_param *cmd; |
| 9391 | wmi_buf_t buf; |
| 9392 | int32_t len; |
| 9393 | int ret; |
| 9394 | |
| 9395 | len = sizeof(wmi_extwow_enable_cmd_fixed_param); |
| 9396 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9397 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9398 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9399 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9400 | } |
| 9401 | |
| 9402 | cmd = (wmi_extwow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 9403 | |
| 9404 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9405 | WMITLV_TAG_STRUC_wmi_extwow_enable_cmd_fixed_param, |
| 9406 | WMITLV_GET_STRUCT_TLVLEN |
| 9407 | (wmi_extwow_enable_cmd_fixed_param)); |
| 9408 | |
| 9409 | cmd->vdev_id = params->vdev_id; |
| 9410 | cmd->type = params->type; |
| 9411 | cmd->wakeup_pin_num = params->wakeup_pin_num; |
| 9412 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9413 | WMI_LOGD("%s: vdev_id %d type %d Wakeup_pin_num %x", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9414 | __func__, cmd->vdev_id, cmd->type, cmd->wakeup_pin_num); |
| 9415 | |
| 9416 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9417 | WMI_EXTWOW_ENABLE_CMDID); |
| 9418 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9419 | WMI_LOGE("%s: Failed to set EXTWOW Enable", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9420 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9421 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9422 | } |
| 9423 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9424 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9425 | |
| 9426 | } |
| 9427 | |
| 9428 | /** |
| 9429 | * send_app_type1_params_in_fw_cmd_tlv() - set app type1 params in fw |
| 9430 | * @wmi_handle: wmi handle |
| 9431 | * @app_type1_params: app type1 params |
| 9432 | * |
| 9433 | * Return: CDF status |
| 9434 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9435 | 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] | 9436 | struct app_type1_params *app_type1_params) |
| 9437 | { |
| 9438 | wmi_extwow_set_app_type1_params_cmd_fixed_param *cmd; |
| 9439 | wmi_buf_t buf; |
| 9440 | int32_t len; |
| 9441 | int ret; |
| 9442 | |
| 9443 | len = sizeof(wmi_extwow_set_app_type1_params_cmd_fixed_param); |
| 9444 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9445 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9446 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9447 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9448 | } |
| 9449 | |
| 9450 | cmd = (wmi_extwow_set_app_type1_params_cmd_fixed_param *) |
| 9451 | wmi_buf_data(buf); |
| 9452 | |
| 9453 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9454 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type1_params_cmd_fixed_param, |
| 9455 | WMITLV_GET_STRUCT_TLVLEN |
| 9456 | (wmi_extwow_set_app_type1_params_cmd_fixed_param)); |
| 9457 | |
| 9458 | cmd->vdev_id = app_type1_params->vdev_id; |
| 9459 | WMI_CHAR_ARRAY_TO_MAC_ADDR(app_type1_params->wakee_mac_addr.bytes, |
| 9460 | &cmd->wakee_mac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9461 | qdf_mem_copy(cmd->ident, app_type1_params->identification_id, 8); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9462 | cmd->ident_len = app_type1_params->id_length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9463 | qdf_mem_copy(cmd->passwd, app_type1_params->password, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9464 | cmd->passwd_len = app_type1_params->pass_length; |
| 9465 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9466 | WMI_LOGD("%s: vdev_id %d wakee_mac_addr %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9467 | "identification_id %.8s id_length %u " |
| 9468 | "password %.16s pass_length %u", |
| 9469 | __func__, cmd->vdev_id, app_type1_params->wakee_mac_addr.bytes, |
| 9470 | cmd->ident, cmd->ident_len, cmd->passwd, cmd->passwd_len); |
| 9471 | |
| 9472 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9473 | WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 9474 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9475 | WMI_LOGE("%s: Failed to set APP TYPE1 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9476 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9477 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9478 | } |
| 9479 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9480 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9481 | } |
| 9482 | |
| 9483 | /** |
| 9484 | * send_set_app_type2_params_in_fw_cmd_tlv() - set app type2 params in fw |
| 9485 | * @wmi_handle: wmi handle |
| 9486 | * @appType2Params: app type2 params |
| 9487 | * |
| 9488 | * Return: CDF status |
| 9489 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9490 | 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] | 9491 | struct app_type2_params *appType2Params) |
| 9492 | { |
| 9493 | wmi_extwow_set_app_type2_params_cmd_fixed_param *cmd; |
| 9494 | wmi_buf_t buf; |
| 9495 | int32_t len; |
| 9496 | int ret; |
| 9497 | |
| 9498 | len = sizeof(wmi_extwow_set_app_type2_params_cmd_fixed_param); |
| 9499 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9500 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9501 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9502 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9503 | } |
| 9504 | |
| 9505 | cmd = (wmi_extwow_set_app_type2_params_cmd_fixed_param *) |
| 9506 | wmi_buf_data(buf); |
| 9507 | |
| 9508 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9509 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type2_params_cmd_fixed_param, |
| 9510 | WMITLV_GET_STRUCT_TLVLEN |
| 9511 | (wmi_extwow_set_app_type2_params_cmd_fixed_param)); |
| 9512 | |
| 9513 | cmd->vdev_id = appType2Params->vdev_id; |
| 9514 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9515 | qdf_mem_copy(cmd->rc4_key, appType2Params->rc4_key, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9516 | cmd->rc4_key_len = appType2Params->rc4_key_len; |
| 9517 | |
| 9518 | cmd->ip_id = appType2Params->ip_id; |
| 9519 | cmd->ip_device_ip = appType2Params->ip_device_ip; |
| 9520 | cmd->ip_server_ip = appType2Params->ip_server_ip; |
| 9521 | |
| 9522 | cmd->tcp_src_port = appType2Params->tcp_src_port; |
| 9523 | cmd->tcp_dst_port = appType2Params->tcp_dst_port; |
| 9524 | cmd->tcp_seq = appType2Params->tcp_seq; |
| 9525 | cmd->tcp_ack_seq = appType2Params->tcp_ack_seq; |
| 9526 | |
| 9527 | cmd->keepalive_init = appType2Params->keepalive_init; |
| 9528 | cmd->keepalive_min = appType2Params->keepalive_min; |
| 9529 | cmd->keepalive_max = appType2Params->keepalive_max; |
| 9530 | cmd->keepalive_inc = appType2Params->keepalive_inc; |
| 9531 | |
| 9532 | WMI_CHAR_ARRAY_TO_MAC_ADDR(appType2Params->gateway_mac.bytes, |
| 9533 | &cmd->gateway_mac); |
| 9534 | cmd->tcp_tx_timeout_val = appType2Params->tcp_tx_timeout_val; |
| 9535 | cmd->tcp_rx_timeout_val = appType2Params->tcp_rx_timeout_val; |
| 9536 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9537 | WMI_LOGD("%s: vdev_id %d gateway_mac %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9538 | "rc4_key %.16s rc4_key_len %u " |
| 9539 | "ip_id %x ip_device_ip %x ip_server_ip %x " |
| 9540 | "tcp_src_port %u tcp_dst_port %u tcp_seq %u " |
| 9541 | "tcp_ack_seq %u keepalive_init %u keepalive_min %u " |
| 9542 | "keepalive_max %u keepalive_inc %u " |
| 9543 | "tcp_tx_timeout_val %u tcp_rx_timeout_val %u", |
| 9544 | __func__, cmd->vdev_id, appType2Params->gateway_mac.bytes, |
| 9545 | cmd->rc4_key, cmd->rc4_key_len, |
| 9546 | cmd->ip_id, cmd->ip_device_ip, cmd->ip_server_ip, |
| 9547 | cmd->tcp_src_port, cmd->tcp_dst_port, cmd->tcp_seq, |
| 9548 | cmd->tcp_ack_seq, cmd->keepalive_init, cmd->keepalive_min, |
| 9549 | cmd->keepalive_max, cmd->keepalive_inc, |
| 9550 | cmd->tcp_tx_timeout_val, cmd->tcp_rx_timeout_val); |
| 9551 | |
| 9552 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9553 | WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 9554 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9555 | WMI_LOGE("%s: Failed to set APP TYPE2 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9556 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9557 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9558 | } |
| 9559 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9560 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9561 | |
| 9562 | } |
| 9563 | |
| 9564 | /** |
| 9565 | * send_set_auto_shutdown_timer_cmd_tlv() - sets auto shutdown timer in firmware |
| 9566 | * @wmi_handle: wmi handle |
| 9567 | * @timer_val: auto shutdown timer value |
| 9568 | * |
| 9569 | * Return: CDF status |
| 9570 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9571 | 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] | 9572 | uint32_t timer_val) |
| 9573 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9574 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9575 | wmi_buf_t buf = NULL; |
| 9576 | uint8_t *buf_ptr; |
| 9577 | wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd; |
| 9578 | int len = sizeof(wmi_host_auto_shutdown_cfg_cmd_fixed_param); |
| 9579 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9580 | 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] | 9581 | __func__, timer_val); |
| 9582 | |
| 9583 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9584 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9585 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9586 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9587 | } |
| 9588 | |
| 9589 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9590 | wmi_auto_sh_cmd = |
| 9591 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param *) buf_ptr; |
| 9592 | wmi_auto_sh_cmd->timer_value = timer_val; |
| 9593 | |
| 9594 | WMITLV_SET_HDR(&wmi_auto_sh_cmd->tlv_header, |
| 9595 | WMITLV_TAG_STRUC_wmi_host_auto_shutdown_cfg_cmd_fixed_param, |
| 9596 | WMITLV_GET_STRUCT_TLVLEN |
| 9597 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param)); |
| 9598 | |
| 9599 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9600 | len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9601 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9602 | WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9603 | __func__, status); |
| 9604 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9605 | } |
| 9606 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9607 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9608 | } |
| 9609 | |
| 9610 | /** |
| 9611 | * send_nan_req_cmd_tlv() - to send nan request to target |
| 9612 | * @wmi_handle: wmi handle |
| 9613 | * @nan_req: request data which will be non-null |
| 9614 | * |
| 9615 | * Return: CDF status |
| 9616 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9617 | 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] | 9618 | struct nan_req_params *nan_req) |
| 9619 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9620 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9621 | wmi_nan_cmd_param *cmd; |
| 9622 | wmi_buf_t buf; |
| 9623 | uint16_t len = sizeof(*cmd); |
| 9624 | uint16_t nan_data_len, nan_data_len_aligned; |
| 9625 | uint8_t *buf_ptr; |
| 9626 | |
| 9627 | /* |
| 9628 | * <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ----> |
| 9629 | * +------------+----------+-----------------------+--------------+ |
| 9630 | * | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data | |
| 9631 | * +------------+----------+-----------------------+--------------+ |
| 9632 | */ |
| 9633 | if (!nan_req) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9634 | WMI_LOGE("%s:nan req is not valid", __func__); |
| 9635 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9636 | } |
| 9637 | nan_data_len = nan_req->request_data_len; |
| 9638 | nan_data_len_aligned = roundup(nan_req->request_data_len, |
| 9639 | sizeof(uint32_t)); |
| 9640 | len += WMI_TLV_HDR_SIZE + nan_data_len_aligned; |
| 9641 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9642 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9643 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 9644 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9645 | } |
| 9646 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9647 | cmd = (wmi_nan_cmd_param *) buf_ptr; |
| 9648 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9649 | WMITLV_TAG_STRUC_wmi_nan_cmd_param, |
| 9650 | WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param)); |
| 9651 | cmd->data_len = nan_req->request_data_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9652 | WMI_LOGD("%s: The data len value is %u", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9653 | __func__, nan_req->request_data_len); |
| 9654 | buf_ptr += sizeof(wmi_nan_cmd_param); |
| 9655 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned); |
| 9656 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9657 | qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9658 | |
| 9659 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9660 | WMI_NAN_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9661 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9662 | WMI_LOGE("%s Failed to send set param command ret = %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9663 | __func__, ret); |
| 9664 | wmi_buf_free(buf); |
| 9665 | } |
| 9666 | |
| 9667 | return ret; |
| 9668 | } |
| 9669 | |
| 9670 | /** |
| 9671 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 9672 | * @wmi_handle: wmi handle |
Jeff Johnson | a87370f | 2017-10-04 19:19:20 -0700 | [diff] [blame] | 9673 | * @params: DHCP server offload info |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9674 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9675 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9676 | */ |
Jeff Johnson | a87370f | 2017-10-04 19:19:20 -0700 | [diff] [blame] | 9677 | static QDF_STATUS |
| 9678 | send_process_dhcpserver_offload_cmd_tlv(wmi_unified_t wmi_handle, |
| 9679 | struct dhcp_offload_info_params *params) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9680 | { |
| 9681 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 9682 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9683 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9684 | |
| 9685 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 9686 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9687 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9688 | "set_dhcp_server_offload cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9689 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9690 | } |
| 9691 | |
| 9692 | cmd = (wmi_set_dhcp_server_offload_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9693 | |
| 9694 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9695 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 9696 | WMITLV_GET_STRUCT_TLVLEN |
| 9697 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
Jeff Johnson | a87370f | 2017-10-04 19:19:20 -0700 | [diff] [blame] | 9698 | cmd->vdev_id = params->vdev_id; |
| 9699 | cmd->enable = params->dhcp_offload_enabled; |
| 9700 | cmd->num_client = params->dhcp_client_num; |
| 9701 | cmd->srv_ipv4 = params->dhcp_srv_addr; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9702 | cmd->start_lsb = 0; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9703 | status = wmi_unified_cmd_send(wmi_handle, buf, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9704 | sizeof(*cmd), |
| 9705 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9706 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9707 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9708 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9709 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9710 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9711 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Jeff Johnson | a87370f | 2017-10-04 19:19:20 -0700 | [diff] [blame] | 9712 | params->vdev_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9713 | |
| 9714 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9715 | } |
| 9716 | |
| 9717 | /** |
| 9718 | * send_set_led_flashing_cmd_tlv() - set led flashing in fw |
| 9719 | * @wmi_handle: wmi handle |
| 9720 | * @flashing: flashing request |
| 9721 | * |
| 9722 | * Return: CDF status |
| 9723 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9724 | 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] | 9725 | struct flashing_req_params *flashing) |
| 9726 | { |
| 9727 | wmi_set_led_flashing_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9728 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9729 | wmi_buf_t buf; |
| 9730 | uint8_t *buf_ptr; |
| 9731 | int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param); |
| 9732 | |
| 9733 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9734 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9735 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9736 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9737 | } |
| 9738 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9739 | cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr; |
| 9740 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9741 | WMITLV_TAG_STRUC_wmi_set_led_flashing_cmd_fixed_param, |
| 9742 | WMITLV_GET_STRUCT_TLVLEN |
| 9743 | (wmi_set_led_flashing_cmd_fixed_param)); |
| 9744 | cmd->pattern_id = flashing->pattern_id; |
| 9745 | cmd->led_x0 = flashing->led_x0; |
| 9746 | cmd->led_x1 = flashing->led_x1; |
| 9747 | |
| 9748 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9749 | WMI_PDEV_SET_LED_FLASHING_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9750 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9751 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9752 | " returned Error %d", __func__, status); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9753 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9754 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9755 | |
| 9756 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9757 | } |
| 9758 | |
| 9759 | /** |
| 9760 | * send_process_ch_avoid_update_cmd_tlv() - handles channel avoid update request |
| 9761 | * @wmi_handle: wmi handle |
| 9762 | * @ch_avoid_update_req: channel avoid update params |
| 9763 | * |
| 9764 | * Return: CDF status |
| 9765 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9766 | 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] | 9767 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9768 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9769 | wmi_buf_t buf = NULL; |
| 9770 | uint8_t *buf_ptr; |
| 9771 | wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp; |
| 9772 | int len = sizeof(wmi_chan_avoid_update_cmd_param); |
| 9773 | |
| 9774 | |
| 9775 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9776 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9777 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9778 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9779 | } |
| 9780 | |
| 9781 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9782 | ch_avoid_update_fp = (wmi_chan_avoid_update_cmd_param *) buf_ptr; |
| 9783 | WMITLV_SET_HDR(&ch_avoid_update_fp->tlv_header, |
| 9784 | WMITLV_TAG_STRUC_wmi_chan_avoid_update_cmd_param, |
| 9785 | WMITLV_GET_STRUCT_TLVLEN |
| 9786 | (wmi_chan_avoid_update_cmd_param)); |
| 9787 | |
| 9788 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9789 | len, WMI_CHAN_AVOID_UPDATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9790 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9791 | WMI_LOGE("wmi_unified_cmd_send" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9792 | " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE" |
| 9793 | " returned Error %d", status); |
| 9794 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9795 | } |
| 9796 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9797 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9798 | } |
| 9799 | |
| 9800 | /** |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 9801 | * send_pdev_set_regdomain_cmd_tlv() - send set regdomain command to fw |
| 9802 | * @wmi_handle: wmi handle |
| 9803 | * @param: pointer to pdev regdomain params |
| 9804 | * |
| 9805 | * Return: 0 for success or error code |
| 9806 | */ |
| 9807 | static QDF_STATUS |
| 9808 | send_pdev_set_regdomain_cmd_tlv(wmi_unified_t wmi_handle, |
| 9809 | struct pdev_set_regdomain_params *param) |
| 9810 | { |
| 9811 | wmi_buf_t buf; |
| 9812 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 9813 | int32_t len = sizeof(*cmd); |
| 9814 | |
| 9815 | |
| 9816 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9817 | if (!buf) { |
| 9818 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9819 | return QDF_STATUS_E_NOMEM; |
| 9820 | } |
| 9821 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 9822 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9823 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 9824 | WMITLV_GET_STRUCT_TLVLEN |
| 9825 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 9826 | |
| 9827 | cmd->reg_domain = param->currentRDinuse; |
| 9828 | cmd->reg_domain_2G = param->currentRD2G; |
| 9829 | cmd->reg_domain_5G = param->currentRD5G; |
| 9830 | cmd->conformance_test_limit_2G = param->ctl_2G; |
| 9831 | cmd->conformance_test_limit_5G = param->ctl_5G; |
| 9832 | cmd->dfs_domain = param->dfsDomain; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9833 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9834 | param->pdev_id); |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 9835 | |
| 9836 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9837 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
| 9838 | WMI_LOGE("%s: Failed to send pdev set regdomain command", |
| 9839 | __func__); |
| 9840 | wmi_buf_free(buf); |
| 9841 | return QDF_STATUS_E_FAILURE; |
| 9842 | } |
| 9843 | |
| 9844 | return QDF_STATUS_SUCCESS; |
| 9845 | } |
| 9846 | |
| 9847 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9848 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 9849 | * @wmi_handle: wmi handle |
| 9850 | * @reg_dmn: reg domain |
| 9851 | * @regdmn2G: 2G reg domain |
| 9852 | * @regdmn5G: 5G reg domain |
| 9853 | * @ctl2G: 2G test limit |
| 9854 | * @ctl5G: 5G test limit |
| 9855 | * |
| 9856 | * Return: none |
| 9857 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9858 | 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] | 9859 | uint32_t reg_dmn, uint16_t regdmn2G, |
Rajeev Kumar Sirasanagandla | 4c1fecd | 2017-06-06 13:27:56 +0530 | [diff] [blame] | 9860 | uint16_t regdmn5G, uint8_t ctl2G, |
| 9861 | uint8_t ctl5G) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9862 | { |
| 9863 | wmi_buf_t buf; |
| 9864 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 9865 | int32_t len = sizeof(*cmd); |
| 9866 | |
| 9867 | |
| 9868 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9869 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9870 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9871 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9872 | } |
| 9873 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 9874 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9875 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 9876 | WMITLV_GET_STRUCT_TLVLEN |
| 9877 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 9878 | cmd->reg_domain = reg_dmn; |
| 9879 | cmd->reg_domain_2G = regdmn2G; |
| 9880 | cmd->reg_domain_5G = regdmn5G; |
| 9881 | cmd->conformance_test_limit_2G = ctl2G; |
| 9882 | cmd->conformance_test_limit_5G = ctl5G; |
| 9883 | |
| 9884 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9885 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9886 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9887 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9888 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9889 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9890 | } |
| 9891 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9892 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9893 | } |
| 9894 | |
| 9895 | |
| 9896 | /** |
| 9897 | * send_set_tdls_offchan_mode_cmd_tlv() - set tdls off channel mode |
| 9898 | * @wmi_handle: wmi handle |
| 9899 | * @chan_switch_params: Pointer to tdls channel switch parameter structure |
| 9900 | * |
| 9901 | * This function sets tdls off channel mode |
| 9902 | * |
| 9903 | * Return: 0 on success; Negative errno otherwise |
| 9904 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9905 | 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] | 9906 | struct tdls_channel_switch_params *chan_switch_params) |
| 9907 | { |
| 9908 | wmi_tdls_set_offchan_mode_cmd_fixed_param *cmd; |
| 9909 | wmi_buf_t wmi_buf; |
| 9910 | u_int16_t len = sizeof(wmi_tdls_set_offchan_mode_cmd_fixed_param); |
| 9911 | |
| 9912 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9913 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9914 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9915 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9916 | } |
| 9917 | cmd = (wmi_tdls_set_offchan_mode_cmd_fixed_param *) |
| 9918 | wmi_buf_data(wmi_buf); |
| 9919 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9920 | WMITLV_TAG_STRUC_wmi_tdls_set_offchan_mode_cmd_fixed_param, |
| 9921 | WMITLV_GET_STRUCT_TLVLEN( |
| 9922 | wmi_tdls_set_offchan_mode_cmd_fixed_param)); |
| 9923 | |
| 9924 | WMI_CHAR_ARRAY_TO_MAC_ADDR(chan_switch_params->peer_mac_addr, |
| 9925 | &cmd->peer_macaddr); |
| 9926 | cmd->vdev_id = chan_switch_params->vdev_id; |
| 9927 | cmd->offchan_mode = chan_switch_params->tdls_sw_mode; |
| 9928 | cmd->is_peer_responder = chan_switch_params->is_responder; |
| 9929 | cmd->offchan_num = chan_switch_params->tdls_off_ch; |
| 9930 | cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset; |
| 9931 | cmd->offchan_oper_class = chan_switch_params->oper_class; |
| 9932 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9933 | 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] | 9934 | cmd->peer_macaddr.mac_addr31to0, |
| 9935 | cmd->peer_macaddr.mac_addr47to32); |
| 9936 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9937 | WMI_LOGD(FL( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9938 | "vdev_id: %d, off channel mode: %d, off channel Num: %d, " |
| 9939 | "off channel offset: 0x%x, is_peer_responder: %d, operating class: %d" |
| 9940 | ), |
| 9941 | cmd->vdev_id, |
| 9942 | cmd->offchan_mode, |
| 9943 | cmd->offchan_num, |
| 9944 | cmd->offchan_bw_bitmap, |
| 9945 | cmd->is_peer_responder, |
| 9946 | cmd->offchan_oper_class); |
| 9947 | |
| 9948 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9949 | WMI_TDLS_SET_OFFCHAN_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9950 | WMI_LOGP(FL("failed to send tdls off chan command")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9951 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9952 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9953 | } |
| 9954 | |
| 9955 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9956 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9957 | } |
| 9958 | |
| 9959 | /** |
| 9960 | * send_update_fw_tdls_state_cmd_tlv() - send enable/disable tdls for a vdev |
| 9961 | * @wmi_handle: wmi handle |
| 9962 | * @pwmaTdlsparams: TDLS params |
| 9963 | * |
| 9964 | * Return: 0 for sucess or error code |
| 9965 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9966 | 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] | 9967 | void *tdls_param, uint8_t tdls_state) |
| 9968 | { |
| 9969 | wmi_tdls_set_state_cmd_fixed_param *cmd; |
| 9970 | wmi_buf_t wmi_buf; |
| 9971 | |
| 9972 | struct wmi_tdls_params *wmi_tdls = (struct wmi_tdls_params *) tdls_param; |
| 9973 | uint16_t len = sizeof(wmi_tdls_set_state_cmd_fixed_param); |
| 9974 | |
| 9975 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9976 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9977 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 9978 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9979 | } |
| 9980 | cmd = (wmi_tdls_set_state_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 9981 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9982 | WMITLV_TAG_STRUC_wmi_tdls_set_state_cmd_fixed_param, |
| 9983 | WMITLV_GET_STRUCT_TLVLEN |
| 9984 | (wmi_tdls_set_state_cmd_fixed_param)); |
| 9985 | cmd->vdev_id = wmi_tdls->vdev_id; |
| 9986 | cmd->state = tdls_state; |
| 9987 | cmd->notification_interval_ms = wmi_tdls->notification_interval_ms; |
| 9988 | cmd->tx_discovery_threshold = wmi_tdls->tx_discovery_threshold; |
| 9989 | cmd->tx_teardown_threshold = wmi_tdls->tx_teardown_threshold; |
| 9990 | cmd->rssi_teardown_threshold = wmi_tdls->rssi_teardown_threshold; |
| 9991 | cmd->rssi_delta = wmi_tdls->rssi_delta; |
| 9992 | cmd->tdls_options = wmi_tdls->tdls_options; |
| 9993 | cmd->tdls_peer_traffic_ind_window = wmi_tdls->peer_traffic_ind_window; |
| 9994 | cmd->tdls_peer_traffic_response_timeout_ms = |
| 9995 | wmi_tdls->peer_traffic_response_timeout; |
| 9996 | cmd->tdls_puapsd_mask = wmi_tdls->puapsd_mask; |
| 9997 | cmd->tdls_puapsd_inactivity_time_ms = wmi_tdls->puapsd_inactivity_time; |
| 9998 | cmd->tdls_puapsd_rx_frame_threshold = |
| 9999 | wmi_tdls->puapsd_rx_frame_threshold; |
| 10000 | cmd->teardown_notification_ms = |
| 10001 | wmi_tdls->teardown_notification_ms; |
| 10002 | cmd->tdls_peer_kickout_threshold = |
| 10003 | wmi_tdls->tdls_peer_kickout_threshold; |
| 10004 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10005 | WMI_LOGD("%s: tdls_state: %d, state: %d, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10006 | "notification_interval_ms: %d, " |
| 10007 | "tx_discovery_threshold: %d, " |
| 10008 | "tx_teardown_threshold: %d, " |
| 10009 | "rssi_teardown_threshold: %d, " |
| 10010 | "rssi_delta: %d, " |
| 10011 | "tdls_options: 0x%x, " |
| 10012 | "tdls_peer_traffic_ind_window: %d, " |
| 10013 | "tdls_peer_traffic_response_timeout: %d, " |
| 10014 | "tdls_puapsd_mask: 0x%x, " |
| 10015 | "tdls_puapsd_inactivity_time: %d, " |
| 10016 | "tdls_puapsd_rx_frame_threshold: %d, " |
| 10017 | "teardown_notification_ms: %d, " |
| 10018 | "tdls_peer_kickout_threshold: %d", |
| 10019 | __func__, tdls_state, cmd->state, |
| 10020 | cmd->notification_interval_ms, |
| 10021 | cmd->tx_discovery_threshold, |
| 10022 | cmd->tx_teardown_threshold, |
| 10023 | cmd->rssi_teardown_threshold, |
| 10024 | cmd->rssi_delta, |
| 10025 | cmd->tdls_options, |
| 10026 | cmd->tdls_peer_traffic_ind_window, |
| 10027 | cmd->tdls_peer_traffic_response_timeout_ms, |
| 10028 | cmd->tdls_puapsd_mask, |
| 10029 | cmd->tdls_puapsd_inactivity_time_ms, |
| 10030 | cmd->tdls_puapsd_rx_frame_threshold, |
| 10031 | cmd->teardown_notification_ms, |
| 10032 | cmd->tdls_peer_kickout_threshold); |
| 10033 | |
| 10034 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10035 | WMI_TDLS_SET_STATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10036 | WMI_LOGP("%s: failed to send tdls set state command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10037 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10038 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10039 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10040 | WMI_LOGD("%s: vdev_id %d", __func__, wmi_tdls->vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10041 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10042 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10043 | } |
| 10044 | |
| 10045 | /** |
| 10046 | * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state |
| 10047 | * @wmi_handle: wmi handle |
| 10048 | * @peerStateParams: TDLS peer state params |
| 10049 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 10050 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10051 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10052 | 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] | 10053 | struct tdls_peer_state_params *peerStateParams, |
| 10054 | uint32_t *ch_mhz) |
| 10055 | { |
| 10056 | wmi_tdls_peer_update_cmd_fixed_param *cmd; |
| 10057 | wmi_tdls_peer_capabilities *peer_cap; |
| 10058 | wmi_channel *chan_info; |
| 10059 | wmi_buf_t wmi_buf; |
| 10060 | uint8_t *buf_ptr; |
| 10061 | uint32_t i; |
| 10062 | int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) + |
| 10063 | sizeof(wmi_tdls_peer_capabilities); |
| 10064 | |
| 10065 | |
| 10066 | len += WMI_TLV_HDR_SIZE + |
| 10067 | sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen; |
| 10068 | |
| 10069 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 10070 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10071 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 10072 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10073 | } |
| 10074 | |
| 10075 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 10076 | cmd = (wmi_tdls_peer_update_cmd_fixed_param *) buf_ptr; |
| 10077 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10078 | WMITLV_TAG_STRUC_wmi_tdls_peer_update_cmd_fixed_param, |
| 10079 | WMITLV_GET_STRUCT_TLVLEN |
| 10080 | (wmi_tdls_peer_update_cmd_fixed_param)); |
| 10081 | |
| 10082 | cmd->vdev_id = peerStateParams->vdevId; |
| 10083 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr, |
| 10084 | &cmd->peer_macaddr); |
| 10085 | |
| 10086 | |
| 10087 | cmd->peer_state = peerStateParams->peerState; |
| 10088 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10089 | WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10090 | "peer_macaddr.mac_addr31to0: 0x%x, " |
| 10091 | "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d", |
| 10092 | __func__, cmd->vdev_id, peerStateParams->peerMacAddr, |
| 10093 | cmd->peer_macaddr.mac_addr31to0, |
| 10094 | cmd->peer_macaddr.mac_addr47to32, cmd->peer_state); |
| 10095 | |
| 10096 | buf_ptr += sizeof(wmi_tdls_peer_update_cmd_fixed_param); |
| 10097 | peer_cap = (wmi_tdls_peer_capabilities *) buf_ptr; |
| 10098 | WMITLV_SET_HDR(&peer_cap->tlv_header, |
| 10099 | WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities, |
| 10100 | WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities)); |
| 10101 | |
| 10102 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3) |
| 10103 | WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap); |
| 10104 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2) |
| 10105 | WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap); |
| 10106 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1) |
| 10107 | WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap); |
| 10108 | if (peerStateParams->peerCap.peerUapsdQueue & 0x01) |
| 10109 | WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap); |
| 10110 | |
| 10111 | /* Ack and More Data Ack are sent as 0, so no need to set |
| 10112 | * but fill SP |
| 10113 | */ |
| 10114 | WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, |
| 10115 | peerStateParams->peerCap.peerMaxSp); |
| 10116 | |
| 10117 | peer_cap->buff_sta_support = |
| 10118 | peerStateParams->peerCap.peerBuffStaSupport; |
| 10119 | peer_cap->off_chan_support = |
| 10120 | peerStateParams->peerCap.peerOffChanSupport; |
| 10121 | peer_cap->peer_curr_operclass = |
| 10122 | peerStateParams->peerCap.peerCurrOperClass; |
| 10123 | /* self curr operclass is not being used and so pass op class for |
| 10124 | * preferred off chan in it. |
| 10125 | */ |
| 10126 | peer_cap->self_curr_operclass = |
| 10127 | peerStateParams->peerCap.opClassForPrefOffChan; |
| 10128 | peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 10129 | peer_cap->peer_operclass_len = |
| 10130 | peerStateParams->peerCap.peerOperClassLen; |
| 10131 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10132 | WMI_LOGD("%s: peer_operclass_len: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10133 | __func__, peer_cap->peer_operclass_len); |
| 10134 | for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 10135 | peer_cap->peer_operclass[i] = |
| 10136 | peerStateParams->peerCap.peerOperClass[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10137 | WMI_LOGD("%s: peer_operclass[%d]: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10138 | __func__, i, peer_cap->peer_operclass[i]); |
| 10139 | } |
| 10140 | |
| 10141 | peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder; |
| 10142 | peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum; |
| 10143 | peer_cap->pref_offchan_bw = |
| 10144 | peerStateParams->peerCap.prefOffChanBandwidth; |
| 10145 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10146 | WMI_LOGD |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10147 | ("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, " |
| 10148 | "peer_curr_operclass: %d, self_curr_operclass: %d, peer_chan_len: " |
| 10149 | "%d, peer_operclass_len: %d, is_peer_responder: %d, pref_offchan_num:" |
| 10150 | " %d, pref_offchan_bw: %d", |
| 10151 | __func__, peer_cap->peer_qos, peer_cap->buff_sta_support, |
| 10152 | peer_cap->off_chan_support, peer_cap->peer_curr_operclass, |
| 10153 | peer_cap->self_curr_operclass, peer_cap->peer_chan_len, |
| 10154 | peer_cap->peer_operclass_len, peer_cap->is_peer_responder, |
| 10155 | peer_cap->pref_offchan_num, peer_cap->pref_offchan_bw); |
| 10156 | |
| 10157 | /* next fill variable size array of peer chan info */ |
| 10158 | buf_ptr += sizeof(wmi_tdls_peer_capabilities); |
| 10159 | WMITLV_SET_HDR(buf_ptr, |
| 10160 | WMITLV_TAG_ARRAY_STRUC, |
| 10161 | sizeof(wmi_channel) * |
| 10162 | peerStateParams->peerCap.peerChanLen); |
| 10163 | chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 10164 | |
| 10165 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) { |
| 10166 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 10167 | WMITLV_TAG_STRUC_wmi_channel, |
| 10168 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 10169 | chan_info->mhz = ch_mhz[i]; |
| 10170 | chan_info->band_center_freq1 = chan_info->mhz; |
| 10171 | chan_info->band_center_freq2 = 0; |
| 10172 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10173 | WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10174 | |
| 10175 | if (peerStateParams->peerCap.peerChan[i].dfsSet) { |
| 10176 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10177 | WMI_LOGI("chan[%d] DFS[%d]\n", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10178 | peerStateParams->peerCap.peerChan[i].chanId, |
| 10179 | peerStateParams->peerCap.peerChan[i].dfsSet); |
| 10180 | } |
| 10181 | |
| 10182 | if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ) |
| 10183 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11G); |
| 10184 | else |
| 10185 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11A); |
| 10186 | |
| 10187 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 10188 | peerStateParams->peerCap. |
| 10189 | peerChan[i].pwr); |
| 10190 | |
| 10191 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 10192 | peerStateParams->peerCap.peerChan[i]. |
| 10193 | pwr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10194 | WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10195 | peerStateParams->peerCap.peerChan[i].pwr); |
| 10196 | |
| 10197 | chan_info++; |
| 10198 | } |
| 10199 | |
| 10200 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10201 | WMI_TDLS_PEER_UPDATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10202 | WMI_LOGE("%s: failed to send tdls peer update state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10203 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10204 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10205 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10206 | } |
| 10207 | |
| 10208 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10209 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10210 | } |
| 10211 | |
| 10212 | /* |
| 10213 | * send_process_fw_mem_dump_cmd_tlv() - Function to request fw memory dump from |
| 10214 | * firmware |
| 10215 | * @wmi_handle: Pointer to wmi handle |
| 10216 | * @mem_dump_req: Pointer for mem_dump_req |
| 10217 | * |
| 10218 | * This function sends memory dump request to firmware |
| 10219 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10220 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10221 | * |
| 10222 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10223 | 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] | 10224 | struct fw_dump_req_param *mem_dump_req) |
| 10225 | { |
| 10226 | wmi_get_fw_mem_dump_fixed_param *cmd; |
| 10227 | wmi_fw_mem_dump *dump_params; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 10228 | struct wmi_fw_dump_seg_req *seg_req; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10229 | int32_t len; |
| 10230 | wmi_buf_t buf; |
| 10231 | u_int8_t *buf_ptr; |
| 10232 | int ret, loop; |
| 10233 | |
| 10234 | /* |
| 10235 | * len = sizeof(fixed param) that includes tlv header + |
| 10236 | * tlv header for array of struc + |
| 10237 | * sizeof (each struct) |
| 10238 | */ |
| 10239 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10240 | len += mem_dump_req->num_seg * sizeof(wmi_fw_mem_dump); |
| 10241 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10242 | |
| 10243 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10244 | WMI_LOGE(FL("Failed allocate wmi buffer")); |
| 10245 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10246 | } |
| 10247 | |
| 10248 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10249 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10250 | cmd = (wmi_get_fw_mem_dump_fixed_param *) buf_ptr; |
| 10251 | |
| 10252 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10253 | WMITLV_TAG_STRUC_wmi_get_fw_mem_dump_fixed_param, |
| 10254 | WMITLV_GET_STRUCT_TLVLEN(wmi_get_fw_mem_dump_fixed_param)); |
| 10255 | |
| 10256 | cmd->request_id = mem_dump_req->request_id; |
| 10257 | cmd->num_fw_mem_dump_segs = mem_dump_req->num_seg; |
| 10258 | |
| 10259 | /* TLV indicating array of structures to follow */ |
| 10260 | buf_ptr += sizeof(wmi_get_fw_mem_dump_fixed_param); |
| 10261 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10262 | sizeof(wmi_fw_mem_dump) * |
| 10263 | cmd->num_fw_mem_dump_segs); |
| 10264 | |
| 10265 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10266 | dump_params = (wmi_fw_mem_dump *) buf_ptr; |
| 10267 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10268 | WMI_LOGI(FL("request_id:%d num_seg:%d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10269 | mem_dump_req->request_id, mem_dump_req->num_seg); |
| 10270 | for (loop = 0; loop < cmd->num_fw_mem_dump_segs; loop++) { |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 10271 | seg_req = (struct wmi_fw_dump_seg_req *) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10272 | ((uint8_t *)(mem_dump_req->segment) + |
| 10273 | loop * sizeof(*seg_req)); |
| 10274 | WMITLV_SET_HDR(&dump_params->tlv_header, |
| 10275 | WMITLV_TAG_STRUC_wmi_fw_mem_dump_params, |
| 10276 | WMITLV_GET_STRUCT_TLVLEN(wmi_fw_mem_dump)); |
| 10277 | dump_params->seg_id = seg_req->seg_id; |
| 10278 | dump_params->seg_start_addr_lo = seg_req->seg_start_addr_lo; |
| 10279 | dump_params->seg_start_addr_hi = seg_req->seg_start_addr_hi; |
| 10280 | dump_params->seg_length = seg_req->seg_length; |
| 10281 | dump_params->dest_addr_lo = seg_req->dst_addr_lo; |
| 10282 | dump_params->dest_addr_hi = seg_req->dst_addr_hi; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10283 | WMI_LOGI(FL("seg_number:%d"), loop); |
| 10284 | 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] | 10285 | dump_params->seg_id, dump_params->seg_start_addr_lo, |
| 10286 | dump_params->seg_start_addr_hi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10287 | 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] | 10288 | dump_params->seg_length, dump_params->dest_addr_lo, |
| 10289 | dump_params->dest_addr_hi); |
| 10290 | dump_params++; |
| 10291 | } |
| 10292 | |
| 10293 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10294 | WMI_GET_FW_MEM_DUMP_CMDID); |
| 10295 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10296 | WMI_LOGE(FL("Failed to send get firmware mem dump request")); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10297 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10298 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10299 | } |
| 10300 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10301 | WMI_LOGI(FL("Get firmware mem dump request sent successfully")); |
| 10302 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10303 | } |
| 10304 | |
| 10305 | /* |
| 10306 | * send_process_set_ie_info_cmd_tlv() - Function to send IE info to firmware |
| 10307 | * @wmi_handle: Pointer to WMi handle |
| 10308 | * @ie_data: Pointer for ie data |
| 10309 | * |
| 10310 | * This function sends IE information to firmware |
| 10311 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10312 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10313 | * |
| 10314 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10315 | 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] | 10316 | struct vdev_ie_info_param *ie_info) |
| 10317 | { |
| 10318 | wmi_vdev_set_ie_cmd_fixed_param *cmd; |
| 10319 | wmi_buf_t buf; |
| 10320 | uint8_t *buf_ptr; |
| 10321 | uint32_t len, ie_len_aligned; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10322 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10323 | |
| 10324 | |
| 10325 | ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t)); |
| 10326 | /* Allocate memory for the WMI command */ |
| 10327 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + ie_len_aligned; |
| 10328 | |
| 10329 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10330 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10331 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 10332 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10333 | } |
| 10334 | |
| 10335 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10336 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10337 | |
| 10338 | /* Populate the WMI command */ |
| 10339 | cmd = (wmi_vdev_set_ie_cmd_fixed_param *)buf_ptr; |
| 10340 | |
| 10341 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10342 | WMITLV_TAG_STRUC_wmi_vdev_set_ie_cmd_fixed_param, |
| 10343 | WMITLV_GET_STRUCT_TLVLEN( |
| 10344 | wmi_vdev_set_ie_cmd_fixed_param)); |
| 10345 | cmd->vdev_id = ie_info->vdev_id; |
| 10346 | cmd->ie_id = ie_info->ie_id; |
| 10347 | cmd->ie_len = ie_info->length; |
Naveen Rawat | 61be23a | 2016-08-03 16:41:33 -0700 | [diff] [blame] | 10348 | cmd->band = ie_info->band; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10349 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10350 | 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] | 10351 | ie_info->length, ie_info->vdev_id); |
| 10352 | |
| 10353 | buf_ptr += sizeof(*cmd); |
| 10354 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 10355 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10356 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10357 | qdf_mem_copy(buf_ptr, ie_info->data, cmd->ie_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10358 | |
| 10359 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10360 | WMI_VDEV_SET_IE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10361 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10362 | WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10363 | wmi_buf_free(buf); |
| 10364 | } |
| 10365 | |
| 10366 | return ret; |
| 10367 | } |
| 10368 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10369 | /** |
| 10370 | * send_smart_ant_enable_cmd_tlv() - WMI smart ant enable function |
| 10371 | * |
| 10372 | * @param wmi_handle : handle to WMI. |
| 10373 | * @param param : pointer to antenna param |
| 10374 | * |
| 10375 | * This function sends smart antenna enable command to FW |
| 10376 | * |
| 10377 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10378 | */ |
| 10379 | static QDF_STATUS send_smart_ant_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 10380 | struct smart_ant_enable_params *param) |
| 10381 | { |
| 10382 | /* Send WMI COMMAND to Enable */ |
| 10383 | wmi_pdev_smart_ant_enable_cmd_fixed_param *cmd; |
| 10384 | wmi_pdev_smart_ant_gpio_handle *gpio_param; |
| 10385 | wmi_buf_t buf; |
| 10386 | uint8_t *buf_ptr; |
| 10387 | int len = 0; |
| 10388 | QDF_STATUS ret; |
| 10389 | int loop = 0; |
| 10390 | |
| 10391 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10392 | len += WMI_HAL_MAX_SANTENNA * sizeof(wmi_pdev_smart_ant_gpio_handle); |
| 10393 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10394 | |
| 10395 | if (!buf) { |
| 10396 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10397 | return QDF_STATUS_E_NOMEM; |
| 10398 | } |
| 10399 | |
| 10400 | buf_ptr = wmi_buf_data(buf); |
| 10401 | qdf_mem_zero(buf_ptr, len); |
| 10402 | cmd = (wmi_pdev_smart_ant_enable_cmd_fixed_param *)buf_ptr; |
| 10403 | |
| 10404 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10405 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_enable_cmd_fixed_param, |
| 10406 | WMITLV_GET_STRUCT_TLVLEN( |
| 10407 | wmi_pdev_smart_ant_enable_cmd_fixed_param)); |
| 10408 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10409 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10410 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10411 | cmd->enable = param->enable; |
| 10412 | cmd->mode = param->mode; |
| 10413 | cmd->rx_antenna = param->rx_antenna; |
| 10414 | cmd->tx_default_antenna = param->rx_antenna; |
| 10415 | |
| 10416 | /* TLV indicating array of structures to follow */ |
| 10417 | buf_ptr += sizeof(wmi_pdev_smart_ant_enable_cmd_fixed_param); |
| 10418 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10419 | WMI_HAL_MAX_SANTENNA * |
| 10420 | sizeof(wmi_pdev_smart_ant_gpio_handle)); |
| 10421 | |
| 10422 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10423 | gpio_param = (wmi_pdev_smart_ant_gpio_handle *)buf_ptr; |
| 10424 | |
| 10425 | for (loop = 0; loop < WMI_HAL_MAX_SANTENNA; loop++) { |
| 10426 | WMITLV_SET_HDR(&gpio_param->tlv_header, |
| 10427 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_gpio_handle, |
| 10428 | WMITLV_GET_STRUCT_TLVLEN( |
| 10429 | wmi_pdev_smart_ant_gpio_handle)); |
| 10430 | if (param->mode == SMART_ANT_MODE_SERIAL) { |
| 10431 | if (loop < WMI_HOST_MAX_SERIAL_ANTENNA) { |
| 10432 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 10433 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 10434 | } else { |
| 10435 | gpio_param->gpio_pin = 0; |
| 10436 | gpio_param->gpio_func = 0; |
| 10437 | } |
| 10438 | } else if (param->mode == SMART_ANT_MODE_PARALLEL) { |
| 10439 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 10440 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 10441 | } |
| 10442 | /* Setting it to 0 for now */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10443 | gpio_param->pdev_id = |
| 10444 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10445 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10446 | gpio_param++; |
| 10447 | } |
| 10448 | |
| 10449 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10450 | buf, |
| 10451 | len, |
| 10452 | WMI_PDEV_SMART_ANT_ENABLE_CMDID); |
| 10453 | |
| 10454 | if (ret != 0) { |
| 10455 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 10456 | WMI_LOGE("enable:%d mode:%d rx_antenna: 0x%08x PINS: [%d %d %d %d] Func[%d %d %d %d] cmdstatus=%d\n", |
| 10457 | cmd->enable, |
| 10458 | cmd->mode, |
| 10459 | cmd->rx_antenna, |
| 10460 | param->gpio_pin[0], param->gpio_pin[1], |
| 10461 | param->gpio_pin[2], param->gpio_pin[3], |
| 10462 | param->gpio_func[0], param->gpio_func[1], |
| 10463 | param->gpio_func[2], param->gpio_func[3], |
| 10464 | ret); |
| 10465 | wmi_buf_free(buf); |
| 10466 | } |
| 10467 | |
| 10468 | return ret; |
| 10469 | } |
| 10470 | |
| 10471 | /** |
| 10472 | * send_smart_ant_set_rx_ant_cmd_tlv() - WMI set rx antenna function |
| 10473 | * |
| 10474 | * @param wmi_handle : handle to WMI. |
| 10475 | * @param param : pointer to rx antenna param |
| 10476 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10477 | */ |
| 10478 | static QDF_STATUS send_smart_ant_set_rx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 10479 | struct smart_ant_rx_ant_params *param) |
| 10480 | { |
| 10481 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *cmd; |
| 10482 | wmi_buf_t buf; |
| 10483 | uint8_t *buf_ptr; |
| 10484 | uint32_t len; |
| 10485 | QDF_STATUS ret; |
| 10486 | |
| 10487 | len = sizeof(*cmd); |
| 10488 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10489 | WMI_LOGD("%s:\n", __func__); |
| 10490 | if (!buf) { |
| 10491 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10492 | return QDF_STATUS_E_NOMEM; |
| 10493 | } |
| 10494 | |
| 10495 | buf_ptr = wmi_buf_data(buf); |
| 10496 | cmd = (wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *)buf_ptr; |
| 10497 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10498 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param, |
| 10499 | WMITLV_GET_STRUCT_TLVLEN( |
| 10500 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param)); |
| 10501 | cmd->rx_antenna = param->antenna; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10502 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10503 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10504 | |
| 10505 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10506 | buf, |
| 10507 | len, |
| 10508 | WMI_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID); |
| 10509 | |
| 10510 | if (ret != 0) { |
| 10511 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 10512 | WMI_LOGE("%s: rx_antenna: 0x%08x cmdstatus=%d\n", |
| 10513 | __func__, |
| 10514 | cmd->rx_antenna, |
| 10515 | ret); |
| 10516 | wmi_buf_free(buf); |
| 10517 | } |
| 10518 | |
| 10519 | return ret; |
| 10520 | } |
| 10521 | |
| 10522 | /** |
| 10523 | * send_set_ctl_table_cmd_tlv() - send ctl table cmd to fw |
| 10524 | * @wmi_handle: wmi handle |
| 10525 | * @param: pointer to hold ctl table param |
| 10526 | * |
| 10527 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10528 | */ |
| 10529 | static QDF_STATUS |
| 10530 | send_set_ctl_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 10531 | struct ctl_table_params *param) |
| 10532 | { |
| 10533 | uint16_t len, ctl_tlv_len; |
| 10534 | uint8_t *buf_ptr; |
| 10535 | wmi_buf_t buf; |
| 10536 | wmi_pdev_set_ctl_table_cmd_fixed_param *cmd; |
| 10537 | uint32_t *ctl_array; |
| 10538 | |
| 10539 | if (!param->ctl_array) |
| 10540 | return QDF_STATUS_E_FAILURE; |
| 10541 | |
| 10542 | if (param->ctl_cmd_len != |
| 10543 | WMI_HOST_NUM_CTLS_2G * WMI_HOST_NUM_BAND_EDGES_2G * 2 + |
| 10544 | WMI_HOST_NUM_CTLS_5G * WMI_HOST_NUM_BAND_EDGES_5G * 2) { |
| 10545 | qdf_print("CTL array len not correct\n"); |
| 10546 | return QDF_STATUS_E_FAILURE; |
| 10547 | } |
| 10548 | |
| 10549 | ctl_tlv_len = WMI_TLV_HDR_SIZE + |
| 10550 | roundup(param->ctl_cmd_len, sizeof(A_UINT32)); |
| 10551 | len = sizeof(*cmd) + ctl_tlv_len; |
| 10552 | |
| 10553 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10554 | if (!buf) { |
| 10555 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10556 | return QDF_STATUS_E_FAILURE; |
| 10557 | } |
| 10558 | |
| 10559 | buf_ptr = wmi_buf_data(buf); |
| 10560 | qdf_mem_zero(buf_ptr, len); |
| 10561 | |
| 10562 | cmd = (wmi_pdev_set_ctl_table_cmd_fixed_param *)buf_ptr; |
| 10563 | |
| 10564 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10565 | WMITLV_TAG_STRUC_wmi_pdev_set_ctl_table_cmd_fixed_param, |
| 10566 | WMITLV_GET_STRUCT_TLVLEN( |
| 10567 | wmi_pdev_set_ctl_table_cmd_fixed_param)); |
| 10568 | cmd->ctl_len = param->ctl_cmd_len; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10569 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10570 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10571 | |
| 10572 | buf_ptr += sizeof(*cmd); |
| 10573 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10574 | (cmd->ctl_len)); |
| 10575 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10576 | ctl_array = (uint32_t *)buf_ptr; |
| 10577 | |
| 10578 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[0], ¶m->ctl_band, |
| 10579 | sizeof(param->ctl_band)); |
| 10580 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[1], param->ctl_array, |
| 10581 | param->ctl_cmd_len - |
| 10582 | sizeof(param->ctl_band)); |
| 10583 | |
| 10584 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10585 | WMI_PDEV_SET_CTL_TABLE_CMDID)) { |
| 10586 | WMI_LOGE("%s:Failed to send command\n", __func__); |
| 10587 | wmi_buf_free(buf); |
| 10588 | return QDF_STATUS_E_FAILURE; |
| 10589 | } |
| 10590 | |
| 10591 | return QDF_STATUS_SUCCESS; |
| 10592 | } |
| 10593 | |
| 10594 | /** |
| 10595 | * send_set_mimogain_table_cmd_tlv() - send mimogain table cmd to fw |
| 10596 | * @wmi_handle: wmi handle |
| 10597 | * @param: pointer to hold mimogain table param |
| 10598 | * |
| 10599 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10600 | */ |
| 10601 | static QDF_STATUS |
| 10602 | send_set_mimogain_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 10603 | struct mimogain_table_params *param) |
| 10604 | { |
| 10605 | uint16_t len, table_tlv_len; |
| 10606 | wmi_buf_t buf; |
| 10607 | uint8_t *buf_ptr; |
| 10608 | wmi_pdev_set_mimogain_table_cmd_fixed_param *cmd; |
| 10609 | uint32_t *gain_table; |
| 10610 | |
| 10611 | if (!param->array_gain) |
| 10612 | return QDF_STATUS_E_FAILURE; |
| 10613 | |
| 10614 | /* len must be multiple of a single array gain table */ |
| 10615 | if (param->tbl_len % |
| 10616 | ((WMI_HOST_TX_NUM_CHAIN-1) * WMI_HOST_TPC_REGINDEX_MAX * |
| 10617 | WMI_HOST_ARRAY_GAIN_NUM_STREAMS) != 0) { |
| 10618 | WMI_LOGE("Array gain table len not correct\n"); |
| 10619 | return QDF_STATUS_E_FAILURE; |
| 10620 | } |
| 10621 | |
| 10622 | table_tlv_len = WMI_TLV_HDR_SIZE + |
| 10623 | roundup(param->tbl_len, sizeof(uint32_t)); |
| 10624 | len = sizeof(*cmd) + table_tlv_len; |
| 10625 | |
| 10626 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10627 | if (!buf) { |
| 10628 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10629 | return QDF_STATUS_E_FAILURE; |
| 10630 | } |
| 10631 | |
| 10632 | buf_ptr = wmi_buf_data(buf); |
| 10633 | qdf_mem_zero(buf_ptr, len); |
| 10634 | |
| 10635 | cmd = (wmi_pdev_set_mimogain_table_cmd_fixed_param *)buf_ptr; |
| 10636 | |
| 10637 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10638 | WMITLV_TAG_STRUC_wmi_pdev_set_mimogain_table_cmd_fixed_param, |
| 10639 | WMITLV_GET_STRUCT_TLVLEN( |
| 10640 | wmi_pdev_set_mimogain_table_cmd_fixed_param)); |
| 10641 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10642 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10643 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10644 | WMI_MIMOGAIN_ARRAY_GAIN_LEN_SET(cmd->mimogain_info, param->tbl_len); |
| 10645 | WMI_MIMOGAIN_MULTI_CHAIN_BYPASS_SET(cmd->mimogain_info, |
| 10646 | param->multichain_gain_bypass); |
| 10647 | |
| 10648 | buf_ptr += sizeof(*cmd); |
| 10649 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10650 | (param->tbl_len)); |
| 10651 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10652 | gain_table = (uint32_t *)buf_ptr; |
| 10653 | |
| 10654 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(gain_table, |
| 10655 | param->array_gain, |
| 10656 | param->tbl_len); |
| 10657 | |
| 10658 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10659 | WMI_PDEV_SET_MIMOGAIN_TABLE_CMDID)) { |
| 10660 | return QDF_STATUS_E_FAILURE; |
| 10661 | } |
| 10662 | |
| 10663 | return QDF_STATUS_SUCCESS; |
| 10664 | } |
| 10665 | |
| 10666 | /** |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 10667 | * enum packet_power_tlv_flags: target defined |
| 10668 | * packet power rate flags for TLV |
| 10669 | * @WMI_TLV_FLAG_ONE_CHAIN: one chain |
| 10670 | * @WMI_TLV_FLAG_TWO_CHAIN: two chain |
| 10671 | * @WMI_TLV_FLAG_THREE_CHAIN: three chain |
| 10672 | * @WMI_TLV_FLAG_FOUR_CHAIN: four chain |
| 10673 | * @WMI_TLV_FLAG_FIVE_CHAIN: five chain |
| 10674 | * @WMI_TLV_FLAG_SIX_CHAIN: six chain |
| 10675 | * @WMI_TLV_FLAG_SEVEN_CHAIN: seven chain |
| 10676 | * @WMI_TLV_FLAG_EIGHT_CHAIN:eight chain |
| 10677 | * @WMI_TLV_FLAG_STBC: STBC is set |
| 10678 | * @WMI_TLV_FLAG_40MHZ: 40MHz chan width |
| 10679 | * @WMI_TLV_FLAG_80MHZ: 80MHz chan width |
| 10680 | * @WMI_TLV_FLAG_160MHZ: 160MHz chan width |
| 10681 | * @WMI_TLV_FLAG_TXBF: Tx Bf enabled |
| 10682 | * @WMI_TLV_FLAG_RTSENA: RTS enabled |
| 10683 | * @WMI_TLV_FLAG_CTSENA: CTS enabled |
| 10684 | * @WMI_TLV_FLAG_LDPC: LDPC is set |
| 10685 | * @WMI_TLV_FLAG_SGI: Short gaurd interval |
| 10686 | * @WMI_TLV_FLAG_SU: SU Data |
| 10687 | * @WMI_TLV_FLAG_DL_MU_MIMO_AC: DL AC MU data |
| 10688 | * @WMI_TLV_FLAG_DL_MU_MIMO_AX: DL AX MU data |
| 10689 | * @WMI_TLV_FLAG_DL_OFDMA: DL OFDMA data |
| 10690 | * @WMI_TLV_FLAG_UL_OFDMA: UL OFDMA data |
| 10691 | * @WMI_TLV_FLAG_UL_MU_MIMO: UL MU data |
| 10692 | * |
| 10693 | * @WMI_TLV_FLAG_BW_MASK: bandwidth mask |
| 10694 | * @WMI_TLV_FLAG_BW_SHIFT: bandwidth shift |
| 10695 | * @WMI_TLV_FLAG_SU_MU_OFDMA_MASK: su/mu/ofdma mask |
| 10696 | * @WMI_TLV_FLAG_SU_MU_OFDMA_shift: su/mu/ofdma shift |
| 10697 | */ |
| 10698 | enum packet_power_tlv_flags { |
| 10699 | WMI_TLV_FLAG_ONE_CHAIN = 0x00000001, |
| 10700 | WMI_TLV_FLAG_TWO_CHAIN = 0x00000003, |
| 10701 | WMI_TLV_FLAG_THREE_CHAIN = 0x00000007, |
| 10702 | WMI_TLV_FLAG_FOUR_CHAIN = 0x0000000F, |
| 10703 | WMI_TLV_FLAG_FIVE_CHAIN = 0x0000001F, |
| 10704 | WMI_TLV_FLAG_SIX_CHAIN = 0x0000003F, |
| 10705 | WMI_TLV_FLAG_SEVEN_CHAIN = 0x0000007F, |
| 10706 | WMI_TLV_FLAG_EIGHT_CHAIN = 0x0000008F, |
| 10707 | WMI_TLV_FLAG_STBC = 0x00000100, |
| 10708 | WMI_TLV_FLAG_40MHZ = 0x00000200, |
| 10709 | WMI_TLV_FLAG_80MHZ = 0x00000300, |
| 10710 | WMI_TLV_FLAG_160MHZ = 0x00000400, |
| 10711 | WMI_TLV_FLAG_TXBF = 0x00000800, |
| 10712 | WMI_TLV_FLAG_RTSENA = 0x00001000, |
| 10713 | WMI_TLV_FLAG_CTSENA = 0x00002000, |
| 10714 | WMI_TLV_FLAG_LDPC = 0x00004000, |
| 10715 | WMI_TLV_FLAG_SGI = 0x00008000, |
| 10716 | WMI_TLV_FLAG_SU = 0x00100000, |
| 10717 | WMI_TLV_FLAG_DL_MU_MIMO_AC = 0x00200000, |
| 10718 | WMI_TLV_FLAG_DL_MU_MIMO_AX = 0x00300000, |
| 10719 | WMI_TLV_FLAG_DL_OFDMA = 0x00400000, |
| 10720 | WMI_TLV_FLAG_UL_OFDMA = 0x00500000, |
| 10721 | WMI_TLV_FLAG_UL_MU_MIMO = 0x00600000, |
| 10722 | |
| 10723 | WMI_TLV_FLAG_CHAIN_MASK = 0xff, |
| 10724 | WMI_TLV_FLAG_BW_MASK = 0x3, |
| 10725 | WMI_TLV_FLAG_BW_SHIFT = 9, |
| 10726 | WMI_TLV_FLAG_SU_MU_OFDMA_MASK = 0x7, |
| 10727 | WMI_TLV_FLAG_SU_MU_OFDMA_SHIFT = 20, |
| 10728 | }; |
| 10729 | |
| 10730 | /** |
| 10731 | * convert_to_power_info_rate_flags() - convert packet_power_info_params |
| 10732 | * to FW understandable format |
| 10733 | * @param: pointer to hold packet power info param |
| 10734 | * |
| 10735 | * @return FW understandable 32 bit rate flags |
| 10736 | */ |
| 10737 | static uint32_t |
| 10738 | convert_to_power_info_rate_flags(struct packet_power_info_params *param) |
| 10739 | { |
| 10740 | uint32_t rateflags = 0; |
| 10741 | |
| 10742 | if (param->chainmask) |
| 10743 | rateflags |= |
| 10744 | (param->chainmask & WMI_TLV_FLAG_CHAIN_MASK); |
| 10745 | if (param->chan_width) |
| 10746 | rateflags |= |
| 10747 | ((param->chan_width & WMI_TLV_FLAG_BW_MASK) |
| 10748 | << WMI_TLV_FLAG_BW_SHIFT); |
| 10749 | if (param->su_mu_ofdma) |
| 10750 | rateflags |= |
| 10751 | ((param->su_mu_ofdma & WMI_TLV_FLAG_SU_MU_OFDMA_MASK) |
| 10752 | << WMI_TLV_FLAG_SU_MU_OFDMA_SHIFT); |
| 10753 | if (param->rate_flags & WMI_HOST_FLAG_STBC) |
| 10754 | rateflags |= WMI_TLV_FLAG_STBC; |
| 10755 | if (param->rate_flags & WMI_HOST_FLAG_LDPC) |
| 10756 | rateflags |= WMI_TLV_FLAG_LDPC; |
| 10757 | if (param->rate_flags & WMI_HOST_FLAG_TXBF) |
| 10758 | rateflags |= WMI_TLV_FLAG_TXBF; |
| 10759 | if (param->rate_flags & WMI_HOST_FLAG_RTSENA) |
| 10760 | rateflags |= WMI_TLV_FLAG_RTSENA; |
| 10761 | if (param->rate_flags & WMI_HOST_FLAG_CTSENA) |
| 10762 | rateflags |= WMI_TLV_FLAG_CTSENA; |
| 10763 | if (param->rate_flags & WMI_HOST_FLAG_SGI) |
| 10764 | rateflags |= WMI_TLV_FLAG_SGI; |
| 10765 | |
| 10766 | return rateflags; |
| 10767 | } |
| 10768 | |
| 10769 | /** |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10770 | * send_packet_power_info_get_cmd_tlv() - send request to get packet power |
| 10771 | * info to fw |
| 10772 | * @wmi_handle: wmi handle |
| 10773 | * @param: pointer to hold packet power info param |
| 10774 | * |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 10775 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10776 | */ |
| 10777 | static QDF_STATUS |
| 10778 | send_packet_power_info_get_cmd_tlv(wmi_unified_t wmi_handle, |
| 10779 | struct packet_power_info_params *param) |
| 10780 | { |
| 10781 | wmi_pdev_get_tpc_cmd_fixed_param *cmd; |
| 10782 | wmi_buf_t wmibuf; |
| 10783 | uint8_t *buf_ptr; |
| 10784 | u_int32_t len = sizeof(wmi_pdev_get_tpc_cmd_fixed_param); |
| 10785 | |
| 10786 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 10787 | if (wmibuf == NULL) |
| 10788 | return QDF_STATUS_E_NOMEM; |
| 10789 | |
| 10790 | buf_ptr = (uint8_t *)wmi_buf_data(wmibuf); |
| 10791 | |
| 10792 | cmd = (wmi_pdev_get_tpc_cmd_fixed_param *)buf_ptr; |
| 10793 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10794 | WMITLV_TAG_STRUC_wmi_pdev_get_tpc_cmd_fixed_param, |
| 10795 | WMITLV_GET_STRUCT_TLVLEN( |
| 10796 | wmi_pdev_get_tpc_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10797 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10798 | param->pdev_id); |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 10799 | cmd->rate_flags = convert_to_power_info_rate_flags(param); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10800 | cmd->nss = param->nss; |
| 10801 | cmd->preamble = param->preamble; |
| 10802 | cmd->hw_rate = param->hw_rate; |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 10803 | |
| 10804 | WMI_LOGI("%s[%d] commandID %d, wmi_pdev_get_tpc_cmd=0x%x," |
| 10805 | "rate_flags: 0x%x, nss: %d, preamble: %d, hw_rate: %d\n", |
| 10806 | __func__, __LINE__, WMI_PDEV_GET_TPC_CMDID, *((u_int32_t *)cmd), |
| 10807 | cmd->rate_flags, cmd->nss, cmd->preamble, cmd->hw_rate); |
| 10808 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10809 | if (wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 10810 | WMI_PDEV_GET_TPC_CMDID)) { |
| 10811 | WMI_LOGE(FL("Failed to get tpc command\n")); |
| 10812 | wmi_buf_free(wmibuf); |
| 10813 | return QDF_STATUS_E_FAILURE; |
| 10814 | } |
| 10815 | |
| 10816 | return QDF_STATUS_SUCCESS; |
| 10817 | } |
| 10818 | |
| 10819 | /** |
| 10820 | * send_vdev_config_ratemask_cmd_tlv() - config ratemask param in fw |
| 10821 | * @wmi_handle: wmi handle |
| 10822 | * @param: pointer to hold config ratemask params |
| 10823 | * |
| 10824 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10825 | */ |
| 10826 | static QDF_STATUS send_vdev_config_ratemask_cmd_tlv(wmi_unified_t wmi_handle, |
| 10827 | struct config_ratemask_params *param) |
| 10828 | { |
| 10829 | wmi_vdev_config_ratemask_cmd_fixed_param *cmd; |
| 10830 | wmi_buf_t buf; |
| 10831 | int32_t len = sizeof(*cmd); |
| 10832 | |
| 10833 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10834 | if (!buf) { |
| 10835 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10836 | return QDF_STATUS_E_FAILURE; |
| 10837 | } |
| 10838 | cmd = (wmi_vdev_config_ratemask_cmd_fixed_param *)wmi_buf_data(buf); |
| 10839 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10840 | WMITLV_TAG_STRUC_wmi_vdev_config_ratemask_fixed_param, |
| 10841 | WMITLV_GET_STRUCT_TLVLEN( |
| 10842 | wmi_vdev_config_ratemask_cmd_fixed_param)); |
| 10843 | cmd->vdev_id = param->vdev_id; |
| 10844 | cmd->type = param->type; |
| 10845 | cmd->mask_lower32 = param->lower32; |
| 10846 | cmd->mask_higher32 = param->higher32; |
| 10847 | WMI_LOGI("Setting vdev ratemask vdev id = 0x%X, type = 0x%X, mask_l32 = 0x%X mask_h32 = 0x%X\n", |
| 10848 | param->vdev_id, param->type, param->lower32, param->higher32); |
| 10849 | |
| 10850 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10851 | WMI_VDEV_RATEMASK_CMDID)) { |
| 10852 | WMI_LOGE("Seting vdev ratemask failed\n"); |
| 10853 | wmi_buf_free(buf); |
| 10854 | return QDF_STATUS_E_FAILURE; |
| 10855 | } |
| 10856 | |
| 10857 | return QDF_STATUS_SUCCESS; |
| 10858 | } |
| 10859 | |
| 10860 | /** |
| 10861 | * send_set_vap_dscp_tid_map_cmd_tlv() - send vap dscp tid map cmd to fw |
| 10862 | * @wmi_handle: wmi handle |
| 10863 | * @param: pointer to hold vap dscp tid map param |
| 10864 | * |
| 10865 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10866 | */ |
| 10867 | static QDF_STATUS |
| 10868 | send_set_vap_dscp_tid_map_cmd_tlv(wmi_unified_t wmi_handle, |
| 10869 | struct vap_dscp_tid_map_params *param) |
| 10870 | { |
| 10871 | wmi_buf_t buf; |
| 10872 | wmi_vdev_set_dscp_tid_map_cmd_fixed_param *cmd; |
| 10873 | int32_t len = sizeof(*cmd); |
| 10874 | |
| 10875 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10876 | if (!buf) { |
| 10877 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10878 | return QDF_STATUS_E_FAILURE; |
| 10879 | } |
| 10880 | |
| 10881 | cmd = (wmi_vdev_set_dscp_tid_map_cmd_fixed_param *)wmi_buf_data(buf); |
| 10882 | qdf_mem_copy(cmd->dscp_to_tid_map, param->dscp_to_tid_map, |
| 10883 | sizeof(A_UINT32) * WMI_DSCP_MAP_MAX); |
| 10884 | |
| 10885 | cmd->vdev_id = param->vdev_id; |
| 10886 | cmd->enable_override = 0; |
| 10887 | |
| 10888 | WMI_LOGI("Setting dscp for vap id: %d\n", cmd->vdev_id); |
| 10889 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10890 | WMI_VDEV_SET_DSCP_TID_MAP_CMDID)) { |
| 10891 | WMI_LOGE("Failed to set dscp cmd\n"); |
| 10892 | wmi_buf_free(buf); |
| 10893 | return QDF_STATUS_E_FAILURE; |
| 10894 | } |
| 10895 | |
| 10896 | return QDF_STATUS_SUCCESS; |
| 10897 | } |
| 10898 | |
| 10899 | /** |
| 10900 | * send_vdev_set_neighbour_rx_cmd_tlv() - set neighbour rx param in fw |
| 10901 | * @wmi_handle: wmi handle |
| 10902 | * @macaddr: vdev mac address |
| 10903 | * @param: pointer to hold neigbour rx param |
| 10904 | * |
| 10905 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10906 | */ |
| 10907 | static QDF_STATUS send_vdev_set_neighbour_rx_cmd_tlv(wmi_unified_t wmi_handle, |
| 10908 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10909 | struct set_neighbour_rx_params *param) |
| 10910 | { |
| 10911 | wmi_vdev_filter_nrp_config_cmd_fixed_param *cmd; |
| 10912 | wmi_buf_t buf; |
| 10913 | int32_t len = sizeof(*cmd); |
| 10914 | |
| 10915 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10916 | if (!buf) { |
| 10917 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10918 | return QDF_STATUS_E_FAILURE; |
| 10919 | } |
| 10920 | cmd = (wmi_vdev_filter_nrp_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 10921 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10922 | WMITLV_TAG_STRUC_wmi_vdev_filter_nrp_config_cmd_fixed_param, |
| 10923 | WMITLV_GET_STRUCT_TLVLEN( |
| 10924 | wmi_vdev_filter_nrp_config_cmd_fixed_param)); |
| 10925 | cmd->vdev_id = param->vdev_id; |
| 10926 | cmd->bssid_idx = param->idx; |
| 10927 | cmd->action = param->action; |
| 10928 | cmd->type = param->type; |
| 10929 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->addr); |
| 10930 | cmd->flag = 0; |
| 10931 | |
| 10932 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10933 | WMI_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID)) { |
| 10934 | WMI_LOGE("Failed to set neighbour rx param\n"); |
| 10935 | wmi_buf_free(buf); |
| 10936 | return QDF_STATUS_E_FAILURE; |
| 10937 | } |
| 10938 | |
| 10939 | return QDF_STATUS_SUCCESS; |
| 10940 | } |
| 10941 | |
| 10942 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 10943 | * 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] | 10944 | * @param wmi_handle : handle to WMI. |
| 10945 | * @param macaddr : vdev mac address |
| 10946 | * @param param : pointer to tx antenna param |
| 10947 | * |
| 10948 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10949 | */ |
| 10950 | static QDF_STATUS send_smart_ant_set_tx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 10951 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10952 | struct smart_ant_tx_ant_params *param) |
| 10953 | { |
| 10954 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *cmd; |
| 10955 | wmi_peer_smart_ant_set_tx_antenna_series *ant_tx_series; |
| 10956 | wmi_buf_t buf; |
| 10957 | int32_t len = 0; |
| 10958 | int i; |
| 10959 | uint8_t *buf_ptr; |
| 10960 | QDF_STATUS ret; |
| 10961 | |
| 10962 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10963 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 10964 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series); |
| 10965 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10966 | |
| 10967 | if (!buf) { |
| 10968 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10969 | return QDF_STATUS_E_NOMEM; |
| 10970 | } |
| 10971 | |
| 10972 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10973 | qdf_mem_zero(buf_ptr, len); |
| 10974 | cmd = (wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *)buf_ptr; |
| 10975 | |
| 10976 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10977 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param, |
| 10978 | WMITLV_GET_STRUCT_TLVLEN( |
| 10979 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param)); |
| 10980 | |
| 10981 | cmd->vdev_id = param->vdev_id; |
| 10982 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10983 | |
| 10984 | buf_ptr += sizeof(wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param); |
| 10985 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10986 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series)); |
| 10987 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10988 | ant_tx_series = (wmi_peer_smart_ant_set_tx_antenna_series *)buf_ptr; |
| 10989 | |
| 10990 | for (i = 0; i < WMI_SMART_ANT_MAX_RATE_SERIES; i++) { |
| 10991 | WMITLV_SET_HDR(&ant_tx_series->tlv_header, |
| 10992 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_series, |
| 10993 | WMITLV_GET_STRUCT_TLVLEN( |
| 10994 | wmi_peer_smart_ant_set_tx_antenna_series)); |
| 10995 | ant_tx_series->antenna_series = param->antenna_array[i]; |
| 10996 | ant_tx_series++; |
| 10997 | } |
| 10998 | |
| 10999 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11000 | buf, |
| 11001 | len, |
| 11002 | WMI_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID); |
| 11003 | |
| 11004 | if (ret != 0) { |
| 11005 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 11006 | wmi_buf_free(buf); |
| 11007 | } |
| 11008 | |
| 11009 | return ret; |
| 11010 | } |
| 11011 | |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11012 | /** |
| 11013 | * send_set_ant_switch_tbl_cmd_tlv() - send ant switch tbl cmd to fw |
| 11014 | * @wmi_handle: wmi handle |
| 11015 | * @param: pointer to hold ant switch tbl param |
| 11016 | * |
| 11017 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11018 | */ |
| 11019 | static QDF_STATUS |
| 11020 | send_set_ant_switch_tbl_cmd_tlv(wmi_unified_t wmi_handle, |
| 11021 | struct ant_switch_tbl_params *param) |
| 11022 | { |
| 11023 | uint8_t len; |
| 11024 | wmi_buf_t buf; |
| 11025 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *cmd; |
| 11026 | wmi_pdev_set_ant_ctrl_chain *ctrl_chain; |
| 11027 | uint8_t *buf_ptr; |
| 11028 | |
| 11029 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11030 | len += sizeof(wmi_pdev_set_ant_ctrl_chain); |
| 11031 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11032 | |
| 11033 | if (!buf) { |
| 11034 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11035 | return QDF_STATUS_E_NOMEM; |
| 11036 | } |
| 11037 | |
| 11038 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11039 | qdf_mem_zero(buf_ptr, len); |
| 11040 | cmd = (wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *)buf_ptr; |
| 11041 | |
| 11042 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11043 | WMITLV_TAG_STRUC_wmi_pdev_set_ant_switch_tbl_cmd_fixed_param, |
| 11044 | WMITLV_GET_STRUCT_TLVLEN( |
| 11045 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param)); |
| 11046 | |
| 11047 | cmd->antCtrlCommon1 = param->ant_ctrl_common1; |
| 11048 | cmd->antCtrlCommon2 = param->ant_ctrl_common2; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11049 | cmd->mac_id = |
| 11050 | wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11051 | |
| 11052 | /* TLV indicating array of structures to follow */ |
| 11053 | buf_ptr += sizeof(wmi_pdev_set_ant_switch_tbl_cmd_fixed_param); |
| 11054 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11055 | sizeof(wmi_pdev_set_ant_ctrl_chain)); |
| 11056 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11057 | ctrl_chain = (wmi_pdev_set_ant_ctrl_chain *)buf_ptr; |
| 11058 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11059 | ctrl_chain->pdev_id = |
| 11060 | wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11061 | ctrl_chain->antCtrlChain = param->antCtrlChain; |
| 11062 | |
| 11063 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11064 | WMI_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID)) { |
| 11065 | wmi_buf_free(buf); |
| 11066 | return QDF_STATUS_E_FAILURE; |
| 11067 | } |
| 11068 | |
| 11069 | return QDF_STATUS_SUCCESS; |
| 11070 | } |
| 11071 | |
| 11072 | /** |
| 11073 | * send_smart_ant_set_training_info_cmd_tlv() - WMI set smart antenna |
| 11074 | * training information function |
| 11075 | * @param wmi_handle : handle to WMI. |
| 11076 | * @macaddr : vdev mac address |
| 11077 | * @param param : pointer to tx antenna param |
| 11078 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11079 | */ |
| 11080 | static QDF_STATUS send_smart_ant_set_training_info_cmd_tlv( |
| 11081 | wmi_unified_t wmi_handle, |
| 11082 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 11083 | struct smart_ant_training_info_params *param) |
| 11084 | { |
| 11085 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *cmd; |
| 11086 | wmi_peer_smart_ant_set_train_antenna_param *train_param; |
| 11087 | wmi_buf_t buf; |
| 11088 | uint8_t *buf_ptr; |
| 11089 | int32_t len = 0; |
| 11090 | QDF_STATUS ret; |
| 11091 | int loop; |
| 11092 | |
| 11093 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11094 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 11095 | sizeof(wmi_peer_smart_ant_set_train_antenna_param); |
| 11096 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11097 | |
| 11098 | if (!buf) { |
| 11099 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11100 | return QDF_STATUS_E_NOMEM; |
| 11101 | } |
| 11102 | |
| 11103 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11104 | qdf_mem_zero(buf_ptr, len); |
| 11105 | cmd = (wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *)buf_ptr; |
| 11106 | |
| 11107 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11108 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param, |
| 11109 | WMITLV_GET_STRUCT_TLVLEN( |
| 11110 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param)); |
| 11111 | |
| 11112 | cmd->vdev_id = param->vdev_id; |
| 11113 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 11114 | cmd->num_pkts = param->numpkts; |
| 11115 | |
| 11116 | buf_ptr += sizeof(wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param); |
| 11117 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11118 | sizeof(wmi_peer_smart_ant_set_train_antenna_param) * |
| 11119 | WMI_SMART_ANT_MAX_RATE_SERIES); |
| 11120 | |
| 11121 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11122 | train_param = (wmi_peer_smart_ant_set_train_antenna_param *)buf_ptr; |
| 11123 | |
| 11124 | for (loop = 0; loop < WMI_SMART_ANT_MAX_RATE_SERIES; loop++) { |
| 11125 | WMITLV_SET_HDR(&train_param->tlv_header, |
| 11126 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_param, |
| 11127 | WMITLV_GET_STRUCT_TLVLEN( |
| 11128 | wmi_peer_smart_ant_set_train_antenna_param)); |
| 11129 | train_param->train_rate_series = param->rate_array[loop]; |
| 11130 | train_param->train_antenna_series = param->antenna_array[loop]; |
| 11131 | train_param->rc_flags = 0; |
| 11132 | WMI_LOGI(FL("Series number:%d\n"), loop); |
| 11133 | WMI_LOGI(FL("Rate [0x%02x] Tx_Antenna [0x%08x]\n"), |
| 11134 | train_param->train_rate_series, |
| 11135 | train_param->train_antenna_series); |
| 11136 | train_param++; |
| 11137 | } |
| 11138 | |
| 11139 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11140 | buf, |
| 11141 | len, |
| 11142 | WMI_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID); |
| 11143 | |
| 11144 | if (ret != 0) { |
| 11145 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 11146 | wmi_buf_free(buf); |
| 11147 | return QDF_STATUS_E_FAILURE; |
| 11148 | } |
| 11149 | |
| 11150 | return ret; |
| 11151 | } |
| 11152 | |
| 11153 | /** |
| 11154 | * send_smart_ant_set_node_config_cmd_tlv() - WMI set node |
| 11155 | * configuration function |
| 11156 | * @param wmi_handle : handle to WMI. |
| 11157 | * @macaddr : vdev mad address |
| 11158 | * @param param : pointer to tx antenna param |
| 11159 | * |
| 11160 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11161 | */ |
| 11162 | static QDF_STATUS send_smart_ant_set_node_config_cmd_tlv( |
| 11163 | wmi_unified_t wmi_handle, |
| 11164 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 11165 | struct smart_ant_node_config_params *param) |
| 11166 | { |
| 11167 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *cmd; |
| 11168 | wmi_buf_t buf; |
| 11169 | uint8_t *buf_ptr; |
| 11170 | int32_t len = 0, args_tlv_len; |
| 11171 | int ret; |
| 11172 | int i = 0; |
| 11173 | A_UINT32 *node_config_args; |
| 11174 | |
| 11175 | args_tlv_len = WMI_TLV_HDR_SIZE + param->args_count * sizeof(A_UINT32); |
| 11176 | len = sizeof(*cmd) + args_tlv_len; |
| 11177 | |
| 11178 | if ((param->args_count == 0)) { |
| 11179 | WMI_LOGE("%s: Can't send a command with %d arguments\n", |
| 11180 | __func__, param->args_count); |
| 11181 | return QDF_STATUS_E_FAILURE; |
| 11182 | } |
| 11183 | |
| 11184 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11185 | if (!buf) { |
| 11186 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11187 | return QDF_STATUS_E_NOMEM; |
| 11188 | } |
| 11189 | |
| 11190 | cmd = (wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *) |
| 11191 | wmi_buf_data(buf); |
| 11192 | buf_ptr = (uint8_t *)cmd; |
| 11193 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11194 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param, |
| 11195 | WMITLV_GET_STRUCT_TLVLEN( |
| 11196 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param)); |
| 11197 | cmd->vdev_id = param->vdev_id; |
| 11198 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 11199 | cmd->cmd_id = param->cmd_id; |
| 11200 | cmd->args_count = param->args_count; |
| 11201 | buf_ptr += sizeof( |
| 11202 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param); |
| 11203 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11204 | (cmd->args_count * sizeof(A_UINT32))); |
| 11205 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11206 | node_config_args = (A_UINT32 *)buf_ptr; |
| 11207 | |
| 11208 | for (i = 0; i < param->args_count; i++) { |
| 11209 | node_config_args[i] = param->args_arr[i]; |
| 11210 | WMI_LOGI("%d", param->args_arr[i]); |
| 11211 | } |
| 11212 | |
| 11213 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11214 | buf, |
| 11215 | len, |
| 11216 | WMI_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID); |
| 11217 | |
| 11218 | if (ret != 0) { |
| 11219 | WMI_LOGE("%s: WMI FAILED:Sent cmd_id: 0x%x\n Node: %02x:%02x:%02x:%02x:%02x:%02x cmdstatus=%d\n", |
| 11220 | __func__, param->cmd_id, macaddr[0], |
| 11221 | macaddr[1], macaddr[2], macaddr[3], |
| 11222 | macaddr[4], macaddr[5], ret); |
| 11223 | wmi_buf_free(buf); |
| 11224 | } |
| 11225 | |
| 11226 | return ret; |
| 11227 | } |
| 11228 | |
| 11229 | /** |
| 11230 | * send_set_atf_cmd_tlv() - send set atf command to fw |
| 11231 | * @wmi_handle: wmi handle |
| 11232 | * @param: pointer to set atf param |
| 11233 | * |
| 11234 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11235 | */ |
| 11236 | static QDF_STATUS |
| 11237 | send_set_atf_cmd_tlv(wmi_unified_t wmi_handle, |
| 11238 | struct set_atf_params *param) |
| 11239 | { |
| 11240 | wmi_atf_peer_info *peer_info; |
| 11241 | wmi_peer_atf_request_fixed_param *cmd; |
| 11242 | wmi_buf_t buf; |
| 11243 | uint8_t *buf_ptr; |
| 11244 | int i; |
| 11245 | int32_t len = 0; |
| 11246 | QDF_STATUS retval; |
| 11247 | |
| 11248 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11249 | len += param->num_peers * sizeof(wmi_atf_peer_info); |
| 11250 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11251 | if (!buf) { |
| 11252 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11253 | return QDF_STATUS_E_FAILURE; |
| 11254 | } |
| 11255 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11256 | cmd = (wmi_peer_atf_request_fixed_param *)buf_ptr; |
| 11257 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11258 | WMITLV_TAG_STRUC_wmi_peer_atf_request_fixed_param, |
| 11259 | WMITLV_GET_STRUCT_TLVLEN( |
| 11260 | wmi_peer_atf_request_fixed_param)); |
| 11261 | cmd->num_peers = param->num_peers; |
| 11262 | |
| 11263 | buf_ptr += sizeof(*cmd); |
| 11264 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11265 | sizeof(wmi_atf_peer_info) * |
| 11266 | cmd->num_peers); |
| 11267 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11268 | peer_info = (wmi_atf_peer_info *)buf_ptr; |
| 11269 | |
| 11270 | for (i = 0; i < cmd->num_peers; i++) { |
| 11271 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 11272 | WMITLV_TAG_STRUC_wmi_atf_peer_info, |
| 11273 | WMITLV_GET_STRUCT_TLVLEN( |
| 11274 | wmi_atf_peer_info)); |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11275 | qdf_mem_copy(&(peer_info->peer_macaddr), |
| 11276 | &(param->peer_info[i].peer_macaddr), |
| 11277 | sizeof(wmi_mac_addr)); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11278 | peer_info->atf_units = param->peer_info[i].percentage_peer; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11279 | peer_info->vdev_id = param->peer_info[i].vdev_id; |
| 11280 | peer_info->pdev_id = |
| 11281 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11282 | param->peer_info[i].pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11283 | /* |
| 11284 | * TLV definition for peer atf request fixed param combines |
| 11285 | * extension stats. Legacy FW for WIN (Non-TLV) has peer atf |
| 11286 | * stats and atf extension stats as two different |
| 11287 | * implementations. |
| 11288 | * Need to discuss with FW on this. |
| 11289 | * |
| 11290 | * peer_info->atf_groupid = param->peer_ext_info[i].group_index; |
| 11291 | * peer_info->atf_units_reserved = |
| 11292 | * param->peer_ext_info[i].atf_index_reserved; |
| 11293 | */ |
| 11294 | peer_info++; |
| 11295 | } |
| 11296 | |
| 11297 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11298 | WMI_PEER_ATF_REQUEST_CMDID); |
| 11299 | |
| 11300 | if (retval != QDF_STATUS_SUCCESS) { |
| 11301 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 11302 | wmi_buf_free(buf); |
| 11303 | } |
| 11304 | |
| 11305 | return retval; |
| 11306 | } |
| 11307 | |
| 11308 | /** |
| 11309 | * send_vdev_set_fwtest_param_cmd_tlv() - send fwtest param in fw |
| 11310 | * @wmi_handle: wmi handle |
| 11311 | * @param: pointer to hold fwtest param |
| 11312 | * |
| 11313 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11314 | */ |
| 11315 | static QDF_STATUS send_vdev_set_fwtest_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 11316 | struct set_fwtest_params *param) |
| 11317 | { |
| 11318 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 11319 | wmi_buf_t buf; |
| 11320 | int32_t len = sizeof(*cmd); |
| 11321 | |
| 11322 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11323 | |
| 11324 | if (!buf) { |
| 11325 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11326 | return QDF_STATUS_E_FAILURE; |
| 11327 | } |
| 11328 | |
| 11329 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 11330 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11331 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 11332 | WMITLV_GET_STRUCT_TLVLEN( |
| 11333 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 11334 | cmd->param_id = param->arg; |
| 11335 | cmd->param_value = param->value; |
| 11336 | |
| 11337 | if (wmi_unified_cmd_send(wmi_handle, buf, len, WMI_FWTEST_CMDID)) { |
| 11338 | WMI_LOGE("Setting FW test param failed\n"); |
| 11339 | wmi_buf_free(buf); |
| 11340 | return QDF_STATUS_E_FAILURE; |
| 11341 | } |
| 11342 | |
| 11343 | return QDF_STATUS_SUCCESS; |
| 11344 | } |
| 11345 | |
| 11346 | /** |
| 11347 | * send_set_qboost_param_cmd_tlv() - send set qboost command to fw |
| 11348 | * @wmi_handle: wmi handle |
| 11349 | * @param: pointer to qboost params |
| 11350 | * @macaddr: vdev mac address |
| 11351 | * |
| 11352 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11353 | */ |
| 11354 | static QDF_STATUS |
| 11355 | send_set_qboost_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 11356 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 11357 | struct set_qboost_params *param) |
| 11358 | { |
| 11359 | WMI_QBOOST_CFG_CMD_fixed_param *cmd; |
| 11360 | wmi_buf_t buf; |
| 11361 | int32_t len; |
| 11362 | QDF_STATUS ret; |
| 11363 | |
| 11364 | len = sizeof(*cmd); |
| 11365 | |
| 11366 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11367 | if (!buf) { |
| 11368 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11369 | return QDF_STATUS_E_FAILURE; |
| 11370 | } |
| 11371 | |
| 11372 | cmd = (WMI_QBOOST_CFG_CMD_fixed_param *)wmi_buf_data(buf); |
| 11373 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11374 | WMITLV_TAG_STRUC_WMI_QBOOST_CFG_CMD_fixed_param, |
| 11375 | WMITLV_GET_STRUCT_TLVLEN( |
| 11376 | WMI_QBOOST_CFG_CMD_fixed_param)); |
| 11377 | cmd->vdev_id = param->vdev_id; |
| 11378 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 11379 | cmd->qb_enable = param->value; |
| 11380 | |
| 11381 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11382 | WMI_QBOOST_CFG_CMDID); |
| 11383 | |
| 11384 | if (ret != 0) { |
| 11385 | WMI_LOGE("Setting qboost cmd failed\n"); |
| 11386 | wmi_buf_free(buf); |
| 11387 | } |
| 11388 | |
| 11389 | return ret; |
| 11390 | } |
| 11391 | |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 11392 | /** |
| 11393 | * send_gpio_config_cmd_tlv() - send gpio config to fw |
| 11394 | * @wmi_handle: wmi handle |
| 11395 | * @param: pointer to hold gpio config param |
| 11396 | * |
| 11397 | * Return: 0 for success or error code |
| 11398 | */ |
| 11399 | static QDF_STATUS |
| 11400 | send_gpio_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 11401 | struct gpio_config_params *param) |
| 11402 | { |
| 11403 | wmi_gpio_config_cmd_fixed_param *cmd; |
| 11404 | wmi_buf_t buf; |
| 11405 | int32_t len; |
| 11406 | QDF_STATUS ret; |
| 11407 | |
| 11408 | len = sizeof(*cmd); |
| 11409 | |
| 11410 | /* Sanity Checks */ |
| 11411 | if (param->pull_type > WMI_GPIO_PULL_DOWN || |
| 11412 | param->intr_mode > WMI_GPIO_INTTYPE_LEVEL_HIGH) { |
| 11413 | return QDF_STATUS_E_FAILURE; |
| 11414 | } |
| 11415 | |
| 11416 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11417 | if (!buf) { |
| 11418 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11419 | return QDF_STATUS_E_FAILURE; |
| 11420 | } |
| 11421 | |
| 11422 | cmd = (wmi_gpio_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 11423 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11424 | WMITLV_TAG_STRUC_wmi_gpio_config_cmd_fixed_param, |
| 11425 | WMITLV_GET_STRUCT_TLVLEN( |
| 11426 | wmi_gpio_config_cmd_fixed_param)); |
| 11427 | cmd->gpio_num = param->gpio_num; |
| 11428 | cmd->input = param->input; |
| 11429 | cmd->pull_type = param->pull_type; |
| 11430 | cmd->intr_mode = param->intr_mode; |
| 11431 | |
| 11432 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11433 | WMI_GPIO_CONFIG_CMDID); |
| 11434 | |
| 11435 | if (ret != 0) { |
| 11436 | WMI_LOGE("Sending GPIO config cmd failed\n"); |
| 11437 | wmi_buf_free(buf); |
| 11438 | } |
| 11439 | |
| 11440 | return ret; |
| 11441 | } |
| 11442 | |
| 11443 | /** |
| 11444 | * send_gpio_output_cmd_tlv() - send gpio output to fw |
| 11445 | * @wmi_handle: wmi handle |
| 11446 | * @param: pointer to hold gpio output param |
| 11447 | * |
| 11448 | * Return: 0 for success or error code |
| 11449 | */ |
| 11450 | static QDF_STATUS |
| 11451 | send_gpio_output_cmd_tlv(wmi_unified_t wmi_handle, |
| 11452 | struct gpio_output_params *param) |
| 11453 | { |
| 11454 | wmi_gpio_output_cmd_fixed_param *cmd; |
| 11455 | wmi_buf_t buf; |
| 11456 | int32_t len; |
| 11457 | QDF_STATUS ret; |
| 11458 | |
| 11459 | len = sizeof(*cmd); |
| 11460 | |
| 11461 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11462 | if (!buf) { |
| 11463 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11464 | return QDF_STATUS_E_FAILURE; |
| 11465 | } |
| 11466 | |
| 11467 | cmd = (wmi_gpio_output_cmd_fixed_param *)wmi_buf_data(buf); |
| 11468 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11469 | WMITLV_TAG_STRUC_wmi_gpio_output_cmd_fixed_param, |
| 11470 | WMITLV_GET_STRUCT_TLVLEN( |
| 11471 | wmi_gpio_output_cmd_fixed_param)); |
| 11472 | cmd->gpio_num = param->gpio_num; |
| 11473 | cmd->set = param->set; |
| 11474 | |
| 11475 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11476 | WMI_GPIO_OUTPUT_CMDID); |
| 11477 | |
| 11478 | if (ret != 0) { |
| 11479 | WMI_LOGE("Sending GPIO output cmd failed\n"); |
| 11480 | wmi_buf_free(buf); |
| 11481 | } |
| 11482 | |
| 11483 | return ret; |
| 11484 | |
| 11485 | } |
| 11486 | |
| 11487 | /** |
| 11488 | * send_phyerr_disable_cmd_tlv() - WMI phyerr disable function |
| 11489 | * |
| 11490 | * @param wmi_handle : handle to WMI. |
| 11491 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11492 | */ |
| 11493 | static QDF_STATUS send_phyerr_disable_cmd_tlv(wmi_unified_t wmi_handle) |
| 11494 | { |
| 11495 | wmi_pdev_dfs_disable_cmd_fixed_param *cmd; |
| 11496 | wmi_buf_t buf; |
| 11497 | QDF_STATUS ret; |
| 11498 | int32_t len; |
| 11499 | |
| 11500 | len = sizeof(*cmd); |
| 11501 | |
| 11502 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11503 | if (!buf) { |
| 11504 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11505 | return QDF_STATUS_E_FAILURE; |
| 11506 | } |
| 11507 | |
| 11508 | cmd = (wmi_pdev_dfs_disable_cmd_fixed_param *)wmi_buf_data(buf); |
| 11509 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11510 | WMITLV_TAG_STRUC_wmi_pdev_dfs_disable_cmd_fixed_param, |
| 11511 | WMITLV_GET_STRUCT_TLVLEN( |
| 11512 | wmi_pdev_dfs_disable_cmd_fixed_param)); |
| 11513 | /* Filling it with WMI_PDEV_ID_SOC for now */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11514 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11515 | WMI_HOST_PDEV_ID_SOC); |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 11516 | |
| 11517 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11518 | WMI_PDEV_DFS_DISABLE_CMDID); |
| 11519 | |
| 11520 | if (ret != 0) { |
| 11521 | WMI_LOGE("Sending PDEV DFS disable cmd failed\n"); |
| 11522 | wmi_buf_free(buf); |
| 11523 | } |
| 11524 | |
| 11525 | return ret; |
| 11526 | } |
| 11527 | |
| 11528 | /** |
| 11529 | * send_phyerr_enable_cmd_tlv() - WMI phyerr disable function |
| 11530 | * |
| 11531 | * @param wmi_handle : handle to WMI. |
| 11532 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11533 | */ |
| 11534 | static QDF_STATUS send_phyerr_enable_cmd_tlv(wmi_unified_t wmi_handle) |
| 11535 | { |
| 11536 | wmi_pdev_dfs_enable_cmd_fixed_param *cmd; |
| 11537 | wmi_buf_t buf; |
| 11538 | QDF_STATUS ret; |
| 11539 | int32_t len; |
| 11540 | |
| 11541 | len = sizeof(*cmd); |
| 11542 | |
| 11543 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11544 | if (!buf) { |
| 11545 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11546 | return QDF_STATUS_E_FAILURE; |
| 11547 | } |
| 11548 | |
| 11549 | cmd = (wmi_pdev_dfs_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 11550 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11551 | WMITLV_TAG_STRUC_wmi_pdev_dfs_enable_cmd_fixed_param, |
| 11552 | WMITLV_GET_STRUCT_TLVLEN( |
| 11553 | wmi_pdev_dfs_enable_cmd_fixed_param)); |
| 11554 | /* Reserved for future use */ |
| 11555 | cmd->reserved0 = 0; |
| 11556 | |
| 11557 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11558 | WMI_PDEV_DFS_ENABLE_CMDID); |
| 11559 | |
| 11560 | if (ret != 0) { |
| 11561 | WMI_LOGE("Sending PDEV DFS enable cmd failed\n"); |
| 11562 | wmi_buf_free(buf); |
| 11563 | } |
| 11564 | |
| 11565 | return ret; |
| 11566 | } |
| 11567 | |
| 11568 | /** |
| 11569 | * send_nf_dbr_dbm_info_get_cmd_tlv() - send request to get nf to fw |
| 11570 | * @wmi_handle: wmi handle |
| 11571 | * |
| 11572 | * Return: 0 for success or error code |
| 11573 | */ |
| 11574 | static QDF_STATUS |
| 11575 | send_nf_dbr_dbm_info_get_cmd_tlv(wmi_unified_t wmi_handle) |
| 11576 | { |
| 11577 | wmi_buf_t buf; |
| 11578 | QDF_STATUS ret; |
| 11579 | |
| 11580 | buf = wmi_buf_alloc(wmi_handle, 0); |
| 11581 | if (buf == NULL) |
| 11582 | return QDF_STATUS_E_NOMEM; |
| 11583 | |
| 11584 | ret = wmi_unified_cmd_send(wmi_handle, buf, 0, |
| 11585 | WMI_PDEV_GET_NFCAL_POWER_CMDID); |
| 11586 | if (ret != 0) { |
| 11587 | WMI_LOGE("Sending get nfcal power cmd failed\n"); |
| 11588 | wmi_buf_free(buf); |
| 11589 | } |
| 11590 | |
| 11591 | return ret; |
| 11592 | } |
| 11593 | |
| 11594 | /** |
| 11595 | * send_set_ht_ie_cmd_tlv() - send ht ie command to fw |
| 11596 | * @wmi_handle: wmi handle |
| 11597 | * @param: pointer to ht ie param |
| 11598 | * |
| 11599 | * Return: 0 for success or error code |
| 11600 | */ |
| 11601 | static QDF_STATUS |
| 11602 | send_set_ht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 11603 | struct ht_ie_params *param) |
| 11604 | { |
| 11605 | wmi_pdev_set_ht_ie_cmd_fixed_param *cmd; |
| 11606 | wmi_buf_t buf; |
| 11607 | QDF_STATUS ret; |
| 11608 | int32_t len; |
| 11609 | uint8_t *buf_ptr; |
| 11610 | |
| 11611 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 11612 | roundup(param->ie_len, sizeof(uint32_t)); |
| 11613 | |
| 11614 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11615 | if (!buf) { |
| 11616 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11617 | return QDF_STATUS_E_FAILURE; |
| 11618 | } |
| 11619 | |
| 11620 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11621 | cmd = (wmi_pdev_set_ht_ie_cmd_fixed_param *)buf_ptr; |
| 11622 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11623 | WMITLV_TAG_STRUC_wmi_pdev_set_ht_ie_cmd_fixed_param, |
| 11624 | WMITLV_GET_STRUCT_TLVLEN( |
| 11625 | wmi_pdev_set_ht_ie_cmd_fixed_param)); |
| 11626 | cmd->reserved0 = 0; |
| 11627 | cmd->ie_len = param->ie_len; |
| 11628 | cmd->tx_streams = param->tx_streams; |
| 11629 | cmd->rx_streams = param->rx_streams; |
| 11630 | |
| 11631 | buf_ptr += sizeof(*cmd); |
| 11632 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 11633 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11634 | if (param->ie_len) |
| 11635 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 11636 | cmd->ie_len); |
| 11637 | |
| 11638 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11639 | WMI_PDEV_SET_HT_CAP_IE_CMDID); |
| 11640 | |
| 11641 | if (ret != 0) { |
| 11642 | WMI_LOGE("Sending set ht ie cmd failed\n"); |
| 11643 | wmi_buf_free(buf); |
| 11644 | } |
| 11645 | |
| 11646 | return ret; |
| 11647 | } |
| 11648 | |
| 11649 | /** |
| 11650 | * send_set_vht_ie_cmd_tlv() - send vht ie command to fw |
| 11651 | * @wmi_handle: wmi handle |
| 11652 | * @param: pointer to vht ie param |
| 11653 | * |
| 11654 | * Return: 0 for success or error code |
| 11655 | */ |
| 11656 | static QDF_STATUS |
| 11657 | send_set_vht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 11658 | struct vht_ie_params *param) |
| 11659 | { |
| 11660 | wmi_pdev_set_vht_ie_cmd_fixed_param *cmd; |
| 11661 | wmi_buf_t buf; |
| 11662 | QDF_STATUS ret; |
| 11663 | int32_t len; |
| 11664 | uint8_t *buf_ptr; |
| 11665 | |
| 11666 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 11667 | roundup(param->ie_len, sizeof(uint32_t)); |
| 11668 | |
| 11669 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11670 | if (!buf) { |
| 11671 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11672 | return QDF_STATUS_E_FAILURE; |
| 11673 | } |
| 11674 | |
| 11675 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11676 | cmd = (wmi_pdev_set_vht_ie_cmd_fixed_param *)buf_ptr; |
| 11677 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11678 | WMITLV_TAG_STRUC_wmi_pdev_set_vht_ie_cmd_fixed_param, |
| 11679 | WMITLV_GET_STRUCT_TLVLEN( |
| 11680 | wmi_pdev_set_vht_ie_cmd_fixed_param)); |
| 11681 | cmd->reserved0 = 0; |
| 11682 | cmd->ie_len = param->ie_len; |
| 11683 | cmd->tx_streams = param->tx_streams; |
| 11684 | cmd->rx_streams = param->rx_streams; |
| 11685 | |
| 11686 | buf_ptr += sizeof(*cmd); |
| 11687 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 11688 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11689 | if (param->ie_len) |
| 11690 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 11691 | cmd->ie_len); |
| 11692 | |
| 11693 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11694 | WMI_PDEV_SET_VHT_CAP_IE_CMDID); |
| 11695 | |
| 11696 | if (ret != 0) { |
| 11697 | WMI_LOGE("Sending set vht ie cmd failed\n"); |
| 11698 | wmi_buf_free(buf); |
| 11699 | } |
| 11700 | |
| 11701 | return ret; |
| 11702 | } |
| 11703 | |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11704 | /** |
| 11705 | * send_set_quiet_mode_cmd_tlv() - send set quiet mode command to fw |
| 11706 | * @wmi_handle: wmi handle |
| 11707 | * @param: pointer to quiet mode params |
| 11708 | * |
| 11709 | * Return: 0 for success or error code |
| 11710 | */ |
| 11711 | static QDF_STATUS |
| 11712 | send_set_quiet_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 11713 | struct set_quiet_mode_params *param) |
| 11714 | { |
| 11715 | wmi_pdev_set_quiet_cmd_fixed_param *quiet_cmd; |
| 11716 | wmi_buf_t buf; |
| 11717 | QDF_STATUS ret; |
| 11718 | int32_t len; |
| 11719 | |
| 11720 | len = sizeof(*quiet_cmd); |
| 11721 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11722 | if (!buf) { |
| 11723 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11724 | return QDF_STATUS_E_FAILURE; |
| 11725 | } |
| 11726 | |
| 11727 | quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf); |
| 11728 | WMITLV_SET_HDR(&quiet_cmd->tlv_header, |
| 11729 | WMITLV_TAG_STRUC_wmi_pdev_set_quiet_cmd_fixed_param, |
| 11730 | WMITLV_GET_STRUCT_TLVLEN( |
| 11731 | wmi_pdev_set_quiet_cmd_fixed_param)); |
| 11732 | quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf); |
| 11733 | quiet_cmd->enabled = param->enabled; |
| 11734 | quiet_cmd->period = (param->period)*(param->intval); |
| 11735 | quiet_cmd->duration = param->duration; |
| 11736 | quiet_cmd->next_start = param->offset; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11737 | quiet_cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11738 | WMI_HOST_PDEV_ID_SOC); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11739 | |
| 11740 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11741 | WMI_PDEV_SET_QUIET_MODE_CMDID); |
| 11742 | |
| 11743 | if (ret != 0) { |
| 11744 | WMI_LOGE("Sending set quiet cmd failed\n"); |
| 11745 | wmi_buf_free(buf); |
| 11746 | } |
| 11747 | |
| 11748 | return ret; |
| 11749 | } |
| 11750 | |
| 11751 | /** |
| 11752 | * send_set_bwf_cmd_tlv() - send set bwf command to fw |
| 11753 | * @wmi_handle: wmi handle |
| 11754 | * @param: pointer to set bwf param |
| 11755 | * |
| 11756 | * Return: 0 for success or error code |
| 11757 | */ |
| 11758 | static QDF_STATUS |
| 11759 | send_set_bwf_cmd_tlv(wmi_unified_t wmi_handle, |
| 11760 | struct set_bwf_params *param) |
| 11761 | { |
| 11762 | wmi_bwf_peer_info *peer_info; |
| 11763 | wmi_peer_bwf_request_fixed_param *cmd; |
| 11764 | wmi_buf_t buf; |
| 11765 | QDF_STATUS retval; |
| 11766 | int32_t len; |
| 11767 | uint8_t *buf_ptr; |
| 11768 | int i; |
| 11769 | |
| 11770 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11771 | len += param->num_peers * sizeof(wmi_bwf_peer_info); |
| 11772 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11773 | if (!buf) { |
| 11774 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11775 | return QDF_STATUS_E_FAILURE; |
| 11776 | } |
| 11777 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11778 | cmd = (wmi_peer_bwf_request_fixed_param *)buf_ptr; |
| 11779 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11780 | WMITLV_TAG_STRUC_wmi_peer_bwf_request_fixed_param, |
| 11781 | WMITLV_GET_STRUCT_TLVLEN( |
| 11782 | wmi_peer_bwf_request_fixed_param)); |
| 11783 | cmd->num_peers = param->num_peers; |
| 11784 | |
| 11785 | buf_ptr += sizeof(*cmd); |
| 11786 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11787 | sizeof(wmi_bwf_peer_info) * |
| 11788 | cmd->num_peers); |
| 11789 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11790 | peer_info = (wmi_bwf_peer_info *)buf_ptr; |
| 11791 | |
| 11792 | for (i = 0; i < cmd->num_peers; i++) { |
| 11793 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 11794 | WMITLV_TAG_STRUC_wmi_bwf_peer_info, |
| 11795 | WMITLV_GET_STRUCT_TLVLEN(wmi_bwf_peer_info)); |
| 11796 | peer_info->bwf_guaranteed_bandwidth = |
| 11797 | param->peer_info[i].throughput; |
| 11798 | peer_info->bwf_max_airtime = |
| 11799 | param->peer_info[i].max_airtime; |
| 11800 | peer_info->bwf_peer_priority = |
| 11801 | param->peer_info[i].priority; |
| 11802 | qdf_mem_copy(&peer_info->peer_macaddr, |
| 11803 | ¶m->peer_info[i].peer_macaddr, |
| 11804 | sizeof(param->peer_info[i].peer_macaddr)); |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11805 | peer_info->vdev_id = |
| 11806 | param->peer_info[i].vdev_id; |
| 11807 | peer_info->pdev_id = |
| 11808 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11809 | param->peer_info[i].pdev_id); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11810 | peer_info++; |
| 11811 | } |
| 11812 | |
| 11813 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11814 | WMI_PEER_BWF_REQUEST_CMDID); |
| 11815 | |
| 11816 | if (retval != QDF_STATUS_SUCCESS) { |
| 11817 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 11818 | wmi_buf_free(buf); |
| 11819 | } |
| 11820 | |
| 11821 | return retval; |
| 11822 | } |
| 11823 | |
| 11824 | /** |
| 11825 | * send_mcast_group_update_cmd_tlv() - send mcast group update cmd to fw |
| 11826 | * @wmi_handle: wmi handle |
| 11827 | * @param: pointer to hold mcast update param |
| 11828 | * |
| 11829 | * Return: 0 for success or error code |
| 11830 | */ |
| 11831 | static QDF_STATUS |
| 11832 | send_mcast_group_update_cmd_tlv(wmi_unified_t wmi_handle, |
| 11833 | struct mcast_group_update_params *param) |
| 11834 | { |
| 11835 | wmi_peer_mcast_group_cmd_fixed_param *cmd; |
| 11836 | wmi_buf_t buf; |
| 11837 | QDF_STATUS ret; |
| 11838 | int32_t len; |
| 11839 | int offset = 0; |
| 11840 | static char dummymask[4] = { 0xFF, 0xFF, 0xFF, 0xFF}; |
| 11841 | |
| 11842 | len = sizeof(*cmd); |
| 11843 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11844 | if (!buf) { |
| 11845 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11846 | return QDF_STATUS_E_FAILURE; |
| 11847 | } |
| 11848 | cmd = (wmi_peer_mcast_group_cmd_fixed_param *)wmi_buf_data(buf); |
| 11849 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11850 | WMITLV_TAG_STRUC_wmi_peer_mcast_group_cmd_fixed_param, |
| 11851 | WMITLV_GET_STRUCT_TLVLEN( |
| 11852 | wmi_peer_mcast_group_cmd_fixed_param)); |
| 11853 | /* confirm the buffer is 4-byte aligned */ |
| 11854 | QDF_ASSERT((((size_t) cmd) & 0x3) == 0); |
| 11855 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 11856 | |
| 11857 | cmd->vdev_id = param->vap_id; |
| 11858 | /* construct the message assuming our endianness matches the target */ |
| 11859 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_ACTION_M & |
| 11860 | (param->action << WMI_PEER_MCAST_GROUP_FLAG_ACTION_S); |
| 11861 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_M & |
| 11862 | (param->wildcard << WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_S); |
| 11863 | if (param->is_action_delete) |
| 11864 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_DELETEALL_M; |
| 11865 | |
| 11866 | if (param->is_mcast_addr_len) |
| 11867 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_IPV6_M; |
| 11868 | |
| 11869 | if (param->is_filter_mode_snoop) |
| 11870 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_SRC_FILTER_EXCLUDE_M; |
| 11871 | |
| 11872 | /* unicast address spec only applies for non-wildcard cases */ |
| 11873 | if (!param->wildcard && param->ucast_mac_addr) { |
| 11874 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->ucast_mac_addr, |
| 11875 | &cmd->ucast_mac_addr); |
| 11876 | } |
Amar Singhal | 5593c90 | 2017-10-03 13:00:29 -0700 | [diff] [blame^] | 11877 | |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11878 | if (param->mcast_ip_addr) { |
| 11879 | QDF_ASSERT(param->mcast_ip_addr_bytes <= |
| 11880 | sizeof(cmd->mcast_ip_addr)); |
| 11881 | offset = sizeof(cmd->mcast_ip_addr) - |
| 11882 | param->mcast_ip_addr_bytes; |
| 11883 | qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_addr) + offset, |
| 11884 | param->mcast_ip_addr, |
| 11885 | param->mcast_ip_addr_bytes); |
| 11886 | } |
| 11887 | if (!param->mask) |
| 11888 | param->mask = &dummymask[0]; |
| 11889 | |
| 11890 | qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_mask) + offset, |
| 11891 | param->mask, |
| 11892 | param->mcast_ip_addr_bytes); |
| 11893 | |
| 11894 | if (param->srcs && param->nsrcs) { |
| 11895 | cmd->num_filter_addr = param->nsrcs; |
| 11896 | QDF_ASSERT((param->nsrcs * param->mcast_ip_addr_bytes) <= |
| 11897 | sizeof(cmd->filter_addr)); |
| 11898 | |
| 11899 | qdf_mem_copy(((uint8_t *) &cmd->filter_addr), param->srcs, |
| 11900 | param->nsrcs * param->mcast_ip_addr_bytes); |
| 11901 | } |
| 11902 | |
| 11903 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11904 | WMI_PEER_MCAST_GROUP_CMDID); |
| 11905 | |
| 11906 | if (ret != QDF_STATUS_SUCCESS) { |
| 11907 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 11908 | wmi_buf_free(buf); |
| 11909 | } |
| 11910 | |
| 11911 | return ret; |
| 11912 | } |
| 11913 | |
| 11914 | /** |
| 11915 | * send_vdev_spectral_configure_cmd_tlv() - send VDEV spectral configure |
| 11916 | * command to fw |
| 11917 | * @wmi_handle: wmi handle |
| 11918 | * @param: pointer to hold spectral config parameter |
| 11919 | * |
| 11920 | * Return: 0 for success or error code |
| 11921 | */ |
| 11922 | static QDF_STATUS send_vdev_spectral_configure_cmd_tlv(wmi_unified_t wmi_handle, |
| 11923 | struct vdev_spectral_configure_params *param) |
| 11924 | { |
| 11925 | wmi_vdev_spectral_configure_cmd_fixed_param *cmd; |
| 11926 | wmi_buf_t buf; |
| 11927 | QDF_STATUS ret; |
| 11928 | int32_t len; |
| 11929 | |
| 11930 | len = sizeof(*cmd); |
| 11931 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11932 | if (!buf) { |
| 11933 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11934 | return QDF_STATUS_E_FAILURE; |
| 11935 | } |
| 11936 | |
| 11937 | cmd = (wmi_vdev_spectral_configure_cmd_fixed_param *)wmi_buf_data(buf); |
| 11938 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11939 | WMITLV_TAG_STRUC_wmi_vdev_spectral_configure_cmd_fixed_param, |
| 11940 | WMITLV_GET_STRUCT_TLVLEN( |
Edayilliam Jayadev | dca2054 | 2017-07-21 12:24:04 +0530 | [diff] [blame] | 11941 | wmi_vdev_spectral_configure_cmd_fixed_param)); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11942 | |
| 11943 | cmd->vdev_id = param->vdev_id; |
| 11944 | cmd->spectral_scan_count = param->count; |
| 11945 | cmd->spectral_scan_period = param->period; |
| 11946 | cmd->spectral_scan_priority = param->spectral_pri; |
| 11947 | cmd->spectral_scan_fft_size = param->fft_size; |
| 11948 | cmd->spectral_scan_gc_ena = param->gc_enable; |
| 11949 | cmd->spectral_scan_restart_ena = param->restart_enable; |
| 11950 | cmd->spectral_scan_noise_floor_ref = param->noise_floor_ref; |
| 11951 | cmd->spectral_scan_init_delay = param->init_delay; |
| 11952 | cmd->spectral_scan_nb_tone_thr = param->nb_tone_thr; |
| 11953 | cmd->spectral_scan_str_bin_thr = param->str_bin_thr; |
| 11954 | cmd->spectral_scan_wb_rpt_mode = param->wb_rpt_mode; |
| 11955 | cmd->spectral_scan_rssi_rpt_mode = param->rssi_rpt_mode; |
| 11956 | cmd->spectral_scan_rssi_thr = param->rssi_thr; |
| 11957 | cmd->spectral_scan_pwr_format = param->pwr_format; |
| 11958 | cmd->spectral_scan_rpt_mode = param->rpt_mode; |
| 11959 | cmd->spectral_scan_bin_scale = param->bin_scale; |
| 11960 | cmd->spectral_scan_dBm_adj = param->dBm_adj; |
| 11961 | cmd->spectral_scan_chn_mask = param->chn_mask; |
| 11962 | |
| 11963 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11964 | WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID); |
| 11965 | |
| 11966 | if (ret != 0) { |
| 11967 | WMI_LOGE("Sending set quiet cmd failed\n"); |
| 11968 | wmi_buf_free(buf); |
| 11969 | } |
| 11970 | |
| 11971 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID\n", |
| 11972 | __func__); |
| 11973 | |
| 11974 | WMI_LOGI("vdev_id = %u\n" |
| 11975 | "spectral_scan_count = %u\n" |
| 11976 | "spectral_scan_period = %u\n" |
| 11977 | "spectral_scan_priority = %u\n" |
| 11978 | "spectral_scan_fft_size = %u\n" |
| 11979 | "spectral_scan_gc_ena = %u\n" |
| 11980 | "spectral_scan_restart_ena = %u\n" |
| 11981 | "spectral_scan_noise_floor_ref = %u\n" |
| 11982 | "spectral_scan_init_delay = %u\n" |
| 11983 | "spectral_scan_nb_tone_thr = %u\n" |
| 11984 | "spectral_scan_str_bin_thr = %u\n" |
| 11985 | "spectral_scan_wb_rpt_mode = %u\n" |
| 11986 | "spectral_scan_rssi_rpt_mode = %u\n" |
| 11987 | "spectral_scan_rssi_thr = %u\n" |
| 11988 | "spectral_scan_pwr_format = %u\n" |
| 11989 | "spectral_scan_rpt_mode = %u\n" |
| 11990 | "spectral_scan_bin_scale = %u\n" |
| 11991 | "spectral_scan_dBm_adj = %u\n" |
| 11992 | "spectral_scan_chn_mask = %u\n", |
| 11993 | param->vdev_id, |
| 11994 | param->count, |
| 11995 | param->period, |
| 11996 | param->spectral_pri, |
| 11997 | param->fft_size, |
| 11998 | param->gc_enable, |
| 11999 | param->restart_enable, |
| 12000 | param->noise_floor_ref, |
| 12001 | param->init_delay, |
| 12002 | param->nb_tone_thr, |
| 12003 | param->str_bin_thr, |
| 12004 | param->wb_rpt_mode, |
| 12005 | param->rssi_rpt_mode, |
| 12006 | param->rssi_thr, |
| 12007 | param->pwr_format, |
| 12008 | param->rpt_mode, |
| 12009 | param->bin_scale, |
| 12010 | param->dBm_adj, |
| 12011 | param->chn_mask); |
| 12012 | WMI_LOGI("%s: Status: %d\n\n", __func__, ret); |
| 12013 | |
| 12014 | return ret; |
| 12015 | } |
| 12016 | |
| 12017 | /** |
| 12018 | * send_vdev_spectral_enable_cmd_tlv() - send VDEV spectral configure |
| 12019 | * command to fw |
| 12020 | * @wmi_handle: wmi handle |
| 12021 | * @param: pointer to hold spectral enable parameter |
| 12022 | * |
| 12023 | * Return: 0 for success or error code |
| 12024 | */ |
| 12025 | static QDF_STATUS send_vdev_spectral_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 12026 | struct vdev_spectral_enable_params *param) |
| 12027 | { |
| 12028 | wmi_vdev_spectral_enable_cmd_fixed_param *cmd; |
| 12029 | wmi_buf_t buf; |
| 12030 | QDF_STATUS ret; |
| 12031 | int32_t len; |
| 12032 | |
| 12033 | len = sizeof(*cmd); |
| 12034 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12035 | if (!buf) { |
| 12036 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12037 | return QDF_STATUS_E_FAILURE; |
| 12038 | } |
| 12039 | |
| 12040 | cmd = (wmi_vdev_spectral_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 12041 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12042 | WMITLV_TAG_STRUC_wmi_vdev_spectral_enable_cmd_fixed_param, |
| 12043 | WMITLV_GET_STRUCT_TLVLEN( |
Edayilliam Jayadev | dca2054 | 2017-07-21 12:24:04 +0530 | [diff] [blame] | 12044 | wmi_vdev_spectral_enable_cmd_fixed_param)); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12045 | |
| 12046 | cmd->vdev_id = param->vdev_id; |
| 12047 | |
| 12048 | if (param->active_valid) { |
| 12049 | cmd->trigger_cmd = param->active ? 1 : 2; |
| 12050 | /* 1: Trigger, 2: Clear Trigger */ |
| 12051 | } else { |
| 12052 | cmd->trigger_cmd = 0; /* 0: Ignore */ |
| 12053 | } |
| 12054 | |
| 12055 | if (param->enabled_valid) { |
| 12056 | cmd->enable_cmd = param->enabled ? 1 : 2; |
| 12057 | /* 1: Enable 2: Disable */ |
| 12058 | } else { |
| 12059 | cmd->enable_cmd = 0; /* 0: Ignore */ |
| 12060 | } |
| 12061 | |
| 12062 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12063 | WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID); |
| 12064 | |
| 12065 | if (ret != 0) { |
| 12066 | WMI_LOGE("Sending scan enable CMD failed\n"); |
| 12067 | wmi_buf_free(buf); |
| 12068 | } |
| 12069 | |
| 12070 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID\n", __func__); |
| 12071 | |
| 12072 | WMI_LOGI("vdev_id = %u\n" |
| 12073 | "trigger_cmd = %u\n" |
| 12074 | "enable_cmd = %u\n", |
| 12075 | cmd->vdev_id, |
| 12076 | cmd->trigger_cmd, |
| 12077 | cmd->enable_cmd); |
| 12078 | |
| 12079 | WMI_LOGI("%s: Status: %d\n\n", __func__, ret); |
| 12080 | |
| 12081 | return ret; |
| 12082 | } |
| 12083 | |
| 12084 | /** |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 12085 | * send_thermal_mitigation_param_cmd_tlv() - configure thermal mitigation params |
| 12086 | * @param wmi_handle : handle to WMI. |
| 12087 | * @param param : pointer to hold thermal mitigation param |
| 12088 | * |
| 12089 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 12090 | */ |
| 12091 | static QDF_STATUS send_thermal_mitigation_param_cmd_tlv( |
| 12092 | wmi_unified_t wmi_handle, |
| 12093 | struct thermal_mitigation_params *param) |
| 12094 | { |
| 12095 | wmi_therm_throt_config_request_fixed_param *tt_conf = NULL; |
| 12096 | wmi_therm_throt_level_config_info *lvl_conf = NULL; |
| 12097 | wmi_buf_t buf = NULL; |
| 12098 | uint8_t *buf_ptr = NULL; |
| 12099 | int error; |
| 12100 | int32_t len; |
| 12101 | int i; |
| 12102 | |
| 12103 | len = sizeof(*tt_conf) + WMI_TLV_HDR_SIZE + |
| 12104 | THERMAL_LEVELS * sizeof(wmi_therm_throt_level_config_info); |
| 12105 | |
| 12106 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12107 | if (!buf) { |
| 12108 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 12109 | return QDF_STATUS_E_NOMEM; |
| 12110 | } |
| 12111 | tt_conf = (wmi_therm_throt_config_request_fixed_param *) wmi_buf_data(buf); |
| 12112 | |
| 12113 | /* init fixed params */ |
| 12114 | WMITLV_SET_HDR(tt_conf, |
| 12115 | WMITLV_TAG_STRUC_wmi_therm_throt_config_request_fixed_param, |
| 12116 | (WMITLV_GET_STRUCT_TLVLEN(wmi_therm_throt_config_request_fixed_param))); |
| 12117 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12118 | tt_conf->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12119 | param->pdev_id); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 12120 | tt_conf->enable = param->enable; |
| 12121 | tt_conf->dc = param->dc; |
| 12122 | tt_conf->dc_per_event = param->dc_per_event; |
| 12123 | tt_conf->therm_throt_levels = THERMAL_LEVELS; |
| 12124 | |
| 12125 | buf_ptr = (uint8_t *) ++tt_conf; |
| 12126 | /* init TLV params */ |
| 12127 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12128 | (THERMAL_LEVELS * sizeof(wmi_therm_throt_level_config_info))); |
| 12129 | |
| 12130 | lvl_conf = (wmi_therm_throt_level_config_info *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 12131 | for (i = 0; i < THERMAL_LEVELS; i++) { |
| 12132 | WMITLV_SET_HDR(&lvl_conf->tlv_header, |
| 12133 | WMITLV_TAG_STRUC_wmi_therm_throt_level_config_info, |
| 12134 | WMITLV_GET_STRUCT_TLVLEN(wmi_therm_throt_level_config_info)); |
| 12135 | lvl_conf->temp_lwm = param->levelconf[i].tmplwm; |
| 12136 | lvl_conf->temp_hwm = param->levelconf[i].tmphwm; |
| 12137 | lvl_conf->dc_off_percent = param->levelconf[i].dcoffpercent; |
| 12138 | lvl_conf->prio = param->levelconf[i].priority; |
| 12139 | lvl_conf++; |
| 12140 | } |
| 12141 | |
| 12142 | error = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12143 | WMI_THERM_THROT_SET_CONF_CMDID); |
| 12144 | if (QDF_IS_STATUS_ERROR(error)) { |
| 12145 | wmi_buf_free(buf); |
| 12146 | WMI_LOGE("Failed to send WMI_THERM_THROT_SET_CONF_CMDID command"); |
| 12147 | } |
| 12148 | |
| 12149 | return error; |
| 12150 | } |
| 12151 | |
| 12152 | /** |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12153 | * send_pdev_qvit_cmd_tlv() - send qvit command to fw |
| 12154 | * @wmi_handle: wmi handle |
| 12155 | * @param: pointer to pdev_qvit_params |
| 12156 | * |
| 12157 | * Return: 0 for success or error code |
| 12158 | */ |
| 12159 | static QDF_STATUS |
| 12160 | send_pdev_qvit_cmd_tlv(wmi_unified_t wmi_handle, |
| 12161 | struct pdev_qvit_params *param) |
| 12162 | { |
| 12163 | wmi_buf_t buf; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12164 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12165 | uint8_t *cmd; |
| 12166 | static uint8_t msgref = 1; |
| 12167 | uint8_t segnumber = 0, seginfo, numsegments; |
| 12168 | uint16_t chunk_len, total_bytes; |
| 12169 | uint8_t *bufpos; |
| 12170 | QVIT_SEG_HDR_INFO_STRUCT seghdrinfo; |
| 12171 | |
| 12172 | bufpos = param->utf_payload; |
| 12173 | total_bytes = param->len; |
| 12174 | ASSERT(total_bytes / MAX_WMI_QVIT_LEN == |
| 12175 | (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN)); |
| 12176 | numsegments = (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN); |
| 12177 | |
| 12178 | if (param->len - (numsegments * MAX_WMI_QVIT_LEN)) |
| 12179 | numsegments++; |
| 12180 | |
| 12181 | while (param->len) { |
| 12182 | if (param->len > MAX_WMI_QVIT_LEN) |
| 12183 | chunk_len = MAX_WMI_QVIT_LEN; /* MAX messsage */ |
| 12184 | else |
| 12185 | chunk_len = param->len; |
| 12186 | |
| 12187 | buf = wmi_buf_alloc(wmi_handle, |
| 12188 | (chunk_len + sizeof(seghdrinfo) + |
| 12189 | WMI_TLV_HDR_SIZE)); |
| 12190 | if (!buf) { |
| 12191 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 12192 | return QDF_STATUS_E_NOMEM; |
| 12193 | } |
| 12194 | |
| 12195 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 12196 | |
| 12197 | seghdrinfo.len = total_bytes; |
| 12198 | seghdrinfo.msgref = msgref; |
| 12199 | seginfo = ((numsegments << 4) & 0xF0) | (segnumber & 0xF); |
| 12200 | seghdrinfo.segmentInfo = seginfo; |
| 12201 | |
| 12202 | segnumber++; |
| 12203 | |
| 12204 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 12205 | (chunk_len + sizeof(seghdrinfo))); |
| 12206 | cmd += WMI_TLV_HDR_SIZE; |
| 12207 | qdf_mem_copy(cmd, &seghdrinfo, sizeof(seghdrinfo)); |
| 12208 | qdf_mem_copy(&cmd[sizeof(seghdrinfo)], bufpos, chunk_len); |
| 12209 | |
| 12210 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 12211 | (chunk_len + sizeof(seghdrinfo) + |
| 12212 | WMI_TLV_HDR_SIZE), |
| 12213 | WMI_PDEV_QVIT_CMDID); |
| 12214 | |
| 12215 | if (ret != 0) { |
| 12216 | WMI_LOGE("Failed to send WMI_PDEV_QVIT_CMDID command"); |
| 12217 | wmi_buf_free(buf); |
| 12218 | break; |
| 12219 | } |
| 12220 | |
| 12221 | param->len -= chunk_len; |
| 12222 | bufpos += chunk_len; |
| 12223 | } |
| 12224 | msgref++; |
| 12225 | |
| 12226 | return ret; |
| 12227 | } |
| 12228 | |
| 12229 | /** |
| 12230 | * send_wmm_update_cmd_tlv() - send wmm update command to fw |
| 12231 | * @wmi_handle: wmi handle |
| 12232 | * @param: pointer to wmm update param |
| 12233 | * |
| 12234 | * Return: 0 for success or error code |
| 12235 | */ |
| 12236 | static QDF_STATUS |
| 12237 | send_wmm_update_cmd_tlv(wmi_unified_t wmi_handle, |
| 12238 | struct wmm_update_params *param) |
| 12239 | { |
| 12240 | wmi_pdev_set_wmm_params_cmd_fixed_param *cmd; |
| 12241 | wmi_wmm_params *wmm_param; |
| 12242 | wmi_buf_t buf; |
| 12243 | QDF_STATUS ret; |
| 12244 | int32_t len; |
| 12245 | int ac = 0; |
| 12246 | struct wmi_host_wmeParams *wmep; |
| 12247 | uint8_t *buf_ptr; |
| 12248 | |
| 12249 | len = sizeof(*cmd) + (WME_NUM_AC * sizeof(*wmm_param)); |
| 12250 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12251 | if (!buf) { |
| 12252 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12253 | return QDF_STATUS_E_FAILURE; |
| 12254 | } |
| 12255 | |
| 12256 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12257 | cmd = (wmi_pdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 12258 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12259 | WMITLV_TAG_STRUC_wmi_pdev_set_wmm_params_cmd_fixed_param, |
| 12260 | WMITLV_GET_STRUCT_TLVLEN |
| 12261 | (wmi_pdev_set_wmm_params_cmd_fixed_param)); |
| 12262 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12263 | cmd->reserved0 = WMI_HOST_PDEV_ID_SOC; |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12264 | |
| 12265 | buf_ptr += sizeof(wmi_pdev_set_wmm_params_cmd_fixed_param); |
| 12266 | |
| 12267 | for (ac = 0; ac < WME_NUM_AC; ac++) { |
| 12268 | wmep = ¶m->wmep_array[ac]; |
| 12269 | wmm_param = (wmi_wmm_params *)buf_ptr; |
| 12270 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 12271 | WMITLV_TAG_STRUC_wmi_wmm_params, |
| 12272 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_params)); |
| 12273 | wmm_param->aifs = wmep->wmep_aifsn; |
| 12274 | wmm_param->cwmin = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmin); |
| 12275 | wmm_param->cwmax = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmax); |
| 12276 | wmm_param->txoplimit = ATH_TXOP_TO_US(wmep->wmep_txopLimit); |
| 12277 | wmm_param->acm = wmep->wmep_acm; |
| 12278 | wmm_param->no_ack = wmep->wmep_noackPolicy; |
| 12279 | buf_ptr += sizeof(wmi_wmm_params); |
| 12280 | } |
| 12281 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12282 | WMI_PDEV_SET_WMM_PARAMS_CMDID); |
| 12283 | |
| 12284 | if (ret != 0) { |
| 12285 | WMI_LOGE("Sending WMM update CMD failed\n"); |
| 12286 | wmi_buf_free(buf); |
| 12287 | } |
| 12288 | |
| 12289 | return ret; |
| 12290 | } |
| 12291 | |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 12292 | /** |
| 12293 | * send_coex_config_cmd_tlv() - send coex config command to fw |
| 12294 | * @wmi_handle: wmi handle |
| 12295 | * @param: pointer to coex config param |
| 12296 | * |
| 12297 | * Return: 0 for success or error code |
| 12298 | */ |
| 12299 | static QDF_STATUS |
| 12300 | send_coex_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 12301 | struct coex_config_params *param) |
| 12302 | { |
| 12303 | WMI_COEX_CONFIG_CMD_fixed_param *cmd; |
| 12304 | wmi_buf_t buf; |
| 12305 | QDF_STATUS ret; |
| 12306 | int32_t len; |
| 12307 | |
| 12308 | len = sizeof(*cmd); |
| 12309 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12310 | if (!buf) { |
| 12311 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12312 | return QDF_STATUS_E_FAILURE; |
| 12313 | } |
| 12314 | |
| 12315 | cmd = (WMI_COEX_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 12316 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12317 | WMITLV_TAG_STRUC_WMI_COEX_CONFIG_CMD_fixed_param, |
| 12318 | WMITLV_GET_STRUCT_TLVLEN( |
Sathish Kumar | 8458a05 | 2017-05-12 15:52:00 +0530 | [diff] [blame] | 12319 | WMI_COEX_CONFIG_CMD_fixed_param)); |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 12320 | |
| 12321 | cmd->vdev_id = param->vdev_id; |
| 12322 | cmd->config_type = param->config_type; |
| 12323 | cmd->config_arg1 = param->config_arg1; |
| 12324 | cmd->config_arg2 = param->config_arg2; |
| 12325 | cmd->config_arg3 = param->config_arg3; |
| 12326 | cmd->config_arg4 = param->config_arg4; |
| 12327 | cmd->config_arg5 = param->config_arg5; |
| 12328 | cmd->config_arg6 = param->config_arg6; |
| 12329 | |
| 12330 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12331 | WMI_COEX_CONFIG_CMDID); |
| 12332 | |
| 12333 | if (ret != 0) { |
| 12334 | WMI_LOGE("Sending COEX CONFIG CMD failed\n"); |
| 12335 | wmi_buf_free(buf); |
| 12336 | } |
| 12337 | |
| 12338 | return ret; |
| 12339 | } |
| 12340 | |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 12341 | static |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12342 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12343 | target_resource_config *tgt_res_cfg) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12344 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12345 | resource_cfg->num_vdevs = tgt_res_cfg->num_vdevs; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12346 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 12347 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 12348 | resource_cfg->num_offload_reorder_buffs = |
| 12349 | tgt_res_cfg->num_offload_reorder_buffs; |
| 12350 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 12351 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 12352 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 12353 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 12354 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 12355 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 12356 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 12357 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 12358 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 12359 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 12360 | resource_cfg->scan_max_pending_req = |
| 12361 | tgt_res_cfg->scan_max_pending_req; |
| 12362 | resource_cfg->bmiss_offload_max_vdev = |
| 12363 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 12364 | resource_cfg->roam_offload_max_vdev = |
| 12365 | tgt_res_cfg->roam_offload_max_vdev; |
| 12366 | resource_cfg->roam_offload_max_ap_profiles = |
| 12367 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 12368 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 12369 | resource_cfg->num_mcast_table_elems = |
| 12370 | tgt_res_cfg->num_mcast_table_elems; |
| 12371 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 12372 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 12373 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 12374 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 12375 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 12376 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 12377 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 12378 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 12379 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 12380 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 12381 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 12382 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 12383 | resource_cfg->num_tdls_conn_table_entries = |
| 12384 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 12385 | resource_cfg->beacon_tx_offload_max_vdev = |
| 12386 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 12387 | resource_cfg->num_multicast_filter_entries = |
| 12388 | tgt_res_cfg->num_multicast_filter_entries; |
| 12389 | resource_cfg->num_wow_filters = |
| 12390 | tgt_res_cfg->num_wow_filters; |
| 12391 | resource_cfg->num_keep_alive_pattern = |
| 12392 | tgt_res_cfg->num_keep_alive_pattern; |
| 12393 | resource_cfg->keep_alive_pattern_size = |
| 12394 | tgt_res_cfg->keep_alive_pattern_size; |
| 12395 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 12396 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 12397 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 12398 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 12399 | resource_cfg->wmi_send_separate = |
| 12400 | tgt_res_cfg->wmi_send_separate; |
| 12401 | resource_cfg->num_ocb_vdevs = |
| 12402 | tgt_res_cfg->num_ocb_vdevs; |
| 12403 | resource_cfg->num_ocb_channels = |
| 12404 | tgt_res_cfg->num_ocb_channels; |
| 12405 | resource_cfg->num_ocb_schedules = |
| 12406 | tgt_res_cfg->num_ocb_schedules; |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 12407 | resource_cfg->bpf_instruction_size = tgt_res_cfg->bpf_instruction_size; |
| 12408 | resource_cfg->max_bssid_rx_filters = tgt_res_cfg->max_bssid_rx_filters; |
| 12409 | resource_cfg->use_pdev_id = tgt_res_cfg->use_pdev_id; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 12410 | |
| 12411 | WMI_RSRC_CFG_FLAG_ATF_CONFIG_ENABLE_SET(resource_cfg->flag1, |
| 12412 | tgt_res_cfg->atf_config); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12413 | } |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 12414 | |
| 12415 | /* copy_hw_mode_id_in_init_cmd() - Helper routine to copy hw_mode in init cmd |
| 12416 | * @wmi_handle: pointer to wmi handle |
| 12417 | * @buf_ptr: pointer to current position in init command buffer |
| 12418 | * @len: pointer to length. This will be updated with current lenght of cmd |
| 12419 | * @param: point host parameters for init command |
| 12420 | * |
| 12421 | * Return: Updated pointer of buf_ptr. |
| 12422 | */ |
| 12423 | static inline uint8_t *copy_hw_mode_in_init_cmd(struct wmi_unified *wmi_handle, |
| 12424 | uint8_t *buf_ptr, int *len, struct wmi_init_cmd_param *param) |
| 12425 | { |
| 12426 | uint16_t idx; |
| 12427 | |
| 12428 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) { |
| 12429 | wmi_pdev_set_hw_mode_cmd_fixed_param *hw_mode; |
| 12430 | wmi_pdev_band_to_mac *band_to_mac; |
| 12431 | |
| 12432 | hw_mode = (wmi_pdev_set_hw_mode_cmd_fixed_param *) |
| 12433 | (buf_ptr + sizeof(wmi_init_cmd_fixed_param) + |
| 12434 | sizeof(wmi_resource_config) + |
| 12435 | WMI_TLV_HDR_SIZE + (param->num_mem_chunks * |
| 12436 | sizeof(wlan_host_memory_chunk))); |
| 12437 | |
| 12438 | WMITLV_SET_HDR(&hw_mode->tlv_header, |
| 12439 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 12440 | (WMITLV_GET_STRUCT_TLVLEN |
| 12441 | (wmi_pdev_set_hw_mode_cmd_fixed_param))); |
| 12442 | |
| 12443 | hw_mode->hw_mode_index = param->hw_mode_id; |
| 12444 | hw_mode->num_band_to_mac = param->num_band_to_mac; |
| 12445 | |
| 12446 | buf_ptr = (uint8_t *) (hw_mode + 1); |
| 12447 | band_to_mac = (wmi_pdev_band_to_mac *) (buf_ptr + |
| 12448 | WMI_TLV_HDR_SIZE); |
| 12449 | for (idx = 0; idx < param->num_band_to_mac; idx++) { |
| 12450 | WMITLV_SET_HDR(&band_to_mac[idx].tlv_header, |
| 12451 | WMITLV_TAG_STRUC_wmi_pdev_band_to_mac, |
| 12452 | WMITLV_GET_STRUCT_TLVLEN |
| 12453 | (wmi_pdev_band_to_mac)); |
| 12454 | band_to_mac[idx].pdev_id = |
| 12455 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12456 | param->band_to_mac[idx].pdev_id); |
| 12457 | band_to_mac[idx].start_freq = |
| 12458 | param->band_to_mac[idx].start_freq; |
| 12459 | band_to_mac[idx].end_freq = |
| 12460 | param->band_to_mac[idx].end_freq; |
| 12461 | } |
| 12462 | *len += sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 12463 | (param->num_band_to_mac * |
| 12464 | sizeof(wmi_pdev_band_to_mac)) + |
| 12465 | WMI_TLV_HDR_SIZE; |
| 12466 | |
| 12467 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12468 | (param->num_band_to_mac * |
| 12469 | sizeof(wmi_pdev_band_to_mac))); |
| 12470 | } |
| 12471 | |
| 12472 | return buf_ptr; |
| 12473 | } |
| 12474 | |
| 12475 | static inline void copy_fw_abi_version_tlv(wmi_unified_t wmi_handle, |
| 12476 | wmi_init_cmd_fixed_param *cmd) |
| 12477 | { |
| 12478 | int num_whitelist; |
| 12479 | wmi_abi_version my_vers; |
| 12480 | |
| 12481 | num_whitelist = sizeof(version_whitelist) / |
| 12482 | sizeof(wmi_whitelist_version_info); |
| 12483 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 12484 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 12485 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 12486 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 12487 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 12488 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 12489 | |
| 12490 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 12491 | &my_vers, |
| 12492 | (struct _wmi_abi_version *)&wmi_handle->fw_abi_version, |
| 12493 | &cmd->host_abi_vers); |
| 12494 | |
| 12495 | qdf_print("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
| 12496 | __func__, |
| 12497 | WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 12498 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 12499 | cmd->host_abi_vers.abi_version_ns_0, |
| 12500 | cmd->host_abi_vers.abi_version_ns_1, |
| 12501 | cmd->host_abi_vers.abi_version_ns_2, |
| 12502 | cmd->host_abi_vers.abi_version_ns_3); |
| 12503 | |
| 12504 | /* Save version sent from host - |
| 12505 | * Will be used to check ready event |
| 12506 | */ |
| 12507 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
| 12508 | sizeof(wmi_abi_version)); |
| 12509 | } |
| 12510 | |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 12511 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12512 | /** |
| 12513 | * send_init_cmd_tlv() - wmi init command |
| 12514 | * @wmi_handle: pointer to wmi handle |
| 12515 | * @res_cfg: resource config |
| 12516 | * @num_mem_chunks: no of mem chunck |
| 12517 | * @mem_chunk: pointer to mem chunck structure |
| 12518 | * |
| 12519 | * This function sends IE information to firmware |
| 12520 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12521 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12522 | * |
| 12523 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12524 | static QDF_STATUS send_init_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12525 | wmi_resource_config *tgt_res_cfg, |
| 12526 | uint8_t num_mem_chunks, struct wmi_host_mem_chunk *mem_chunks, |
| 12527 | bool action) |
| 12528 | { |
| 12529 | wmi_buf_t buf; |
| 12530 | wmi_init_cmd_fixed_param *cmd; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12531 | uint8_t *buf_ptr; |
| 12532 | wmi_resource_config *resource_cfg; |
| 12533 | wlan_host_memory_chunk *host_mem_chunks; |
| 12534 | uint32_t mem_chunk_len = 0; |
| 12535 | uint16_t idx; |
| 12536 | int len; |
| 12537 | int ret; |
| 12538 | |
| 12539 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 12540 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 12541 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 12542 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12543 | WMI_LOGD("%s: wmi_buf_alloc failed\n", __func__); |
| 12544 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12545 | } |
| 12546 | |
| 12547 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12548 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 12549 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 12550 | |
| 12551 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 12552 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 12553 | + WMI_TLV_HDR_SIZE); |
| 12554 | |
| 12555 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12556 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 12557 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 12558 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12559 | qdf_mem_copy(resource_cfg, tgt_res_cfg, sizeof(wmi_resource_config)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12560 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 12561 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 12562 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 12563 | |
| 12564 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 12565 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 12566 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 12567 | WMITLV_GET_STRUCT_TLVLEN |
| 12568 | (wlan_host_memory_chunk)); |
| 12569 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 12570 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 12571 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12572 | WMI_LOGD("chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12573 | idx, host_mem_chunks[idx].size, |
| 12574 | host_mem_chunks[idx].ptr); |
| 12575 | } |
| 12576 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 12577 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 12578 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 12579 | WMITLV_TAG_ARRAY_STRUC, |
| 12580 | (sizeof(wlan_host_memory_chunk) * |
| 12581 | num_mem_chunks)); |
| 12582 | |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 12583 | /* Fill fw_abi_vers */ |
| 12584 | copy_fw_abi_version_tlv(wmi_handle, cmd); |
| 12585 | |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12586 | if (action) { |
| 12587 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12588 | WMI_INIT_CMDID); |
| 12589 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12590 | 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] | 12591 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12592 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12593 | } |
| 12594 | } else { |
| 12595 | wmi_handle->saved_wmi_init_cmd.buf = buf; |
| 12596 | wmi_handle->saved_wmi_init_cmd.buf_len = len; |
| 12597 | } |
| 12598 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12599 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12600 | |
| 12601 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 12602 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12603 | /** |
| 12604 | * send_saved_init_cmd_tlv() - wmi init command |
| 12605 | * @wmi_handle: pointer to wmi handle |
| 12606 | * |
| 12607 | * This function sends IE information to firmware |
| 12608 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12609 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12610 | * |
| 12611 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12612 | 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] | 12613 | { |
| 12614 | int status; |
| 12615 | |
| 12616 | if (!wmi_handle->saved_wmi_init_cmd.buf || |
| 12617 | !wmi_handle->saved_wmi_init_cmd.buf_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12618 | WMI_LOGP("Service ready ext event w/o WMI_SERVICE_EXT_MSG!"); |
| 12619 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12620 | } |
| 12621 | status = wmi_unified_cmd_send(wmi_handle, |
| 12622 | wmi_handle->saved_wmi_init_cmd.buf, |
| 12623 | wmi_handle->saved_wmi_init_cmd.buf_len, |
| 12624 | WMI_INIT_CMDID); |
| 12625 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12626 | 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] | 12627 | wmi_buf_free(wmi_handle->saved_wmi_init_cmd.buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12628 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12629 | } |
| 12630 | wmi_handle->saved_wmi_init_cmd.buf = NULL; |
| 12631 | wmi_handle->saved_wmi_init_cmd.buf_len = 0; |
| 12632 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12633 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12634 | } |
| 12635 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12636 | 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] | 12637 | { |
| 12638 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 12639 | wmi_service_ready_event_fixed_param *ev; |
| 12640 | |
| 12641 | |
| 12642 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 12643 | |
| 12644 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 12645 | if (!ev) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12646 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12647 | |
| 12648 | /*Save fw version from service ready message */ |
| 12649 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12650 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12651 | sizeof(wmi_handle->fw_abi_version)); |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 12652 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12653 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12654 | } |
| 12655 | |
| 12656 | /** |
| 12657 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 12658 | * @wmi_handle: pointer to wmi handle |
| 12659 | * @res_cfg: resource config |
| 12660 | * @num_mem_chunks: no of mem chunck |
| 12661 | * @mem_chunk: pointer to mem chunck structure |
| 12662 | * |
| 12663 | * This function sends IE information to firmware |
| 12664 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12665 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12666 | * |
| 12667 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12668 | 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] | 12669 | void *evt_buf) |
| 12670 | { |
| 12671 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 12672 | wmi_ready_event_fixed_param *ev = NULL; |
| 12673 | |
| 12674 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 12675 | ev = param_buf->fixed_param; |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 12676 | if (!wmi_versions_are_compatible((struct _wmi_abi_version *) |
| 12677 | &wmi_handle->final_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12678 | &ev->fw_abi_vers)) { |
| 12679 | /* |
| 12680 | * Error: Our host version and the given firmware version |
| 12681 | * are incompatible. |
| 12682 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12683 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12684 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x\n", |
| 12685 | __func__, |
| 12686 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 12687 | abi_version_0), |
| 12688 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 12689 | abi_version_0), |
| 12690 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 12691 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 12692 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 12693 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 12694 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 12695 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 12696 | ev->fw_abi_vers.abi_version_ns_0, |
| 12697 | ev->fw_abi_vers.abi_version_ns_1, |
| 12698 | ev->fw_abi_vers.abi_version_ns_2, |
| 12699 | ev->fw_abi_vers.abi_version_ns_3); |
| 12700 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12701 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12702 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12703 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12704 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12705 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12706 | sizeof(wmi_abi_version)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12707 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12708 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12709 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12710 | |
| 12711 | /** |
| 12712 | * send_set_base_macaddr_indicate_cmd_tlv() - set base mac address in fw |
| 12713 | * @wmi_handle: wmi handle |
| 12714 | * @custom_addr: base mac address |
| 12715 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12716 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12717 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12718 | 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] | 12719 | uint8_t *custom_addr) |
| 12720 | { |
| 12721 | wmi_pdev_set_base_macaddr_cmd_fixed_param *cmd; |
| 12722 | wmi_buf_t buf; |
| 12723 | int err; |
| 12724 | |
| 12725 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 12726 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12727 | WMI_LOGE("Failed to allocate buffer to send base macaddr cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12728 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12729 | } |
| 12730 | |
| 12731 | 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] | 12732 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12733 | |
| 12734 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12735 | WMITLV_TAG_STRUC_wmi_pdev_set_base_macaddr_cmd_fixed_param, |
| 12736 | WMITLV_GET_STRUCT_TLVLEN |
| 12737 | (wmi_pdev_set_base_macaddr_cmd_fixed_param)); |
| 12738 | WMI_CHAR_ARRAY_TO_MAC_ADDR(custom_addr, &cmd->base_macaddr); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12739 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12740 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12741 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 12742 | sizeof(*cmd), |
| 12743 | WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 12744 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12745 | WMI_LOGE("Failed to send set_base_macaddr cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12746 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12747 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12748 | } |
| 12749 | |
| 12750 | return 0; |
| 12751 | } |
| 12752 | |
| 12753 | /** |
| 12754 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 12755 | * @handle: wmi handle |
| 12756 | * @event: Event received from FW |
| 12757 | * @len: Length of the event |
| 12758 | * |
| 12759 | * Enables the low frequency events and disables the high frequency |
| 12760 | * events. Bit 17 indicates if the event if low/high frequency. |
| 12761 | * 1 - high frequency, 0 - low frequency |
| 12762 | * |
| 12763 | * Return: 0 on successfully enabling/disabling the events |
| 12764 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12765 | 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] | 12766 | uint8_t *event, |
| 12767 | uint32_t len) |
| 12768 | { |
| 12769 | uint32_t num_of_diag_events_logs; |
| 12770 | wmi_diag_event_log_config_fixed_param *cmd; |
| 12771 | wmi_buf_t buf; |
| 12772 | uint8_t *buf_ptr; |
| 12773 | uint32_t *cmd_args, *evt_args; |
| 12774 | uint32_t buf_len, i; |
| 12775 | |
| 12776 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 12777 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 12778 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12779 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12780 | |
| 12781 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 12782 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12783 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12784 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12785 | } |
| 12786 | wmi_event = param_buf->fixed_param; |
| 12787 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
Amar Singhal | 5593c90 | 2017-10-03 13:00:29 -0700 | [diff] [blame^] | 12788 | |
| 12789 | if (num_of_diag_events_logs > |
| 12790 | param_buf->num_diag_events_logs_list) { |
| 12791 | WMI_LOGE("message number of events %d is more than tlv hdr content %d", |
| 12792 | num_of_diag_events_logs, |
| 12793 | param_buf->num_diag_events_logs_list); |
| 12794 | return QDF_STATUS_E_INVAL; |
| 12795 | } |
| 12796 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12797 | evt_args = param_buf->diag_events_logs_list; |
| 12798 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12799 | 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] | 12800 | __func__, num_of_diag_events_logs); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12801 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12802 | } |
| 12803 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12804 | WMI_LOGD("%s: num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12805 | __func__, num_of_diag_events_logs); |
| 12806 | |
| 12807 | /* Free any previous allocation */ |
| 12808 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12809 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12810 | |
Varun Reddy Yeturu | c799752 | 2017-08-20 13:41:02 -0700 | [diff] [blame] | 12811 | if (num_of_diag_events_logs > |
| 12812 | (WMI_SVC_MSG_MAX_SIZE / sizeof(uint32_t))) { |
| 12813 | WMI_LOGE("%s: excess num of logs:%d", __func__, |
| 12814 | num_of_diag_events_logs); |
| 12815 | QDF_ASSERT(0); |
| 12816 | return QDF_STATUS_E_INVAL; |
| 12817 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12818 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12819 | 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] | 12820 | sizeof(uint32_t)); |
| 12821 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12822 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12823 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12824 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12825 | } |
| 12826 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 12827 | |
| 12828 | /* Prepare the send buffer */ |
| 12829 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 12830 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 12831 | |
| 12832 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 12833 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12834 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12835 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12836 | wmi_handle->events_logs_list = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12837 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12838 | } |
| 12839 | |
| 12840 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 12841 | buf_ptr = (uint8_t *) cmd; |
| 12842 | |
| 12843 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12844 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 12845 | WMITLV_GET_STRUCT_TLVLEN( |
| 12846 | wmi_diag_event_log_config_fixed_param)); |
| 12847 | |
| 12848 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 12849 | |
| 12850 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 12851 | |
| 12852 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 12853 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 12854 | |
| 12855 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 12856 | |
| 12857 | /* Populate the events */ |
| 12858 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 12859 | /* Low freq (0) - Enable (1) the event |
| 12860 | * High freq (1) - Disable (0) the event |
| 12861 | */ |
| 12862 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 12863 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 12864 | /* Set the event ID */ |
| 12865 | WMI_DIAG_ID_SET(cmd_args[i], |
| 12866 | WMI_DIAG_ID_GET(evt_args[i])); |
| 12867 | /* Set the type */ |
| 12868 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 12869 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12870 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12871 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 12872 | } |
| 12873 | |
| 12874 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 12875 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12876 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12877 | __func__); |
| 12878 | wmi_buf_free(buf); |
| 12879 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 12880 | * Host can still have this list |
| 12881 | */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12882 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12883 | } |
| 12884 | |
| 12885 | return 0; |
| 12886 | } |
| 12887 | |
| 12888 | /** |
| 12889 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 12890 | * @wmi_handle: wmi handle |
| 12891 | * @start_log: Start logging related parameters |
| 12892 | * |
| 12893 | * Send the command to the FW based on which specific logging of diag |
| 12894 | * event/log id can be started/stopped |
| 12895 | * |
| 12896 | * Return: None |
| 12897 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12898 | 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] | 12899 | struct wmi_wifi_start_log *start_log) |
| 12900 | { |
| 12901 | wmi_diag_event_log_config_fixed_param *cmd; |
| 12902 | wmi_buf_t buf; |
| 12903 | uint8_t *buf_ptr; |
| 12904 | uint32_t len, count, log_level, i; |
| 12905 | uint32_t *cmd_args; |
| 12906 | uint32_t total_len; |
| 12907 | count = 0; |
| 12908 | |
| 12909 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12910 | WMI_LOGE("%s: Not received event/log list from FW, yet", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12911 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12912 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12913 | } |
| 12914 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 12915 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 12916 | */ |
| 12917 | total_len = 0; |
| 12918 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 12919 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 12920 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 12921 | total_len++; |
| 12922 | } |
| 12923 | |
| 12924 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 12925 | (total_len * sizeof(uint32_t)); |
| 12926 | |
| 12927 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12928 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12929 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12930 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12931 | } |
| 12932 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 12933 | buf_ptr = (uint8_t *) cmd; |
| 12934 | |
| 12935 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12936 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 12937 | WMITLV_GET_STRUCT_TLVLEN( |
| 12938 | wmi_diag_event_log_config_fixed_param)); |
| 12939 | |
| 12940 | cmd->num_of_diag_events_logs = total_len; |
| 12941 | |
| 12942 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 12943 | |
| 12944 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 12945 | (total_len * sizeof(uint32_t))); |
| 12946 | |
| 12947 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 12948 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 12949 | if (start_log->verbose_level >= WMI_LOG_LEVEL_ACTIVE) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12950 | log_level = 1; |
| 12951 | else |
| 12952 | log_level = 0; |
| 12953 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12954 | 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] | 12955 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 12956 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 12957 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 12958 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 12959 | |
| 12960 | WMI_DIAG_ID_SET(cmd_args[count], |
| 12961 | WMI_DIAG_ID_GET(val)); |
| 12962 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 12963 | WMI_DIAG_TYPE_GET(val)); |
| 12964 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 12965 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12966 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12967 | count++; |
| 12968 | } |
| 12969 | } |
| 12970 | |
| 12971 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12972 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12973 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12974 | __func__); |
| 12975 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12976 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12977 | } |
| 12978 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12979 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12980 | } |
| 12981 | |
| 12982 | /** |
| 12983 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 12984 | * @wmi_handle: WMI handle |
| 12985 | * |
| 12986 | * This function is used to send the flush command to the FW, |
| 12987 | * that will flush the fw logs that are residue in the FW |
| 12988 | * |
| 12989 | * Return: None |
| 12990 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12991 | 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] | 12992 | { |
| 12993 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 12994 | wmi_buf_t buf; |
| 12995 | int len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12996 | QDF_STATUS ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12997 | |
| 12998 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12999 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13000 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13001 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13002 | } |
| 13003 | |
| 13004 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 13005 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13006 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 13007 | WMITLV_GET_STRUCT_TLVLEN( |
| 13008 | wmi_debug_mesg_flush_fixed_param)); |
| 13009 | cmd->reserved0 = 0; |
| 13010 | |
| 13011 | ret = wmi_unified_cmd_send(wmi_handle, |
| 13012 | buf, |
| 13013 | len, |
| 13014 | WMI_DEBUG_MESG_FLUSH_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13015 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13016 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13017 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13018 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13019 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13020 | WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13021 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 13022 | return ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13023 | } |
| 13024 | |
| 13025 | /** |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13026 | * 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] | 13027 | * @wmi_handle: wmi handle |
| 13028 | * @msg: PCL structure containing the PCL and the number of channels |
| 13029 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13030 | * 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] | 13031 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 13032 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 13033 | * to migrate to a new channel without host driver involvement. An example of |
| 13034 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 13035 | * manage the channel selection without firmware involvement. |
| 13036 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13037 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 13038 | * channel list. The weights corresponds to the channels sent in |
| 13039 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 13040 | * weightage compared to the non PCL channels. |
| 13041 | * |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13042 | * Return: Success if the cmd is sent successfully to the firmware |
| 13043 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13044 | 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] | 13045 | struct wmi_pcl_chan_weights *msg) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13046 | { |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13047 | wmi_pdev_set_pcl_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13048 | wmi_buf_t buf; |
| 13049 | uint8_t *buf_ptr; |
| 13050 | uint32_t *cmd_args, i, len; |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13051 | uint32_t chan_len; |
| 13052 | |
| 13053 | chan_len = msg->saved_num_chan; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13054 | |
| 13055 | len = sizeof(*cmd) + |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13056 | WMI_TLV_HDR_SIZE + (chan_len * sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13057 | |
| 13058 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13059 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13060 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13061 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13062 | } |
| 13063 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13064 | cmd = (wmi_pdev_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13065 | buf_ptr = (uint8_t *) cmd; |
| 13066 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13067 | WMITLV_TAG_STRUC_wmi_pdev_set_pcl_cmd_fixed_param, |
| 13068 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_pcl_cmd_fixed_param)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13069 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13070 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 13071 | WMI_HOST_PDEV_ID_SOC); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13072 | cmd->num_chan = chan_len; |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 13073 | WMI_LOGD("%s: Total chan (PCL) len:%d", __func__, cmd->num_chan); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13074 | |
| 13075 | buf_ptr += sizeof(wmi_pdev_set_pcl_cmd_fixed_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13076 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13077 | (chan_len * sizeof(uint32_t))); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13078 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13079 | for (i = 0; i < chan_len ; i++) { |
| 13080 | cmd_args[i] = msg->weighed_valid_list[i]; |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 13081 | WMI_LOGD("%s: chan:%d weight:%d", __func__, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13082 | msg->saved_chan_list[i], cmd_args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13083 | } |
| 13084 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 13085 | WMI_PDEV_SET_PCL_CMDID)) { |
| 13086 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_PCL_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13087 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13088 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13089 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13090 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13091 | } |
| 13092 | |
| 13093 | /** |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 13094 | * 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] | 13095 | * @wmi_handle: wmi handle |
| 13096 | * @msg: Structure containing the following parameters |
| 13097 | * |
| 13098 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 13099 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 13100 | * |
| 13101 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 13102 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 13103 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 13104 | * |
| 13105 | * Return: Success if the cmd is sent successfully to the firmware |
| 13106 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13107 | 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] | 13108 | uint32_t hw_mode_index) |
| 13109 | { |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 13110 | wmi_pdev_set_hw_mode_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13111 | wmi_buf_t buf; |
| 13112 | uint32_t len; |
| 13113 | |
| 13114 | len = sizeof(*cmd); |
| 13115 | |
| 13116 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13117 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13118 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13119 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13120 | } |
| 13121 | |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 13122 | 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] | 13123 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 13124 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 13125 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_hw_mode_cmd_fixed_param)); |
| 13126 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13127 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 13128 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13129 | cmd->hw_mode_index = hw_mode_index; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13130 | WMI_LOGI("%s: HW mode index:%d", __func__, cmd->hw_mode_index); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13131 | |
| 13132 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 13133 | WMI_PDEV_SET_HW_MODE_CMDID)) { |
| 13134 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_HW_MODE_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13135 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13136 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13137 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13138 | } |
| 13139 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13140 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13141 | } |
| 13142 | |
| 13143 | /** |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13144 | * 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] | 13145 | * @wmi_handle: wmi handle |
| 13146 | * @msg: Dual MAC config parameters |
| 13147 | * |
| 13148 | * Configures WLAN firmware with the dual MAC features |
| 13149 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13150 | * Return: QDF_STATUS. 0 on success. |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13151 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 13152 | static |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13153 | 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] | 13154 | struct wmi_dual_mac_config *msg) |
| 13155 | { |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13156 | wmi_pdev_set_mac_config_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13157 | wmi_buf_t buf; |
| 13158 | uint32_t len; |
| 13159 | |
| 13160 | len = sizeof(*cmd); |
| 13161 | |
| 13162 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13163 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13164 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 13165 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13166 | } |
| 13167 | |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13168 | 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] | 13169 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13170 | WMITLV_TAG_STRUC_wmi_pdev_set_mac_config_cmd_fixed_param, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13171 | WMITLV_GET_STRUCT_TLVLEN( |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13172 | wmi_pdev_set_mac_config_cmd_fixed_param)); |
| 13173 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13174 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 13175 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13176 | cmd->concurrent_scan_config_bits = msg->scan_config; |
| 13177 | cmd->fw_mode_config_bits = msg->fw_mode_config; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13178 | WMI_LOGI("%s: scan_config:%x fw_mode_config:%x", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13179 | __func__, msg->scan_config, msg->fw_mode_config); |
| 13180 | |
| 13181 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 13182 | WMI_PDEV_SET_MAC_CONFIG_CMDID)) { |
| 13183 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_MAC_CONFIG_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13184 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 13185 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13186 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13187 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13188 | } |
| 13189 | |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 13190 | #ifdef BIG_ENDIAN_HOST |
| 13191 | /** |
| 13192 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 13193 | * @param data_len - data length |
| 13194 | * @param data - pointer to data |
| 13195 | * |
| 13196 | * Return: QDF_STATUS - success or error status |
| 13197 | */ |
| 13198 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 13199 | struct fips_params *param) |
| 13200 | { |
| 13201 | unsigned char *key_unaligned, *data_unaligned; |
| 13202 | int c; |
| 13203 | u_int8_t *key_aligned = NULL; |
| 13204 | u_int8_t *data_aligned = NULL; |
| 13205 | |
| 13206 | /* Assigning unaligned space to copy the key */ |
| 13207 | key_unaligned = qdf_mem_malloc( |
| 13208 | sizeof(u_int8_t)*param->key_len + FIPS_ALIGN); |
| 13209 | data_unaligned = qdf_mem_malloc( |
| 13210 | sizeof(u_int8_t)*param->data_len + FIPS_ALIGN); |
| 13211 | |
| 13212 | /* Checking if kmalloc is succesful to allocate space */ |
| 13213 | if (key_unaligned == NULL) |
| 13214 | return QDF_STATUS_SUCCESS; |
| 13215 | /* Checking if space is aligned */ |
| 13216 | if (!FIPS_IS_ALIGNED(key_unaligned, FIPS_ALIGN)) { |
| 13217 | /* align to 4 */ |
| 13218 | key_aligned = |
| 13219 | (u_int8_t *)FIPS_ALIGNTO(key_unaligned, |
| 13220 | FIPS_ALIGN); |
| 13221 | } else { |
| 13222 | key_aligned = (u_int8_t *)key_unaligned; |
| 13223 | } |
| 13224 | |
| 13225 | /* memset and copy content from key to key aligned */ |
| 13226 | OS_MEMSET(key_aligned, 0, param->key_len); |
| 13227 | OS_MEMCPY(key_aligned, param->key, param->key_len); |
| 13228 | |
| 13229 | /* print a hexdump for host debug */ |
| 13230 | print_hex_dump(KERN_DEBUG, |
| 13231 | "\t Aligned and Copied Key:@@@@ ", |
| 13232 | DUMP_PREFIX_NONE, |
| 13233 | 16, 1, key_aligned, param->key_len, true); |
| 13234 | |
| 13235 | /* Checking if kmalloc is succesful to allocate space */ |
| 13236 | if (data_unaligned == NULL) |
| 13237 | return QDF_STATUS_SUCCESS; |
| 13238 | /* Checking of space is aligned */ |
| 13239 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 13240 | /* align to 4 */ |
| 13241 | data_aligned = |
| 13242 | (u_int8_t *)FIPS_ALIGNTO(data_unaligned, |
| 13243 | FIPS_ALIGN); |
| 13244 | } else { |
| 13245 | data_aligned = (u_int8_t *)data_unaligned; |
| 13246 | } |
| 13247 | |
| 13248 | /* memset and copy content from data to data aligned */ |
| 13249 | OS_MEMSET(data_aligned, 0, param->data_len); |
| 13250 | OS_MEMCPY(data_aligned, param->data, param->data_len); |
| 13251 | |
| 13252 | /* print a hexdump for host debug */ |
| 13253 | print_hex_dump(KERN_DEBUG, |
| 13254 | "\t Properly Aligned and Copied Data:@@@@ ", |
| 13255 | DUMP_PREFIX_NONE, |
| 13256 | 16, 1, data_aligned, param->data_len, true); |
| 13257 | |
| 13258 | /* converting to little Endian both key_aligned and |
| 13259 | * data_aligned*/ |
| 13260 | for (c = 0; c < param->key_len/4; c++) { |
| 13261 | *((u_int32_t *)key_aligned+c) = |
| 13262 | qdf_cpu_to_le32(*((u_int32_t *)key_aligned+c)); |
| 13263 | } |
| 13264 | for (c = 0; c < param->data_len/4; c++) { |
| 13265 | *((u_int32_t *)data_aligned+c) = |
| 13266 | qdf_cpu_to_le32(*((u_int32_t *)data_aligned+c)); |
| 13267 | } |
| 13268 | |
| 13269 | /* update endian data to key and data vectors */ |
| 13270 | OS_MEMCPY(param->key, key_aligned, param->key_len); |
| 13271 | OS_MEMCPY(param->data, data_aligned, param->data_len); |
| 13272 | |
| 13273 | /* clean up allocated spaces */ |
| 13274 | qdf_mem_free(key_unaligned); |
| 13275 | key_unaligned = NULL; |
| 13276 | key_aligned = NULL; |
| 13277 | |
| 13278 | qdf_mem_free(data_unaligned); |
| 13279 | data_unaligned = NULL; |
| 13280 | data_aligned = NULL; |
| 13281 | |
| 13282 | return QDF_STATUS_SUCCESS; |
| 13283 | } |
| 13284 | #else |
| 13285 | /** |
| 13286 | * fips_align_data_be() - DUMMY for LE platform |
| 13287 | * |
| 13288 | * Return: QDF_STATUS - success |
| 13289 | */ |
| 13290 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 13291 | struct fips_params *param) |
| 13292 | { |
| 13293 | return QDF_STATUS_SUCCESS; |
| 13294 | } |
| 13295 | #endif |
| 13296 | |
| 13297 | |
| 13298 | /** |
| 13299 | * send_pdev_fips_cmd_tlv() - send pdev fips cmd to fw |
| 13300 | * @wmi_handle: wmi handle |
| 13301 | * @param: pointer to hold pdev fips param |
| 13302 | * |
| 13303 | * Return: 0 for success or error code |
| 13304 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13305 | static QDF_STATUS |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 13306 | send_pdev_fips_cmd_tlv(wmi_unified_t wmi_handle, |
| 13307 | struct fips_params *param) |
| 13308 | { |
| 13309 | wmi_pdev_fips_cmd_fixed_param *cmd; |
| 13310 | wmi_buf_t buf; |
| 13311 | uint8_t *buf_ptr; |
| 13312 | uint32_t len = sizeof(wmi_pdev_fips_cmd_fixed_param); |
| 13313 | QDF_STATUS retval = QDF_STATUS_SUCCESS; |
| 13314 | |
| 13315 | /* Length TLV placeholder for array of bytes */ |
| 13316 | len += WMI_TLV_HDR_SIZE; |
| 13317 | if (param->data_len) |
| 13318 | len += (param->data_len*sizeof(uint8_t)); |
| 13319 | |
| 13320 | /* |
| 13321 | * Data length must be multiples of 16 bytes - checked against 0xF - |
| 13322 | * and must be less than WMI_SVC_MSG_SIZE - static size of |
| 13323 | * wmi_pdev_fips_cmd structure |
| 13324 | */ |
| 13325 | |
| 13326 | /* do sanity on the input */ |
| 13327 | if (!(((param->data_len & 0xF) == 0) && |
| 13328 | ((param->data_len > 0) && |
| 13329 | (param->data_len < (WMI_HOST_MAX_BUFFER_SIZE - |
| 13330 | sizeof(wmi_pdev_fips_cmd_fixed_param)))))) { |
| 13331 | return QDF_STATUS_E_INVAL; |
| 13332 | } |
| 13333 | |
| 13334 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13335 | if (!buf) { |
| 13336 | qdf_print("%s:wmi_buf_alloc failed\n", __func__); |
| 13337 | return QDF_STATUS_E_FAILURE; |
| 13338 | } |
| 13339 | |
| 13340 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13341 | cmd = (wmi_pdev_fips_cmd_fixed_param *)buf_ptr; |
| 13342 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13343 | WMITLV_TAG_STRUC_wmi_pdev_fips_cmd_fixed_param, |
| 13344 | WMITLV_GET_STRUCT_TLVLEN |
| 13345 | (wmi_pdev_fips_cmd_fixed_param)); |
| 13346 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13347 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 13348 | param->pdev_id); |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 13349 | if (param->key != NULL && param->data != NULL) { |
| 13350 | cmd->key_len = param->key_len; |
| 13351 | cmd->data_len = param->data_len; |
| 13352 | cmd->fips_cmd = !!(param->op); |
| 13353 | |
| 13354 | if (fips_align_data_be(wmi_handle, param) != QDF_STATUS_SUCCESS) |
| 13355 | return QDF_STATUS_E_FAILURE; |
| 13356 | |
| 13357 | qdf_mem_copy(cmd->key, param->key, param->key_len); |
| 13358 | |
| 13359 | if (param->mode == FIPS_ENGINE_AES_CTR || |
| 13360 | param->mode == FIPS_ENGINE_AES_MIC) { |
| 13361 | cmd->mode = param->mode; |
| 13362 | } else { |
| 13363 | cmd->mode = FIPS_ENGINE_AES_CTR; |
| 13364 | } |
| 13365 | qdf_print(KERN_ERR "Key len = %d, Data len = %d\n", |
| 13366 | cmd->key_len, cmd->data_len); |
| 13367 | |
| 13368 | print_hex_dump(KERN_DEBUG, "Key: ", DUMP_PREFIX_NONE, 16, 1, |
| 13369 | cmd->key, cmd->key_len, true); |
| 13370 | buf_ptr += sizeof(*cmd); |
| 13371 | |
| 13372 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->data_len); |
| 13373 | |
| 13374 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13375 | if (param->data_len) |
| 13376 | qdf_mem_copy(buf_ptr, |
| 13377 | (uint8_t *) param->data, param->data_len); |
| 13378 | |
| 13379 | print_hex_dump(KERN_DEBUG, "Plain text: ", DUMP_PREFIX_NONE, |
| 13380 | 16, 1, buf_ptr, cmd->data_len, true); |
| 13381 | |
| 13382 | buf_ptr += param->data_len; |
| 13383 | |
| 13384 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13385 | WMI_PDEV_FIPS_CMDID); |
| 13386 | qdf_print("%s return value %d\n", __func__, retval); |
| 13387 | } else { |
| 13388 | qdf_print("\n%s:%d Key or Data is NULL\n", __func__, __LINE__); |
| 13389 | wmi_buf_free(buf); |
| 13390 | retval = -QDF_STATUS_E_BADMSG; |
| 13391 | } |
| 13392 | |
| 13393 | return retval; |
| 13394 | } |
| 13395 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13396 | #ifdef WLAN_PMO_ENABLE |
| 13397 | /** |
| 13398 | * send_add_wow_wakeup_event_cmd_tlv() - Configures wow wakeup events. |
| 13399 | * @wmi_handle: wmi handle |
| 13400 | * @vdev_id: vdev id |
| 13401 | * @bitmap: Event bitmap |
| 13402 | * @enable: enable/disable |
| 13403 | * |
| 13404 | * Return: CDF status |
| 13405 | */ |
| 13406 | static QDF_STATUS send_add_wow_wakeup_event_cmd_tlv(wmi_unified_t wmi_handle, |
| 13407 | uint32_t vdev_id, |
Ravi Kumar Bokka | ce4ac39 | 2017-03-23 17:20:31 +0530 | [diff] [blame] | 13408 | uint32_t *bitmap, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13409 | bool enable) |
| 13410 | { |
| 13411 | WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *cmd; |
| 13412 | uint16_t len; |
| 13413 | wmi_buf_t buf; |
| 13414 | int ret; |
| 13415 | |
| 13416 | len = sizeof(WMI_WOW_ADD_DEL_EVT_CMD_fixed_param); |
| 13417 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13418 | if (!buf) { |
| 13419 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 13420 | return QDF_STATUS_E_NOMEM; |
| 13421 | } |
| 13422 | cmd = (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *) wmi_buf_data(buf); |
| 13423 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13424 | WMITLV_TAG_STRUC_WMI_WOW_ADD_DEL_EVT_CMD_fixed_param, |
| 13425 | WMITLV_GET_STRUCT_TLVLEN |
| 13426 | (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param)); |
| 13427 | cmd->vdev_id = vdev_id; |
| 13428 | cmd->is_add = enable; |
Ravi Kumar Bokka | ce4ac39 | 2017-03-23 17:20:31 +0530 | [diff] [blame] | 13429 | qdf_mem_copy(&(cmd->event_bitmaps[0]), bitmap, sizeof(uint32_t) * |
| 13430 | WMI_WOW_MAX_EVENT_BM_LEN); |
| 13431 | |
| 13432 | WMI_LOGD("Wakeup pattern 0x%x%x%x%x %s in fw", cmd->event_bitmaps[0], |
| 13433 | cmd->event_bitmaps[1], cmd->event_bitmaps[2], |
| 13434 | cmd->event_bitmaps[3], enable ? "enabled" : "disabled"); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13435 | |
| 13436 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13437 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 13438 | if (ret) { |
| 13439 | WMI_LOGE("Failed to config wow wakeup event"); |
| 13440 | wmi_buf_free(buf); |
| 13441 | return QDF_STATUS_E_FAILURE; |
| 13442 | } |
| 13443 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13444 | return QDF_STATUS_SUCCESS; |
| 13445 | } |
| 13446 | |
| 13447 | /** |
| 13448 | * send_wow_patterns_to_fw_cmd_tlv() - Sends WOW patterns to FW. |
| 13449 | * @wmi_handle: wmi handle |
| 13450 | * @vdev_id: vdev id |
| 13451 | * @ptrn_id: pattern id |
| 13452 | * @ptrn: pattern |
| 13453 | * @ptrn_len: pattern length |
| 13454 | * @ptrn_offset: pattern offset |
| 13455 | * @mask: mask |
| 13456 | * @mask_len: mask length |
| 13457 | * @user: true for user configured pattern and false for default pattern |
| 13458 | * @default_patterns: default patterns |
| 13459 | * |
| 13460 | * Return: CDF status |
| 13461 | */ |
| 13462 | static QDF_STATUS send_wow_patterns_to_fw_cmd_tlv(wmi_unified_t wmi_handle, |
| 13463 | uint8_t vdev_id, uint8_t ptrn_id, |
| 13464 | const uint8_t *ptrn, uint8_t ptrn_len, |
| 13465 | uint8_t ptrn_offset, const uint8_t *mask, |
| 13466 | uint8_t mask_len, bool user, |
| 13467 | uint8_t default_patterns) |
| 13468 | { |
| 13469 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 13470 | WOW_BITMAP_PATTERN_T *bitmap_pattern; |
| 13471 | wmi_buf_t buf; |
| 13472 | uint8_t *buf_ptr; |
| 13473 | int32_t len; |
| 13474 | int ret; |
| 13475 | |
| 13476 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 13477 | WMI_TLV_HDR_SIZE + |
| 13478 | 1 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 13479 | WMI_TLV_HDR_SIZE + |
| 13480 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 13481 | WMI_TLV_HDR_SIZE + |
| 13482 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 13483 | WMI_TLV_HDR_SIZE + |
| 13484 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 13485 | WMI_TLV_HDR_SIZE + |
| 13486 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 13487 | |
| 13488 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13489 | if (!buf) { |
| 13490 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 13491 | return QDF_STATUS_E_NOMEM; |
| 13492 | } |
| 13493 | |
| 13494 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 13495 | buf_ptr = (uint8_t *) cmd; |
| 13496 | |
| 13497 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13498 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 13499 | WMITLV_GET_STRUCT_TLVLEN |
| 13500 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 13501 | cmd->vdev_id = vdev_id; |
| 13502 | cmd->pattern_id = ptrn_id; |
| 13503 | |
| 13504 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 13505 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 13506 | |
| 13507 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13508 | sizeof(WOW_BITMAP_PATTERN_T)); |
| 13509 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13510 | bitmap_pattern = (WOW_BITMAP_PATTERN_T *) buf_ptr; |
| 13511 | |
| 13512 | WMITLV_SET_HDR(&bitmap_pattern->tlv_header, |
| 13513 | WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T, |
| 13514 | WMITLV_GET_STRUCT_TLVLEN(WOW_BITMAP_PATTERN_T)); |
| 13515 | |
| 13516 | qdf_mem_copy(&bitmap_pattern->patternbuf[0], ptrn, ptrn_len); |
| 13517 | qdf_mem_copy(&bitmap_pattern->bitmaskbuf[0], mask, mask_len); |
| 13518 | |
| 13519 | bitmap_pattern->pattern_offset = ptrn_offset; |
| 13520 | bitmap_pattern->pattern_len = ptrn_len; |
| 13521 | |
| 13522 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMAP_PATTERN_SIZE) |
| 13523 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMAP_PATTERN_SIZE; |
| 13524 | |
| 13525 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMASK_SIZE) |
| 13526 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMASK_SIZE; |
| 13527 | |
| 13528 | bitmap_pattern->bitmask_len = bitmap_pattern->pattern_len; |
| 13529 | bitmap_pattern->pattern_id = ptrn_id; |
| 13530 | |
| 13531 | WMI_LOGI("vdev: %d, ptrn id: %d, ptrn len: %d, ptrn offset: %d user %d", |
| 13532 | cmd->vdev_id, cmd->pattern_id, bitmap_pattern->pattern_len, |
| 13533 | bitmap_pattern->pattern_offset, user); |
| 13534 | WMI_LOGI("Pattern : "); |
| 13535 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 13536 | &bitmap_pattern->patternbuf[0], bitmap_pattern->pattern_len); |
| 13537 | |
| 13538 | WMI_LOGI("Mask : "); |
| 13539 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 13540 | &bitmap_pattern->bitmaskbuf[0], bitmap_pattern->pattern_len); |
| 13541 | |
| 13542 | buf_ptr += sizeof(WOW_BITMAP_PATTERN_T); |
| 13543 | |
| 13544 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 13545 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13546 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13547 | |
| 13548 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 13549 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13550 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13551 | |
| 13552 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 13553 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13554 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13555 | |
| 13556 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 13557 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 13558 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13559 | |
| 13560 | /* Fill TLV for ratelimit_interval with dummy data as this fix elem */ |
| 13561 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 1 * sizeof(A_UINT32)); |
| 13562 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13563 | *(A_UINT32 *) buf_ptr = 0; |
| 13564 | |
| 13565 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13566 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 13567 | if (ret) { |
| 13568 | WMI_LOGE("%s: Failed to send wow ptrn to fw", __func__); |
| 13569 | wmi_buf_free(buf); |
| 13570 | return QDF_STATUS_E_FAILURE; |
| 13571 | } |
| 13572 | |
| 13573 | return QDF_STATUS_SUCCESS; |
| 13574 | } |
| 13575 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13576 | /** |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13577 | * fill_arp_offload_params_tlv() - Fill ARP offload data |
| 13578 | * @wmi_handle: wmi handle |
| 13579 | * @offload_req: offload request |
| 13580 | * @buf_ptr: buffer pointer |
| 13581 | * |
| 13582 | * To fill ARP offload data to firmware |
| 13583 | * when target goes to wow mode. |
| 13584 | * |
| 13585 | * Return: None |
| 13586 | */ |
| 13587 | static void fill_arp_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13588 | struct pmo_arp_offload_params *offload_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13589 | { |
| 13590 | |
| 13591 | int i; |
| 13592 | WMI_ARP_OFFLOAD_TUPLE *arp_tuple; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13593 | bool enable_or_disable = offload_req->enable; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13594 | |
| 13595 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13596 | (WMI_MAX_ARP_OFFLOADS*sizeof(WMI_ARP_OFFLOAD_TUPLE))); |
| 13597 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 13598 | for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { |
| 13599 | arp_tuple = (WMI_ARP_OFFLOAD_TUPLE *)*buf_ptr; |
| 13600 | WMITLV_SET_HDR(&arp_tuple->tlv_header, |
| 13601 | WMITLV_TAG_STRUC_WMI_ARP_OFFLOAD_TUPLE, |
| 13602 | WMITLV_GET_STRUCT_TLVLEN(WMI_ARP_OFFLOAD_TUPLE)); |
| 13603 | |
| 13604 | /* Fill data for ARP and NS in the first tupple for LA */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13605 | if ((enable_or_disable & PMO_OFFLOAD_ENABLE) && (i == 0)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13606 | /* Copy the target ip addr and flags */ |
| 13607 | arp_tuple->flags = WMI_ARPOFF_FLAGS_VALID; |
| 13608 | qdf_mem_copy(&arp_tuple->target_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13609 | offload_req->host_ipv4_addr, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13610 | WMI_IPV4_ADDR_LEN); |
| 13611 | WMI_LOGD("ARPOffload IP4 address: %pI4", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13612 | offload_req->host_ipv4_addr); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13613 | } |
| 13614 | *buf_ptr += sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 13615 | } |
| 13616 | } |
| 13617 | |
| 13618 | #ifdef WLAN_NS_OFFLOAD |
| 13619 | /** |
| 13620 | * fill_ns_offload_params_tlv() - Fill NS offload data |
| 13621 | * @wmi|_handle: wmi handle |
| 13622 | * @offload_req: offload request |
| 13623 | * @buf_ptr: buffer pointer |
| 13624 | * |
| 13625 | * To fill NS offload data to firmware |
| 13626 | * when target goes to wow mode. |
| 13627 | * |
| 13628 | * Return: None |
| 13629 | */ |
| 13630 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13631 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13632 | { |
| 13633 | |
| 13634 | int i; |
| 13635 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13636 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13637 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13638 | (WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 13639 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 13640 | for (i = 0; i < WMI_MAX_NS_OFFLOADS; i++) { |
| 13641 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 13642 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 13643 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 13644 | (sizeof(WMI_NS_OFFLOAD_TUPLE) - WMI_TLV_HDR_SIZE)); |
| 13645 | |
| 13646 | /* |
| 13647 | * Fill data only for NS offload in the first ARP tuple for LA |
| 13648 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13649 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13650 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 13651 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13652 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13653 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13654 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13655 | sizeof(WMI_IPV6_ADDR)); |
| 13656 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13657 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13658 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13659 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13660 | ns_tuple->flags |= |
| 13661 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 13662 | } |
| 13663 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13664 | i, &ns_req->self_ipv6_addr[i], |
| 13665 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13666 | |
| 13667 | /* target MAC is optional, check if it is valid, |
| 13668 | * if this is not valid, the target will use the known |
| 13669 | * local MAC address rather than the tuple |
| 13670 | */ |
| 13671 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13672 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13673 | &ns_tuple->target_mac); |
| 13674 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 13675 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 13676 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 13677 | } |
| 13678 | } |
| 13679 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 13680 | } |
| 13681 | } |
| 13682 | |
| 13683 | |
| 13684 | /** |
| 13685 | * fill_nsoffload_ext_tlv() - Fill NS offload ext data |
| 13686 | * @wmi: wmi handle |
| 13687 | * @offload_req: offload request |
| 13688 | * @buf_ptr: buffer pointer |
| 13689 | * |
| 13690 | * To fill extended NS offload extended data to firmware |
| 13691 | * when target goes to wow mode. |
| 13692 | * |
| 13693 | * Return: None |
| 13694 | */ |
| 13695 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13696 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13697 | { |
| 13698 | int i; |
| 13699 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 13700 | uint32_t count, num_ns_ext_tuples; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13701 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13702 | count = ns_req->num_ns_offload_count; |
| 13703 | num_ns_ext_tuples = ns_req->num_ns_offload_count - |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13704 | WMI_MAX_NS_OFFLOADS; |
| 13705 | |
| 13706 | /* Populate extended NS offload tuples */ |
| 13707 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13708 | (num_ns_ext_tuples * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 13709 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 13710 | for (i = WMI_MAX_NS_OFFLOADS; i < count; i++) { |
| 13711 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 13712 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 13713 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 13714 | (sizeof(WMI_NS_OFFLOAD_TUPLE)-WMI_TLV_HDR_SIZE)); |
| 13715 | |
| 13716 | /* |
| 13717 | * Fill data only for NS offload in the first ARP tuple for LA |
| 13718 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13719 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13720 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 13721 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13722 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13723 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13724 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13725 | sizeof(WMI_IPV6_ADDR)); |
| 13726 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13727 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13728 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13729 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13730 | ns_tuple->flags |= |
| 13731 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 13732 | } |
| 13733 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13734 | i, &ns_req->self_ipv6_addr[i], |
| 13735 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13736 | |
| 13737 | /* target MAC is optional, check if it is valid, |
| 13738 | * if this is not valid, the target will use the |
| 13739 | * known local MAC address rather than the tuple |
| 13740 | */ |
| 13741 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13742 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13743 | &ns_tuple->target_mac); |
| 13744 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 13745 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 13746 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 13747 | } |
| 13748 | } |
| 13749 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 13750 | } |
| 13751 | } |
| 13752 | #else |
| 13753 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13754 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13755 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13756 | } |
| 13757 | |
| 13758 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13759 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13760 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13761 | } |
| 13762 | #endif |
| 13763 | |
| 13764 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13765 | * send_enable_arp_ns_offload_cmd_tlv() - enable ARP NS offload |
| 13766 | * @wma: wmi handle |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13767 | * @arp_offload_req: arp offload request |
| 13768 | * @ns_offload_req: ns offload request |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13769 | * @arp_only: flag |
| 13770 | * |
| 13771 | * To configure ARP NS off load data to firmware |
| 13772 | * when target goes to wow mode. |
| 13773 | * |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13774 | * Return: QDF Status |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13775 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13776 | 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] | 13777 | struct pmo_arp_offload_params *arp_offload_req, |
| 13778 | struct pmo_ns_offload_params *ns_offload_req, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13779 | uint8_t vdev_id) |
| 13780 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13781 | int32_t res; |
| 13782 | WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13783 | A_UINT8 *buf_ptr; |
| 13784 | wmi_buf_t buf; |
| 13785 | int32_t len; |
| 13786 | uint32_t count = 0, num_ns_ext_tuples = 0; |
| 13787 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13788 | count = ns_offload_req->num_ns_offload_count; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13789 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13790 | /* |
| 13791 | * TLV place holder size for array of NS tuples |
| 13792 | * TLV place holder size for array of ARP tuples |
| 13793 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13794 | len = sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param) + |
| 13795 | WMI_TLV_HDR_SIZE + |
| 13796 | WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE) + |
| 13797 | WMI_TLV_HDR_SIZE + |
| 13798 | WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13799 | |
| 13800 | /* |
| 13801 | * If there are more than WMI_MAX_NS_OFFLOADS addresses then allocate |
| 13802 | * extra length for extended NS offload tuples which follows ARP offload |
| 13803 | * tuples. Host needs to fill this structure in following format: |
| 13804 | * 2 NS ofload tuples |
| 13805 | * 2 ARP offload tuples |
| 13806 | * N numbers of extended NS offload tuples if HDD has given more than |
| 13807 | * 2 NS offload addresses |
| 13808 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13809 | if (count > WMI_MAX_NS_OFFLOADS) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13810 | num_ns_ext_tuples = count - WMI_MAX_NS_OFFLOADS; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13811 | len += WMI_TLV_HDR_SIZE + num_ns_ext_tuples |
| 13812 | * sizeof(WMI_NS_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13813 | } |
| 13814 | |
| 13815 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13816 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13817 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13818 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13819 | } |
| 13820 | |
| 13821 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 13822 | cmd = (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *) buf_ptr; |
| 13823 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13824 | WMITLV_TAG_STRUC_WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param, |
| 13825 | WMITLV_GET_STRUCT_TLVLEN |
| 13826 | (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param)); |
| 13827 | cmd->flags = 0; |
| 13828 | cmd->vdev_id = vdev_id; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13829 | cmd->num_ns_ext_tuples = num_ns_ext_tuples; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13830 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13831 | WMI_LOGD("ARP NS Offload vdev_id: %d", cmd->vdev_id); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13832 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13833 | buf_ptr += sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13834 | fill_ns_offload_params_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
| 13835 | fill_arp_offload_params_tlv(wmi_handle, arp_offload_req, &buf_ptr); |
| 13836 | if (num_ns_ext_tuples) |
| 13837 | fill_nsoffload_ext_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13838 | |
| 13839 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13840 | WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 13841 | if (res) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13842 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13843 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13844 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13845 | } |
| 13846 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13847 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13848 | } |
| 13849 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13850 | /** |
| 13851 | * send_enable_enhance_multicast_offload_tlv() - send enhance multicast offload |
| 13852 | * @wmi_handle: wmi handle |
| 13853 | * @vdev_id: vdev id |
| 13854 | * @action: true for enable else false |
| 13855 | * |
| 13856 | * To enable enhance multicast offload to firmware |
| 13857 | * when target goes to wow mode. |
| 13858 | * |
| 13859 | * Return: QDF Status |
| 13860 | */ |
| 13861 | |
| 13862 | static |
| 13863 | QDF_STATUS send_enable_enhance_multicast_offload_tlv( |
| 13864 | wmi_unified_t wmi_handle, |
| 13865 | uint8_t vdev_id, bool action) |
| 13866 | { |
| 13867 | QDF_STATUS status; |
| 13868 | wmi_buf_t buf; |
| 13869 | wmi_config_enhanced_mcast_filter_cmd_fixed_param *cmd; |
| 13870 | |
| 13871 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 13872 | if (!buf) { |
| 13873 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 13874 | return QDF_STATUS_E_NOMEM; |
| 13875 | } |
| 13876 | |
| 13877 | cmd = (wmi_config_enhanced_mcast_filter_cmd_fixed_param *) |
| 13878 | wmi_buf_data(buf); |
| 13879 | |
| 13880 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13881 | WMITLV_TAG_STRUC_wmi_config_enhanced_mcast_filter_fixed_param, |
| 13882 | WMITLV_GET_STRUCT_TLVLEN( |
| 13883 | wmi_config_enhanced_mcast_filter_cmd_fixed_param)); |
| 13884 | |
| 13885 | cmd->vdev_id = vdev_id; |
| 13886 | cmd->enable = ((action == 0) ? ENHANCED_MCAST_FILTER_DISABLED : |
| 13887 | ENHANCED_MCAST_FILTER_ENABLED); |
| 13888 | WMI_LOGD("%s: config enhance multicast offload action %d for vdev %d", |
| 13889 | __func__, action, vdev_id); |
| 13890 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13891 | sizeof(*cmd), WMI_CONFIG_ENHANCED_MCAST_FILTER_CMDID); |
| 13892 | if (status != QDF_STATUS_SUCCESS) { |
| 13893 | qdf_nbuf_free(buf); |
| 13894 | WMI_LOGE("%s:Failed to send ENHANCED_MCAST_FILTER_CMDID", |
| 13895 | __func__); |
| 13896 | } |
| 13897 | |
| 13898 | return status; |
| 13899 | } |
| 13900 | |
| 13901 | /** |
| 13902 | * extract_gtk_rsp_event_tlv() - extract gtk rsp params from event |
| 13903 | * @wmi_handle: wmi handle |
| 13904 | * @param evt_buf: pointer to event buffer |
| 13905 | * @param hdr: Pointer to hold header |
| 13906 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 13907 | * |
| 13908 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13909 | */ |
| 13910 | static QDF_STATUS extract_gtk_rsp_event_tlv(wmi_unified_t wmi_handle, |
| 13911 | void *evt_buf, struct pmo_gtk_rsp_params *gtk_rsp_param, uint32_t len) |
| 13912 | { |
| 13913 | WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *fixed_param; |
| 13914 | WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *param_buf; |
| 13915 | |
| 13916 | param_buf = (WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *)evt_buf; |
| 13917 | if (!param_buf) { |
| 13918 | WMI_LOGE("gtk param_buf is NULL"); |
| 13919 | return QDF_STATUS_E_INVAL; |
| 13920 | } |
| 13921 | |
| 13922 | if (len < sizeof(WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param)) { |
| 13923 | WMI_LOGE("Invalid length for GTK status"); |
| 13924 | return QDF_STATUS_E_INVAL; |
| 13925 | } |
| 13926 | |
| 13927 | fixed_param = (WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *) |
| 13928 | param_buf->fixed_param; |
| 13929 | gtk_rsp_param->vdev_id = fixed_param->vdev_id; |
| 13930 | gtk_rsp_param->status_flag = QDF_STATUS_SUCCESS; |
| 13931 | gtk_rsp_param->refresh_cnt = fixed_param->refresh_cnt; |
| 13932 | qdf_mem_copy(>k_rsp_param->replay_counter, |
| 13933 | &fixed_param->replay_counter, |
| 13934 | GTK_REPLAY_COUNTER_BYTES); |
| 13935 | |
| 13936 | return QDF_STATUS_SUCCESS; |
| 13937 | |
| 13938 | } |
| 13939 | |
| 13940 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 13941 | /** |
| 13942 | * send_wow_sta_ra_filter_cmd_tlv() - set RA filter pattern in fw |
| 13943 | * @wmi_handle: wmi handle |
| 13944 | * @vdev_id: vdev id |
| 13945 | * |
| 13946 | * Return: CDF status |
| 13947 | */ |
| 13948 | static QDF_STATUS send_wow_sta_ra_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 13949 | uint8_t vdev_id, uint8_t default_pattern, |
| 13950 | uint16_t rate_limit_interval) |
| 13951 | { |
| 13952 | |
| 13953 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 13954 | wmi_buf_t buf; |
| 13955 | uint8_t *buf_ptr; |
| 13956 | int32_t len; |
| 13957 | int ret; |
| 13958 | |
| 13959 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 13960 | WMI_TLV_HDR_SIZE + |
| 13961 | 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 13962 | WMI_TLV_HDR_SIZE + |
| 13963 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 13964 | WMI_TLV_HDR_SIZE + |
| 13965 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 13966 | WMI_TLV_HDR_SIZE + |
| 13967 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 13968 | WMI_TLV_HDR_SIZE + |
| 13969 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 13970 | |
| 13971 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13972 | if (!buf) { |
| 13973 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 13974 | return QDF_STATUS_E_NOMEM; |
| 13975 | } |
| 13976 | |
| 13977 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 13978 | buf_ptr = (uint8_t *) cmd; |
| 13979 | |
| 13980 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13981 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 13982 | WMITLV_GET_STRUCT_TLVLEN |
| 13983 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 13984 | cmd->vdev_id = vdev_id; |
| 13985 | cmd->pattern_id = default_pattern, |
| 13986 | cmd->pattern_type = WOW_IPV6_RA_PATTERN; |
| 13987 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 13988 | |
| 13989 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 13990 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13991 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13992 | |
| 13993 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 13994 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13995 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13996 | |
| 13997 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 13998 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13999 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14000 | |
| 14001 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 14002 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 14003 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14004 | |
| 14005 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 14006 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 14007 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14008 | |
| 14009 | /* Fill TLV for ra_ratelimit_interval. */ |
| 14010 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 14011 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14012 | |
| 14013 | *((A_UINT32 *) buf_ptr) = rate_limit_interval; |
| 14014 | |
| 14015 | WMI_LOGD("%s: send RA rate limit [%d] to fw vdev = %d", __func__, |
| 14016 | rate_limit_interval, vdev_id); |
| 14017 | |
| 14018 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14019 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 14020 | if (ret) { |
| 14021 | WMI_LOGE("%s: Failed to send RA rate limit to fw", __func__); |
| 14022 | wmi_buf_free(buf); |
| 14023 | return QDF_STATUS_E_FAILURE; |
| 14024 | } |
| 14025 | |
| 14026 | return QDF_STATUS_SUCCESS; |
| 14027 | |
| 14028 | } |
| 14029 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 14030 | |
| 14031 | /** |
| 14032 | * send_add_clear_mcbc_filter_cmd_tlv() - set mcast filter command to fw |
| 14033 | * @wmi_handle: wmi handle |
| 14034 | * @vdev_id: vdev id |
| 14035 | * @multicastAddr: mcast address |
| 14036 | * @clearList: clear list flag |
| 14037 | * |
| 14038 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14039 | */ |
| 14040 | static QDF_STATUS send_add_clear_mcbc_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 14041 | uint8_t vdev_id, |
| 14042 | struct qdf_mac_addr multicast_addr, |
| 14043 | bool clearList) |
| 14044 | { |
| 14045 | WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *cmd; |
| 14046 | wmi_buf_t buf; |
| 14047 | int err; |
| 14048 | |
| 14049 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 14050 | if (!buf) { |
| 14051 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
| 14052 | return QDF_STATUS_E_NOMEM; |
| 14053 | } |
| 14054 | |
| 14055 | cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf); |
| 14056 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 14057 | |
| 14058 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14059 | WMITLV_TAG_STRUC_WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param, |
| 14060 | WMITLV_GET_STRUCT_TLVLEN |
| 14061 | (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param)); |
| 14062 | cmd->action = |
| 14063 | (clearList ? WMI_MCAST_FILTER_DELETE : WMI_MCAST_FILTER_SET); |
| 14064 | cmd->vdev_id = vdev_id; |
| 14065 | WMI_CHAR_ARRAY_TO_MAC_ADDR(multicast_addr.bytes, &cmd->mcastbdcastaddr); |
| 14066 | |
| 14067 | WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d; MCBC MAC Addr: %pM", |
| 14068 | cmd->action, vdev_id, clearList, multicast_addr.bytes); |
| 14069 | |
| 14070 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 14071 | sizeof(*cmd), |
| 14072 | WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 14073 | if (err) { |
| 14074 | WMI_LOGE("Failed to send set_param cmd"); |
| 14075 | wmi_buf_free(buf); |
| 14076 | return QDF_STATUS_E_FAILURE; |
| 14077 | } |
| 14078 | |
| 14079 | return QDF_STATUS_SUCCESS; |
| 14080 | } |
| 14081 | |
| 14082 | /** |
Poddar, Siddarth | 79ba820 | 2017-09-28 17:14:01 +0530 | [diff] [blame] | 14083 | * send_multiple_add_clear_mcbc_filter_cmd_tlv() - send multiple mcast filter |
| 14084 | * command to fw |
| 14085 | * @wmi_handle: wmi handle |
| 14086 | * @vdev_id: vdev id |
| 14087 | * @mcast_filter_params: mcast filter params |
| 14088 | * |
| 14089 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14090 | */ |
| 14091 | static QDF_STATUS send_multiple_add_clear_mcbc_filter_cmd_tlv( |
| 14092 | wmi_unified_t wmi_handle, |
| 14093 | uint8_t vdev_id, |
| 14094 | struct pmo_mcast_filter_params *filter_param) |
| 14095 | |
| 14096 | { |
| 14097 | WMI_SET_MULTIPLE_MCAST_FILTER_CMD_fixed_param *cmd; |
| 14098 | uint8_t *buf_ptr; |
| 14099 | wmi_buf_t buf; |
| 14100 | int err; |
| 14101 | int i; |
| 14102 | uint8_t *mac_addr_src_ptr = NULL; |
| 14103 | wmi_mac_addr *mac_addr_dst_ptr; |
| 14104 | uint32_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 14105 | sizeof(wmi_mac_addr) * filter_param->multicast_addr_cnt; |
| 14106 | |
| 14107 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14108 | if (!buf) { |
| 14109 | WMI_LOGE("Failed to allocate memory"); |
| 14110 | return QDF_STATUS_E_NOMEM; |
| 14111 | } |
| 14112 | |
| 14113 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 14114 | cmd = (WMI_SET_MULTIPLE_MCAST_FILTER_CMD_fixed_param *) |
| 14115 | wmi_buf_data(buf); |
| 14116 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 14117 | |
| 14118 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14119 | WMITLV_TAG_STRUC_wmi_set_multiple_mcast_filter_cmd_fixed_param, |
| 14120 | WMITLV_GET_STRUCT_TLVLEN |
| 14121 | (WMI_SET_MULTIPLE_MCAST_FILTER_CMD_fixed_param)); |
| 14122 | cmd->operation = |
| 14123 | ((filter_param->action == 0) ? WMI_MULTIPLE_MCAST_FILTER_DELETE |
| 14124 | : WMI_MULTIPLE_MCAST_FILTER_ADD); |
| 14125 | cmd->vdev_id = vdev_id; |
| 14126 | cmd->num_mcastaddrs = filter_param->multicast_addr_cnt; |
| 14127 | |
| 14128 | buf_ptr += sizeof(*cmd); |
| 14129 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 14130 | sizeof(wmi_mac_addr) * |
| 14131 | filter_param->multicast_addr_cnt); |
| 14132 | |
| 14133 | if (filter_param->multicast_addr_cnt == 0) |
| 14134 | goto send_cmd; |
| 14135 | |
| 14136 | mac_addr_src_ptr = (uint8_t *)&filter_param->multicast_addr; |
| 14137 | mac_addr_dst_ptr = (wmi_mac_addr *) |
| 14138 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 14139 | |
| 14140 | for (i = 0; i < filter_param->multicast_addr_cnt; i++) { |
| 14141 | WMI_CHAR_ARRAY_TO_MAC_ADDR(mac_addr_src_ptr, mac_addr_dst_ptr); |
| 14142 | mac_addr_src_ptr += ATH_MAC_LEN; |
| 14143 | mac_addr_dst_ptr++; |
| 14144 | } |
| 14145 | |
| 14146 | send_cmd: |
| 14147 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 14148 | len, |
| 14149 | WMI_SET_MULTIPLE_MCAST_FILTER_CMDID); |
| 14150 | if (err) { |
| 14151 | WMI_LOGE("Failed to send set_param cmd"); |
| 14152 | wmi_buf_free(buf); |
| 14153 | return QDF_STATUS_E_FAILURE; |
| 14154 | } |
| 14155 | |
| 14156 | return QDF_STATUS_SUCCESS; |
| 14157 | } |
| 14158 | |
| 14159 | |
| 14160 | /** |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14161 | * send_gtk_offload_cmd_tlv() - send GTK offload command to fw |
| 14162 | * @wmi_handle: wmi handle |
| 14163 | * @vdev_id: vdev id |
| 14164 | * @params: GTK offload parameters |
| 14165 | * |
| 14166 | * Return: CDF status |
| 14167 | */ |
| 14168 | static |
| 14169 | QDF_STATUS send_gtk_offload_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id, |
| 14170 | struct pmo_gtk_req *params, |
| 14171 | bool enable_offload, |
| 14172 | uint32_t gtk_offload_opcode) |
| 14173 | { |
| 14174 | int len; |
| 14175 | wmi_buf_t buf; |
| 14176 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14177 | wmi_gtk_offload_fils_tlv_param *ext_param; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14178 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14179 | uint8_t *buf_ptr; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14180 | |
| 14181 | WMI_LOGD("%s Enter", __func__); |
| 14182 | |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14183 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*ext_param); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14184 | |
| 14185 | /* alloc wmi buffer */ |
| 14186 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14187 | if (!buf) { |
| 14188 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 14189 | status = QDF_STATUS_E_NOMEM; |
| 14190 | goto out; |
| 14191 | } |
| 14192 | |
| 14193 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14194 | buf_ptr = (uint8_t *)cmd; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14195 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14196 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 14197 | WMITLV_GET_STRUCT_TLVLEN |
| 14198 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 14199 | |
| 14200 | cmd->vdev_id = vdev_id; |
| 14201 | |
| 14202 | /* Request target to enable GTK offload */ |
| 14203 | if (enable_offload == PMO_GTK_OFFLOAD_ENABLE) { |
| 14204 | cmd->flags = gtk_offload_opcode; |
| 14205 | |
| 14206 | /* Copy the keys and replay counter */ |
| 14207 | qdf_mem_copy(cmd->KCK, params->kck, PMO_KCK_LEN); |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14208 | qdf_mem_copy(cmd->KEK, params->kek, PMO_KEK_LEN_LEGACY); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14209 | qdf_mem_copy(cmd->replay_counter, ¶ms->replay_counter, |
| 14210 | GTK_REPLAY_COUNTER_BYTES); |
| 14211 | } else { |
| 14212 | cmd->flags = gtk_offload_opcode; |
| 14213 | } |
| 14214 | |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14215 | buf_ptr += sizeof(*cmd); |
| 14216 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(*ext_param)); |
| 14217 | buf_ptr += WMI_TLV_HDR_SIZE; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14218 | |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 14219 | ext_param = (wmi_gtk_offload_fils_tlv_param *)buf_ptr; |
| 14220 | WMITLV_SET_HDR(&ext_param->tlv_header, |
| 14221 | WMITLV_TAG_STRUC_wmi_gtk_offload_extended_tlv_param, |
| 14222 | WMITLV_GET_STRUCT_TLVLEN( |
| 14223 | wmi_gtk_offload_fils_tlv_param)); |
| 14224 | ext_param->vdev_id = vdev_id; |
| 14225 | ext_param->flags = cmd->flags; |
| 14226 | ext_param->kek_len = params->kek_len; |
| 14227 | qdf_mem_copy(ext_param->KEK, params->kek, params->kek_len); |
| 14228 | qdf_mem_copy(ext_param->KCK, params->kck, WMI_GTK_OFFLOAD_KCK_BYTES); |
| 14229 | qdf_mem_copy(ext_param->replay_counter, ¶ms->replay_counter, |
| 14230 | GTK_REPLAY_COUNTER_BYTES); |
| 14231 | |
| 14232 | WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x kek len %d", vdev_id, cmd->flags, params->kek_len); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14233 | /* send the wmi command */ |
| 14234 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14235 | WMI_GTK_OFFLOAD_CMDID)) { |
| 14236 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID"); |
| 14237 | wmi_buf_free(buf); |
| 14238 | status = QDF_STATUS_E_FAILURE; |
| 14239 | } |
| 14240 | |
| 14241 | out: |
| 14242 | WMI_LOGD("%s Exit", __func__); |
| 14243 | return status; |
| 14244 | } |
| 14245 | |
| 14246 | /** |
| 14247 | * send_process_gtk_offload_getinfo_cmd_tlv() - send GTK offload cmd to fw |
| 14248 | * @wmi_handle: wmi handle |
| 14249 | * @params: GTK offload params |
| 14250 | * |
| 14251 | * Return: CDF status |
| 14252 | */ |
| 14253 | static QDF_STATUS send_process_gtk_offload_getinfo_cmd_tlv( |
| 14254 | wmi_unified_t wmi_handle, |
| 14255 | uint8_t vdev_id, |
| 14256 | uint64_t offload_req_opcode) |
| 14257 | { |
| 14258 | int len; |
| 14259 | wmi_buf_t buf; |
| 14260 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
| 14261 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 14262 | |
| 14263 | len = sizeof(*cmd); |
| 14264 | |
| 14265 | /* alloc wmi buffer */ |
| 14266 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14267 | if (!buf) { |
| 14268 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 14269 | status = QDF_STATUS_E_NOMEM; |
| 14270 | goto out; |
| 14271 | } |
| 14272 | |
| 14273 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 14274 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14275 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 14276 | WMITLV_GET_STRUCT_TLVLEN |
| 14277 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 14278 | |
| 14279 | /* Request for GTK offload status */ |
| 14280 | cmd->flags = offload_req_opcode; |
| 14281 | cmd->vdev_id = vdev_id; |
| 14282 | |
| 14283 | /* send the wmi command */ |
| 14284 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14285 | WMI_GTK_OFFLOAD_CMDID)) { |
| 14286 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID for req info"); |
| 14287 | wmi_buf_free(buf); |
| 14288 | status = QDF_STATUS_E_FAILURE; |
| 14289 | } |
| 14290 | |
| 14291 | out: |
| 14292 | return status; |
| 14293 | } |
| 14294 | |
| 14295 | /** |
| 14296 | * send_action_frame_patterns_cmd_tlv() - send wmi cmd of action filter params |
| 14297 | * @wmi_handle: wmi handler |
| 14298 | * @action_params: pointer to action_params |
| 14299 | * |
| 14300 | * Return: 0 for success, otherwise appropriate error code |
| 14301 | */ |
| 14302 | static QDF_STATUS send_action_frame_patterns_cmd_tlv(wmi_unified_t wmi_handle, |
| 14303 | struct pmo_action_wakeup_set_params *action_params) |
| 14304 | { |
| 14305 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *cmd; |
| 14306 | wmi_buf_t buf; |
| 14307 | int i; |
| 14308 | int32_t err; |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14309 | uint32_t len = 0, *cmd_args; |
| 14310 | uint8_t *buf_ptr; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14311 | |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14312 | len = (PMO_SUPPORTED_ACTION_CATE * sizeof(A_UINT32)) |
| 14313 | + WMI_TLV_HDR_SIZE + sizeof(*cmd); |
| 14314 | buf = wmi_buf_alloc(wmi_handle, len); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14315 | if (!buf) { |
| 14316 | WMI_LOGE("Failed to allocate buffer to send action filter cmd"); |
| 14317 | return QDF_STATUS_E_NOMEM; |
| 14318 | } |
| 14319 | cmd = (WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *) wmi_buf_data(buf); |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14320 | buf_ptr = (uint8_t *)cmd; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14321 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14322 | WMITLV_TAG_STRUC_wmi_wow_set_action_wake_up_cmd_fixed_param, |
| 14323 | WMITLV_GET_STRUCT_TLVLEN( |
| 14324 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param)); |
| 14325 | |
| 14326 | cmd->vdev_id = action_params->vdev_id; |
| 14327 | cmd->operation = action_params->operation; |
| 14328 | |
| 14329 | for (i = 0; i < MAX_SUPPORTED_ACTION_CATEGORY_ELE_LIST; i++) |
| 14330 | cmd->action_category_map[i] = |
| 14331 | action_params->action_category_map[i]; |
| 14332 | |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14333 | buf_ptr += sizeof(WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param); |
| 14334 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 14335 | (PMO_SUPPORTED_ACTION_CATE * sizeof(A_UINT32))); |
| 14336 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14337 | cmd_args = (uint32_t *) buf_ptr; |
| 14338 | for (i = 0; i < PMO_SUPPORTED_ACTION_CATE; i++) |
| 14339 | cmd_args[i] = action_params->action_per_category[i]; |
| 14340 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14341 | err = wmi_unified_cmd_send(wmi_handle, buf, |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14342 | len, WMI_WOW_SET_ACTION_WAKE_UP_CMDID); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14343 | if (err) { |
| 14344 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
| 14345 | wmi_buf_free(buf); |
| 14346 | return QDF_STATUS_E_FAILURE; |
| 14347 | } |
| 14348 | |
| 14349 | return QDF_STATUS_SUCCESS; |
| 14350 | } |
| 14351 | |
| 14352 | #ifdef FEATURE_WLAN_LPHB |
| 14353 | |
| 14354 | /** |
| 14355 | * send_lphb_config_hbenable_cmd_tlv() - enable command of LPHB configuration |
| 14356 | * @wmi_handle: wmi handle |
| 14357 | * @lphb_conf_req: configuration info |
| 14358 | * |
| 14359 | * Return: CDF status |
| 14360 | */ |
| 14361 | static QDF_STATUS send_lphb_config_hbenable_cmd_tlv(wmi_unified_t wmi_handle, |
| 14362 | wmi_hb_set_enable_cmd_fixed_param *params) |
| 14363 | { |
| 14364 | QDF_STATUS status; |
| 14365 | wmi_buf_t buf = NULL; |
| 14366 | uint8_t *buf_ptr; |
| 14367 | wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp; |
| 14368 | int len = sizeof(wmi_hb_set_enable_cmd_fixed_param); |
| 14369 | |
| 14370 | |
| 14371 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14372 | if (!buf) { |
| 14373 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14374 | return QDF_STATUS_E_NOMEM; |
| 14375 | } |
| 14376 | |
| 14377 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14378 | hb_enable_fp = (wmi_hb_set_enable_cmd_fixed_param *) buf_ptr; |
| 14379 | WMITLV_SET_HDR(&hb_enable_fp->tlv_header, |
| 14380 | WMITLV_TAG_STRUC_wmi_hb_set_enable_cmd_fixed_param, |
| 14381 | WMITLV_GET_STRUCT_TLVLEN |
| 14382 | (wmi_hb_set_enable_cmd_fixed_param)); |
| 14383 | |
| 14384 | /* fill in values */ |
| 14385 | hb_enable_fp->vdev_id = params->session; |
| 14386 | hb_enable_fp->enable = params->enable; |
| 14387 | hb_enable_fp->item = params->item; |
| 14388 | hb_enable_fp->session = params->session; |
| 14389 | |
| 14390 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14391 | len, WMI_HB_SET_ENABLE_CMDID); |
| 14392 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14393 | WMI_LOGE("cmd_send WMI_HB_SET_ENABLE returned Error %d", |
| 14394 | status); |
| 14395 | wmi_buf_free(buf); |
| 14396 | } |
| 14397 | |
| 14398 | return status; |
| 14399 | } |
| 14400 | |
| 14401 | /** |
| 14402 | * send_lphb_config_tcp_params_cmd_tlv() - set tcp params of LPHB configuration |
| 14403 | * @wmi_handle: wmi handle |
| 14404 | * @lphb_conf_req: lphb config request |
| 14405 | * |
| 14406 | * Return: CDF status |
| 14407 | */ |
| 14408 | static QDF_STATUS send_lphb_config_tcp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 14409 | wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req) |
| 14410 | { |
| 14411 | QDF_STATUS status; |
| 14412 | wmi_buf_t buf = NULL; |
| 14413 | uint8_t *buf_ptr; |
| 14414 | wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp; |
| 14415 | int len = sizeof(wmi_hb_set_tcp_params_cmd_fixed_param); |
| 14416 | |
| 14417 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14418 | if (!buf) { |
| 14419 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14420 | return QDF_STATUS_E_NOMEM; |
| 14421 | } |
| 14422 | |
| 14423 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14424 | hb_tcp_params_fp = (wmi_hb_set_tcp_params_cmd_fixed_param *) buf_ptr; |
| 14425 | WMITLV_SET_HDR(&hb_tcp_params_fp->tlv_header, |
| 14426 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_params_cmd_fixed_param, |
| 14427 | WMITLV_GET_STRUCT_TLVLEN |
| 14428 | (wmi_hb_set_tcp_params_cmd_fixed_param)); |
| 14429 | |
| 14430 | /* fill in values */ |
| 14431 | hb_tcp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 14432 | hb_tcp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 14433 | hb_tcp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 14434 | hb_tcp_params_fp->seq = lphb_conf_req->seq; |
| 14435 | hb_tcp_params_fp->src_port = lphb_conf_req->src_port; |
| 14436 | hb_tcp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 14437 | hb_tcp_params_fp->interval = lphb_conf_req->interval; |
| 14438 | hb_tcp_params_fp->timeout = lphb_conf_req->timeout; |
| 14439 | hb_tcp_params_fp->session = lphb_conf_req->session; |
| 14440 | qdf_mem_copy(&hb_tcp_params_fp->gateway_mac, |
| 14441 | &lphb_conf_req->gateway_mac, |
| 14442 | sizeof(hb_tcp_params_fp->gateway_mac)); |
| 14443 | |
| 14444 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14445 | len, WMI_HB_SET_TCP_PARAMS_CMDID); |
| 14446 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14447 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PARAMS returned Error %d", |
| 14448 | status); |
| 14449 | wmi_buf_free(buf); |
| 14450 | } |
| 14451 | |
| 14452 | return status; |
| 14453 | } |
| 14454 | |
| 14455 | /** |
| 14456 | * send_lphb_config_tcp_pkt_filter_cmd_tlv() - configure tcp packet filter cmd |
| 14457 | * @wmi_handle: wmi handle |
| 14458 | * @lphb_conf_req: lphb config request |
| 14459 | * |
| 14460 | * Return: CDF status |
| 14461 | */ |
| 14462 | static |
| 14463 | QDF_STATUS send_lphb_config_tcp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 14464 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp) |
| 14465 | { |
| 14466 | QDF_STATUS status; |
| 14467 | wmi_buf_t buf = NULL; |
| 14468 | uint8_t *buf_ptr; |
| 14469 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp; |
| 14470 | int len = sizeof(wmi_hb_set_tcp_pkt_filter_cmd_fixed_param); |
| 14471 | |
| 14472 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14473 | if (!buf) { |
| 14474 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14475 | return QDF_STATUS_E_NOMEM; |
| 14476 | } |
| 14477 | |
| 14478 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14479 | hb_tcp_filter_fp = |
| 14480 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 14481 | WMITLV_SET_HDR(&hb_tcp_filter_fp->tlv_header, |
| 14482 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_pkt_filter_cmd_fixed_param, |
| 14483 | WMITLV_GET_STRUCT_TLVLEN |
| 14484 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param)); |
| 14485 | |
| 14486 | /* fill in values */ |
| 14487 | hb_tcp_filter_fp->vdev_id = g_hb_tcp_filter_fp->vdev_id; |
| 14488 | hb_tcp_filter_fp->length = g_hb_tcp_filter_fp->length; |
| 14489 | hb_tcp_filter_fp->offset = g_hb_tcp_filter_fp->offset; |
| 14490 | hb_tcp_filter_fp->session = g_hb_tcp_filter_fp->session; |
| 14491 | memcpy((void *)&hb_tcp_filter_fp->filter, |
| 14492 | (void *)&g_hb_tcp_filter_fp->filter, |
| 14493 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 14494 | |
| 14495 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14496 | len, WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
| 14497 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14498 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PKT_FILTER returned Error %d", |
| 14499 | status); |
| 14500 | wmi_buf_free(buf); |
| 14501 | } |
| 14502 | |
| 14503 | return status; |
| 14504 | } |
| 14505 | |
| 14506 | /** |
| 14507 | * send_lphb_config_udp_params_cmd_tlv() - configure udp param command of LPHB |
| 14508 | * @wmi_handle: wmi handle |
| 14509 | * @lphb_conf_req: lphb config request |
| 14510 | * |
| 14511 | * Return: CDF status |
| 14512 | */ |
| 14513 | static QDF_STATUS send_lphb_config_udp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 14514 | wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req) |
| 14515 | { |
| 14516 | QDF_STATUS status; |
| 14517 | wmi_buf_t buf = NULL; |
| 14518 | uint8_t *buf_ptr; |
| 14519 | wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp; |
| 14520 | int len = sizeof(wmi_hb_set_udp_params_cmd_fixed_param); |
| 14521 | |
| 14522 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14523 | if (!buf) { |
| 14524 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14525 | return QDF_STATUS_E_NOMEM; |
| 14526 | } |
| 14527 | |
| 14528 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14529 | hb_udp_params_fp = (wmi_hb_set_udp_params_cmd_fixed_param *) buf_ptr; |
| 14530 | WMITLV_SET_HDR(&hb_udp_params_fp->tlv_header, |
| 14531 | WMITLV_TAG_STRUC_wmi_hb_set_udp_params_cmd_fixed_param, |
| 14532 | WMITLV_GET_STRUCT_TLVLEN |
| 14533 | (wmi_hb_set_udp_params_cmd_fixed_param)); |
| 14534 | |
| 14535 | /* fill in values */ |
| 14536 | hb_udp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 14537 | hb_udp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 14538 | hb_udp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 14539 | hb_udp_params_fp->src_port = lphb_conf_req->src_port; |
| 14540 | hb_udp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 14541 | hb_udp_params_fp->interval = lphb_conf_req->interval; |
| 14542 | hb_udp_params_fp->timeout = lphb_conf_req->timeout; |
| 14543 | hb_udp_params_fp->session = lphb_conf_req->session; |
| 14544 | qdf_mem_copy(&hb_udp_params_fp->gateway_mac, |
| 14545 | &lphb_conf_req->gateway_mac, |
| 14546 | sizeof(lphb_conf_req->gateway_mac)); |
| 14547 | |
| 14548 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14549 | len, WMI_HB_SET_UDP_PARAMS_CMDID); |
| 14550 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14551 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PARAMS returned Error %d", |
| 14552 | status); |
| 14553 | wmi_buf_free(buf); |
| 14554 | } |
| 14555 | |
| 14556 | return status; |
| 14557 | } |
| 14558 | |
| 14559 | /** |
| 14560 | * send_lphb_config_udp_pkt_filter_cmd_tlv() - configure udp pkt filter command |
| 14561 | * @wmi_handle: wmi handle |
| 14562 | * @lphb_conf_req: lphb config request |
| 14563 | * |
| 14564 | * Return: CDF status |
| 14565 | */ |
| 14566 | static |
| 14567 | QDF_STATUS send_lphb_config_udp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 14568 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req) |
| 14569 | { |
| 14570 | QDF_STATUS status; |
| 14571 | wmi_buf_t buf = NULL; |
| 14572 | uint8_t *buf_ptr; |
| 14573 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp; |
| 14574 | int len = sizeof(wmi_hb_set_udp_pkt_filter_cmd_fixed_param); |
| 14575 | |
| 14576 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14577 | if (!buf) { |
| 14578 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14579 | return QDF_STATUS_E_NOMEM; |
| 14580 | } |
| 14581 | |
| 14582 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14583 | hb_udp_filter_fp = |
| 14584 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 14585 | WMITLV_SET_HDR(&hb_udp_filter_fp->tlv_header, |
| 14586 | WMITLV_TAG_STRUC_wmi_hb_set_udp_pkt_filter_cmd_fixed_param, |
| 14587 | WMITLV_GET_STRUCT_TLVLEN |
| 14588 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param)); |
| 14589 | |
| 14590 | /* fill in values */ |
| 14591 | hb_udp_filter_fp->vdev_id = lphb_conf_req->vdev_id; |
| 14592 | hb_udp_filter_fp->length = lphb_conf_req->length; |
| 14593 | hb_udp_filter_fp->offset = lphb_conf_req->offset; |
| 14594 | hb_udp_filter_fp->session = lphb_conf_req->session; |
| 14595 | memcpy((void *)&hb_udp_filter_fp->filter, |
| 14596 | (void *)&lphb_conf_req->filter, |
| 14597 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 14598 | |
| 14599 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14600 | len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
| 14601 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14602 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PKT_FILTER returned Error %d", |
| 14603 | status); |
| 14604 | wmi_buf_free(buf); |
| 14605 | } |
| 14606 | |
| 14607 | return status; |
| 14608 | } |
| 14609 | #endif /* FEATURE_WLAN_LPHB */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14610 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14611 | static QDF_STATUS send_conf_hw_filter_cmd_tlv(wmi_unified_t wmi, |
| 14612 | struct pmo_hw_filter_params *req) |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14613 | { |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14614 | QDF_STATUS status; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14615 | wmi_hw_data_filter_cmd_fixed_param *cmd; |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14616 | wmi_buf_t wmi_buf; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14617 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14618 | if (!req) { |
| 14619 | WMI_LOGE("req is null"); |
| 14620 | return QDF_STATUS_E_INVAL; |
| 14621 | } |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14622 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14623 | wmi_buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 14624 | if (!wmi_buf) { |
| 14625 | WMI_LOGE(FL("Out of memory")); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14626 | return QDF_STATUS_E_NOMEM; |
| 14627 | } |
| 14628 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14629 | cmd = (wmi_hw_data_filter_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14630 | WMITLV_SET_HDR(&cmd->tlv_header, |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14631 | WMITLV_TAG_STRUC_wmi_hw_data_filter_cmd_fixed_param, |
| 14632 | WMITLV_GET_STRUCT_TLVLEN(wmi_hw_data_filter_cmd_fixed_param)); |
| 14633 | cmd->vdev_id = req->vdev_id; |
| 14634 | cmd->enable = req->mode != PMO_HW_FILTER_DISABLED; |
| 14635 | cmd->hw_filter_bitmap = req->mode; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14636 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14637 | WMI_LOGD("configure hw filter (vdev_id: %d, mode: %d)", |
| 14638 | req->vdev_id, req->mode); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14639 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14640 | status = wmi_unified_cmd_send(wmi, wmi_buf, sizeof(*cmd), |
| 14641 | WMI_HW_DATA_FILTER_CMDID); |
| 14642 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14643 | WMI_LOGE("Failed to configure hw filter"); |
| 14644 | wmi_buf_free(wmi_buf); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14645 | } |
| 14646 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14647 | return status; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14648 | } |
Ravi Kumar Bokka | 0f3f04d | 2017-04-20 17:14:33 +0530 | [diff] [blame] | 14649 | |
| 14650 | /** |
| 14651 | * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter |
| 14652 | * @wmi_handle: wmi handle |
| 14653 | * @vdev_id: vdev id |
| 14654 | * @enable: Flag to enable/disable packet filter |
| 14655 | * |
| 14656 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14657 | */ |
| 14658 | static QDF_STATUS send_enable_disable_packet_filter_cmd_tlv( |
| 14659 | wmi_unified_t wmi_handle, uint8_t vdev_id, bool enable) |
| 14660 | { |
| 14661 | int32_t len; |
| 14662 | int ret = 0; |
| 14663 | wmi_buf_t buf; |
| 14664 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd; |
| 14665 | |
| 14666 | len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param); |
| 14667 | |
| 14668 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14669 | if (!buf) { |
| 14670 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 14671 | return QDF_STATUS_E_NOMEM; |
| 14672 | } |
| 14673 | |
| 14674 | cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf); |
| 14675 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14676 | WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param, |
| 14677 | WMITLV_GET_STRUCT_TLVLEN( |
| 14678 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param)); |
| 14679 | |
| 14680 | cmd->vdev_id = vdev_id; |
| 14681 | if (enable) |
| 14682 | cmd->enable = PACKET_FILTER_SET_ENABLE; |
| 14683 | else |
| 14684 | cmd->enable = PACKET_FILTER_SET_DISABLE; |
| 14685 | |
| 14686 | WMI_LOGE("%s: Packet filter enable %d for vdev_id %d", |
| 14687 | __func__, cmd->enable, vdev_id); |
| 14688 | |
| 14689 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14690 | WMI_PACKET_FILTER_ENABLE_CMDID); |
| 14691 | if (ret) { |
| 14692 | WMI_LOGE("Failed to send packet filter wmi cmd to fw"); |
| 14693 | wmi_buf_free(buf); |
| 14694 | } |
| 14695 | |
| 14696 | return ret; |
| 14697 | } |
| 14698 | |
| 14699 | /** |
| 14700 | * send_config_packet_filter_cmd_tlv() - configure packet filter in target |
| 14701 | * @wmi_handle: wmi handle |
| 14702 | * @vdev_id: vdev id |
| 14703 | * @rcv_filter_param: Packet filter parameters |
| 14704 | * @filter_id: Filter id |
| 14705 | * @enable: Flag to add/delete packet filter configuration |
| 14706 | * |
| 14707 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14708 | */ |
| 14709 | static QDF_STATUS send_config_packet_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 14710 | uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param, |
| 14711 | uint8_t filter_id, bool enable) |
| 14712 | { |
| 14713 | int len, i; |
| 14714 | int err = 0; |
| 14715 | wmi_buf_t buf; |
| 14716 | WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd; |
| 14717 | |
| 14718 | |
| 14719 | /* allocate the memory */ |
| 14720 | len = sizeof(*cmd); |
| 14721 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14722 | if (!buf) { |
| 14723 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
| 14724 | return QDF_STATUS_E_NOMEM; |
| 14725 | } |
| 14726 | |
| 14727 | cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 14728 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14729 | WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param, |
| 14730 | WMITLV_GET_STRUCT_TLVLEN |
| 14731 | (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param)); |
| 14732 | |
| 14733 | cmd->vdev_id = vdev_id; |
| 14734 | cmd->filter_id = filter_id; |
| 14735 | if (enable) |
| 14736 | cmd->filter_action = PACKET_FILTER_SET_ACTIVE; |
| 14737 | else |
| 14738 | cmd->filter_action = PACKET_FILTER_SET_INACTIVE; |
| 14739 | |
| 14740 | if (enable) { |
| 14741 | cmd->num_params = QDF_MIN( |
| 14742 | WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER, |
| 14743 | rcv_filter_param->num_params); |
| 14744 | cmd->filter_type = rcv_filter_param->filter_type; |
| 14745 | cmd->coalesce_time = rcv_filter_param->coalesce_time; |
| 14746 | |
| 14747 | for (i = 0; i < cmd->num_params; i++) { |
| 14748 | cmd->paramsData[i].proto_type = |
| 14749 | rcv_filter_param->params_data[i].protocol_layer; |
| 14750 | cmd->paramsData[i].cmp_type = |
| 14751 | rcv_filter_param->params_data[i].compare_flag; |
| 14752 | cmd->paramsData[i].data_length = |
| 14753 | rcv_filter_param->params_data[i].data_length; |
| 14754 | cmd->paramsData[i].data_offset = |
| 14755 | rcv_filter_param->params_data[i].data_offset; |
| 14756 | memcpy(&cmd->paramsData[i].compareData, |
| 14757 | rcv_filter_param->params_data[i].compare_data, |
| 14758 | sizeof(cmd->paramsData[i].compareData)); |
| 14759 | memcpy(&cmd->paramsData[i].dataMask, |
| 14760 | rcv_filter_param->params_data[i].data_mask, |
| 14761 | sizeof(cmd->paramsData[i].dataMask)); |
| 14762 | } |
| 14763 | } |
| 14764 | |
| 14765 | WMI_LOGE("Packet filter action %d filter with id: %d, num_params=%d", |
| 14766 | cmd->filter_action, cmd->filter_id, cmd->num_params); |
| 14767 | /* send the command along with data */ |
| 14768 | err = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14769 | WMI_PACKET_FILTER_CONFIG_CMDID); |
| 14770 | if (err) { |
| 14771 | WMI_LOGE("Failed to send pkt_filter cmd"); |
| 14772 | wmi_buf_free(buf); |
| 14773 | return QDF_STATUS_E_FAILURE; |
| 14774 | } |
| 14775 | |
| 14776 | return QDF_STATUS_SUCCESS; |
| 14777 | } |
Ravi Kumar Bokka | 8f2c92f | 2017-03-23 15:22:51 +0530 | [diff] [blame] | 14778 | #endif /* End of WLAN_PMO_ENABLE */ |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14779 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14780 | /** |
| 14781 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 14782 | * @wmi_handle: wmi handle |
| 14783 | * @request: SSID hotlist set request |
| 14784 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14785 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14786 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14787 | static QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14788 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 14789 | struct ssid_hotlist_request_params *request) |
| 14790 | { |
| 14791 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 14792 | wmi_buf_t wmi_buf; |
| 14793 | uint32_t len; |
| 14794 | uint32_t array_size; |
| 14795 | uint8_t *buf_ptr; |
| 14796 | |
| 14797 | /* length of fixed portion */ |
| 14798 | len = sizeof(*cmd); |
| 14799 | |
| 14800 | /* length of variable portion */ |
| 14801 | array_size = |
| 14802 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 14803 | len += WMI_TLV_HDR_SIZE + array_size; |
| 14804 | |
| 14805 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14806 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14807 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 14808 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14809 | } |
| 14810 | |
| 14811 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 14812 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 14813 | buf_ptr; |
| 14814 | WMITLV_SET_HDR |
| 14815 | (&cmd->tlv_header, |
| 14816 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 14817 | WMITLV_GET_STRUCT_TLVLEN |
| 14818 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 14819 | |
| 14820 | cmd->request_id = request->request_id; |
| 14821 | cmd->requestor_id = 0; |
| 14822 | cmd->vdev_id = request->session_id; |
| 14823 | cmd->table_id = 0; |
| 14824 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 14825 | cmd->total_entries = request->ssid_count; |
| 14826 | cmd->num_entries_in_page = request->ssid_count; |
| 14827 | cmd->first_entry_index = 0; |
| 14828 | |
| 14829 | buf_ptr += sizeof(*cmd); |
| 14830 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 14831 | |
| 14832 | if (request->ssid_count) { |
| 14833 | wmi_extscan_hotlist_ssid_entry *entry; |
| 14834 | int i; |
| 14835 | |
| 14836 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14837 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 14838 | for (i = 0; i < request->ssid_count; i++) { |
| 14839 | WMITLV_SET_HDR |
| 14840 | (entry, |
| 14841 | WMITLV_TAG_ARRAY_STRUC, |
| 14842 | WMITLV_GET_STRUCT_TLVLEN |
| 14843 | (wmi_extscan_hotlist_ssid_entry)); |
| 14844 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14845 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14846 | request->ssids[i].ssid.mac_ssid, |
| 14847 | request->ssids[i].ssid.length); |
| 14848 | entry->band = request->ssids[i].band; |
| 14849 | entry->min_rssi = request->ssids[i].rssi_low; |
| 14850 | entry->max_rssi = request->ssids[i].rssi_high; |
| 14851 | entry++; |
| 14852 | } |
| 14853 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 14854 | } else { |
| 14855 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 14856 | } |
| 14857 | |
| 14858 | if (wmi_unified_cmd_send |
| 14859 | (wmi_handle, wmi_buf, len, |
| 14860 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14861 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14862 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14863 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14864 | } |
| 14865 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14866 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14867 | } |
| 14868 | |
| 14869 | /** |
| 14870 | * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw. |
| 14871 | * @wmi_handle: wmi handle |
| 14872 | * @vdev_id: vdev id |
| 14873 | * |
| 14874 | * This function sends roam synch complete event to fw. |
| 14875 | * |
| 14876 | * Return: CDF STATUS |
| 14877 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14878 | 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] | 14879 | uint8_t vdev_id) |
| 14880 | { |
| 14881 | wmi_roam_synch_complete_fixed_param *cmd; |
| 14882 | wmi_buf_t wmi_buf; |
| 14883 | uint8_t *buf_ptr; |
| 14884 | uint16_t len; |
| 14885 | len = sizeof(wmi_roam_synch_complete_fixed_param); |
| 14886 | |
| 14887 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14888 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14889 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 14890 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14891 | } |
| 14892 | cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf); |
| 14893 | buf_ptr = (uint8_t *) cmd; |
| 14894 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14895 | WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param, |
| 14896 | WMITLV_GET_STRUCT_TLVLEN |
| 14897 | (wmi_roam_synch_complete_fixed_param)); |
| 14898 | cmd->vdev_id = vdev_id; |
| 14899 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 14900 | WMI_ROAM_SYNCH_COMPLETE)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14901 | WMI_LOGP("%s: failed to send roam synch confirmation", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14902 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14903 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14904 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14905 | } |
| 14906 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14907 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14908 | } |
| 14909 | |
| 14910 | /** |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 14911 | * send_fw_test_cmd_tlv() - send fw test command to fw. |
| 14912 | * @wmi_handle: wmi handle |
| 14913 | * @wmi_fwtest: fw test command |
| 14914 | * |
| 14915 | * This function sends fw test command to fw. |
| 14916 | * |
| 14917 | * Return: CDF STATUS |
| 14918 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 14919 | static |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 14920 | QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, |
| 14921 | struct set_fwtest_params *wmi_fwtest) |
| 14922 | { |
| 14923 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 14924 | wmi_buf_t wmi_buf; |
| 14925 | uint16_t len; |
| 14926 | |
| 14927 | len = sizeof(*cmd); |
| 14928 | |
| 14929 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14930 | if (!wmi_buf) { |
| 14931 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 14932 | return QDF_STATUS_E_NOMEM; |
| 14933 | } |
| 14934 | |
| 14935 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 14936 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14937 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 14938 | WMITLV_GET_STRUCT_TLVLEN( |
| 14939 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 14940 | cmd->param_id = wmi_fwtest->arg; |
| 14941 | cmd->param_value = wmi_fwtest->value; |
| 14942 | |
| 14943 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 14944 | WMI_FWTEST_CMDID)) { |
| 14945 | WMI_LOGP("%s: failed to send fw test command", __func__); |
| 14946 | qdf_nbuf_free(wmi_buf); |
| 14947 | return QDF_STATUS_E_FAILURE; |
| 14948 | } |
| 14949 | |
| 14950 | return QDF_STATUS_SUCCESS; |
| 14951 | } |
| 14952 | |
| 14953 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14954 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 14955 | * @wmi_handle: wmi handle |
| 14956 | * @wmi_utest: unit test command |
| 14957 | * |
| 14958 | * This function send unit test command to fw. |
| 14959 | * |
| 14960 | * Return: CDF STATUS |
| 14961 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14962 | 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] | 14963 | struct wmi_unit_test_cmd *wmi_utest) |
| 14964 | { |
| 14965 | wmi_unit_test_cmd_fixed_param *cmd; |
| 14966 | wmi_buf_t wmi_buf; |
| 14967 | uint8_t *buf_ptr; |
| 14968 | int i; |
| 14969 | uint16_t len, args_tlv_len; |
| 14970 | A_UINT32 *unit_test_cmd_args; |
| 14971 | |
| 14972 | args_tlv_len = |
| 14973 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(A_UINT32); |
| 14974 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 14975 | |
| 14976 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14977 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14978 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 14979 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14980 | } |
| 14981 | |
| 14982 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 14983 | buf_ptr = (uint8_t *) cmd; |
| 14984 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14985 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 14986 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 14987 | cmd->vdev_id = wmi_utest->vdev_id; |
| 14988 | cmd->module_id = wmi_utest->module_id; |
| 14989 | cmd->num_args = wmi_utest->num_args; |
| 14990 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 14991 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 14992 | (wmi_utest->num_args * sizeof(uint32_t))); |
| 14993 | unit_test_cmd_args = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14994 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14995 | for (i = 0; (i < wmi_utest->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 14996 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14997 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14998 | } |
| 14999 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 15000 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15001 | WMI_LOGP("%s: failed to send unit test command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 15002 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15003 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15004 | } |
| 15005 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15006 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15007 | } |
| 15008 | |
| 15009 | /** |
| 15010 | * send_roam_invoke_cmd_tlv() - send roam invoke command to fw. |
| 15011 | * @wmi_handle: wma handle |
| 15012 | * @roaminvoke: roam invoke command |
| 15013 | * |
| 15014 | * Send roam invoke command to fw for fastreassoc. |
| 15015 | * |
| 15016 | * Return: CDF STATUS |
| 15017 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15018 | 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] | 15019 | struct wmi_roam_invoke_cmd *roaminvoke, |
| 15020 | uint32_t ch_hz) |
| 15021 | { |
| 15022 | wmi_roam_invoke_cmd_fixed_param *cmd; |
| 15023 | wmi_buf_t wmi_buf; |
| 15024 | u_int8_t *buf_ptr; |
| 15025 | u_int16_t len, args_tlv_len; |
| 15026 | A_UINT32 *channel_list; |
| 15027 | wmi_mac_addr *bssid_list; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15028 | wmi_tlv_buf_len_param *buf_len_tlv; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15029 | |
| 15030 | /* Host sends only one channel and one bssid */ |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15031 | args_tlv_len = (4 * WMI_TLV_HDR_SIZE) + sizeof(A_UINT32) + |
| 15032 | sizeof(wmi_mac_addr) + sizeof(wmi_tlv_buf_len_param) + |
| 15033 | roundup(roaminvoke->frame_len, sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15034 | len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len; |
| 15035 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 15036 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15037 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 15038 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15039 | } |
| 15040 | |
| 15041 | cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 15042 | buf_ptr = (u_int8_t *) cmd; |
| 15043 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15044 | WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param, |
| 15045 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param)); |
| 15046 | cmd->vdev_id = roaminvoke->vdev_id; |
Arif Hussain | 7698b6d | 2016-12-15 20:05:36 -0800 | [diff] [blame] | 15047 | cmd->flags |= (1 << WMI_ROAM_INVOKE_FLAG_REPORT_FAILURE); |
Krunal Soni | 7544a40 | 2017-07-25 11:23:44 -0700 | [diff] [blame] | 15048 | if (roaminvoke->is_same_bssid) |
| 15049 | cmd->flags |= (1 << WMI_ROAM_INVOKE_FLAG_NO_NULL_FRAME_TO_AP); |
| 15050 | WMI_LOGD(FL("is_same_bssid flag: %d"), roaminvoke->is_same_bssid); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15051 | |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 15052 | if (roaminvoke->frame_len) { |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15053 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_SKIP; |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 15054 | /* packing 1 beacon/probe_rsp frame with WMI cmd */ |
| 15055 | cmd->num_buf = 1; |
| 15056 | } else { |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15057 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_FIXED_CH; |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 15058 | cmd->num_buf = 0; |
| 15059 | } |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15060 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15061 | cmd->roam_ap_sel_mode = 0; |
| 15062 | cmd->roam_delay = 0; |
| 15063 | cmd->num_chan = 1; |
| 15064 | cmd->num_bssid = 1; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15065 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15066 | buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param); |
| 15067 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 15068 | (sizeof(u_int32_t))); |
| 15069 | channel_list = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 15070 | *channel_list = ch_hz; |
| 15071 | buf_ptr += sizeof(A_UINT32) + WMI_TLV_HDR_SIZE; |
| 15072 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 15073 | (sizeof(wmi_mac_addr))); |
| 15074 | bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 15075 | WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15076 | |
| 15077 | /* move to next tlv i.e. bcn_prb_buf_list */ |
| 15078 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_mac_addr); |
| 15079 | |
| 15080 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 15081 | sizeof(wmi_tlv_buf_len_param)); |
| 15082 | |
| 15083 | buf_len_tlv = (wmi_tlv_buf_len_param *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 15084 | buf_len_tlv->buf_len = roaminvoke->frame_len; |
| 15085 | |
| 15086 | /* move to next tlv i.e. bcn_prb_frm */ |
| 15087 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_tlv_buf_len_param); |
| 15088 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 15089 | roundup(roaminvoke->frame_len, sizeof(uint32_t))); |
| 15090 | |
| 15091 | /* copy frame after the header */ |
| 15092 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
| 15093 | roaminvoke->frame_buf, |
| 15094 | roaminvoke->frame_len); |
| 15095 | |
| 15096 | WMI_LOGD(FL("bcn/prb_rsp frame, length: %d"), roaminvoke->frame_len); |
| 15097 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 15098 | buf_ptr + WMI_TLV_HDR_SIZE, |
| 15099 | roaminvoke->frame_len); |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 15100 | WMI_LOGD(FL("flag:%d, MODE scn:%d, ap:%d, dly:%d, n_ch:%d, n_bssid:%d"), |
| 15101 | cmd->flags, cmd->roam_scan_mode, |
| 15102 | cmd->roam_ap_sel_mode, cmd->roam_delay, |
| 15103 | cmd->num_chan, cmd->num_bssid); |
| 15104 | WMI_LOGD(FL("BSSID: %pM, channel: %d"), roaminvoke->bssid, ch_hz); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 15105 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15106 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 15107 | WMI_ROAM_INVOKE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15108 | WMI_LOGP("%s: failed to send roam invoke command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15109 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15110 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15111 | } |
| 15112 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15113 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15114 | } |
| 15115 | |
| 15116 | /** |
| 15117 | * send_roam_scan_offload_cmd_tlv() - set roam offload command |
| 15118 | * @wmi_handle: wmi handle |
| 15119 | * @command: command |
| 15120 | * @vdev_id: vdev id |
| 15121 | * |
| 15122 | * This function set roam offload command to fw. |
| 15123 | * |
| 15124 | * Return: CDF status |
| 15125 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15126 | 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] | 15127 | uint32_t command, uint32_t vdev_id) |
| 15128 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15129 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15130 | wmi_roam_scan_cmd_fixed_param *cmd_fp; |
| 15131 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15132 | int len; |
| 15133 | uint8_t *buf_ptr; |
| 15134 | |
| 15135 | len = sizeof(wmi_roam_scan_cmd_fixed_param); |
| 15136 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15137 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15138 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15139 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15140 | } |
| 15141 | |
| 15142 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15143 | |
| 15144 | cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr; |
| 15145 | WMITLV_SET_HDR(&cmd_fp->tlv_header, |
| 15146 | WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param, |
| 15147 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param)); |
| 15148 | cmd_fp->vdev_id = vdev_id; |
| 15149 | cmd_fp->command_arg = command; |
| 15150 | |
| 15151 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15152 | len, WMI_ROAM_SCAN_CMD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15153 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15154 | 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] | 15155 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15156 | goto error; |
| 15157 | } |
| 15158 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15159 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__); |
| 15160 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15161 | |
| 15162 | error: |
| 15163 | wmi_buf_free(buf); |
| 15164 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15165 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15166 | } |
| 15167 | |
| 15168 | /** |
| 15169 | * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw |
| 15170 | * @wmi_handle: wmi handle |
| 15171 | * @ap_profile_p: ap profile |
| 15172 | * @vdev_id: vdev id |
| 15173 | * |
| 15174 | * Send WMI_ROAM_AP_PROFILE to firmware |
| 15175 | * |
| 15176 | * Return: CDF status |
| 15177 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15178 | static QDF_STATUS send_roam_scan_offload_ap_profile_cmd_tlv(wmi_unified_t wmi_handle, |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 15179 | struct ap_profile_params *ap_profile) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15180 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15181 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15182 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15183 | int len; |
| 15184 | uint8_t *buf_ptr; |
| 15185 | wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp; |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 15186 | wmi_roam_cnd_scoring_param *score_param; |
| 15187 | wmi_ap_profile *profile; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15188 | |
| 15189 | len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile); |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 15190 | len += sizeof(*score_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15191 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15192 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15193 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15194 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15195 | } |
| 15196 | |
| 15197 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15198 | roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr; |
| 15199 | WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header, |
| 15200 | WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param, |
| 15201 | WMITLV_GET_STRUCT_TLVLEN |
| 15202 | (wmi_roam_ap_profile_fixed_param)); |
| 15203 | /* fill in threshold values */ |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 15204 | roam_ap_profile_fp->vdev_id = ap_profile->vdev_id; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15205 | roam_ap_profile_fp->id = 0; |
| 15206 | buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param); |
| 15207 | |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 15208 | profile = (wmi_ap_profile *)buf_ptr; |
| 15209 | WMITLV_SET_HDR(&profile->tlv_header, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15210 | WMITLV_TAG_STRUC_wmi_ap_profile, |
| 15211 | WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile)); |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 15212 | profile->flags = ap_profile->profile.flags; |
| 15213 | profile->rssi_threshold = ap_profile->profile.rssi_threshold; |
| 15214 | profile->ssid.ssid_len = ap_profile->profile.ssid.length; |
| 15215 | qdf_mem_copy(profile->ssid.ssid, ap_profile->profile.ssid.mac_ssid, |
| 15216 | profile->ssid.ssid_len); |
| 15217 | profile->rsn_authmode = ap_profile->profile.rsn_authmode; |
| 15218 | profile->rsn_ucastcipherset = ap_profile->profile.rsn_ucastcipherset; |
| 15219 | profile->rsn_mcastcipherset = ap_profile->profile.rsn_mcastcipherset; |
| 15220 | profile->rsn_mcastmgmtcipherset = |
| 15221 | ap_profile->profile.rsn_mcastmgmtcipherset; |
| 15222 | profile->rssi_abs_thresh = ap_profile->profile.rssi_abs_thresh; |
| 15223 | |
| 15224 | WMI_LOGD("AP profile: flags %x rssi_threshold %d ssid:%.*s authmode %d uc cipher %d mc cipher %d mc mgmt cipher %d rssi abs thresh %d", |
| 15225 | profile->flags, profile->rssi_threshold, |
| 15226 | profile->ssid.ssid_len, ap_profile->profile.ssid.mac_ssid, |
| 15227 | profile->rsn_authmode, profile->rsn_ucastcipherset, |
| 15228 | profile->rsn_mcastcipherset, profile->rsn_mcastmgmtcipherset, |
| 15229 | profile->rssi_abs_thresh); |
| 15230 | |
| 15231 | buf_ptr += sizeof(wmi_ap_profile); |
| 15232 | |
| 15233 | score_param = (wmi_roam_cnd_scoring_param *)buf_ptr; |
| 15234 | WMITLV_SET_HDR(&score_param->tlv_header, |
| 15235 | WMITLV_TAG_STRUC_wmi_roam_cnd_scoring_param, |
| 15236 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_cnd_scoring_param)); |
| 15237 | score_param->disable_bitmap = ap_profile->param.disable_bitmap; |
| 15238 | score_param->rssi_weightage_pcnt = |
| 15239 | ap_profile->param.rssi_weightage; |
| 15240 | score_param->ht_weightage_pcnt = ap_profile->param.ht_weightage; |
| 15241 | score_param->vht_weightage_pcnt = ap_profile->param.vht_weightage; |
| 15242 | score_param->he_weightage_pcnt = ap_profile->param.he_weightage; |
| 15243 | score_param->bw_weightage_pcnt = ap_profile->param.bw_weightage; |
| 15244 | score_param->band_weightage_pcnt = ap_profile->param.band_weightage; |
| 15245 | score_param->nss_weightage_pcnt = ap_profile->param.nss_weightage; |
| 15246 | score_param->esp_qbss_weightage_pcnt = |
| 15247 | ap_profile->param.esp_qbss_weightage; |
| 15248 | score_param->beamforming_weightage_pcnt = |
| 15249 | ap_profile->param.beamforming_weightage; |
| 15250 | score_param->pcl_weightage_pcnt = ap_profile->param.pcl_weightage; |
| 15251 | score_param->oce_wan_weightage_pcnt = |
| 15252 | ap_profile->param.oce_wan_weightage; |
| 15253 | |
| 15254 | WMI_LOGD("Score params weightage: disable_bitmap %x rssi %d ht %d vht %d he %d BW %d band %d NSS %d ESP %d BF %d PCL %d OCE WAN %d", |
| 15255 | score_param->disable_bitmap, score_param->rssi_weightage_pcnt, |
| 15256 | score_param->ht_weightage_pcnt, |
| 15257 | score_param->vht_weightage_pcnt, |
| 15258 | score_param->he_weightage_pcnt, score_param->bw_weightage_pcnt, |
| 15259 | score_param->band_weightage_pcnt, |
| 15260 | score_param->nss_weightage_pcnt, |
| 15261 | score_param->esp_qbss_weightage_pcnt, |
| 15262 | score_param->beamforming_weightage_pcnt, |
| 15263 | score_param->pcl_weightage_pcnt, |
| 15264 | score_param->oce_wan_weightage_pcnt); |
| 15265 | |
| 15266 | score_param->bw_scoring.score_pcnt = ap_profile->param.bw_index_score; |
| 15267 | score_param->band_scoring.score_pcnt = |
| 15268 | ap_profile->param.band_index_score; |
| 15269 | score_param->nss_scoring.score_pcnt = |
| 15270 | ap_profile->param.nss_index_score; |
| 15271 | |
| 15272 | WMI_LOGD("Params index score bitmask: bw_index_score %x band_index_score %x nss_index_score %x", |
| 15273 | score_param->bw_scoring.score_pcnt, |
| 15274 | score_param->band_scoring.score_pcnt, |
| 15275 | score_param->nss_scoring.score_pcnt); |
| 15276 | |
| 15277 | score_param->rssi_scoring.best_rssi_threshold = |
| 15278 | (-1) * ap_profile->param.rssi_scoring.best_rssi_threshold; |
| 15279 | score_param->rssi_scoring.good_rssi_threshold = |
| 15280 | (-1) * ap_profile->param.rssi_scoring.good_rssi_threshold; |
| 15281 | score_param->rssi_scoring.bad_rssi_threshold = |
| 15282 | (-1) * ap_profile->param.rssi_scoring.bad_rssi_threshold; |
| 15283 | score_param->rssi_scoring.good_rssi_pcnt = |
| 15284 | ap_profile->param.rssi_scoring.good_rssi_pcnt; |
| 15285 | score_param->rssi_scoring.bad_rssi_pcnt = |
| 15286 | ap_profile->param.rssi_scoring.bad_rssi_pcnt; |
| 15287 | score_param->rssi_scoring.good_bucket_size = |
| 15288 | ap_profile->param.rssi_scoring.good_bucket_size; |
| 15289 | score_param->rssi_scoring.bad_bucket_size = |
| 15290 | ap_profile->param.rssi_scoring.bad_bucket_size; |
| 15291 | score_param->rssi_scoring.rssi_pref_5g_rssi_thresh = |
| 15292 | (-1) * ap_profile->param.rssi_scoring.rssi_pref_5g_rssi_thresh; |
| 15293 | |
| 15294 | WMI_LOGD("Rssi scoring threshold: best RSSI %d good RSSI %d bad RSSI %d prefer 5g threshold %d", |
| 15295 | score_param->rssi_scoring.best_rssi_threshold, |
| 15296 | score_param->rssi_scoring.good_rssi_threshold, |
| 15297 | score_param->rssi_scoring.bad_rssi_threshold, |
| 15298 | score_param->rssi_scoring.rssi_pref_5g_rssi_thresh); |
| 15299 | WMI_LOGD("Good RSSI score for each slot %d bad RSSI score for each slot %d good bucket %d bad bucket %d", |
| 15300 | score_param->rssi_scoring.good_rssi_pcnt, |
| 15301 | score_param->rssi_scoring.bad_rssi_pcnt, |
| 15302 | score_param->rssi_scoring.good_bucket_size, |
| 15303 | score_param->rssi_scoring.bad_bucket_size); |
| 15304 | |
| 15305 | score_param->esp_qbss_scoring.num_slot = |
| 15306 | ap_profile->param.esp_qbss_scoring.num_slot; |
| 15307 | score_param->esp_qbss_scoring.score_pcnt3_to_0 = |
| 15308 | ap_profile->param.esp_qbss_scoring.score_pcnt3_to_0; |
| 15309 | score_param->esp_qbss_scoring.score_pcnt7_to_4 = |
| 15310 | ap_profile->param.esp_qbss_scoring.score_pcnt7_to_4; |
| 15311 | score_param->esp_qbss_scoring.score_pcnt11_to_8 = |
| 15312 | ap_profile->param.esp_qbss_scoring.score_pcnt11_to_8; |
| 15313 | score_param->esp_qbss_scoring.score_pcnt15_to_12 = |
| 15314 | ap_profile->param.esp_qbss_scoring.score_pcnt15_to_12; |
| 15315 | |
| 15316 | WMI_LOGD("ESP QBSS index weight: slots %d weight 0to3 %x weight 4to7 %x weight 8to11 %x weight 12to15 %x", |
| 15317 | score_param->esp_qbss_scoring.num_slot, |
| 15318 | score_param->esp_qbss_scoring.score_pcnt3_to_0, |
| 15319 | score_param->esp_qbss_scoring.score_pcnt7_to_4, |
| 15320 | score_param->esp_qbss_scoring.score_pcnt11_to_8, |
| 15321 | score_param->esp_qbss_scoring.score_pcnt15_to_12); |
| 15322 | |
| 15323 | score_param->oce_wan_scoring.num_slot = |
| 15324 | ap_profile->param.oce_wan_scoring.num_slot; |
| 15325 | score_param->oce_wan_scoring.score_pcnt3_to_0 = |
| 15326 | ap_profile->param.oce_wan_scoring.score_pcnt3_to_0; |
| 15327 | score_param->oce_wan_scoring.score_pcnt7_to_4 = |
| 15328 | ap_profile->param.oce_wan_scoring.score_pcnt7_to_4; |
| 15329 | score_param->oce_wan_scoring.score_pcnt11_to_8 = |
| 15330 | ap_profile->param.oce_wan_scoring.score_pcnt11_to_8; |
| 15331 | score_param->oce_wan_scoring.score_pcnt15_to_12 = |
| 15332 | ap_profile->param.oce_wan_scoring.score_pcnt15_to_12; |
| 15333 | |
| 15334 | WMI_LOGD("OCE WAN index weight: slots %d weight 0to3 %x weight 4to7 %x weight 8to11 %x weight 12to15 %x", |
| 15335 | score_param->oce_wan_scoring.num_slot, |
| 15336 | score_param->oce_wan_scoring.score_pcnt3_to_0, |
| 15337 | score_param->oce_wan_scoring.score_pcnt7_to_4, |
| 15338 | score_param->oce_wan_scoring.score_pcnt11_to_8, |
| 15339 | score_param->oce_wan_scoring.score_pcnt15_to_12); |
| 15340 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15341 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15342 | len, WMI_ROAM_AP_PROFILE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15343 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15344 | 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] | 15345 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15346 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15347 | } |
| 15348 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15349 | WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15350 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15351 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15352 | } |
| 15353 | |
| 15354 | /** |
| 15355 | * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period |
| 15356 | * @wmi_handle: wmi handle |
| 15357 | * @scan_period: scan period |
| 15358 | * @scan_age: scan age |
| 15359 | * @vdev_id: vdev id |
| 15360 | * |
| 15361 | * Send WMI_ROAM_SCAN_PERIOD parameters to fw. |
| 15362 | * |
| 15363 | * Return: CDF status |
| 15364 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15365 | 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] | 15366 | uint32_t scan_period, |
| 15367 | uint32_t scan_age, |
| 15368 | uint32_t vdev_id) |
| 15369 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15370 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15371 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15372 | int len; |
| 15373 | uint8_t *buf_ptr; |
| 15374 | wmi_roam_scan_period_fixed_param *scan_period_fp; |
| 15375 | |
| 15376 | /* Send scan period values */ |
| 15377 | len = sizeof(wmi_roam_scan_period_fixed_param); |
| 15378 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15379 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15380 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15381 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15382 | } |
| 15383 | |
| 15384 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15385 | scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr; |
| 15386 | WMITLV_SET_HDR(&scan_period_fp->tlv_header, |
| 15387 | WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param, |
| 15388 | WMITLV_GET_STRUCT_TLVLEN |
| 15389 | (wmi_roam_scan_period_fixed_param)); |
| 15390 | /* fill in scan period values */ |
| 15391 | scan_period_fp->vdev_id = vdev_id; |
| 15392 | scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */ |
| 15393 | scan_period_fp->roam_scan_age = scan_age; |
| 15394 | |
| 15395 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15396 | len, WMI_ROAM_SCAN_PERIOD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15397 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15398 | 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] | 15399 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15400 | goto error; |
| 15401 | } |
| 15402 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15403 | 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] | 15404 | __func__, scan_period, scan_age); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15405 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15406 | error: |
| 15407 | wmi_buf_free(buf); |
| 15408 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15409 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15410 | } |
| 15411 | |
| 15412 | /** |
| 15413 | * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list |
| 15414 | * @wmi_handle: wmi handle |
| 15415 | * @chan_count: channel count |
| 15416 | * @chan_list: channel list |
| 15417 | * @list_type: list type |
| 15418 | * @vdev_id: vdev id |
| 15419 | * |
| 15420 | * Set roam offload channel list. |
| 15421 | * |
| 15422 | * Return: CDF status |
| 15423 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15424 | 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] | 15425 | uint8_t chan_count, |
Varun Reddy Yeturu | 5a552cf | 2016-07-07 17:42:49 -0700 | [diff] [blame] | 15426 | uint32_t *chan_list, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15427 | uint8_t list_type, uint32_t vdev_id) |
| 15428 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15429 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15430 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15431 | int len, list_tlv_len; |
| 15432 | int i; |
| 15433 | uint8_t *buf_ptr; |
| 15434 | wmi_roam_chan_list_fixed_param *chan_list_fp; |
| 15435 | A_UINT32 *roam_chan_list_array; |
| 15436 | |
| 15437 | if (chan_count == 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15438 | WMI_LOGD("%s : invalid number of channels %d", __func__, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15439 | chan_count); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15440 | return QDF_STATUS_E_EMPTY; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15441 | } |
| 15442 | /* Channel list is a table of 2 TLV's */ |
| 15443 | list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(A_UINT32); |
| 15444 | len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len; |
| 15445 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15446 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15447 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15448 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15449 | } |
| 15450 | |
| 15451 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15452 | chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr; |
| 15453 | WMITLV_SET_HDR(&chan_list_fp->tlv_header, |
| 15454 | WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param, |
| 15455 | WMITLV_GET_STRUCT_TLVLEN |
| 15456 | (wmi_roam_chan_list_fixed_param)); |
| 15457 | chan_list_fp->vdev_id = vdev_id; |
| 15458 | chan_list_fp->num_chan = chan_count; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 15459 | if (chan_count > 0 && list_type == WMI_CHANNEL_LIST_STATIC) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15460 | /* external app is controlling channel list */ |
| 15461 | chan_list_fp->chan_list_type = |
| 15462 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC; |
| 15463 | } else { |
| 15464 | /* umac supplied occupied channel list in LFR */ |
| 15465 | chan_list_fp->chan_list_type = |
| 15466 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC; |
| 15467 | } |
| 15468 | |
| 15469 | buf_ptr += sizeof(wmi_roam_chan_list_fixed_param); |
| 15470 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 15471 | (chan_list_fp->num_chan * sizeof(uint32_t))); |
| 15472 | roam_chan_list_array = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 15473 | WMI_LOGD("%s: %d channels = ", __func__, chan_list_fp->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15474 | for (i = 0; ((i < chan_list_fp->num_chan) && |
| 15475 | (i < WMI_ROAM_MAX_CHANNELS)); i++) { |
| 15476 | roam_chan_list_array[i] = chan_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15477 | WMI_LOGI("%d,", roam_chan_list_array[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15478 | } |
| 15479 | |
| 15480 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15481 | len, WMI_ROAM_CHAN_LIST); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15482 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15483 | 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] | 15484 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15485 | goto error; |
| 15486 | } |
| 15487 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 15488 | WMI_LOGD("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15489 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15490 | error: |
| 15491 | wmi_buf_free(buf); |
| 15492 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15493 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15494 | } |
| 15495 | |
| 15496 | /** |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 15497 | * send_per_roam_config_cmd_tlv() - set per roaming config to FW |
| 15498 | * @wmi_handle: wmi handle |
| 15499 | * @req_buf: per roam config buffer |
| 15500 | * |
| 15501 | * Return: QDF status |
| 15502 | */ |
| 15503 | static QDF_STATUS send_per_roam_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 15504 | struct wmi_per_roam_config_req *req_buf) |
| 15505 | { |
| 15506 | wmi_buf_t buf = NULL; |
| 15507 | QDF_STATUS status; |
| 15508 | int len; |
| 15509 | uint8_t *buf_ptr; |
| 15510 | wmi_roam_per_config_fixed_param *wmi_per_config; |
| 15511 | |
| 15512 | len = sizeof(wmi_roam_per_config_fixed_param); |
| 15513 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15514 | if (!buf) { |
| 15515 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15516 | return QDF_STATUS_E_NOMEM; |
| 15517 | } |
| 15518 | |
| 15519 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15520 | wmi_per_config = |
| 15521 | (wmi_roam_per_config_fixed_param *) buf_ptr; |
| 15522 | WMITLV_SET_HDR(&wmi_per_config->tlv_header, |
| 15523 | WMITLV_TAG_STRUC_wmi_roam_per_config_fixed_param, |
| 15524 | WMITLV_GET_STRUCT_TLVLEN |
| 15525 | (wmi_roam_per_config_fixed_param)); |
| 15526 | |
| 15527 | /* fill in per roam config values */ |
| 15528 | wmi_per_config->vdev_id = req_buf->vdev_id; |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 15529 | |
| 15530 | wmi_per_config->enable = req_buf->per_config.enable; |
| 15531 | wmi_per_config->high_rate_thresh = |
| 15532 | (req_buf->per_config.tx_high_rate_thresh << 16) | |
| 15533 | (req_buf->per_config.rx_high_rate_thresh & 0x0000ffff); |
| 15534 | wmi_per_config->low_rate_thresh = |
| 15535 | (req_buf->per_config.tx_low_rate_thresh << 16) | |
| 15536 | (req_buf->per_config.rx_low_rate_thresh & 0x0000ffff); |
| 15537 | wmi_per_config->pkt_err_rate_thresh_pct = |
| 15538 | (req_buf->per_config.tx_rate_thresh_percnt << 16) | |
| 15539 | (req_buf->per_config.rx_rate_thresh_percnt & 0x0000ffff); |
| 15540 | 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] | 15541 | wmi_per_config->pkt_err_rate_mon_time = |
| 15542 | (req_buf->per_config.tx_per_mon_time << 16) | |
| 15543 | (req_buf->per_config.rx_per_mon_time & 0x0000ffff); |
Selvaraj, Sridhar | ba7e361 | 2017-05-17 16:05:15 +0530 | [diff] [blame] | 15544 | wmi_per_config->min_candidate_rssi = |
| 15545 | req_buf->per_config.min_candidate_rssi; |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 15546 | |
| 15547 | /* Send per roam config parameters */ |
| 15548 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15549 | len, WMI_ROAM_PER_CONFIG_CMDID); |
| 15550 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15551 | WMI_LOGE("WMI_ROAM_PER_CONFIG_CMDID failed, Error %d", |
| 15552 | status); |
| 15553 | wmi_buf_free(buf); |
| 15554 | return status; |
| 15555 | } |
| 15556 | |
| 15557 | WMI_LOGI(FL("per roam enable=%d, vdev=%d"), |
| 15558 | req_buf->per_config.enable, req_buf->vdev_id); |
| 15559 | return QDF_STATUS_SUCCESS; |
| 15560 | } |
| 15561 | |
| 15562 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15563 | * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th |
| 15564 | * @wmi_handle: wmi handle |
| 15565 | * @rssi_change_thresh: RSSI Change threshold |
| 15566 | * @bcn_rssi_weight: beacon RSSI weight |
| 15567 | * @vdev_id: vdev id |
| 15568 | * |
| 15569 | * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw. |
| 15570 | * |
| 15571 | * Return: CDF status |
| 15572 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15573 | 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] | 15574 | uint32_t vdev_id, |
| 15575 | int32_t rssi_change_thresh, |
| 15576 | uint32_t bcn_rssi_weight, |
| 15577 | uint32_t hirssi_delay_btw_scans) |
| 15578 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15579 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15580 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15581 | int len; |
| 15582 | uint8_t *buf_ptr; |
| 15583 | wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp; |
| 15584 | |
| 15585 | /* Send rssi change parameters */ |
| 15586 | len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param); |
| 15587 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15588 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15589 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15590 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15591 | } |
| 15592 | |
| 15593 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15594 | rssi_change_fp = |
| 15595 | (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr; |
| 15596 | WMITLV_SET_HDR(&rssi_change_fp->tlv_header, |
| 15597 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param, |
| 15598 | WMITLV_GET_STRUCT_TLVLEN |
| 15599 | (wmi_roam_scan_rssi_change_threshold_fixed_param)); |
| 15600 | /* fill in rssi change threshold (hysteresis) values */ |
| 15601 | rssi_change_fp->vdev_id = vdev_id; |
| 15602 | rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh; |
| 15603 | rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight; |
| 15604 | rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans; |
| 15605 | |
| 15606 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15607 | len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15608 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15609 | 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] | 15610 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15611 | goto error; |
| 15612 | } |
| 15613 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15614 | 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] | 15615 | rssi_change_thresh, bcn_rssi_weight); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15616 | WMI_LOGI(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans); |
| 15617 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15618 | error: |
| 15619 | wmi_buf_free(buf); |
| 15620 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15621 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15622 | } |
| 15623 | |
| 15624 | /** wmi_get_hotlist_entries_per_page() - hotlist entries per page |
| 15625 | * @wmi_handle: wmi handle. |
| 15626 | * @cmd: size of command structure. |
| 15627 | * @per_entry_size: per entry size. |
| 15628 | * |
| 15629 | * This utility function calculates how many hotlist entries can |
| 15630 | * fit in one page. |
| 15631 | * |
| 15632 | * Return: number of entries |
| 15633 | */ |
| 15634 | static inline int wmi_get_hotlist_entries_per_page(wmi_unified_t wmi_handle, |
| 15635 | size_t cmd_size, |
| 15636 | size_t per_entry_size) |
| 15637 | { |
| 15638 | uint32_t avail_space = 0; |
| 15639 | int num_entries = 0; |
| 15640 | uint16_t max_msg_len = wmi_get_max_msg_len(wmi_handle); |
| 15641 | |
| 15642 | /* Calculate number of hotlist entries that can |
| 15643 | * be passed in wma message request. |
| 15644 | */ |
| 15645 | avail_space = max_msg_len - cmd_size; |
| 15646 | num_entries = avail_space / per_entry_size; |
| 15647 | return num_entries; |
| 15648 | } |
| 15649 | |
| 15650 | /** |
| 15651 | * send_get_buf_extscan_hotlist_cmd_tlv() - prepare hotlist command |
| 15652 | * @wmi_handle: wmi handle |
| 15653 | * @photlist: hotlist command params |
| 15654 | * @buf_len: buffer length |
| 15655 | * |
| 15656 | * This function fills individual elements for hotlist request and |
| 15657 | * TLV for bssid entries |
| 15658 | * |
| 15659 | * Return: CDF Status. |
| 15660 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15661 | 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] | 15662 | struct ext_scan_setbssi_hotlist_params * |
| 15663 | photlist, int *buf_len) |
| 15664 | { |
| 15665 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd = NULL; |
| 15666 | wmi_extscan_hotlist_entry *dest_hotlist; |
| 15667 | struct ap_threshold_params *src_ap = photlist->ap; |
| 15668 | wmi_buf_t buf; |
| 15669 | uint8_t *buf_ptr; |
| 15670 | |
| 15671 | int j, index = 0; |
| 15672 | int cmd_len = 0; |
| 15673 | int num_entries; |
| 15674 | int min_entries = 0; |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 15675 | uint32_t numap = photlist->numAp; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15676 | int len = sizeof(*cmd); |
| 15677 | |
| 15678 | len += WMI_TLV_HDR_SIZE; |
| 15679 | cmd_len = len; |
| 15680 | |
| 15681 | num_entries = wmi_get_hotlist_entries_per_page(wmi_handle, |
| 15682 | cmd_len, |
| 15683 | sizeof(*dest_hotlist)); |
| 15684 | /* setbssid hotlist expects the bssid list |
| 15685 | * to be non zero value |
| 15686 | */ |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 15687 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_HOTLIST_APS)) { |
Srinivas Girigowda | bf1a9ef | 2016-12-07 14:32:24 -0800 | [diff] [blame] | 15688 | WMI_LOGE("Invalid number of APs: %d", numap); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15689 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15690 | } |
| 15691 | |
| 15692 | /* Split the hot list entry pages and send multiple command |
| 15693 | * requests if the buffer reaches the maximum request size |
| 15694 | */ |
| 15695 | while (index < numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15696 | min_entries = QDF_MIN(num_entries, numap); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15697 | len += min_entries * sizeof(wmi_extscan_hotlist_entry); |
| 15698 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15699 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15700 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 15701 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15702 | } |
| 15703 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15704 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 15705 | buf_ptr; |
| 15706 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15707 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 15708 | WMITLV_GET_STRUCT_TLVLEN |
| 15709 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 15710 | |
| 15711 | /* Multiple requests are sent until the num_entries_in_page |
| 15712 | * matches the total_entries |
| 15713 | */ |
| 15714 | cmd->request_id = photlist->requestId; |
| 15715 | cmd->vdev_id = photlist->sessionId; |
| 15716 | cmd->total_entries = numap; |
| 15717 | cmd->mode = 1; |
| 15718 | cmd->num_entries_in_page = min_entries; |
| 15719 | cmd->lost_ap_scan_count = photlist->lost_ap_sample_size; |
| 15720 | cmd->first_entry_index = index; |
| 15721 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15722 | 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] | 15723 | __func__, cmd->vdev_id, cmd->total_entries, |
| 15724 | cmd->num_entries_in_page, |
| 15725 | cmd->lost_ap_scan_count); |
| 15726 | |
| 15727 | buf_ptr += sizeof(*cmd); |
| 15728 | WMITLV_SET_HDR(buf_ptr, |
| 15729 | WMITLV_TAG_ARRAY_STRUC, |
| 15730 | min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 15731 | dest_hotlist = (wmi_extscan_hotlist_entry *) |
| 15732 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 15733 | |
| 15734 | /* Populate bssid, channel info and rssi |
| 15735 | * for the bssid's that are sent as hotlists. |
| 15736 | */ |
| 15737 | for (j = 0; j < min_entries; j++) { |
| 15738 | WMITLV_SET_HDR(dest_hotlist, |
| 15739 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 15740 | WMITLV_GET_STRUCT_TLVLEN |
| 15741 | (wmi_extscan_hotlist_entry)); |
| 15742 | |
| 15743 | dest_hotlist->min_rssi = src_ap->low; |
| 15744 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 15745 | &dest_hotlist->bssid); |
| 15746 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15747 | WMI_LOGD("%s:channel:%d min_rssi %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15748 | __func__, dest_hotlist->channel, |
| 15749 | dest_hotlist->min_rssi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15750 | WMI_LOGD |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15751 | ("%s: bssid mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 15752 | __func__, dest_hotlist->bssid.mac_addr31to0, |
| 15753 | dest_hotlist->bssid.mac_addr47to32); |
| 15754 | dest_hotlist++; |
| 15755 | src_ap++; |
| 15756 | } |
| 15757 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 15758 | (min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 15759 | |
| 15760 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15761 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15762 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 15763 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15764 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15765 | } |
| 15766 | index = index + min_entries; |
| 15767 | num_entries = numap - min_entries; |
| 15768 | len = cmd_len; |
| 15769 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15770 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15771 | } |
| 15772 | |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 15773 | /** |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 15774 | * send_set_active_bpf_mode_cmd_tlv() - configure active BPF mode in FW |
| 15775 | * @wmi_handle: the WMI handle |
| 15776 | * @vdev_id: the Id of the vdev to apply the configuration to |
| 15777 | * @ucast_mode: the active BPF mode to configure for unicast packets |
| 15778 | * @mcast_bcast_mode: the active BPF mode to configure for multicast/broadcast |
| 15779 | * packets |
| 15780 | * |
| 15781 | * Return: QDF status |
| 15782 | */ |
| 15783 | static QDF_STATUS send_set_active_bpf_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 15784 | uint8_t vdev_id, |
| 15785 | enum wmi_host_active_bpf_mode ucast_mode, |
| 15786 | enum wmi_host_active_bpf_mode mcast_bcast_mode) |
| 15787 | { |
| 15788 | const WMITLV_TAG_ID tag_id = |
| 15789 | WMITLV_TAG_STRUC_wmi_bpf_set_vdev_active_mode_cmd_fixed_param; |
| 15790 | const uint32_t tlv_len = WMITLV_GET_STRUCT_TLVLEN( |
| 15791 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param); |
| 15792 | QDF_STATUS status; |
| 15793 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param *cmd; |
| 15794 | wmi_buf_t buf; |
| 15795 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 15796 | WMI_LOGD("Sending WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID(%u, %d, %d)", |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 15797 | vdev_id, ucast_mode, mcast_bcast_mode); |
| 15798 | |
| 15799 | /* allocate command buffer */ |
| 15800 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 15801 | if (!buf) { |
| 15802 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 15803 | return QDF_STATUS_E_NOMEM; |
| 15804 | } |
| 15805 | |
| 15806 | /* set TLV header */ |
| 15807 | cmd = (wmi_bpf_set_vdev_active_mode_cmd_fixed_param *)wmi_buf_data(buf); |
| 15808 | WMITLV_SET_HDR(&cmd->tlv_header, tag_id, tlv_len); |
| 15809 | |
| 15810 | /* populate data */ |
| 15811 | cmd->vdev_id = vdev_id; |
| 15812 | cmd->uc_mode = ucast_mode; |
| 15813 | cmd->mcbc_mode = mcast_bcast_mode; |
| 15814 | |
| 15815 | /* send to FW */ |
| 15816 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 15817 | WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID); |
| 15818 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15819 | WMI_LOGE("Failed to send WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID:%d", |
| 15820 | status); |
| 15821 | wmi_buf_free(buf); |
| 15822 | return status; |
| 15823 | } |
| 15824 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 15825 | WMI_LOGD("Sent WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID successfully"); |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 15826 | |
| 15827 | return QDF_STATUS_SUCCESS; |
| 15828 | } |
| 15829 | |
| 15830 | /** |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 15831 | * send_power_dbg_cmd_tlv() - send power debug commands |
| 15832 | * @wmi_handle: wmi handle |
| 15833 | * @param: wmi power debug parameter |
| 15834 | * |
| 15835 | * Send WMI_POWER_DEBUG_CMDID parameters to fw. |
| 15836 | * |
| 15837 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 15838 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 15839 | static QDF_STATUS send_power_dbg_cmd_tlv(wmi_unified_t wmi_handle, |
| 15840 | struct wmi_power_dbg_params *param) |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 15841 | { |
| 15842 | wmi_buf_t buf = NULL; |
| 15843 | QDF_STATUS status; |
| 15844 | int len, args_tlv_len; |
| 15845 | uint8_t *buf_ptr; |
| 15846 | uint8_t i; |
| 15847 | wmi_pdev_wal_power_debug_cmd_fixed_param *cmd; |
| 15848 | uint32_t *cmd_args; |
| 15849 | |
| 15850 | /* Prepare and send power debug cmd parameters */ |
| 15851 | args_tlv_len = WMI_TLV_HDR_SIZE + param->num_args * sizeof(uint32_t); |
| 15852 | len = sizeof(*cmd) + args_tlv_len; |
| 15853 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15854 | if (!buf) { |
| 15855 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15856 | return QDF_STATUS_E_NOMEM; |
| 15857 | } |
| 15858 | |
| 15859 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15860 | cmd = (wmi_pdev_wal_power_debug_cmd_fixed_param *) buf_ptr; |
| 15861 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15862 | WMITLV_TAG_STRUC_wmi_pdev_wal_power_debug_cmd_fixed_param, |
| 15863 | WMITLV_GET_STRUCT_TLVLEN |
| 15864 | (wmi_pdev_wal_power_debug_cmd_fixed_param)); |
| 15865 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15866 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 15867 | param->pdev_id); |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 15868 | cmd->module_id = param->module_id; |
| 15869 | cmd->num_args = param->num_args; |
| 15870 | buf_ptr += sizeof(*cmd); |
| 15871 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 15872 | (param->num_args * sizeof(uint32_t))); |
| 15873 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 15874 | WMI_LOGI("%s: %d num of args = ", __func__, param->num_args); |
| 15875 | for (i = 0; (i < param->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 15876 | cmd_args[i] = param->args[i]; |
| 15877 | WMI_LOGI("%d,", param->args[i]); |
| 15878 | } |
| 15879 | |
| 15880 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15881 | len, WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
| 15882 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15883 | WMI_LOGE("wmi_unified_cmd_send WMI_PDEV_WAL_POWER_DEBUG_CMDID returned Error %d", |
| 15884 | status); |
| 15885 | goto error; |
| 15886 | } |
| 15887 | |
| 15888 | return QDF_STATUS_SUCCESS; |
| 15889 | error: |
| 15890 | wmi_buf_free(buf); |
| 15891 | |
| 15892 | return status; |
| 15893 | } |
| 15894 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15895 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 15896 | * send_multiple_vdev_restart_req_cmd_tlv() - send multiple vdev restart req |
| 15897 | * @wmi_handle: wmi handle |
| 15898 | * @param: wmi multiple vdev restart req param |
| 15899 | * |
| 15900 | * Send WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID parameters to fw. |
| 15901 | * |
| 15902 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 15903 | */ |
| 15904 | static QDF_STATUS send_multiple_vdev_restart_req_cmd_tlv( |
| 15905 | wmi_unified_t wmi_handle, |
| 15906 | struct multiple_vdev_restart_params *param) |
| 15907 | { |
| 15908 | wmi_buf_t buf; |
| 15909 | QDF_STATUS qdf_status; |
| 15910 | wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *cmd; |
| 15911 | int i; |
| 15912 | uint8_t *buf_ptr; |
| 15913 | uint32_t *vdev_ids; |
| 15914 | wmi_channel *chan_info; |
| 15915 | struct channel_param *tchan_info; |
| 15916 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 15917 | |
| 15918 | len += sizeof(wmi_channel); |
| 15919 | if (param->num_vdevs) |
| 15920 | len += sizeof(uint32_t) * param->num_vdevs; |
| 15921 | |
| 15922 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15923 | if (!buf) { |
| 15924 | WMI_LOGE("Failed to allocate memory\n"); |
| 15925 | qdf_status = QDF_STATUS_E_NOMEM; |
| 15926 | goto end; |
| 15927 | } |
| 15928 | |
| 15929 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 15930 | cmd = (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *) |
| 15931 | buf_ptr; |
| 15932 | |
| 15933 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15934 | WMITLV_TAG_STRUC_wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param, |
| 15935 | WMITLV_GET_STRUCT_TLVLEN |
| 15936 | (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15937 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 15938 | param->pdev_id); |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 15939 | cmd->requestor_id = param->requestor_id; |
| 15940 | cmd->disable_hw_ack = param->disable_hw_ack; |
| 15941 | cmd->cac_duration_ms = param->cac_duration_ms; |
| 15942 | cmd->num_vdevs = param->num_vdevs; |
| 15943 | |
| 15944 | buf_ptr += sizeof(*cmd); |
| 15945 | |
| 15946 | WMITLV_SET_HDR(buf_ptr, |
| 15947 | WMITLV_TAG_ARRAY_UINT32, |
| 15948 | sizeof(A_UINT32) * param->num_vdevs); |
| 15949 | vdev_ids = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 15950 | for (i = 0; i < param->num_vdevs; i++) { |
| 15951 | vdev_ids[i] = param->vdev_ids[i]; |
| 15952 | } |
| 15953 | |
| 15954 | buf_ptr += (sizeof(A_UINT32) * param->num_vdevs) + WMI_TLV_HDR_SIZE; |
| 15955 | |
| 15956 | WMITLV_SET_HDR(buf_ptr, |
| 15957 | WMITLV_TAG_STRUC_wmi_channel, |
| 15958 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
Sathish Kumar | 3e28e00 | 2017-03-07 15:53:04 +0530 | [diff] [blame] | 15959 | chan_info = (wmi_channel *)buf_ptr; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 15960 | tchan_info = &(param->ch_param); |
| 15961 | chan_info->mhz = tchan_info->mhz; |
| 15962 | chan_info->band_center_freq1 = tchan_info->cfreq1; |
| 15963 | chan_info->band_center_freq2 = tchan_info->cfreq2; |
| 15964 | if (tchan_info->is_chan_passive) |
| 15965 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 15966 | WMI_CHAN_FLAG_PASSIVE); |
| 15967 | if (tchan_info->allow_vht) |
| 15968 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 15969 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 15970 | else if (tchan_info->allow_ht) |
| 15971 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 15972 | WMI_CHAN_FLAG_ALLOW_HT); |
| 15973 | WMI_SET_CHANNEL_MODE(chan_info, tchan_info->phy_mode); |
| 15974 | WMI_SET_CHANNEL_MIN_POWER(chan_info, tchan_info->minpower); |
| 15975 | WMI_SET_CHANNEL_MAX_POWER(chan_info, tchan_info->maxpower); |
| 15976 | WMI_SET_CHANNEL_REG_POWER(chan_info, tchan_info->maxregpower); |
| 15977 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, tchan_info->antennamax); |
| 15978 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, tchan_info->reg_class_id); |
| 15979 | |
| 15980 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15981 | WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID); |
| 15982 | |
| 15983 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 15984 | WMI_LOGE("%s: Failed to send\n", __func__); |
| 15985 | wmi_buf_free(buf); |
| 15986 | } |
| 15987 | |
| 15988 | end: |
| 15989 | return qdf_status; |
| 15990 | } |
| 15991 | |
| 15992 | /** |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 15993 | * send_dfs_phyerr_offload_en_cmd_tlv() - send dfs phyerr offload enable cmd |
| 15994 | * @wmi_handle: wmi handle |
| 15995 | * @pdev_id: pdev id |
| 15996 | * |
| 15997 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID command to firmware. |
| 15998 | * |
| 15999 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 16000 | */ |
| 16001 | static QDF_STATUS send_dfs_phyerr_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 16002 | uint32_t pdev_id) |
| 16003 | { |
| 16004 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *cmd; |
| 16005 | wmi_buf_t buf; |
| 16006 | uint16_t len; |
| 16007 | QDF_STATUS ret; |
| 16008 | |
| 16009 | len = sizeof(*cmd); |
| 16010 | buf = wmi_buf_alloc(wmi_handle, len); |
| 16011 | |
| 16012 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 16013 | |
| 16014 | if (!buf) { |
| 16015 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 16016 | return QDF_STATUS_E_NOMEM; |
| 16017 | } |
| 16018 | |
| 16019 | cmd = (wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *) |
| 16020 | wmi_buf_data(buf); |
| 16021 | |
| 16022 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 16023 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param, |
| 16024 | WMITLV_GET_STRUCT_TLVLEN( |
| 16025 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param)); |
| 16026 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16027 | 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] | 16028 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 16029 | WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID); |
| 16030 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 16031 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 16032 | __func__, ret, pdev_id); |
| 16033 | wmi_buf_free(buf); |
| 16034 | return QDF_STATUS_E_FAILURE; |
| 16035 | } |
| 16036 | |
| 16037 | return QDF_STATUS_SUCCESS; |
| 16038 | } |
| 16039 | |
| 16040 | /** |
| 16041 | * send_dfs_phyerr_offload_dis_cmd_tlv() - send dfs phyerr offload disable cmd |
| 16042 | * @wmi_handle: wmi handle |
| 16043 | * @pdev_id: pdev id |
| 16044 | * |
| 16045 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID command to firmware. |
| 16046 | * |
| 16047 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 16048 | */ |
| 16049 | static QDF_STATUS send_dfs_phyerr_offload_dis_cmd_tlv(wmi_unified_t wmi_handle, |
| 16050 | uint32_t pdev_id) |
| 16051 | { |
| 16052 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *cmd; |
| 16053 | wmi_buf_t buf; |
| 16054 | uint16_t len; |
| 16055 | QDF_STATUS ret; |
| 16056 | |
| 16057 | len = sizeof(*cmd); |
| 16058 | buf = wmi_buf_alloc(wmi_handle, len); |
| 16059 | |
| 16060 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 16061 | |
| 16062 | if (!buf) { |
| 16063 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 16064 | return QDF_STATUS_E_NOMEM; |
| 16065 | } |
| 16066 | |
| 16067 | cmd = (wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *) |
| 16068 | wmi_buf_data(buf); |
| 16069 | |
| 16070 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 16071 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param, |
| 16072 | WMITLV_GET_STRUCT_TLVLEN( |
| 16073 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param)); |
| 16074 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16075 | 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] | 16076 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 16077 | WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID); |
| 16078 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 16079 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 16080 | __func__, ret, pdev_id); |
| 16081 | wmi_buf_free(buf); |
| 16082 | return QDF_STATUS_E_FAILURE; |
| 16083 | } |
| 16084 | |
| 16085 | return QDF_STATUS_SUCCESS; |
| 16086 | } |
| 16087 | |
| 16088 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16089 | * init_cmd_send_tlv() - send initialization cmd to fw |
| 16090 | * @wmi_handle: wmi handle |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16091 | * @param param: pointer to wmi init param |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16092 | * |
| 16093 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16094 | */ |
| 16095 | static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16096 | struct wmi_init_cmd_param *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16097 | { |
| 16098 | wmi_buf_t buf; |
| 16099 | wmi_init_cmd_fixed_param *cmd; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16100 | uint8_t *buf_ptr; |
| 16101 | wmi_resource_config *resource_cfg; |
| 16102 | wlan_host_memory_chunk *host_mem_chunks; |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16103 | uint32_t mem_chunk_len = 0, hw_mode_len = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16104 | uint16_t idx; |
| 16105 | int len; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 16106 | QDF_STATUS ret; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16107 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16108 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + |
| 16109 | WMI_TLV_HDR_SIZE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16110 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16111 | |
| 16112 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) |
| 16113 | hw_mode_len = sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 16114 | WMI_TLV_HDR_SIZE + |
| 16115 | (param->num_band_to_mac * sizeof(wmi_pdev_band_to_mac)); |
| 16116 | |
| 16117 | 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] | 16118 | if (!buf) { |
| 16119 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 16120 | return QDF_STATUS_E_FAILURE; |
| 16121 | } |
| 16122 | |
| 16123 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 16124 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 16125 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 16126 | |
| 16127 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 16128 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 16129 | + WMI_TLV_HDR_SIZE); |
| 16130 | |
| 16131 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 16132 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 16133 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 16134 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16135 | wmi_copy_resource_config(resource_cfg, param->res_cfg); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16136 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 16137 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 16138 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 16139 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16140 | for (idx = 0; idx < param->num_mem_chunks; ++idx) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16141 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 16142 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 16143 | WMITLV_GET_STRUCT_TLVLEN |
| 16144 | (wlan_host_memory_chunk)); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16145 | host_mem_chunks[idx].ptr = param->mem_chunks[idx].paddr; |
| 16146 | host_mem_chunks[idx].size = param->mem_chunks[idx].len; |
| 16147 | host_mem_chunks[idx].req_id = param->mem_chunks[idx].req_id; |
Vivek | f85a42b | 2017-06-21 11:38:28 +0530 | [diff] [blame] | 16148 | QDF_TRACE(QDF_MODULE_ID_ANY, QDF_TRACE_LEVEL_DEBUG, |
| 16149 | "chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16150 | idx, host_mem_chunks[idx].size, |
| 16151 | host_mem_chunks[idx].ptr); |
| 16152 | } |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16153 | cmd->num_host_mem_chunks = param->num_mem_chunks; |
| 16154 | len += (param->num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 16155 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16156 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 16157 | WMITLV_TAG_ARRAY_STRUC, |
| 16158 | (sizeof(wlan_host_memory_chunk) * |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16159 | param->num_mem_chunks)); |
| 16160 | |
| 16161 | /* Fill hw mode id config */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16162 | 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] | 16163 | |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 16164 | /* Fill fw_abi_vers */ |
| 16165 | copy_fw_abi_version_tlv(wmi_handle, cmd); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16166 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 16167 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID); |
| 16168 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 16169 | WMI_LOGE("wmi_unified_cmd_send WMI_INIT_CMDID returned Error %d", |
| 16170 | ret); |
| 16171 | wmi_buf_free(buf); |
| 16172 | } |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 16173 | |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 16174 | return ret; |
| 16175 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16176 | } |
| 16177 | |
| 16178 | /** |
| 16179 | * save_service_bitmap_tlv() - save service bitmap |
| 16180 | * @wmi_handle: wmi handle |
| 16181 | * @param evt_buf: pointer to event buffer |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 16182 | * @param bitmap_buf: bitmap buffer, for converged legacy support |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16183 | * |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16184 | * Return: QDF_STATUS |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16185 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 16186 | static |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16187 | QDF_STATUS save_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 16188 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16189 | { |
| 16190 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16191 | struct wmi_soc *soc = wmi_handle->soc; |
| 16192 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16193 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16194 | |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16195 | /* If it is already allocated, use that buffer. This can happen |
| 16196 | * during target stop/start scenarios where host allocation is skipped. |
| 16197 | */ |
| 16198 | if (!soc->wmi_service_bitmap) { |
| 16199 | soc->wmi_service_bitmap = |
| 16200 | qdf_mem_malloc(WMI_SERVICE_BM_SIZE * sizeof(uint32_t)); |
| 16201 | if (!soc->wmi_service_bitmap) { |
| 16202 | WMI_LOGE("Failed memory allocation for service bitmap"); |
| 16203 | return QDF_STATUS_E_NOMEM; |
| 16204 | } |
| 16205 | } |
| 16206 | |
| 16207 | qdf_mem_copy(soc->wmi_service_bitmap, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16208 | param_buf->wmi_service_bitmap, |
| 16209 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 16210 | |
| 16211 | if (bitmap_buf) |
| 16212 | qdf_mem_copy(bitmap_buf, |
| 16213 | param_buf->wmi_service_bitmap, |
| 16214 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16215 | |
| 16216 | return QDF_STATUS_SUCCESS; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16217 | } |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16218 | |
| 16219 | /** |
| 16220 | * save_ext_service_bitmap_tlv() - save extendend service bitmap |
| 16221 | * @wmi_handle: wmi handle |
| 16222 | * @param evt_buf: pointer to event buffer |
| 16223 | * @param bitmap_buf: bitmap buffer, for converged legacy support |
| 16224 | * |
| 16225 | * Return: QDF_STATUS |
| 16226 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 16227 | static |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16228 | QDF_STATUS save_ext_service_bitmap_tlv(wmi_unified_t wmi_handle, void *evt_buf, |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 16229 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16230 | { |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16231 | WMI_SERVICE_AVAILABLE_EVENTID_param_tlvs *param_buf; |
| 16232 | wmi_service_available_event_fixed_param *ev; |
| 16233 | struct wmi_soc *soc = wmi_handle->soc; |
| 16234 | |
| 16235 | param_buf = (WMI_SERVICE_AVAILABLE_EVENTID_param_tlvs *) evt_buf; |
| 16236 | |
| 16237 | ev = param_buf->fixed_param; |
| 16238 | |
| 16239 | /* If it is already allocated, use that buffer. This can happen |
| 16240 | * during target stop/start scenarios where host allocation is skipped. |
| 16241 | */ |
| 16242 | if (!soc->wmi_ext_service_bitmap) { |
| 16243 | soc->wmi_ext_service_bitmap = qdf_mem_malloc( |
| 16244 | WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(uint32_t)); |
| 16245 | if (!soc->wmi_ext_service_bitmap) { |
| 16246 | WMI_LOGE("Failed memory allocation for service bitmap"); |
| 16247 | return QDF_STATUS_E_NOMEM; |
| 16248 | } |
| 16249 | } |
| 16250 | |
| 16251 | qdf_mem_copy(soc->wmi_ext_service_bitmap, |
| 16252 | ev->wmi_service_segment_bitmap, |
| 16253 | (WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(uint32_t))); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16254 | |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 16255 | if (bitmap_buf) |
| 16256 | qdf_mem_copy(bitmap_buf, |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16257 | soc->wmi_ext_service_bitmap, |
| 16258 | (WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(uint32_t))); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16259 | |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16260 | return QDF_STATUS_SUCCESS; |
| 16261 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16262 | /** |
| 16263 | * is_service_enabled_tlv() - Check if service enabled |
| 16264 | * @param wmi_handle: wmi handle |
| 16265 | * @param service_id: service identifier |
| 16266 | * |
| 16267 | * Return: 1 enabled, 0 disabled |
| 16268 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 16269 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16270 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 16271 | uint32_t service_id) |
| 16272 | { |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16273 | struct wmi_soc *soc = wmi_handle->soc; |
| 16274 | |
| 16275 | if (!soc->wmi_service_bitmap) { |
| 16276 | WMI_LOGE("WMI service bit map is not saved yet\n"); |
| 16277 | return false; |
| 16278 | } |
| 16279 | |
| 16280 | /* if WMI_EXTENDED_SERVICE_AVAILABLE was received with extended bitmap, |
| 16281 | * use WMI_SERVICE_EXT_ENABLE to check the services. |
| 16282 | */ |
| 16283 | if (soc->wmi_ext_service_bitmap) |
| 16284 | return WMI_SERVICE_EXT_IS_ENABLED(soc->wmi_service_bitmap, |
| 16285 | soc->wmi_ext_service_bitmap, |
| 16286 | service_id); |
| 16287 | |
| 16288 | return WMI_SERVICE_IS_ENABLED(soc->wmi_service_bitmap, |
| 16289 | service_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16290 | } |
| 16291 | #else |
| 16292 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 16293 | uint32_t service_id) |
| 16294 | { |
| 16295 | return false; |
| 16296 | } |
| 16297 | #endif |
| 16298 | |
Nandha Kishore Easwaran | a769b36 | 2017-06-15 10:29:29 +0530 | [diff] [blame] | 16299 | static inline void copy_ht_cap_info(uint32_t ev_target_cap, |
| 16300 | struct wlan_psoc_target_capability_info *cap) |
| 16301 | { |
| 16302 | /* except LDPC all flags are common betwen legacy and here |
| 16303 | * also IBFEER is not defined for TLV |
| 16304 | */ |
| 16305 | cap->ht_cap_info |= ev_target_cap & ( |
| 16306 | WMI_HT_CAP_ENABLED |
| 16307 | | WMI_HT_CAP_HT20_SGI |
| 16308 | | WMI_HT_CAP_DYNAMIC_SMPS |
| 16309 | | WMI_HT_CAP_TX_STBC |
| 16310 | | WMI_HT_CAP_TX_STBC_MASK_SHIFT |
| 16311 | | WMI_HT_CAP_RX_STBC |
| 16312 | | WMI_HT_CAP_RX_STBC_MASK_SHIFT |
| 16313 | | WMI_HT_CAP_LDPC |
| 16314 | | WMI_HT_CAP_L_SIG_TXOP_PROT |
| 16315 | | WMI_HT_CAP_MPDU_DENSITY |
| 16316 | | WMI_HT_CAP_MPDU_DENSITY_MASK_SHIFT |
| 16317 | | WMI_HT_CAP_HT40_SGI); |
| 16318 | if (ev_target_cap & WMI_HT_CAP_LDPC) |
| 16319 | cap->ht_cap_info |= WMI_HOST_HT_CAP_RX_LDPC | |
| 16320 | WMI_HOST_HT_CAP_TX_LDPC; |
| 16321 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16322 | /** |
| 16323 | * extract_service_ready_tlv() - extract service ready event |
| 16324 | * @wmi_handle: wmi handle |
| 16325 | * @param evt_buf: pointer to received event buffer |
| 16326 | * @param cap: pointer to hold target capability information extracted from even |
| 16327 | * |
| 16328 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16329 | */ |
| 16330 | static QDF_STATUS extract_service_ready_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 16331 | void *evt_buf, struct wlan_psoc_target_capability_info *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16332 | { |
| 16333 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 16334 | wmi_service_ready_event_fixed_param *ev; |
| 16335 | |
| 16336 | |
| 16337 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16338 | |
| 16339 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 16340 | if (!ev) { |
| 16341 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 16342 | return QDF_STATUS_E_FAILURE; |
| 16343 | } |
| 16344 | |
| 16345 | cap->phy_capability = ev->phy_capability; |
| 16346 | cap->max_frag_entry = ev->max_frag_entry; |
| 16347 | cap->num_rf_chains = ev->num_rf_chains; |
Nandha Kishore Easwaran | a769b36 | 2017-06-15 10:29:29 +0530 | [diff] [blame] | 16348 | copy_ht_cap_info(ev->ht_cap_info, cap); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16349 | cap->vht_cap_info = ev->vht_cap_info; |
| 16350 | cap->vht_supp_mcs = ev->vht_supp_mcs; |
| 16351 | cap->hw_min_tx_power = ev->hw_min_tx_power; |
| 16352 | cap->hw_max_tx_power = ev->hw_max_tx_power; |
| 16353 | cap->sys_cap_info = ev->sys_cap_info; |
| 16354 | cap->min_pkt_size_enable = ev->min_pkt_size_enable; |
| 16355 | cap->max_bcn_ie_size = ev->max_bcn_ie_size; |
| 16356 | cap->max_num_scan_channels = ev->max_num_scan_channels; |
| 16357 | cap->max_supported_macs = ev->max_supported_macs; |
| 16358 | cap->wmi_fw_sub_feat_caps = ev->wmi_fw_sub_feat_caps; |
| 16359 | cap->txrx_chainmask = ev->txrx_chainmask; |
| 16360 | cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; |
| 16361 | cap->num_msdu_desc = ev->num_msdu_desc; |
Kiran Venkatappa | 59d6e1f | 2017-10-12 15:04:22 +0530 | [diff] [blame] | 16362 | cap->fw_version = ev->fw_build_vers; |
| 16363 | /* fw_version_1 is not available in TLV. */ |
| 16364 | cap->fw_version_1 = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16365 | |
| 16366 | return QDF_STATUS_SUCCESS; |
| 16367 | } |
| 16368 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 16369 | /* convert_wireless_modes_tlv() - Convert REGDMN_MODE values sent by target |
| 16370 | * to host internal WMI_HOST_REGDMN_MODE values. |
| 16371 | * REGULATORY TODO : REGDMN_MODE_11AC_VHT*_2G values are not used by the |
| 16372 | * host currently. Add this in the future if required. |
| 16373 | * 11AX (Phase II) : 11ax related values are not currently |
| 16374 | * advertised separately by FW. As part of phase II regulatory bring-up, |
| 16375 | * finalize the advertisement mechanism. |
| 16376 | * @target_wireless_mode: target wireless mode received in message |
| 16377 | * |
| 16378 | * Return: returns the host internal wireless mode. |
| 16379 | */ |
| 16380 | static inline uint32_t convert_wireless_modes_tlv(uint32_t target_wireless_mode) |
| 16381 | { |
| 16382 | |
| 16383 | uint32_t wireless_modes = 0; |
| 16384 | |
| 16385 | if (target_wireless_mode & REGDMN_MODE_11A) |
| 16386 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A; |
| 16387 | |
| 16388 | if (target_wireless_mode & REGDMN_MODE_TURBO) |
| 16389 | wireless_modes |= WMI_HOST_REGDMN_MODE_TURBO; |
| 16390 | |
| 16391 | if (target_wireless_mode & REGDMN_MODE_11B) |
| 16392 | wireless_modes |= WMI_HOST_REGDMN_MODE_11B; |
| 16393 | |
| 16394 | if (target_wireless_mode & REGDMN_MODE_PUREG) |
| 16395 | wireless_modes |= WMI_HOST_REGDMN_MODE_PUREG; |
| 16396 | |
| 16397 | if (target_wireless_mode & REGDMN_MODE_11G) |
| 16398 | wireless_modes |= WMI_HOST_REGDMN_MODE_11G; |
| 16399 | |
| 16400 | if (target_wireless_mode & REGDMN_MODE_108G) |
| 16401 | wireless_modes |= WMI_HOST_REGDMN_MODE_108G; |
| 16402 | |
| 16403 | if (target_wireless_mode & REGDMN_MODE_108A) |
| 16404 | wireless_modes |= WMI_HOST_REGDMN_MODE_108A; |
| 16405 | |
| 16406 | if (target_wireless_mode & REGDMN_MODE_XR) |
| 16407 | wireless_modes |= WMI_HOST_REGDMN_MODE_XR; |
| 16408 | |
| 16409 | if (target_wireless_mode & REGDMN_MODE_11A_HALF_RATE) |
| 16410 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_HALF_RATE; |
| 16411 | |
| 16412 | if (target_wireless_mode & REGDMN_MODE_11A_QUARTER_RATE) |
| 16413 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_QUARTER_RATE; |
| 16414 | |
| 16415 | if (target_wireless_mode & REGDMN_MODE_11NG_HT20) |
| 16416 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT20; |
| 16417 | |
| 16418 | if (target_wireless_mode & REGDMN_MODE_11NA_HT20) |
| 16419 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT20; |
| 16420 | |
| 16421 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40PLUS) |
| 16422 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40PLUS; |
| 16423 | |
| 16424 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40MINUS) |
| 16425 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40MINUS; |
| 16426 | |
| 16427 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40PLUS) |
| 16428 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40PLUS; |
| 16429 | |
| 16430 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40MINUS) |
| 16431 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40MINUS; |
| 16432 | |
| 16433 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT20) |
| 16434 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT20; |
| 16435 | |
| 16436 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40PLUS) |
| 16437 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40PLUS; |
| 16438 | |
| 16439 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40MINUS) |
| 16440 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40MINUS; |
| 16441 | |
| 16442 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80) |
| 16443 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80; |
| 16444 | |
| 16445 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT160) |
| 16446 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT160; |
| 16447 | |
| 16448 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80_80) |
| 16449 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80_80; |
| 16450 | |
| 16451 | return wireless_modes; |
| 16452 | } |
| 16453 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16454 | /** |
| 16455 | * extract_hal_reg_cap_tlv() - extract HAL registered capabilities |
| 16456 | * @wmi_handle: wmi handle |
| 16457 | * @param evt_buf: Pointer to event buffer |
| 16458 | * @param cap: pointer to hold HAL reg capabilities |
| 16459 | * |
| 16460 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16461 | */ |
| 16462 | 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] | 16463 | void *evt_buf, struct wlan_psoc_hal_reg_capability *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16464 | { |
| 16465 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 16466 | |
| 16467 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16468 | |
| 16469 | qdf_mem_copy(cap, (((uint8_t *)param_buf->hal_reg_capabilities) + |
| 16470 | sizeof(uint32_t)), |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 16471 | sizeof(struct wlan_psoc_hal_reg_capability)); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16472 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 16473 | cap->wireless_modes = convert_wireless_modes_tlv( |
| 16474 | param_buf->hal_reg_capabilities->wireless_modes); |
Pratik Gandhi | 33bb714 | 2017-01-05 19:38:41 +0530 | [diff] [blame] | 16475 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16476 | return QDF_STATUS_SUCCESS; |
| 16477 | } |
| 16478 | |
| 16479 | /** |
| 16480 | * extract_host_mem_req_tlv() - Extract host memory request event |
| 16481 | * @wmi_handle: wmi handle |
| 16482 | * @param evt_buf: pointer to event buffer |
| 16483 | * @param num_entries: pointer to hold number of entries requested |
| 16484 | * |
| 16485 | * Return: Number of entries requested |
| 16486 | */ |
| 16487 | static host_mem_req *extract_host_mem_req_tlv(wmi_unified_t wmi_handle, |
| 16488 | void *evt_buf, uint8_t *num_entries) |
| 16489 | { |
| 16490 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 16491 | wmi_service_ready_event_fixed_param *ev; |
| 16492 | |
| 16493 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16494 | |
| 16495 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 16496 | if (!ev) { |
| 16497 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 16498 | return NULL; |
| 16499 | } |
| 16500 | |
| 16501 | *num_entries = ev->num_mem_reqs; |
| 16502 | |
| 16503 | return (host_mem_req *)param_buf->mem_reqs; |
| 16504 | } |
| 16505 | |
| 16506 | /** |
| 16507 | * save_fw_version_in_service_ready_tlv() - Save fw version in service |
| 16508 | * ready function |
| 16509 | * @wmi_handle: wmi handle |
| 16510 | * @param evt_buf: pointer to event buffer |
| 16511 | * |
| 16512 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16513 | */ |
| 16514 | static QDF_STATUS |
| 16515 | save_fw_version_in_service_ready_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 16516 | { |
| 16517 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 16518 | wmi_service_ready_event_fixed_param *ev; |
| 16519 | |
| 16520 | |
| 16521 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16522 | |
| 16523 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 16524 | if (!ev) { |
| 16525 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 16526 | return QDF_STATUS_E_FAILURE; |
| 16527 | } |
| 16528 | |
| 16529 | /*Save fw version from service ready message */ |
| 16530 | /*This will be used while sending INIT message */ |
| 16531 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
| 16532 | sizeof(wmi_handle->fw_abi_version)); |
Kiran Venkatappa | 22a0298 | 2017-10-11 22:56:45 +0530 | [diff] [blame] | 16533 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16534 | return QDF_STATUS_SUCCESS; |
| 16535 | } |
| 16536 | |
| 16537 | /** |
| 16538 | * ready_extract_init_status_tlv() - Extract init status from ready event |
| 16539 | * @wmi_handle: wmi handle |
| 16540 | * @param evt_buf: Pointer to event buffer |
| 16541 | * |
| 16542 | * Return: ready status |
| 16543 | */ |
| 16544 | static uint32_t ready_extract_init_status_tlv(wmi_unified_t wmi_handle, |
| 16545 | void *evt_buf) |
| 16546 | { |
| 16547 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 16548 | wmi_ready_event_fixed_param *ev = NULL; |
| 16549 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16550 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 16551 | ev = param_buf->fixed_param; |
| 16552 | |
| 16553 | qdf_print("%s:%d\n", __func__, ev->status); |
| 16554 | |
| 16555 | return ev->status; |
| 16556 | } |
| 16557 | |
| 16558 | /** |
| 16559 | * ready_extract_mac_addr_tlv() - extract mac address from ready event |
| 16560 | * @wmi_handle: wmi handle |
| 16561 | * @param evt_buf: pointer to event buffer |
| 16562 | * @param macaddr: Pointer to hold MAC address |
| 16563 | * |
| 16564 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16565 | */ |
| 16566 | static QDF_STATUS ready_extract_mac_addr_tlv(wmi_unified_t wmi_hamdle, |
| 16567 | void *evt_buf, uint8_t *macaddr) |
| 16568 | { |
| 16569 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 16570 | wmi_ready_event_fixed_param *ev = NULL; |
| 16571 | |
| 16572 | |
| 16573 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 16574 | ev = param_buf->fixed_param; |
| 16575 | |
| 16576 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, macaddr); |
| 16577 | |
| 16578 | return QDF_STATUS_SUCCESS; |
| 16579 | } |
| 16580 | |
| 16581 | /** |
Manoj Ekbote | dd27390 | 2017-07-09 23:28:56 -0700 | [diff] [blame] | 16582 | * ready_extract_mac_addr_list_tlv() - extract MAC address list from ready event |
| 16583 | * @wmi_handle: wmi handle |
| 16584 | * @param evt_buf: pointer to event buffer |
| 16585 | * @param macaddr: Pointer to hold number of MAC addresses |
| 16586 | * |
| 16587 | * Return: Pointer to addr list |
| 16588 | */ |
| 16589 | static wmi_host_mac_addr *ready_extract_mac_addr_list_tlv(wmi_unified_t wmi_hamdle, |
| 16590 | void *evt_buf, uint8_t *num_mac) |
| 16591 | { |
| 16592 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 16593 | wmi_ready_event_fixed_param *ev = NULL; |
| 16594 | |
| 16595 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 16596 | ev = param_buf->fixed_param; |
| 16597 | |
| 16598 | *num_mac = ev->num_extra_mac_addr; |
| 16599 | |
| 16600 | return (wmi_host_mac_addr *) param_buf->mac_addr_list; |
| 16601 | } |
| 16602 | |
| 16603 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16604 | * extract_dbglog_data_len_tlv() - extract debuglog data length |
| 16605 | * @wmi_handle: wmi handle |
| 16606 | * @param evt_buf: pointer to event buffer |
| 16607 | * |
| 16608 | * Return: length |
| 16609 | */ |
| 16610 | 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] | 16611 | void *evt_buf, uint32_t *len) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16612 | { |
| 16613 | WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf; |
| 16614 | |
| 16615 | param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) evt_buf; |
| 16616 | |
| 16617 | *len = param_buf->num_bufp; |
| 16618 | |
| 16619 | return param_buf->bufp; |
| 16620 | } |
| 16621 | |
| 16622 | /** |
| 16623 | * extract_vdev_start_resp_tlv() - extract vdev start response |
| 16624 | * @wmi_handle: wmi handle |
| 16625 | * @param evt_buf: pointer to event buffer |
| 16626 | * @param vdev_rsp: Pointer to hold vdev response |
| 16627 | * |
| 16628 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16629 | */ |
| 16630 | static QDF_STATUS extract_vdev_start_resp_tlv(wmi_unified_t wmi_handle, |
| 16631 | void *evt_buf, wmi_host_vdev_start_resp *vdev_rsp) |
| 16632 | { |
| 16633 | WMI_VDEV_START_RESP_EVENTID_param_tlvs *param_buf; |
| 16634 | wmi_vdev_start_response_event_fixed_param *ev; |
| 16635 | |
| 16636 | param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) evt_buf; |
| 16637 | if (!param_buf) { |
| 16638 | qdf_print("Invalid start response event buffer\n"); |
| 16639 | return QDF_STATUS_E_INVAL; |
| 16640 | } |
| 16641 | |
| 16642 | ev = param_buf->fixed_param; |
| 16643 | if (!ev) { |
| 16644 | qdf_print("Invalid start response event buffer\n"); |
| 16645 | return QDF_STATUS_E_INVAL; |
| 16646 | } |
| 16647 | |
| 16648 | qdf_mem_zero(vdev_rsp, sizeof(*vdev_rsp)); |
| 16649 | |
| 16650 | vdev_rsp->vdev_id = ev->vdev_id; |
| 16651 | vdev_rsp->requestor_id = ev->requestor_id; |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 16652 | switch (ev->resp_type) { |
| 16653 | case WMI_VDEV_START_RESP_EVENT: |
| 16654 | vdev_rsp->resp_type = WMI_HOST_VDEV_START_RESP_EVENT; |
| 16655 | break; |
| 16656 | case WMI_VDEV_RESTART_RESP_EVENT: |
| 16657 | vdev_rsp->resp_type = WMI_HOST_VDEV_RESTART_RESP_EVENT; |
| 16658 | break; |
| 16659 | default: |
| 16660 | qdf_print("Invalid start response event buffer\n"); |
| 16661 | break; |
| 16662 | }; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16663 | vdev_rsp->status = ev->status; |
| 16664 | vdev_rsp->chain_mask = ev->chain_mask; |
| 16665 | vdev_rsp->smps_mode = ev->smps_mode; |
| 16666 | vdev_rsp->mac_id = ev->mac_id; |
| 16667 | vdev_rsp->cfgd_tx_streams = ev->cfgd_tx_streams; |
| 16668 | vdev_rsp->cfgd_rx_streams = ev->cfgd_rx_streams; |
| 16669 | |
| 16670 | return QDF_STATUS_SUCCESS; |
| 16671 | } |
| 16672 | |
| 16673 | /** |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16674 | * extract_tbttoffset_num_vdevs_tlv() - extract tbtt offset num vdev |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16675 | * @wmi_handle: wmi handle |
| 16676 | * @param evt_buf: pointer to event buffer |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16677 | * @param num_vdevs: Pointer to hold num vdev |
| 16678 | * |
| 16679 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16680 | */ |
| 16681 | static QDF_STATUS extract_tbttoffset_num_vdevs_tlv(void *wmi_hdl, |
| 16682 | void *evt_buf, uint32_t *num_vdevs) |
| 16683 | { |
| 16684 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 16685 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
| 16686 | uint32_t vdev_map; |
| 16687 | |
| 16688 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *)evt_buf; |
| 16689 | if (!param_buf) { |
| 16690 | qdf_print("Invalid tbtt update ext event buffer\n"); |
| 16691 | return QDF_STATUS_E_INVAL; |
| 16692 | } |
| 16693 | tbtt_offset_event = param_buf->fixed_param; |
| 16694 | vdev_map = tbtt_offset_event->vdev_map; |
| 16695 | *num_vdevs = wmi_vdev_map_to_num_vdevs(vdev_map); |
| 16696 | |
| 16697 | return QDF_STATUS_SUCCESS; |
| 16698 | } |
| 16699 | |
| 16700 | /** |
| 16701 | * extract_ext_tbttoffset_num_vdevs_tlv() - extract ext tbtt offset num vdev |
| 16702 | * @wmi_handle: wmi handle |
| 16703 | * @param evt_buf: pointer to event buffer |
| 16704 | * @param num_vdevs: Pointer to hold num vdev |
| 16705 | * |
| 16706 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16707 | */ |
| 16708 | static QDF_STATUS extract_ext_tbttoffset_num_vdevs_tlv(void *wmi_hdl, |
| 16709 | void *evt_buf, uint32_t *num_vdevs) |
| 16710 | { |
| 16711 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *param_buf; |
| 16712 | wmi_tbtt_offset_ext_event_fixed_param *tbtt_offset_ext_event; |
| 16713 | |
| 16714 | param_buf = (WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *)evt_buf; |
| 16715 | if (!param_buf) { |
| 16716 | qdf_print("Invalid tbtt update ext event buffer\n"); |
| 16717 | return QDF_STATUS_E_INVAL; |
| 16718 | } |
| 16719 | tbtt_offset_ext_event = param_buf->fixed_param; |
| 16720 | |
| 16721 | *num_vdevs = tbtt_offset_ext_event->num_vdevs; |
| 16722 | |
| 16723 | return QDF_STATUS_SUCCESS; |
| 16724 | } |
| 16725 | |
| 16726 | /** |
| 16727 | * extract_tbttoffset_update_params_tlv() - extract tbtt offset param |
| 16728 | * @wmi_handle: wmi handle |
| 16729 | * @param evt_buf: pointer to event buffer |
| 16730 | * @param idx: Index refering to a vdev |
| 16731 | * @param tbtt_param: Pointer to tbttoffset event param |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16732 | * |
| 16733 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16734 | */ |
| 16735 | static QDF_STATUS extract_tbttoffset_update_params_tlv(void *wmi_hdl, |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16736 | void *evt_buf, uint8_t idx, |
| 16737 | struct tbttoffset_params *tbtt_param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16738 | { |
| 16739 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 16740 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16741 | uint32_t vdev_map; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16742 | |
| 16743 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *) evt_buf; |
| 16744 | if (!param_buf) { |
| 16745 | qdf_print("Invalid tbtt update event buffer\n"); |
| 16746 | return QDF_STATUS_E_INVAL; |
| 16747 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16748 | |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16749 | tbtt_offset_event = param_buf->fixed_param; |
| 16750 | vdev_map = tbtt_offset_event->vdev_map; |
| 16751 | tbtt_param->vdev_id = wmi_vdev_map_to_vdev_id(vdev_map, idx); |
| 16752 | if (tbtt_param->vdev_id == WLAN_INVALID_VDEV_ID) |
| 16753 | return QDF_STATUS_E_INVAL; |
| 16754 | tbtt_param->tbttoffset = |
| 16755 | param_buf->tbttoffset_list[tbtt_param->vdev_id]; |
| 16756 | |
| 16757 | return QDF_STATUS_SUCCESS; |
| 16758 | } |
| 16759 | |
| 16760 | /** |
| 16761 | * extract_ext_tbttoffset_update_params_tlv() - extract ext tbtt offset param |
| 16762 | * @wmi_handle: wmi handle |
| 16763 | * @param evt_buf: pointer to event buffer |
| 16764 | * @param idx: Index refering to a vdev |
| 16765 | * @param tbtt_param: Pointer to tbttoffset event param |
| 16766 | * |
| 16767 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16768 | */ |
| 16769 | static QDF_STATUS extract_ext_tbttoffset_update_params_tlv(void *wmi_hdl, |
| 16770 | void *evt_buf, uint8_t idx, |
| 16771 | struct tbttoffset_params *tbtt_param) |
| 16772 | { |
| 16773 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *param_buf; |
| 16774 | wmi_tbtt_offset_info *tbtt_offset_info; |
| 16775 | |
| 16776 | param_buf = (WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *)evt_buf; |
| 16777 | if (!param_buf) { |
| 16778 | qdf_print("Invalid tbtt update event buffer\n"); |
| 16779 | return QDF_STATUS_E_INVAL; |
| 16780 | } |
| 16781 | tbtt_offset_info = ¶m_buf->tbtt_offset_info[idx]; |
| 16782 | |
| 16783 | tbtt_param->vdev_id = tbtt_offset_info->vdev_id; |
| 16784 | tbtt_param->tbttoffset = tbtt_offset_info->tbttoffset; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16785 | |
| 16786 | return QDF_STATUS_SUCCESS; |
| 16787 | } |
| 16788 | |
| 16789 | /** |
| 16790 | * extract_mgmt_rx_params_tlv() - extract management rx params from event |
| 16791 | * @wmi_handle: wmi handle |
| 16792 | * @param evt_buf: pointer to event buffer |
| 16793 | * @param hdr: Pointer to hold header |
| 16794 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 16795 | * |
| 16796 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16797 | */ |
| 16798 | 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] | 16799 | void *evt_buf, struct mgmt_rx_event_params *hdr, |
| 16800 | uint8_t **bufp) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16801 | { |
| 16802 | WMI_MGMT_RX_EVENTID_param_tlvs *param_tlvs = NULL; |
| 16803 | wmi_mgmt_rx_hdr *ev_hdr = NULL; |
| 16804 | |
| 16805 | param_tlvs = (WMI_MGMT_RX_EVENTID_param_tlvs *) evt_buf; |
| 16806 | if (!param_tlvs) { |
| 16807 | WMI_LOGE("Get NULL point message from FW"); |
| 16808 | return QDF_STATUS_E_INVAL; |
| 16809 | } |
| 16810 | |
| 16811 | ev_hdr = param_tlvs->hdr; |
| 16812 | if (!hdr) { |
| 16813 | WMI_LOGE("Rx event is NULL"); |
| 16814 | return QDF_STATUS_E_INVAL; |
| 16815 | } |
| 16816 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16817 | hdr->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 16818 | ev_hdr->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16819 | |
| 16820 | hdr->channel = ev_hdr->channel; |
| 16821 | hdr->snr = ev_hdr->snr; |
| 16822 | hdr->rate = ev_hdr->rate; |
| 16823 | hdr->phy_mode = ev_hdr->phy_mode; |
| 16824 | hdr->buf_len = ev_hdr->buf_len; |
| 16825 | hdr->status = ev_hdr->status; |
| 16826 | hdr->flags = ev_hdr->flags; |
| 16827 | hdr->rssi = ev_hdr->rssi; |
| 16828 | hdr->tsf_delta = ev_hdr->tsf_delta; |
| 16829 | qdf_mem_copy(hdr->rssi_ctl, ev_hdr->rssi_ctl, sizeof(hdr->rssi_ctl)); |
| 16830 | |
| 16831 | *bufp = param_tlvs->bufp; |
| 16832 | |
| 16833 | return QDF_STATUS_SUCCESS; |
| 16834 | } |
| 16835 | |
| 16836 | /** |
| 16837 | * extract_vdev_stopped_param_tlv() - extract vdev stop param from event |
| 16838 | * @wmi_handle: wmi handle |
| 16839 | * @param evt_buf: pointer to event buffer |
| 16840 | * @param vdev_id: Pointer to hold vdev identifier |
| 16841 | * |
| 16842 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16843 | */ |
| 16844 | static QDF_STATUS extract_vdev_stopped_param_tlv(wmi_unified_t wmi_handle, |
| 16845 | void *evt_buf, uint32_t *vdev_id) |
| 16846 | { |
| 16847 | WMI_VDEV_STOPPED_EVENTID_param_tlvs *param_buf; |
| 16848 | wmi_vdev_stopped_event_fixed_param *resp_event; |
| 16849 | |
| 16850 | param_buf = (WMI_VDEV_STOPPED_EVENTID_param_tlvs *) evt_buf; |
| 16851 | if (!param_buf) { |
| 16852 | WMI_LOGE("Invalid event buffer"); |
| 16853 | return QDF_STATUS_E_INVAL; |
| 16854 | } |
| 16855 | resp_event = param_buf->fixed_param; |
| 16856 | *vdev_id = resp_event->vdev_id; |
| 16857 | |
| 16858 | return QDF_STATUS_SUCCESS; |
| 16859 | } |
| 16860 | |
| 16861 | /** |
| 16862 | * extract_vdev_roam_param_tlv() - extract vdev roam param from event |
| 16863 | * @wmi_handle: wmi handle |
| 16864 | * @param evt_buf: pointer to event buffer |
| 16865 | * @param param: Pointer to hold roam param |
| 16866 | * |
| 16867 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16868 | */ |
| 16869 | static QDF_STATUS extract_vdev_roam_param_tlv(wmi_unified_t wmi_handle, |
| 16870 | void *evt_buf, wmi_host_roam_event *param) |
| 16871 | { |
| 16872 | WMI_ROAM_EVENTID_param_tlvs *param_buf; |
| 16873 | wmi_roam_event_fixed_param *evt; |
| 16874 | |
| 16875 | param_buf = (WMI_ROAM_EVENTID_param_tlvs *) evt_buf; |
| 16876 | if (!param_buf) { |
| 16877 | WMI_LOGE("Invalid roam event buffer"); |
| 16878 | return QDF_STATUS_E_INVAL; |
| 16879 | } |
| 16880 | |
| 16881 | evt = param_buf->fixed_param; |
| 16882 | qdf_mem_zero(param, sizeof(*param)); |
| 16883 | |
| 16884 | param->vdev_id = evt->vdev_id; |
| 16885 | param->reason = evt->reason; |
| 16886 | param->rssi = evt->rssi; |
| 16887 | |
| 16888 | return QDF_STATUS_SUCCESS; |
| 16889 | } |
| 16890 | |
| 16891 | /** |
| 16892 | * extract_vdev_scan_ev_param_tlv() - extract vdev scan param from event |
| 16893 | * @wmi_handle: wmi handle |
| 16894 | * @param evt_buf: pointer to event buffer |
| 16895 | * @param param: Pointer to hold vdev scan param |
| 16896 | * |
| 16897 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16898 | */ |
| 16899 | 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] | 16900 | void *evt_buf, struct scan_event *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16901 | { |
| 16902 | WMI_SCAN_EVENTID_param_tlvs *param_buf = NULL; |
| 16903 | wmi_scan_event_fixed_param *evt = NULL; |
| 16904 | |
| 16905 | param_buf = (WMI_SCAN_EVENTID_param_tlvs *) evt_buf; |
| 16906 | evt = param_buf->fixed_param; |
| 16907 | |
| 16908 | qdf_mem_zero(param, sizeof(*param)); |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 16909 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16910 | switch (evt->event) { |
| 16911 | case WMI_SCAN_EVENT_STARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16912 | param->type = SCAN_EVENT_TYPE_STARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16913 | break; |
| 16914 | case WMI_SCAN_EVENT_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16915 | param->type = SCAN_EVENT_TYPE_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16916 | break; |
| 16917 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16918 | param->type = SCAN_EVENT_TYPE_BSS_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16919 | break; |
| 16920 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16921 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16922 | break; |
| 16923 | case WMI_SCAN_EVENT_DEQUEUED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16924 | param->type = SCAN_EVENT_TYPE_DEQUEUED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16925 | break; |
| 16926 | case WMI_SCAN_EVENT_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16927 | param->type = SCAN_EVENT_TYPE_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16928 | break; |
| 16929 | case WMI_SCAN_EVENT_START_FAILED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16930 | param->type = SCAN_EVENT_TYPE_START_FAILED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16931 | break; |
| 16932 | case WMI_SCAN_EVENT_RESTARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16933 | param->type = SCAN_EVENT_TYPE_RESTARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16934 | break; |
Sreelakshmi Konamki | 76d62af | 2017-05-25 18:11:03 +0530 | [diff] [blame] | 16935 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16936 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16937 | break; |
| 16938 | case WMI_SCAN_EVENT_MAX: |
| 16939 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16940 | param->type = SCAN_EVENT_TYPE_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16941 | break; |
| 16942 | }; |
| 16943 | |
| 16944 | switch (evt->reason) { |
| 16945 | case WMI_SCAN_REASON_NONE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16946 | param->reason = SCAN_REASON_NONE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16947 | break; |
| 16948 | case WMI_SCAN_REASON_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16949 | param->reason = SCAN_REASON_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16950 | break; |
| 16951 | case WMI_SCAN_REASON_CANCELLED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16952 | param->reason = SCAN_REASON_CANCELLED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16953 | break; |
| 16954 | case WMI_SCAN_REASON_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16955 | param->reason = SCAN_REASON_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16956 | break; |
| 16957 | case WMI_SCAN_REASON_TIMEDOUT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16958 | param->reason = SCAN_REASON_TIMEDOUT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16959 | break; |
| 16960 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16961 | param->reason = SCAN_REASON_INTERNAL_FAILURE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16962 | break; |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 16963 | case WMI_SCAN_REASON_SUSPENDED: |
| 16964 | param->reason = SCAN_REASON_SUSPENDED; |
| 16965 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16966 | case WMI_SCAN_REASON_MAX: |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 16967 | param->reason = SCAN_REASON_MAX; |
| 16968 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16969 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16970 | param->reason = SCAN_REASON_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16971 | break; |
| 16972 | }; |
| 16973 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16974 | param->chan_freq = evt->channel_freq; |
| 16975 | param->requester = evt->requestor; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16976 | param->scan_id = evt->scan_id; |
| 16977 | param->vdev_id = evt->vdev_id; |
Sathish Kumar | b863315 | 2017-08-11 15:00:04 +0530 | [diff] [blame] | 16978 | param->timestamp = evt->tsf_timestamp; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16979 | |
| 16980 | return QDF_STATUS_SUCCESS; |
| 16981 | } |
| 16982 | |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 16983 | #ifdef CONVERGED_TDLS_ENABLE |
| 16984 | /** |
| 16985 | * extract_vdev_tdls_ev_param_tlv() - extract vdev tdls param from event |
| 16986 | * @wmi_handle: wmi handle |
| 16987 | * @param evt_buf: pointer to event buffer |
| 16988 | * @param param: Pointer to hold vdev tdls param |
| 16989 | * |
| 16990 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16991 | */ |
| 16992 | static QDF_STATUS extract_vdev_tdls_ev_param_tlv(wmi_unified_t wmi_handle, |
| 16993 | void *evt_buf, struct tdls_event_info *param) |
| 16994 | { |
| 16995 | WMI_TDLS_PEER_EVENTID_param_tlvs *param_buf; |
| 16996 | wmi_tdls_peer_event_fixed_param *evt; |
| 16997 | |
| 16998 | param_buf = (WMI_TDLS_PEER_EVENTID_param_tlvs *)evt_buf; |
| 16999 | if (!param_buf) { |
| 17000 | WMI_LOGE("%s: NULL param_buf", __func__); |
| 17001 | return QDF_STATUS_E_NULL_VALUE; |
| 17002 | } |
| 17003 | |
| 17004 | evt = param_buf->fixed_param; |
| 17005 | |
| 17006 | qdf_mem_zero(param, sizeof(*param)); |
| 17007 | |
| 17008 | param->vdev_id = evt->vdev_id; |
| 17009 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&evt->peer_macaddr, |
| 17010 | param->peermac.bytes); |
| 17011 | switch (evt->peer_status) { |
| 17012 | case WMI_TDLS_SHOULD_DISCOVER: |
| 17013 | param->message_type = TDLS_SHOULD_DISCOVER; |
| 17014 | break; |
| 17015 | case WMI_TDLS_SHOULD_TEARDOWN: |
| 17016 | param->message_type = TDLS_SHOULD_TEARDOWN; |
| 17017 | break; |
| 17018 | case WMI_TDLS_PEER_DISCONNECTED: |
| 17019 | param->message_type = TDLS_PEER_DISCONNECTED; |
| 17020 | break; |
| 17021 | case WMI_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
| 17022 | param->message_type = TDLS_CONNECTION_TRACKER_NOTIFY; |
| 17023 | break; |
| 17024 | default: |
| 17025 | WMI_LOGE("%s: Discarding unknown tdls event %d from target", |
| 17026 | __func__, evt->peer_status); |
| 17027 | return QDF_STATUS_E_INVAL; |
| 17028 | }; |
| 17029 | |
| 17030 | switch (evt->peer_reason) { |
| 17031 | case WMI_TDLS_TEARDOWN_REASON_TX: |
| 17032 | param->peer_reason = TDLS_TEARDOWN_TX; |
| 17033 | break; |
| 17034 | case WMI_TDLS_TEARDOWN_REASON_RSSI: |
| 17035 | param->peer_reason = TDLS_TEARDOWN_RSSI; |
| 17036 | break; |
| 17037 | case WMI_TDLS_TEARDOWN_REASON_SCAN: |
| 17038 | param->peer_reason = TDLS_TEARDOWN_SCAN; |
| 17039 | break; |
| 17040 | case WMI_TDLS_DISCONNECTED_REASON_PEER_DELETE: |
| 17041 | param->peer_reason = TDLS_DISCONNECTED_PEER_DELETE; |
| 17042 | break; |
| 17043 | case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT: |
| 17044 | param->peer_reason = TDLS_TEARDOWN_PTR_TIMEOUT; |
| 17045 | break; |
| 17046 | case WMI_TDLS_TEARDOWN_REASON_BAD_PTR: |
| 17047 | param->peer_reason = TDLS_TEARDOWN_BAD_PTR; |
| 17048 | break; |
| 17049 | case WMI_TDLS_TEARDOWN_REASON_NO_RESPONSE: |
| 17050 | param->peer_reason = TDLS_TEARDOWN_NO_RSP; |
| 17051 | break; |
| 17052 | case WMI_TDLS_ENTER_BUF_STA: |
| 17053 | param->peer_reason = TDLS_PEER_ENTER_BUF_STA; |
| 17054 | break; |
| 17055 | case WMI_TDLS_EXIT_BUF_STA: |
| 17056 | param->peer_reason = TDLS_PEER_EXIT_BUF_STA; |
| 17057 | break; |
| 17058 | case WMI_TDLS_ENTER_BT_BUSY_MODE: |
| 17059 | param->peer_reason = TDLS_ENTER_BT_BUSY; |
| 17060 | break; |
| 17061 | case WMI_TDLS_EXIT_BT_BUSY_MODE: |
| 17062 | param->peer_reason = TDLS_EXIT_BT_BUSY; |
| 17063 | break; |
| 17064 | case WMI_TDLS_SCAN_STARTED_EVENT: |
| 17065 | param->peer_reason = TDLS_SCAN_STARTED; |
| 17066 | break; |
| 17067 | case WMI_TDLS_SCAN_COMPLETED_EVENT: |
| 17068 | param->peer_reason = TDLS_SCAN_COMPLETED; |
| 17069 | break; |
| 17070 | |
| 17071 | default: |
| 17072 | WMI_LOGE("%s: unknown reason %d in tdls event %d from target", |
| 17073 | __func__, evt->peer_reason, evt->peer_status); |
| 17074 | return QDF_STATUS_E_INVAL; |
| 17075 | }; |
| 17076 | |
| 17077 | WMI_LOGD("%s: tdls event, peer: %pM, type: 0x%x, reason: %d, vdev: %d", |
| 17078 | __func__, param->peermac.bytes, param->message_type, |
| 17079 | param->peer_reason, param->vdev_id); |
| 17080 | |
| 17081 | return QDF_STATUS_SUCCESS; |
| 17082 | } |
| 17083 | #endif |
| 17084 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17085 | /** |
| 17086 | * extract_mgmt_tx_compl_param_tlv() - extract MGMT tx completion event params |
| 17087 | * @wmi_handle: wmi handle |
| 17088 | * @param evt_buf: pointer to event buffer |
| 17089 | * @param param: Pointer to hold MGMT TX completion params |
| 17090 | * |
| 17091 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17092 | */ |
| 17093 | static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle, |
| 17094 | void *evt_buf, wmi_host_mgmt_tx_compl_event *param) |
| 17095 | { |
| 17096 | WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 17097 | wmi_mgmt_tx_compl_event_fixed_param *cmpl_params; |
| 17098 | |
| 17099 | param_buf = (WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *) |
| 17100 | evt_buf; |
| 17101 | if (!param_buf) { |
| 17102 | WMI_LOGE("%s: Invalid mgmt Tx completion event", __func__); |
| 17103 | return QDF_STATUS_E_INVAL; |
| 17104 | } |
| 17105 | cmpl_params = param_buf->fixed_param; |
| 17106 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17107 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17108 | cmpl_params->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17109 | param->desc_id = cmpl_params->desc_id; |
| 17110 | param->status = cmpl_params->status; |
| 17111 | |
| 17112 | return QDF_STATUS_SUCCESS; |
| 17113 | } |
| 17114 | |
| 17115 | /** |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 17116 | * extract_offchan_data_tx_compl_param_tlv() - |
| 17117 | * extract Offchan data tx completion event params |
| 17118 | * @wmi_handle: wmi handle |
| 17119 | * @param evt_buf: pointer to event buffer |
| 17120 | * @param param: Pointer to hold offchan data TX completion params |
| 17121 | * |
| 17122 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17123 | */ |
| 17124 | static QDF_STATUS extract_offchan_data_tx_compl_param_tlv( |
| 17125 | wmi_unified_t wmi_handle, void *evt_buf, |
| 17126 | struct wmi_host_offchan_data_tx_compl_event *param) |
| 17127 | { |
| 17128 | WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 17129 | wmi_offchan_data_tx_compl_event_fixed_param *cmpl_params; |
| 17130 | |
| 17131 | param_buf = (WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *) |
| 17132 | evt_buf; |
| 17133 | if (!param_buf) { |
| 17134 | WMI_LOGE("%s: Invalid offchan data Tx compl event", __func__); |
| 17135 | return QDF_STATUS_E_INVAL; |
| 17136 | } |
| 17137 | cmpl_params = param_buf->fixed_param; |
| 17138 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17139 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17140 | cmpl_params->pdev_id); |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 17141 | param->desc_id = cmpl_params->desc_id; |
| 17142 | param->status = cmpl_params->status; |
| 17143 | |
| 17144 | return QDF_STATUS_SUCCESS; |
| 17145 | } |
| 17146 | |
| 17147 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 17148 | * extract_pdev_csa_switch_count_status_tlv() - extract pdev csa switch count |
| 17149 | * status tlv |
| 17150 | * @wmi_handle: wmi handle |
| 17151 | * @param evt_buf: pointer to event buffer |
| 17152 | * @param param: Pointer to hold csa switch count status event param |
| 17153 | * |
| 17154 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17155 | */ |
| 17156 | static QDF_STATUS extract_pdev_csa_switch_count_status_tlv( |
| 17157 | wmi_unified_t wmi_handle, |
| 17158 | void *evt_buf, |
| 17159 | struct pdev_csa_switch_count_status *param) |
| 17160 | { |
| 17161 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *param_buf; |
| 17162 | wmi_pdev_csa_switch_count_status_event_fixed_param *csa_status; |
| 17163 | |
| 17164 | param_buf = (WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *) |
| 17165 | evt_buf; |
| 17166 | if (!param_buf) { |
| 17167 | WMI_LOGE("%s: Invalid CSA status event\n", __func__); |
| 17168 | return QDF_STATUS_E_INVAL; |
| 17169 | } |
| 17170 | |
| 17171 | csa_status = param_buf->fixed_param; |
| 17172 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17173 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17174 | csa_status->pdev_id); |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 17175 | param->current_switch_count = csa_status->current_switch_count; |
| 17176 | param->num_vdevs = csa_status->num_vdevs; |
| 17177 | param->vdev_ids = param_buf->vdev_ids; |
| 17178 | |
| 17179 | return QDF_STATUS_SUCCESS; |
| 17180 | } |
| 17181 | |
| 17182 | /** |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17183 | * extract_swba_num_vdevs_tlv() - extract swba num vdevs from event |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17184 | * @wmi_handle: wmi handle |
| 17185 | * @param evt_buf: pointer to event buffer |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17186 | * @param num_vdevs: Pointer to hold num vdevs |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17187 | * |
| 17188 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17189 | */ |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17190 | static QDF_STATUS extract_swba_num_vdevs_tlv(wmi_unified_t wmi_handle, |
| 17191 | void *evt_buf, uint32_t *num_vdevs) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17192 | { |
| 17193 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 17194 | wmi_host_swba_event_fixed_param *swba_event; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17195 | uint32_t vdev_map; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17196 | |
| 17197 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 17198 | if (!param_buf) { |
| 17199 | WMI_LOGE("Invalid swba event buffer"); |
| 17200 | return QDF_STATUS_E_INVAL; |
| 17201 | } |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17202 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17203 | swba_event = param_buf->fixed_param; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17204 | *num_vdevs = swba_event->num_vdevs; |
| 17205 | if (!(*num_vdevs)) { |
| 17206 | vdev_map = swba_event->vdev_map; |
| 17207 | *num_vdevs = wmi_vdev_map_to_num_vdevs(vdev_map); |
| 17208 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17209 | |
| 17210 | return QDF_STATUS_SUCCESS; |
| 17211 | } |
| 17212 | |
| 17213 | /** |
| 17214 | * extract_swba_tim_info_tlv() - extract swba tim info from event |
| 17215 | * @wmi_handle: wmi handle |
| 17216 | * @param evt_buf: pointer to event buffer |
| 17217 | * @param idx: Index to bcn info |
| 17218 | * @param tim_info: Pointer to hold tim info |
| 17219 | * |
| 17220 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17221 | */ |
| 17222 | static QDF_STATUS extract_swba_tim_info_tlv(wmi_unified_t wmi_handle, |
| 17223 | void *evt_buf, uint32_t idx, wmi_host_tim_info *tim_info) |
| 17224 | { |
| 17225 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 17226 | wmi_tim_info *tim_info_ev; |
| 17227 | |
| 17228 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 17229 | if (!param_buf) { |
| 17230 | WMI_LOGE("Invalid swba event buffer"); |
| 17231 | return QDF_STATUS_E_INVAL; |
| 17232 | } |
| 17233 | |
| 17234 | tim_info_ev = ¶m_buf->tim_info[idx]; |
| 17235 | |
| 17236 | tim_info->tim_len = tim_info_ev->tim_len; |
| 17237 | tim_info->tim_mcast = tim_info_ev->tim_mcast; |
| 17238 | qdf_mem_copy(tim_info->tim_bitmap, tim_info_ev->tim_bitmap, |
| 17239 | (sizeof(uint32_t) * WMI_TIM_BITMAP_ARRAY_SIZE)); |
| 17240 | tim_info->tim_changed = tim_info_ev->tim_changed; |
| 17241 | tim_info->tim_num_ps_pending = tim_info_ev->tim_num_ps_pending; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17242 | tim_info->vdev_id = tim_info_ev->vdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17243 | |
| 17244 | return QDF_STATUS_SUCCESS; |
| 17245 | } |
| 17246 | |
| 17247 | /** |
| 17248 | * extract_swba_noa_info_tlv() - extract swba NoA information from event |
| 17249 | * @wmi_handle: wmi handle |
| 17250 | * @param evt_buf: pointer to event buffer |
| 17251 | * @param idx: Index to bcn info |
| 17252 | * @param p2p_desc: Pointer to hold p2p NoA info |
| 17253 | * |
| 17254 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17255 | */ |
| 17256 | static QDF_STATUS extract_swba_noa_info_tlv(wmi_unified_t wmi_handle, |
| 17257 | void *evt_buf, uint32_t idx, wmi_host_p2p_noa_info *p2p_desc) |
| 17258 | { |
| 17259 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 17260 | wmi_p2p_noa_info *p2p_noa_info; |
| 17261 | uint8_t i = 0; |
| 17262 | |
| 17263 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 17264 | if (!param_buf) { |
| 17265 | WMI_LOGE("Invalid swba event buffer"); |
| 17266 | return QDF_STATUS_E_INVAL; |
| 17267 | } |
| 17268 | |
| 17269 | p2p_noa_info = ¶m_buf->p2p_noa_info[idx]; |
| 17270 | |
| 17271 | p2p_desc->modified = false; |
| 17272 | p2p_desc->num_descriptors = 0; |
| 17273 | if (WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(p2p_noa_info)) { |
| 17274 | p2p_desc->modified = true; |
| 17275 | p2p_desc->index = |
| 17276 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(p2p_noa_info); |
| 17277 | p2p_desc->oppPS = |
| 17278 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(p2p_noa_info); |
| 17279 | p2p_desc->ctwindow = |
| 17280 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(p2p_noa_info); |
| 17281 | p2p_desc->num_descriptors = |
| 17282 | (uint8_t) WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET |
| 17283 | (p2p_noa_info); |
| 17284 | for (i = 0; i < p2p_desc->num_descriptors; i++) { |
| 17285 | p2p_desc->noa_descriptors[i].type_count = |
| 17286 | (uint8_t) p2p_noa_info->noa_descriptors[i]. |
| 17287 | type_count; |
| 17288 | p2p_desc->noa_descriptors[i].duration = |
| 17289 | p2p_noa_info->noa_descriptors[i].duration; |
| 17290 | p2p_desc->noa_descriptors[i].interval = |
| 17291 | p2p_noa_info->noa_descriptors[i].interval; |
| 17292 | p2p_desc->noa_descriptors[i].start_time = |
| 17293 | p2p_noa_info->noa_descriptors[i].start_time; |
| 17294 | } |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17295 | p2p_desc->vdev_id = p2p_noa_info->vdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17296 | } |
| 17297 | |
| 17298 | return QDF_STATUS_SUCCESS; |
| 17299 | } |
| 17300 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 17301 | #ifdef CONVERGED_P2P_ENABLE |
| 17302 | /** |
| 17303 | * extract_p2p_noa_ev_param_tlv() - extract p2p noa information from event |
| 17304 | * @wmi_handle: wmi handle |
| 17305 | * @param evt_buf: pointer to event buffer |
| 17306 | * @param param: Pointer to hold p2p noa info |
| 17307 | * |
| 17308 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17309 | */ |
| 17310 | static QDF_STATUS extract_p2p_noa_ev_param_tlv( |
| 17311 | wmi_unified_t wmi_handle, void *evt_buf, |
| 17312 | struct p2p_noa_info *param) |
| 17313 | { |
| 17314 | WMI_P2P_NOA_EVENTID_param_tlvs *param_tlvs; |
| 17315 | wmi_p2p_noa_event_fixed_param *fixed_param; |
| 17316 | uint8_t i; |
| 17317 | wmi_p2p_noa_info *wmi_noa_info; |
| 17318 | uint8_t *buf_ptr; |
| 17319 | uint32_t descriptors; |
| 17320 | |
| 17321 | param_tlvs = (WMI_P2P_NOA_EVENTID_param_tlvs *) evt_buf; |
| 17322 | if (!param_tlvs) { |
| 17323 | WMI_LOGE("%s: Invalid P2P NoA event buffer", __func__); |
| 17324 | return QDF_STATUS_E_INVAL; |
| 17325 | } |
| 17326 | |
| 17327 | if (!param) { |
| 17328 | WMI_LOGE("noa information param is null"); |
| 17329 | return QDF_STATUS_E_INVAL; |
| 17330 | } |
| 17331 | |
| 17332 | fixed_param = param_tlvs->fixed_param; |
| 17333 | buf_ptr = (uint8_t *) fixed_param; |
| 17334 | buf_ptr += sizeof(wmi_p2p_noa_event_fixed_param); |
| 17335 | wmi_noa_info = (wmi_p2p_noa_info *) (buf_ptr); |
| 17336 | |
| 17337 | if (!WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(wmi_noa_info)) { |
| 17338 | WMI_LOGE("%s: noa attr is not modified", __func__); |
| 17339 | return QDF_STATUS_E_INVAL; |
| 17340 | } |
| 17341 | |
| 17342 | param->vdev_id = fixed_param->vdev_id; |
| 17343 | param->index = |
| 17344 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(wmi_noa_info); |
| 17345 | param->opps_ps = |
| 17346 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(wmi_noa_info); |
| 17347 | param->ct_window = |
| 17348 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(wmi_noa_info); |
| 17349 | descriptors = WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET(wmi_noa_info); |
| 17350 | param->num_desc = (uint8_t) descriptors; |
| 17351 | |
| 17352 | WMI_LOGD("%s:index %u, opps_ps %u, ct_window %u, num_descriptors = %u", __func__, |
| 17353 | param->index, param->opps_ps, param->ct_window, |
| 17354 | param->num_desc); |
| 17355 | for (i = 0; i < param->num_desc; i++) { |
| 17356 | param->noa_desc[i].type_count = |
| 17357 | (uint8_t) wmi_noa_info->noa_descriptors[i]. |
| 17358 | type_count; |
| 17359 | param->noa_desc[i].duration = |
| 17360 | wmi_noa_info->noa_descriptors[i].duration; |
| 17361 | param->noa_desc[i].interval = |
| 17362 | wmi_noa_info->noa_descriptors[i].interval; |
| 17363 | param->noa_desc[i].start_time = |
| 17364 | wmi_noa_info->noa_descriptors[i].start_time; |
| 17365 | WMI_LOGD("%s:NoA descriptor[%d] type_count %u, duration %u, interval %u, start_time = %u", |
| 17366 | __func__, i, param->noa_desc[i].type_count, |
| 17367 | param->noa_desc[i].duration, |
| 17368 | param->noa_desc[i].interval, |
| 17369 | param->noa_desc[i].start_time); |
| 17370 | } |
| 17371 | |
| 17372 | return QDF_STATUS_SUCCESS; |
| 17373 | } |
| 17374 | |
| 17375 | /** |
| 17376 | * extract_p2p_lo_stop_ev_param_tlv() - extract p2p lo stop |
| 17377 | * information from event |
| 17378 | * @wmi_handle: wmi handle |
| 17379 | * @param evt_buf: pointer to event buffer |
| 17380 | * @param param: Pointer to hold p2p lo stop event information |
| 17381 | * |
| 17382 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17383 | */ |
| 17384 | static QDF_STATUS extract_p2p_lo_stop_ev_param_tlv( |
| 17385 | wmi_unified_t wmi_handle, void *evt_buf, |
| 17386 | struct p2p_lo_event *param) |
| 17387 | { |
| 17388 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *param_tlvs; |
| 17389 | wmi_p2p_lo_stopped_event_fixed_param *lo_param; |
| 17390 | |
| 17391 | param_tlvs = (WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *) |
| 17392 | evt_buf; |
| 17393 | if (!param_tlvs) { |
| 17394 | WMI_LOGE("%s: Invalid P2P lo stop event buffer", __func__); |
| 17395 | return QDF_STATUS_E_INVAL; |
| 17396 | } |
| 17397 | |
| 17398 | if (!param) { |
| 17399 | WMI_LOGE("lo stop event param is null"); |
| 17400 | return QDF_STATUS_E_INVAL; |
| 17401 | } |
| 17402 | |
| 17403 | lo_param = param_tlvs->fixed_param; |
| 17404 | param->vdev_id = lo_param->vdev_id; |
| 17405 | param->reason_code = lo_param->reason; |
| 17406 | WMI_LOGD("%s: vdev_id:%d, reason:%d", __func__, |
| 17407 | param->vdev_id, param->reason_code); |
| 17408 | |
| 17409 | return QDF_STATUS_SUCCESS; |
| 17410 | } |
| 17411 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 17412 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17413 | /** |
| 17414 | * extract_peer_sta_kickout_ev_tlv() - extract peer sta kickout event |
| 17415 | * @wmi_handle: wmi handle |
| 17416 | * @param evt_buf: pointer to event buffer |
| 17417 | * @param ev: Pointer to hold peer param |
| 17418 | * |
| 17419 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17420 | */ |
| 17421 | static QDF_STATUS extract_peer_sta_kickout_ev_tlv(wmi_unified_t wmi_handle, |
| 17422 | void *evt_buf, wmi_host_peer_sta_kickout_event *ev) |
| 17423 | { |
| 17424 | WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *param_buf = NULL; |
| 17425 | wmi_peer_sta_kickout_event_fixed_param *kickout_event = NULL; |
| 17426 | |
| 17427 | param_buf = (WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *) evt_buf; |
| 17428 | kickout_event = param_buf->fixed_param; |
| 17429 | |
| 17430 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&kickout_event->peer_macaddr, |
| 17431 | ev->peer_macaddr); |
| 17432 | |
| 17433 | ev->reason = kickout_event->reason; |
| 17434 | ev->rssi = kickout_event->rssi; |
| 17435 | |
| 17436 | return QDF_STATUS_SUCCESS; |
| 17437 | } |
| 17438 | |
| 17439 | /** |
| 17440 | * extract_all_stats_counts_tlv() - extract all stats count from event |
| 17441 | * @wmi_handle: wmi handle |
| 17442 | * @param evt_buf: pointer to event buffer |
| 17443 | * @param stats_param: Pointer to hold stats count |
| 17444 | * |
| 17445 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17446 | */ |
| 17447 | static QDF_STATUS extract_all_stats_counts_tlv(wmi_unified_t wmi_handle, |
| 17448 | void *evt_buf, wmi_host_stats_event *stats_param) |
| 17449 | { |
| 17450 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17451 | wmi_stats_event_fixed_param *ev; |
| 17452 | |
| 17453 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17454 | |
| 17455 | ev = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17456 | if (!ev) { |
| 17457 | WMI_LOGE("%s: Failed to alloc memory\n", __func__); |
| 17458 | return QDF_STATUS_E_FAILURE; |
| 17459 | } |
| 17460 | |
| 17461 | switch (ev->stats_id) { |
| 17462 | case WMI_REQUEST_PEER_STAT: |
| 17463 | stats_param->stats_id = WMI_HOST_REQUEST_PEER_STAT; |
| 17464 | break; |
| 17465 | |
| 17466 | case WMI_REQUEST_AP_STAT: |
| 17467 | stats_param->stats_id = WMI_HOST_REQUEST_AP_STAT; |
| 17468 | break; |
| 17469 | |
| 17470 | case WMI_REQUEST_PDEV_STAT: |
| 17471 | stats_param->stats_id = WMI_HOST_REQUEST_PDEV_STAT; |
| 17472 | break; |
| 17473 | |
| 17474 | case WMI_REQUEST_VDEV_STAT: |
| 17475 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_STAT; |
| 17476 | break; |
| 17477 | |
| 17478 | case WMI_REQUEST_BCNFLT_STAT: |
| 17479 | stats_param->stats_id = WMI_HOST_REQUEST_BCNFLT_STAT; |
| 17480 | break; |
| 17481 | |
| 17482 | case WMI_REQUEST_VDEV_RATE_STAT: |
| 17483 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT; |
| 17484 | break; |
| 17485 | |
| 17486 | default: |
| 17487 | stats_param->stats_id = 0; |
| 17488 | break; |
| 17489 | |
| 17490 | } |
| 17491 | |
| 17492 | stats_param->num_pdev_stats = ev->num_pdev_stats; |
| 17493 | stats_param->num_pdev_ext_stats = 0; |
| 17494 | stats_param->num_vdev_stats = ev->num_vdev_stats; |
| 17495 | stats_param->num_peer_stats = ev->num_peer_stats; |
| 17496 | stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; |
| 17497 | stats_param->num_chan_stats = ev->num_chan_stats; |
Gurumoorthi Gnanasambandhan | 305aeae | 2017-08-10 22:12:36 +0530 | [diff] [blame] | 17498 | stats_param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17499 | ev->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17500 | |
| 17501 | return QDF_STATUS_SUCCESS; |
| 17502 | } |
| 17503 | |
| 17504 | /** |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 17505 | * extract_pdev_tx_stats() - extract pdev tx stats from event |
| 17506 | */ |
| 17507 | static void extract_pdev_tx_stats(wmi_host_dbg_tx_stats *tx, struct wlan_dbg_tx_stats *tx_stats) |
| 17508 | { |
| 17509 | /* Tx Stats */ |
| 17510 | tx->comp_queued = tx_stats->comp_queued; |
| 17511 | tx->comp_delivered = tx_stats->comp_delivered; |
| 17512 | tx->msdu_enqued = tx_stats->msdu_enqued; |
| 17513 | tx->mpdu_enqued = tx_stats->mpdu_enqued; |
| 17514 | tx->wmm_drop = tx_stats->wmm_drop; |
| 17515 | tx->local_enqued = tx_stats->local_enqued; |
| 17516 | tx->local_freed = tx_stats->local_freed; |
| 17517 | tx->hw_queued = tx_stats->hw_queued; |
| 17518 | tx->hw_reaped = tx_stats->hw_reaped; |
| 17519 | tx->underrun = tx_stats->underrun; |
| 17520 | tx->tx_abort = tx_stats->tx_abort; |
| 17521 | tx->mpdus_requed = tx_stats->mpdus_requed; |
| 17522 | tx->data_rc = tx_stats->data_rc; |
| 17523 | tx->self_triggers = tx_stats->self_triggers; |
| 17524 | tx->sw_retry_failure = tx_stats->sw_retry_failure; |
| 17525 | tx->illgl_rate_phy_err = tx_stats->illgl_rate_phy_err; |
| 17526 | tx->pdev_cont_xretry = tx_stats->pdev_cont_xretry; |
| 17527 | tx->pdev_tx_timeout = tx_stats->pdev_tx_timeout; |
| 17528 | tx->pdev_resets = tx_stats->pdev_resets; |
| 17529 | tx->stateless_tid_alloc_failure = tx_stats->stateless_tid_alloc_failure; |
| 17530 | tx->phy_underrun = tx_stats->phy_underrun; |
| 17531 | tx->txop_ovf = tx_stats->txop_ovf; |
| 17532 | |
| 17533 | return; |
| 17534 | } |
| 17535 | |
| 17536 | |
| 17537 | /** |
| 17538 | * extract_pdev_rx_stats() - extract pdev rx stats from event |
| 17539 | */ |
| 17540 | static void extract_pdev_rx_stats(wmi_host_dbg_rx_stats *rx, struct wlan_dbg_rx_stats *rx_stats) |
| 17541 | { |
| 17542 | /* Rx Stats */ |
| 17543 | rx->mid_ppdu_route_change = rx_stats->mid_ppdu_route_change; |
| 17544 | rx->status_rcvd = rx_stats->status_rcvd; |
| 17545 | rx->r0_frags = rx_stats->r0_frags; |
| 17546 | rx->r1_frags = rx_stats->r1_frags; |
| 17547 | rx->r2_frags = rx_stats->r2_frags; |
| 17548 | /* Only TLV */ |
| 17549 | rx->r3_frags = 0; |
| 17550 | rx->htt_msdus = rx_stats->htt_msdus; |
| 17551 | rx->htt_mpdus = rx_stats->htt_mpdus; |
| 17552 | rx->loc_msdus = rx_stats->loc_msdus; |
| 17553 | rx->loc_mpdus = rx_stats->loc_mpdus; |
| 17554 | rx->oversize_amsdu = rx_stats->oversize_amsdu; |
| 17555 | rx->phy_errs = rx_stats->phy_errs; |
| 17556 | rx->phy_err_drop = rx_stats->phy_err_drop; |
| 17557 | rx->mpdu_errs = rx_stats->mpdu_errs; |
| 17558 | |
| 17559 | return; |
| 17560 | } |
| 17561 | |
| 17562 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17563 | * extract_pdev_stats_tlv() - extract pdev stats from event |
| 17564 | * @wmi_handle: wmi handle |
| 17565 | * @param evt_buf: pointer to event buffer |
| 17566 | * @param index: Index into pdev stats |
| 17567 | * @param pdev_stats: Pointer to hold pdev stats |
| 17568 | * |
| 17569 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17570 | */ |
| 17571 | static QDF_STATUS extract_pdev_stats_tlv(wmi_unified_t wmi_handle, |
| 17572 | void *evt_buf, uint32_t index, wmi_host_pdev_stats *pdev_stats) |
| 17573 | { |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 17574 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17575 | wmi_stats_event_fixed_param *ev_param; |
| 17576 | uint8_t *data; |
| 17577 | |
| 17578 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17579 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17580 | |
| 17581 | data = param_buf->data; |
| 17582 | |
| 17583 | if (index < ev_param->num_pdev_stats) { |
| 17584 | wmi_pdev_stats *ev = (wmi_pdev_stats *) ((data) + |
| 17585 | (index * sizeof(wmi_pdev_stats))); |
| 17586 | |
| 17587 | pdev_stats->chan_nf = ev->chan_nf; |
| 17588 | pdev_stats->tx_frame_count = ev->tx_frame_count; |
| 17589 | pdev_stats->rx_frame_count = ev->rx_frame_count; |
| 17590 | pdev_stats->rx_clear_count = ev->rx_clear_count; |
| 17591 | pdev_stats->cycle_count = ev->cycle_count; |
| 17592 | pdev_stats->phy_err_count = ev->phy_err_count; |
| 17593 | pdev_stats->chan_tx_pwr = ev->chan_tx_pwr; |
| 17594 | |
| 17595 | extract_pdev_tx_stats(&(pdev_stats->pdev_stats.tx), |
| 17596 | &(ev->pdev_stats.tx)); |
| 17597 | extract_pdev_rx_stats(&(pdev_stats->pdev_stats.rx), |
| 17598 | &(ev->pdev_stats.rx)); |
| 17599 | } |
| 17600 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17601 | return QDF_STATUS_SUCCESS; |
| 17602 | } |
| 17603 | |
| 17604 | /** |
| 17605 | * extract_pdev_ext_stats_tlv() - extract extended pdev stats from event |
| 17606 | * @wmi_handle: wmi handle |
| 17607 | * @param evt_buf: pointer to event buffer |
| 17608 | * @param index: Index into extended pdev stats |
| 17609 | * @param pdev_ext_stats: Pointer to hold extended pdev stats |
| 17610 | * |
| 17611 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17612 | */ |
| 17613 | static QDF_STATUS extract_pdev_ext_stats_tlv(wmi_unified_t wmi_handle, |
| 17614 | void *evt_buf, uint32_t index, wmi_host_pdev_ext_stats *pdev_ext_stats) |
| 17615 | { |
| 17616 | return QDF_STATUS_SUCCESS; |
| 17617 | } |
| 17618 | |
| 17619 | /** |
| 17620 | * extract_vdev_stats_tlv() - extract vdev stats from event |
| 17621 | * @wmi_handle: wmi handle |
| 17622 | * @param evt_buf: pointer to event buffer |
| 17623 | * @param index: Index into vdev stats |
| 17624 | * @param vdev_stats: Pointer to hold vdev stats |
| 17625 | * |
| 17626 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17627 | */ |
| 17628 | static QDF_STATUS extract_vdev_stats_tlv(wmi_unified_t wmi_handle, |
| 17629 | void *evt_buf, uint32_t index, wmi_host_vdev_stats *vdev_stats) |
| 17630 | { |
| 17631 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17632 | wmi_stats_event_fixed_param *ev_param; |
| 17633 | uint8_t *data; |
| 17634 | |
| 17635 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17636 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17637 | data = (uint8_t *) param_buf->data; |
| 17638 | |
| 17639 | if (index < ev_param->num_vdev_stats) { |
| 17640 | wmi_vdev_stats *ev = (wmi_vdev_stats *) ((data) + |
| 17641 | ((ev_param->num_pdev_stats) * |
| 17642 | sizeof(wmi_pdev_stats)) + |
| 17643 | (index * sizeof(wmi_vdev_stats))); |
| 17644 | |
| 17645 | vdev_stats->vdev_id = ev->vdev_id; |
| 17646 | vdev_stats->vdev_snr.bcn_snr = ev->vdev_snr.bcn_snr; |
| 17647 | vdev_stats->vdev_snr.dat_snr = ev->vdev_snr.dat_snr; |
| 17648 | |
| 17649 | OS_MEMCPY(vdev_stats->tx_frm_cnt, ev->tx_frm_cnt, |
| 17650 | sizeof(ev->tx_frm_cnt)); |
| 17651 | vdev_stats->rx_frm_cnt = ev->rx_frm_cnt; |
| 17652 | OS_MEMCPY(vdev_stats->multiple_retry_cnt, |
| 17653 | ev->multiple_retry_cnt, |
| 17654 | sizeof(ev->multiple_retry_cnt)); |
| 17655 | OS_MEMCPY(vdev_stats->fail_cnt, ev->fail_cnt, |
| 17656 | sizeof(ev->fail_cnt)); |
| 17657 | vdev_stats->rts_fail_cnt = ev->rts_fail_cnt; |
| 17658 | vdev_stats->rts_succ_cnt = ev->rts_succ_cnt; |
| 17659 | vdev_stats->rx_err_cnt = ev->rx_err_cnt; |
| 17660 | vdev_stats->rx_discard_cnt = ev->rx_discard_cnt; |
| 17661 | vdev_stats->ack_fail_cnt = ev->ack_fail_cnt; |
| 17662 | OS_MEMCPY(vdev_stats->tx_rate_history, ev->tx_rate_history, |
| 17663 | sizeof(ev->tx_rate_history)); |
| 17664 | OS_MEMCPY(vdev_stats->bcn_rssi_history, ev->bcn_rssi_history, |
| 17665 | sizeof(ev->bcn_rssi_history)); |
| 17666 | |
| 17667 | } |
| 17668 | |
| 17669 | return QDF_STATUS_SUCCESS; |
| 17670 | } |
| 17671 | |
| 17672 | /** |
| 17673 | * extract_peer_stats_tlv() - extract peer stats from event |
| 17674 | * @wmi_handle: wmi handle |
| 17675 | * @param evt_buf: pointer to event buffer |
| 17676 | * @param index: Index into peer stats |
| 17677 | * @param peer_stats: Pointer to hold peer stats |
| 17678 | * |
| 17679 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17680 | */ |
| 17681 | static QDF_STATUS extract_peer_stats_tlv(wmi_unified_t wmi_handle, |
| 17682 | void *evt_buf, uint32_t index, wmi_host_peer_stats *peer_stats) |
| 17683 | { |
| 17684 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17685 | wmi_stats_event_fixed_param *ev_param; |
| 17686 | uint8_t *data; |
| 17687 | |
| 17688 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17689 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17690 | data = (uint8_t *) param_buf->data; |
| 17691 | |
| 17692 | if (index < ev_param->num_peer_stats) { |
| 17693 | wmi_peer_stats *ev = (wmi_peer_stats *) ((data) + |
| 17694 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 17695 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 17696 | (index * sizeof(wmi_peer_stats))); |
| 17697 | |
| 17698 | OS_MEMSET(peer_stats, 0, sizeof(wmi_host_peer_stats)); |
| 17699 | |
| 17700 | OS_MEMCPY(&(peer_stats->peer_macaddr), |
| 17701 | &(ev->peer_macaddr), sizeof(wmi_mac_addr)); |
| 17702 | |
| 17703 | peer_stats->peer_rssi = ev->peer_rssi; |
| 17704 | peer_stats->peer_tx_rate = ev->peer_tx_rate; |
| 17705 | peer_stats->peer_rx_rate = ev->peer_rx_rate; |
| 17706 | } |
| 17707 | |
| 17708 | return QDF_STATUS_SUCCESS; |
| 17709 | } |
| 17710 | |
| 17711 | /** |
| 17712 | * extract_bcnflt_stats_tlv() - extract bcn fault stats from event |
| 17713 | * @wmi_handle: wmi handle |
| 17714 | * @param evt_buf: pointer to event buffer |
| 17715 | * @param index: Index into bcn fault stats |
| 17716 | * @param bcnflt_stats: Pointer to hold bcn fault stats |
| 17717 | * |
| 17718 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17719 | */ |
| 17720 | static QDF_STATUS extract_bcnflt_stats_tlv(wmi_unified_t wmi_handle, |
| 17721 | void *evt_buf, uint32_t index, wmi_host_bcnflt_stats *peer_stats) |
| 17722 | { |
| 17723 | return QDF_STATUS_SUCCESS; |
| 17724 | } |
| 17725 | |
| 17726 | /** |
| 17727 | * extract_peer_extd_stats_tlv() - extract extended peer stats from event |
| 17728 | * @wmi_handle: wmi handle |
| 17729 | * @param evt_buf: pointer to event buffer |
| 17730 | * @param index: Index into extended peer stats |
| 17731 | * @param peer_extd_stats: Pointer to hold extended peer stats |
| 17732 | * |
| 17733 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17734 | */ |
| 17735 | static QDF_STATUS extract_peer_extd_stats_tlv(wmi_unified_t wmi_handle, |
| 17736 | void *evt_buf, uint32_t index, |
| 17737 | wmi_host_peer_extd_stats *peer_extd_stats) |
| 17738 | { |
| 17739 | return QDF_STATUS_SUCCESS; |
| 17740 | } |
| 17741 | |
| 17742 | /** |
| 17743 | * extract_chan_stats_tlv() - extract chan stats from event |
| 17744 | * @wmi_handle: wmi handle |
| 17745 | * @param evt_buf: pointer to event buffer |
| 17746 | * @param index: Index into chan stats |
| 17747 | * @param vdev_extd_stats: Pointer to hold chan stats |
| 17748 | * |
| 17749 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17750 | */ |
| 17751 | static QDF_STATUS extract_chan_stats_tlv(wmi_unified_t wmi_handle, |
| 17752 | void *evt_buf, uint32_t index, wmi_host_chan_stats *chan_stats) |
| 17753 | { |
| 17754 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17755 | wmi_stats_event_fixed_param *ev_param; |
| 17756 | uint8_t *data; |
| 17757 | |
| 17758 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17759 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17760 | data = (uint8_t *) param_buf->data; |
| 17761 | |
| 17762 | if (index < ev_param->num_chan_stats) { |
| 17763 | wmi_chan_stats *ev = (wmi_chan_stats *) ((data) + |
| 17764 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 17765 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 17766 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 17767 | (index * sizeof(wmi_chan_stats))); |
| 17768 | |
| 17769 | |
| 17770 | /* Non-TLV doesnt have num_chan_stats */ |
| 17771 | chan_stats->chan_mhz = ev->chan_mhz; |
| 17772 | chan_stats->sampling_period_us = ev->sampling_period_us; |
| 17773 | chan_stats->rx_clear_count = ev->rx_clear_count; |
| 17774 | chan_stats->tx_duration_us = ev->tx_duration_us; |
| 17775 | chan_stats->rx_duration_us = ev->rx_duration_us; |
| 17776 | } |
| 17777 | |
| 17778 | return QDF_STATUS_SUCCESS; |
| 17779 | } |
| 17780 | |
| 17781 | /** |
| 17782 | * extract_profile_ctx_tlv() - extract profile context from event |
| 17783 | * @wmi_handle: wmi handle |
| 17784 | * @param evt_buf: pointer to event buffer |
| 17785 | * @idx: profile stats index to extract |
| 17786 | * @param profile_ctx: Pointer to hold profile context |
| 17787 | * |
| 17788 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17789 | */ |
| 17790 | static QDF_STATUS extract_profile_ctx_tlv(wmi_unified_t wmi_handle, |
| 17791 | void *evt_buf, wmi_host_wlan_profile_ctx_t *profile_ctx) |
| 17792 | { |
| 17793 | return QDF_STATUS_SUCCESS; |
| 17794 | } |
| 17795 | |
| 17796 | /** |
| 17797 | * extract_profile_data_tlv() - extract profile data from event |
| 17798 | * @wmi_handle: wmi handle |
| 17799 | * @param evt_buf: pointer to event buffer |
| 17800 | * @param profile_data: Pointer to hold profile data |
| 17801 | * |
| 17802 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17803 | */ |
| 17804 | static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, |
| 17805 | void *evt_buf, uint8_t idx, wmi_host_wlan_profile_t *profile_data) |
| 17806 | { |
| 17807 | |
| 17808 | return QDF_STATUS_SUCCESS; |
| 17809 | } |
| 17810 | |
| 17811 | /** |
| 17812 | * extract_chan_info_event_tlv() - extract chan information from event |
| 17813 | * @wmi_handle: wmi handle |
| 17814 | * @param evt_buf: pointer to event buffer |
| 17815 | * @param chan_info: Pointer to hold chan information |
| 17816 | * |
| 17817 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17818 | */ |
| 17819 | static QDF_STATUS extract_chan_info_event_tlv(wmi_unified_t wmi_handle, |
| 17820 | void *evt_buf, wmi_host_chan_info_event *chan_info) |
| 17821 | { |
| 17822 | WMI_CHAN_INFO_EVENTID_param_tlvs *param_buf; |
| 17823 | wmi_chan_info_event_fixed_param *ev; |
| 17824 | |
| 17825 | param_buf = (WMI_CHAN_INFO_EVENTID_param_tlvs *) evt_buf; |
| 17826 | |
| 17827 | ev = (wmi_chan_info_event_fixed_param *) param_buf->fixed_param; |
| 17828 | if (!ev) { |
| 17829 | WMI_LOGE("%s: Failed to allocmemory\n", __func__); |
| 17830 | return QDF_STATUS_E_FAILURE; |
| 17831 | } |
| 17832 | |
| 17833 | chan_info->err_code = ev->err_code; |
| 17834 | chan_info->freq = ev->freq; |
| 17835 | chan_info->cmd_flags = ev->cmd_flags; |
| 17836 | chan_info->noise_floor = ev->noise_floor; |
| 17837 | chan_info->rx_clear_count = ev->rx_clear_count; |
| 17838 | chan_info->cycle_count = ev->cycle_count; |
Edayilliam Jayadev | 5d161a9 | 2017-09-22 13:21:03 +0530 | [diff] [blame] | 17839 | chan_info->tx_frame_cnt = ev->tx_frame_cnt; |
| 17840 | chan_info->mac_clk_mhz = ev->mac_clk_mhz; |
Sathish Kumar | 87db1bd | 2017-05-08 12:35:55 +0530 | [diff] [blame] | 17841 | chan_info->pdev_id = wlan_get_pdev_id_from_vdev_id( |
| 17842 | (struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc, |
| 17843 | ev->vdev_id, WLAN_SCAN_ID); |
Kiran Venkatappa | da3eae6 | 2017-08-10 17:48:37 +0530 | [diff] [blame] | 17844 | chan_info->chan_tx_pwr_range = ev->chan_tx_pwr_range; |
| 17845 | chan_info->chan_tx_pwr_tp = ev->chan_tx_pwr_tp; |
| 17846 | chan_info->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count; |
| 17847 | chan_info->rx_11b_mode_data_duration = ev->rx_11b_mode_data_duration; |
| 17848 | chan_info->tx_frame_cnt = ev->tx_frame_cnt; |
| 17849 | chan_info->rx_frame_count = ev->rx_frame_count; |
| 17850 | chan_info->mac_clk_mhz = ev->mac_clk_mhz; |
| 17851 | chan_info->vdev_id = ev->vdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17852 | |
| 17853 | return QDF_STATUS_SUCCESS; |
| 17854 | } |
| 17855 | |
| 17856 | /** |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 17857 | * extract_pdev_utf_event_tlv() - extract UTF data info from event |
| 17858 | * @wmi_handle: WMI handle |
| 17859 | * @param evt_buf: Pointer to event buffer |
| 17860 | * @param param: Pointer to hold data |
| 17861 | * |
| 17862 | * Return : QDF_STATUS_SUCCESS for success or error code |
| 17863 | */ |
| 17864 | static QDF_STATUS extract_pdev_utf_event_tlv(wmi_unified_t wmi_handle, |
| 17865 | uint8_t *evt_buf, |
| 17866 | struct wmi_host_pdev_utf_event *event) |
| 17867 | { |
| 17868 | WMI_PDEV_UTF_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 17869 | struct wmi_host_utf_seg_header_info *seg_hdr; |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 17870 | |
| 17871 | param_buf = (WMI_PDEV_UTF_EVENTID_param_tlvs *)evt_buf; |
| 17872 | event->data = param_buf->data; |
| 17873 | event->datalen = param_buf->num_data; |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 17874 | seg_hdr = (struct wmi_host_utf_seg_header_info *)param_buf->data; |
Kiran Venkatappa | 15978c6 | 2017-02-28 12:42:36 +0530 | [diff] [blame] | 17875 | /* Set pdev_id=1 until FW adds support to include pdev_id */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17876 | event->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 17877 | seg_hdr->pdev_id); |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 17878 | |
| 17879 | return QDF_STATUS_SUCCESS; |
| 17880 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17881 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17882 | /** |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 17883 | * extract_chainmask_tables_tlv() - extract chain mask tables from event |
| 17884 | * @wmi_handle: wmi handle |
| 17885 | * @param evt_buf: pointer to event buffer |
| 17886 | * @param param: Pointer to hold evt buf |
| 17887 | * |
| 17888 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17889 | */ |
| 17890 | static QDF_STATUS extract_chainmask_tables_tlv(wmi_unified_t wmi_handle, |
| 17891 | uint8_t *event, struct wlan_psoc_host_chainmask_table *chainmask_table) |
| 17892 | { |
| 17893 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 17894 | WMI_MAC_PHY_CHAINMASK_CAPABILITY *chainmask_caps; |
| 17895 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 17896 | uint8_t i = 0, j = 0; |
| 17897 | |
| 17898 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 17899 | if (!param_buf) |
| 17900 | return QDF_STATUS_E_INVAL; |
| 17901 | |
| 17902 | hw_caps = param_buf->soc_hw_mode_caps; |
| 17903 | if (!hw_caps) |
| 17904 | return QDF_STATUS_E_INVAL; |
| 17905 | |
| 17906 | if (!hw_caps->num_chainmask_tables) |
| 17907 | return QDF_STATUS_E_INVAL; |
| 17908 | |
| 17909 | chainmask_caps = param_buf->mac_phy_chainmask_caps; |
| 17910 | |
| 17911 | if (chainmask_caps == NULL) |
| 17912 | return QDF_STATUS_E_INVAL; |
| 17913 | |
| 17914 | for (i = 0; i < hw_caps->num_chainmask_tables; i++) { |
| 17915 | |
| 17916 | qdf_print("Dumping chain mask combo data for table : %d\n", i); |
| 17917 | for (j = 0; j < chainmask_table[i].num_valid_chainmasks; j++) { |
| 17918 | |
| 17919 | chainmask_table[i].cap_list[j].chainmask = |
| 17920 | chainmask_caps->chainmask; |
| 17921 | |
| 17922 | chainmask_table[i].cap_list[j].supports_chan_width_20 = |
| 17923 | WMI_SUPPORT_CHAN_WIDTH_20_GET(chainmask_caps->supported_flags); |
| 17924 | |
| 17925 | chainmask_table[i].cap_list[j].supports_chan_width_40 = |
| 17926 | WMI_SUPPORT_CHAN_WIDTH_40_GET(chainmask_caps->supported_flags); |
| 17927 | |
| 17928 | chainmask_table[i].cap_list[j].supports_chan_width_80 = |
| 17929 | WMI_SUPPORT_CHAN_WIDTH_80_GET(chainmask_caps->supported_flags); |
| 17930 | |
| 17931 | chainmask_table[i].cap_list[j].supports_chan_width_160 = |
| 17932 | WMI_SUPPORT_CHAN_WIDTH_160_GET(chainmask_caps->supported_flags); |
| 17933 | |
| 17934 | chainmask_table[i].cap_list[j].supports_chan_width_80P80 = |
| 17935 | WMI_SUPPORT_CHAN_WIDTH_80P80_GET(chainmask_caps->supported_flags); |
| 17936 | |
| 17937 | chainmask_table[i].cap_list[j].chain_mask_2G = |
| 17938 | WMI_SUPPORT_CHAIN_MASK_2G_GET(chainmask_caps->supported_flags); |
| 17939 | |
| 17940 | chainmask_table[i].cap_list[j].chain_mask_5G = |
| 17941 | WMI_SUPPORT_CHAIN_MASK_5G_GET(chainmask_caps->supported_flags); |
| 17942 | |
| 17943 | chainmask_table[i].cap_list[j].chain_mask_tx = |
| 17944 | WMI_SUPPORT_CHAIN_MASK_TX_GET(chainmask_caps->supported_flags); |
| 17945 | |
| 17946 | chainmask_table[i].cap_list[j].chain_mask_rx = |
| 17947 | WMI_SUPPORT_CHAIN_MASK_RX_GET(chainmask_caps->supported_flags); |
| 17948 | |
| 17949 | chainmask_table[i].cap_list[j].supports_aDFS = |
| 17950 | WMI_SUPPORT_CHAIN_MASK_ADFS_GET(chainmask_caps->supported_flags); |
| 17951 | |
| 17952 | qdf_print("supported_flags: 0x%08x chainmasks: 0x%08x\n", |
| 17953 | chainmask_caps->supported_flags, |
| 17954 | chainmask_caps->chainmask |
| 17955 | ); |
| 17956 | chainmask_caps++; |
| 17957 | } |
| 17958 | } |
| 17959 | |
| 17960 | return QDF_STATUS_SUCCESS; |
| 17961 | } |
| 17962 | |
| 17963 | /** |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17964 | * extract_service_ready_ext_tlv() - extract basic extended service ready params |
| 17965 | * from event |
| 17966 | * @wmi_handle: wmi handle |
| 17967 | * @param evt_buf: pointer to event buffer |
| 17968 | * @param param: Pointer to hold evt buf |
| 17969 | * |
| 17970 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17971 | */ |
| 17972 | 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] | 17973 | uint8_t *event, struct wlan_psoc_host_service_ext_param *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17974 | { |
| 17975 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 17976 | wmi_service_ready_ext_event_fixed_param *ev; |
| 17977 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 17978 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 17979 | WMI_MAC_PHY_CHAINMASK_COMBO *chain_mask_combo; |
| 17980 | uint8_t i = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17981 | |
| 17982 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 17983 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17984 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17985 | |
| 17986 | ev = param_buf->fixed_param; |
| 17987 | if (!ev) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17988 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17989 | |
| 17990 | /* Move this to host based bitmap */ |
| 17991 | param->default_conc_scan_config_bits = |
| 17992 | ev->default_conc_scan_config_bits; |
| 17993 | param->default_fw_config_bits = ev->default_fw_config_bits; |
| 17994 | param->he_cap_info = ev->he_cap_info; |
| 17995 | param->mpdu_density = ev->mpdu_density; |
| 17996 | param->max_bssid_rx_filters = ev->max_bssid_rx_filters; |
Kiran Venkatappa | 59d6e1f | 2017-10-12 15:04:22 +0530 | [diff] [blame] | 17997 | param->fw_build_vers_ext = ev->fw_build_vers_ext; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17998 | qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); |
| 17999 | |
| 18000 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18001 | if (hw_caps) |
| 18002 | param->num_hw_modes = hw_caps->num_hw_modes; |
| 18003 | else |
| 18004 | param->num_hw_modes = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18005 | |
| 18006 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18007 | if (reg_caps) |
| 18008 | param->num_phy = reg_caps->num_phy; |
| 18009 | else |
| 18010 | param->num_phy = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18011 | |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 18012 | if (hw_caps) { |
| 18013 | param->num_chainmask_tables = hw_caps->num_chainmask_tables; |
| 18014 | qdf_print("Num chain mask tables: %d\n", hw_caps->num_chainmask_tables); |
| 18015 | } else |
| 18016 | param->num_chainmask_tables = 0; |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 18017 | |
| 18018 | chain_mask_combo = param_buf->mac_phy_chainmask_combo; |
| 18019 | |
| 18020 | if (chain_mask_combo == NULL) |
| 18021 | return QDF_STATUS_SUCCESS; |
| 18022 | |
| 18023 | qdf_print("Dumping chain mask combo data\n"); |
| 18024 | |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 18025 | for (i = 0; i < param->num_chainmask_tables; i++) { |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 18026 | |
| 18027 | qdf_print("table_id : %d Num valid chainmasks: %d\n", |
| 18028 | chain_mask_combo->chainmask_table_id, |
| 18029 | chain_mask_combo->num_valid_chainmask |
| 18030 | ); |
| 18031 | |
| 18032 | param->chainmask_table[i].table_id = |
| 18033 | chain_mask_combo->chainmask_table_id; |
| 18034 | param->chainmask_table[i].num_valid_chainmasks = |
| 18035 | chain_mask_combo->num_valid_chainmask; |
| 18036 | chain_mask_combo++; |
| 18037 | } |
| 18038 | qdf_print("chain mask combo end\n"); |
| 18039 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18040 | return QDF_STATUS_SUCCESS; |
| 18041 | } |
| 18042 | |
| 18043 | /** |
| 18044 | * extract_hw_mode_cap_service_ready_ext_tlv() - |
| 18045 | * extract HW mode cap from service ready event |
| 18046 | * @wmi_handle: wmi handle |
| 18047 | * @param evt_buf: pointer to event buffer |
| 18048 | * @param param: Pointer to hold evt buf |
| 18049 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 18050 | * |
| 18051 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18052 | */ |
| 18053 | static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( |
| 18054 | wmi_unified_t wmi_handle, |
| 18055 | uint8_t *event, uint8_t hw_mode_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 18056 | struct wlan_psoc_host_hw_mode_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18057 | { |
| 18058 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 18059 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 18060 | |
| 18061 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 18062 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18063 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18064 | |
| 18065 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18066 | if (!hw_caps) |
| 18067 | return QDF_STATUS_E_INVAL; |
| 18068 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18069 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18070 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18071 | |
| 18072 | param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; |
| 18073 | param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; |
| 18074 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 18075 | param->hw_mode_config_type = |
| 18076 | param_buf->hw_mode_caps[hw_mode_idx].hw_mode_config_type; |
| 18077 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18078 | return QDF_STATUS_SUCCESS; |
| 18079 | } |
| 18080 | |
| 18081 | /** |
| 18082 | * extract_mac_phy_cap_service_ready_ext_tlv() - |
| 18083 | * extract MAC phy cap from service ready event |
| 18084 | * @wmi_handle: wmi handle |
| 18085 | * @param evt_buf: pointer to event buffer |
| 18086 | * @param param: Pointer to hold evt buf |
| 18087 | * @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] | 18088 | * @param phy_id: phy id within hw_mode |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18089 | * |
| 18090 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18091 | */ |
| 18092 | static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( |
| 18093 | wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 18094 | uint8_t *event, uint8_t hw_mode_id, uint8_t phy_id, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 18095 | struct wlan_psoc_host_mac_phy_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18096 | { |
| 18097 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18098 | WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 18099 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 18100 | uint32_t phy_map; |
| 18101 | uint8_t hw_idx, phy_idx = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18102 | |
| 18103 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 18104 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18105 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18106 | |
| 18107 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18108 | if (!hw_caps) |
| 18109 | return QDF_STATUS_E_INVAL; |
| 18110 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 18111 | for (hw_idx = 0; hw_idx < hw_caps->num_hw_modes; hw_idx++) { |
| 18112 | if (hw_mode_id == param_buf->hw_mode_caps[hw_idx].hw_mode_id) |
| 18113 | break; |
| 18114 | |
| 18115 | phy_map = param_buf->hw_mode_caps[hw_idx].phy_id_map; |
| 18116 | while (phy_map) { |
| 18117 | phy_map >>= 1; |
| 18118 | phy_idx++; |
| 18119 | } |
| 18120 | } |
| 18121 | |
| 18122 | if (hw_idx == hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18123 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18124 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 18125 | phy_idx += phy_id; |
| 18126 | if (phy_idx >= param_buf->num_mac_phy_caps) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18127 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 18128 | |
| 18129 | mac_phy_caps = ¶m_buf->mac_phy_caps[phy_idx]; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18130 | |
| 18131 | param->hw_mode_id = mac_phy_caps->hw_mode_id; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18132 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18133 | mac_phy_caps->pdev_id); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18134 | param->phy_id = mac_phy_caps->phy_id; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 18135 | param->supports_11b = |
| 18136 | WMI_SUPPORT_11B_GET(mac_phy_caps->supported_flags); |
| 18137 | param->supports_11g = |
| 18138 | WMI_SUPPORT_11G_GET(mac_phy_caps->supported_flags); |
| 18139 | param->supports_11a = |
| 18140 | WMI_SUPPORT_11A_GET(mac_phy_caps->supported_flags); |
| 18141 | param->supports_11n = |
| 18142 | WMI_SUPPORT_11N_GET(mac_phy_caps->supported_flags); |
| 18143 | param->supports_11ac = |
| 18144 | WMI_SUPPORT_11AC_GET(mac_phy_caps->supported_flags); |
| 18145 | param->supports_11ax = |
| 18146 | WMI_SUPPORT_11AX_GET(mac_phy_caps->supported_flags); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18147 | |
| 18148 | param->supported_bands = mac_phy_caps->supported_bands; |
| 18149 | param->ampdu_density = mac_phy_caps->ampdu_density; |
| 18150 | param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; |
| 18151 | param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; |
| 18152 | param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; |
| 18153 | param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; |
| 18154 | param->he_cap_info_2G = mac_phy_caps->he_cap_info_2G; |
| 18155 | param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; |
| 18156 | param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; |
| 18157 | param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; |
| 18158 | param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; |
| 18159 | param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; |
| 18160 | param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; |
| 18161 | param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; |
| 18162 | param->he_cap_info_5G = mac_phy_caps->he_cap_info_5G; |
| 18163 | param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; |
| 18164 | param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; |
| 18165 | param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; |
Kris Muthusamy | 61fe369 | 2017-02-20 02:35:47 -0800 | [diff] [blame] | 18166 | qdf_mem_copy(¶m->he_cap_phy_info_2G, |
| 18167 | &mac_phy_caps->he_cap_phy_info_2G, |
| 18168 | sizeof(param->he_cap_phy_info_2G)); |
| 18169 | qdf_mem_copy(¶m->he_cap_phy_info_5G, |
| 18170 | &mac_phy_caps->he_cap_phy_info_5G, |
| 18171 | sizeof(param->he_cap_phy_info_5G)); |
| 18172 | qdf_mem_copy(¶m->he_ppet2G, &mac_phy_caps->he_ppet2G, |
| 18173 | sizeof(param->he_ppet2G)); |
| 18174 | qdf_mem_copy(¶m->he_ppet5G, &mac_phy_caps->he_ppet5G, |
| 18175 | sizeof(param->he_ppet5G)); |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 18176 | param->chainmask_table_id = mac_phy_caps->chainmask_table_id; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18177 | |
| 18178 | return QDF_STATUS_SUCCESS; |
| 18179 | } |
| 18180 | |
| 18181 | /** |
| 18182 | * extract_reg_cap_service_ready_ext_tlv() - |
| 18183 | * extract REG cap from service ready event |
| 18184 | * @wmi_handle: wmi handle |
| 18185 | * @param evt_buf: pointer to event buffer |
| 18186 | * @param param: Pointer to hold evt buf |
| 18187 | * @param phy_idx: phy idx should be less than num_mode |
| 18188 | * |
| 18189 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18190 | */ |
| 18191 | static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( |
| 18192 | wmi_unified_t wmi_handle, |
| 18193 | uint8_t *event, uint8_t phy_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 18194 | struct wlan_psoc_host_hal_reg_capabilities_ext *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18195 | { |
| 18196 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 18197 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 18198 | WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; |
| 18199 | |
| 18200 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 18201 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18202 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18203 | |
| 18204 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18205 | if (!reg_caps) |
| 18206 | return QDF_STATUS_E_INVAL; |
| 18207 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18208 | if (phy_idx >= reg_caps->num_phy) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18209 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18210 | |
| 18211 | ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; |
| 18212 | |
| 18213 | param->phy_id = ext_reg_cap->phy_id; |
| 18214 | param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; |
| 18215 | param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; |
| 18216 | param->regcap1 = ext_reg_cap->regcap1; |
| 18217 | param->regcap2 = ext_reg_cap->regcap2; |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 18218 | param->wireless_modes = convert_wireless_modes_tlv( |
| 18219 | ext_reg_cap->wireless_modes); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18220 | param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; |
| 18221 | param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; |
| 18222 | param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; |
| 18223 | param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; |
| 18224 | |
| 18225 | return QDF_STATUS_SUCCESS; |
| 18226 | } |
| 18227 | |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 18228 | /** |
| 18229 | * extract_dcs_interference_type_tlv() - extract dcs interference type |
| 18230 | * from event |
| 18231 | * @wmi_handle: wmi handle |
| 18232 | * @param evt_buf: pointer to event buffer |
| 18233 | * @param param: Pointer to hold dcs interference param |
| 18234 | * |
| 18235 | * Return: 0 for success or error code |
| 18236 | */ |
| 18237 | static QDF_STATUS extract_dcs_interference_type_tlv( |
| 18238 | wmi_unified_t wmi_handle, |
| 18239 | void *evt_buf, struct wmi_host_dcs_interference_param *param) |
| 18240 | { |
| 18241 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 18242 | |
| 18243 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 18244 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18245 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 18246 | |
| 18247 | param->interference_type = param_buf->fixed_param->interference_type; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18248 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18249 | param_buf->fixed_param->pdev_id); |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 18250 | |
| 18251 | return QDF_STATUS_SUCCESS; |
| 18252 | } |
| 18253 | |
| 18254 | /* |
| 18255 | * extract_dcs_cw_int_tlv() - extract dcs cw interference from event |
| 18256 | * @wmi_handle: wmi handle |
| 18257 | * @param evt_buf: pointer to event buffer |
| 18258 | * @param cw_int: Pointer to hold cw interference |
| 18259 | * |
| 18260 | * Return: 0 for success or error code |
| 18261 | */ |
| 18262 | static QDF_STATUS extract_dcs_cw_int_tlv(wmi_unified_t wmi_handle, |
| 18263 | void *evt_buf, |
| 18264 | wmi_host_ath_dcs_cw_int *cw_int) |
| 18265 | { |
| 18266 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 18267 | wlan_dcs_cw_int *ev; |
| 18268 | |
| 18269 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 18270 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18271 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 18272 | |
| 18273 | ev = param_buf->cw_int; |
| 18274 | |
| 18275 | cw_int->channel = ev->channel; |
| 18276 | |
| 18277 | return QDF_STATUS_SUCCESS; |
| 18278 | } |
| 18279 | |
| 18280 | /** |
| 18281 | * extract_dcs_im_tgt_stats_tlv() - extract dcs im target stats from event |
| 18282 | * @wmi_handle: wmi handle |
| 18283 | * @param evt_buf: pointer to event buffer |
| 18284 | * @param wlan_stat: Pointer to hold wlan stats |
| 18285 | * |
| 18286 | * Return: 0 for success or error code |
| 18287 | */ |
| 18288 | static QDF_STATUS extract_dcs_im_tgt_stats_tlv(wmi_unified_t wmi_handle, |
| 18289 | void *evt_buf, |
| 18290 | wmi_host_dcs_im_tgt_stats_t *wlan_stat) |
| 18291 | { |
| 18292 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 18293 | wlan_dcs_im_tgt_stats_t *ev; |
| 18294 | |
| 18295 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 18296 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18297 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 18298 | |
| 18299 | ev = param_buf->wlan_stat; |
| 18300 | wlan_stat->reg_tsf32 = ev->reg_tsf32; |
| 18301 | wlan_stat->last_ack_rssi = ev->last_ack_rssi; |
| 18302 | wlan_stat->tx_waste_time = ev->tx_waste_time; |
| 18303 | wlan_stat->rx_time = ev->rx_time; |
| 18304 | wlan_stat->phyerr_cnt = ev->phyerr_cnt; |
| 18305 | wlan_stat->mib_stats.listen_time = ev->listen_time; |
| 18306 | wlan_stat->mib_stats.reg_tx_frame_cnt = ev->reg_tx_frame_cnt; |
| 18307 | wlan_stat->mib_stats.reg_rx_frame_cnt = ev->reg_rx_frame_cnt; |
| 18308 | wlan_stat->mib_stats.reg_rxclr_cnt = ev->reg_rxclr_cnt; |
| 18309 | wlan_stat->mib_stats.reg_cycle_cnt = ev->reg_cycle_cnt; |
| 18310 | wlan_stat->mib_stats.reg_rxclr_ext_cnt = ev->reg_rxclr_ext_cnt; |
| 18311 | wlan_stat->mib_stats.reg_ofdm_phyerr_cnt = ev->reg_ofdm_phyerr_cnt; |
| 18312 | wlan_stat->mib_stats.reg_cck_phyerr_cnt = ev->reg_cck_phyerr_cnt; |
| 18313 | wlan_stat->chan_nf = ev->chan_nf; |
| 18314 | wlan_stat->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count; |
| 18315 | |
| 18316 | return QDF_STATUS_SUCCESS; |
| 18317 | } |
| 18318 | |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 18319 | /** |
| 18320 | * extract_thermal_stats_tlv() - extract thermal stats from event |
| 18321 | * @wmi_handle: wmi handle |
| 18322 | * @param evt_buf: Pointer to event buffer |
| 18323 | * @param temp: Pointer to hold extracted temperature |
| 18324 | * @param level: Pointer to hold extracted level |
| 18325 | * |
| 18326 | * Return: 0 for success or error code |
| 18327 | */ |
| 18328 | static QDF_STATUS |
| 18329 | extract_thermal_stats_tlv(wmi_unified_t wmi_handle, |
| 18330 | void *evt_buf, uint32_t *temp, |
| 18331 | uint32_t *level, uint32_t *pdev_id) |
| 18332 | { |
| 18333 | WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf; |
| 18334 | wmi_therm_throt_stats_event_fixed_param *tt_stats_event; |
| 18335 | |
| 18336 | param_buf = |
| 18337 | (WMI_THERM_THROT_STATS_EVENTID_param_tlvs *) evt_buf; |
| 18338 | if (!param_buf) |
| 18339 | return QDF_STATUS_E_INVAL; |
| 18340 | |
| 18341 | tt_stats_event = param_buf->fixed_param; |
| 18342 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18343 | *pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18344 | tt_stats_event->pdev_id); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 18345 | *temp = tt_stats_event->temp; |
| 18346 | *level = tt_stats_event->level; |
| 18347 | |
| 18348 | return QDF_STATUS_SUCCESS; |
| 18349 | } |
| 18350 | |
| 18351 | /** |
| 18352 | * extract_thermal_level_stats_tlv() - extract thermal level stats from event |
| 18353 | * @wmi_handle: wmi handle |
| 18354 | * @param evt_buf: pointer to event buffer |
| 18355 | * @param idx: Index to level stats |
| 18356 | * @param levelcount: Pointer to hold levelcount |
| 18357 | * @param dccount: Pointer to hold dccount |
| 18358 | * |
| 18359 | * Return: 0 for success or error code |
| 18360 | */ |
| 18361 | static QDF_STATUS |
| 18362 | extract_thermal_level_stats_tlv(wmi_unified_t wmi_handle, |
| 18363 | void *evt_buf, uint8_t idx, uint32_t *levelcount, |
| 18364 | uint32_t *dccount) |
| 18365 | { |
| 18366 | WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf; |
| 18367 | wmi_therm_throt_level_stats_info *tt_level_info; |
| 18368 | |
| 18369 | param_buf = |
| 18370 | (WMI_THERM_THROT_STATS_EVENTID_param_tlvs *) evt_buf; |
| 18371 | if (!param_buf) |
| 18372 | return QDF_STATUS_E_INVAL; |
| 18373 | |
| 18374 | tt_level_info = param_buf->therm_throt_level_stats_info; |
| 18375 | |
| 18376 | if (idx < THERMAL_LEVELS) { |
| 18377 | *levelcount = tt_level_info[idx].level_count; |
| 18378 | *dccount = tt_level_info[idx].dc_count; |
| 18379 | return QDF_STATUS_SUCCESS; |
| 18380 | } |
| 18381 | |
| 18382 | return QDF_STATUS_E_FAILURE; |
| 18383 | } |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 18384 | #ifdef BIG_ENDIAN_HOST |
| 18385 | /** |
| 18386 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 18387 | * @param data_len - data length |
| 18388 | * @param data - pointer to data |
| 18389 | * |
| 18390 | * Return: QDF_STATUS - success or error status |
| 18391 | */ |
| 18392 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 18393 | { |
| 18394 | uint8_t *data_aligned = NULL; |
| 18395 | int c; |
| 18396 | unsigned char *data_unaligned; |
| 18397 | |
| 18398 | data_unaligned = qdf_mem_malloc(((sizeof(uint8_t) * data_len) + |
| 18399 | FIPS_ALIGN)); |
| 18400 | /* Assigning unaligned space to copy the data */ |
| 18401 | /* Checking if kmalloc does succesful allocation */ |
| 18402 | if (data_unaligned == NULL) |
| 18403 | return QDF_STATUS_E_FAILURE; |
| 18404 | |
| 18405 | /* Checking if space is alligned */ |
| 18406 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 18407 | /* align the data space */ |
| 18408 | data_aligned = |
| 18409 | (uint8_t *)FIPS_ALIGNTO(data_unaligned, FIPS_ALIGN); |
| 18410 | } else { |
| 18411 | data_aligned = (u_int8_t *)data_unaligned; |
| 18412 | } |
| 18413 | |
| 18414 | /* memset and copy content from data to data aligned */ |
| 18415 | OS_MEMSET(data_aligned, 0, data_len); |
| 18416 | OS_MEMCPY(data_aligned, data, data_len); |
| 18417 | /* Endianness to LE */ |
| 18418 | for (c = 0; c < data_len/4; c++) { |
| 18419 | *((u_int32_t *)data_aligned + c) = |
Padma Raghunathan | 1edbf23 | 2017-08-31 15:26:47 +0530 | [diff] [blame] | 18420 | qdf_le32_to_cpu(*((u_int32_t *)data_aligned + c)); |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 18421 | } |
| 18422 | |
| 18423 | /* Copy content to event->data */ |
| 18424 | OS_MEMCPY(data, data_aligned, data_len); |
| 18425 | |
| 18426 | /* clean up allocated space */ |
| 18427 | qdf_mem_free(data_unaligned); |
| 18428 | data_aligned = NULL; |
| 18429 | data_unaligned = NULL; |
| 18430 | |
| 18431 | /*************************************************************/ |
| 18432 | |
| 18433 | return QDF_STATUS_SUCCESS; |
| 18434 | } |
| 18435 | #else |
| 18436 | /** |
| 18437 | * fips_conv_data_be() - DUMMY for LE platform |
| 18438 | * |
| 18439 | * Return: QDF_STATUS - success |
| 18440 | */ |
| 18441 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 18442 | { |
| 18443 | return QDF_STATUS_SUCCESS; |
| 18444 | } |
| 18445 | #endif |
| 18446 | |
| 18447 | /** |
| 18448 | * extract_fips_event_data_tlv() - extract fips event data |
| 18449 | * @wmi_handle: wmi handle |
| 18450 | * @param evt_buf: pointer to event buffer |
| 18451 | * @param param: pointer FIPS event params |
| 18452 | * |
| 18453 | * Return: 0 for success or error code |
| 18454 | */ |
| 18455 | static QDF_STATUS extract_fips_event_data_tlv(wmi_unified_t wmi_handle, |
| 18456 | void *evt_buf, struct wmi_host_fips_event_param *param) |
| 18457 | { |
| 18458 | WMI_PDEV_FIPS_EVENTID_param_tlvs *param_buf; |
| 18459 | wmi_pdev_fips_event_fixed_param *event; |
| 18460 | |
| 18461 | param_buf = (WMI_PDEV_FIPS_EVENTID_param_tlvs *) evt_buf; |
| 18462 | event = (wmi_pdev_fips_event_fixed_param *) param_buf->fixed_param; |
| 18463 | |
| 18464 | if (fips_conv_data_be(event->data_len, param_buf->data) != |
| 18465 | QDF_STATUS_SUCCESS) |
| 18466 | return QDF_STATUS_E_FAILURE; |
| 18467 | |
| 18468 | param->data = (uint32_t *)param_buf->data; |
| 18469 | param->data_len = event->data_len; |
| 18470 | param->error_status = event->error_status; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18471 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18472 | event->pdev_id); |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 18473 | |
| 18474 | return QDF_STATUS_SUCCESS; |
| 18475 | } |
| 18476 | |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 18477 | /* |
| 18478 | * extract_peer_delete_response_event_tlv() - extract peer delete response event |
| 18479 | * @wmi_handle: wmi handle |
| 18480 | * @param evt_buf: pointer to event buffer |
| 18481 | * @param vdev_id: Pointer to hold vdev_id |
| 18482 | * @param mac_addr: Pointer to hold peer mac address |
| 18483 | * |
| 18484 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18485 | */ |
| 18486 | static QDF_STATUS extract_peer_delete_response_event_tlv(wmi_unified_t wmi_hdl, |
| 18487 | void *evt_buf, struct wmi_host_peer_delete_response_event *param) |
| 18488 | { |
| 18489 | WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *param_buf; |
| 18490 | wmi_peer_delete_resp_event_fixed_param *ev; |
| 18491 | |
| 18492 | param_buf = (WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *)evt_buf; |
| 18493 | |
| 18494 | ev = (wmi_peer_delete_resp_event_fixed_param *) param_buf->fixed_param; |
| 18495 | if (!ev) { |
| 18496 | WMI_LOGE("%s: Invalid peer_delete response\n", __func__); |
| 18497 | return QDF_STATUS_E_FAILURE; |
| 18498 | } |
| 18499 | |
| 18500 | param->vdev_id = ev->vdev_id; |
| 18501 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->peer_macaddr, |
| 18502 | ¶m->mac_address.bytes[0]); |
| 18503 | |
| 18504 | return QDF_STATUS_SUCCESS; |
| 18505 | } |
| 18506 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 18507 | static bool is_management_record_tlv(uint32_t cmd_id) |
| 18508 | { |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 18509 | if (cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 18510 | return true; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18511 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 18512 | return false; |
| 18513 | } |
| 18514 | |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 18515 | static uint16_t wmi_tag_vdev_set_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 18516 | { |
| 18517 | wmi_vdev_set_param_cmd_fixed_param *set_cmd; |
| 18518 | |
| 18519 | set_cmd = (wmi_vdev_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 18520 | |
| 18521 | switch (set_cmd->param_id) { |
| 18522 | case WMI_VDEV_PARAM_LISTEN_INTERVAL: |
| 18523 | case WMI_VDEV_PARAM_DTIM_POLICY: |
| 18524 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 18525 | default: |
| 18526 | break; |
| 18527 | } |
| 18528 | |
| 18529 | return 0; |
| 18530 | } |
| 18531 | |
| 18532 | static uint16_t wmi_tag_sta_powersave_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 18533 | { |
| 18534 | wmi_sta_powersave_param_cmd_fixed_param *ps_cmd; |
| 18535 | |
| 18536 | ps_cmd = (wmi_sta_powersave_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 18537 | |
| 18538 | switch (ps_cmd->param) { |
| 18539 | case WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD: |
| 18540 | case WMI_STA_PS_PARAM_INACTIVITY_TIME: |
| 18541 | case WMI_STA_PS_ENABLE_QPOWER: |
| 18542 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 18543 | default: |
| 18544 | break; |
| 18545 | } |
| 18546 | |
| 18547 | return 0; |
| 18548 | } |
| 18549 | |
| 18550 | static uint16_t wmi_tag_common_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf, |
| 18551 | uint32_t cmd_id) |
| 18552 | { |
| 18553 | if (qdf_atomic_read(&wmi_hdl->is_wow_bus_suspended)) |
| 18554 | return 0; |
| 18555 | |
| 18556 | switch (cmd_id) { |
| 18557 | case WMI_VDEV_SET_PARAM_CMDID: |
| 18558 | return wmi_tag_vdev_set_cmd(wmi_hdl, buf); |
| 18559 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 18560 | return wmi_tag_sta_powersave_cmd(wmi_hdl, buf); |
| 18561 | default: |
| 18562 | break; |
| 18563 | } |
| 18564 | |
| 18565 | return 0; |
| 18566 | } |
| 18567 | |
| 18568 | static uint16_t wmi_tag_fw_hang_cmd(wmi_unified_t wmi_handle) |
| 18569 | { |
| 18570 | uint16_t tag = 0; |
| 18571 | |
| 18572 | if (qdf_atomic_read(&wmi_handle->is_target_suspended)) { |
| 18573 | pr_err("%s: Target is already suspended, Ignore FW Hang Command\n", |
| 18574 | __func__); |
| 18575 | return tag; |
| 18576 | } |
| 18577 | |
| 18578 | if (wmi_handle->tag_crash_inject) |
| 18579 | tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 18580 | |
| 18581 | wmi_handle->tag_crash_inject = false; |
| 18582 | return tag; |
| 18583 | } |
| 18584 | |
| 18585 | /** |
| 18586 | * wmi_set_htc_tx_tag_tlv() - set HTC TX tag for WMI commands |
| 18587 | * @wmi_handle: WMI handle |
| 18588 | * @buf: WMI buffer |
| 18589 | * @cmd_id: WMI command Id |
| 18590 | * |
| 18591 | * Return htc_tx_tag |
| 18592 | */ |
| 18593 | static uint16_t wmi_set_htc_tx_tag_tlv(wmi_unified_t wmi_handle, |
| 18594 | wmi_buf_t buf, |
| 18595 | uint32_t cmd_id) |
| 18596 | { |
| 18597 | uint16_t htc_tx_tag = 0; |
| 18598 | |
| 18599 | switch (cmd_id) { |
| 18600 | case WMI_WOW_ENABLE_CMDID: |
| 18601 | case WMI_PDEV_SUSPEND_CMDID: |
| 18602 | case WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID: |
| 18603 | case WMI_WOW_ADD_WAKE_PATTERN_CMDID: |
| 18604 | case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: |
| 18605 | case WMI_PDEV_RESUME_CMDID: |
| 18606 | case WMI_WOW_DEL_WAKE_PATTERN_CMDID: |
| 18607 | case WMI_WOW_SET_ACTION_WAKE_UP_CMDID: |
| 18608 | #ifdef FEATURE_WLAN_D0WOW |
| 18609 | case WMI_D0_WOW_ENABLE_DISABLE_CMDID: |
| 18610 | #endif |
| 18611 | htc_tx_tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 18612 | break; |
| 18613 | case WMI_FORCE_FW_HANG_CMDID: |
| 18614 | htc_tx_tag = wmi_tag_fw_hang_cmd(wmi_handle); |
| 18615 | break; |
| 18616 | case WMI_VDEV_SET_PARAM_CMDID: |
| 18617 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 18618 | htc_tx_tag = wmi_tag_common_cmd(wmi_handle, buf, cmd_id); |
| 18619 | default: |
| 18620 | break; |
| 18621 | } |
| 18622 | |
| 18623 | return htc_tx_tag; |
| 18624 | } |
| 18625 | |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 18626 | /** |
| 18627 | * extract_channel_hopping_event_tlv() - extract channel hopping param |
| 18628 | * from event |
| 18629 | * @wmi_handle: wmi handle |
| 18630 | * @param evt_buf: pointer to event buffer |
| 18631 | * @param ch_hopping: Pointer to hold channel hopping param |
| 18632 | * |
| 18633 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18634 | */ |
| 18635 | static QDF_STATUS extract_channel_hopping_event_tlv( |
| 18636 | wmi_unified_t wmi_handle, void *evt_buf, |
| 18637 | wmi_host_pdev_channel_hopping_event *ch_hopping) |
| 18638 | { |
| 18639 | WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *param_buf; |
| 18640 | wmi_pdev_channel_hopping_event_fixed_param *event; |
| 18641 | |
| 18642 | param_buf = (WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *)evt_buf; |
| 18643 | event = (wmi_pdev_channel_hopping_event_fixed_param *) |
| 18644 | param_buf->fixed_param; |
| 18645 | |
| 18646 | ch_hopping->noise_floor_report_iter = event->noise_floor_report_iter; |
| 18647 | ch_hopping->noise_floor_total_iter = event->noise_floor_total_iter; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18648 | ch_hopping->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18649 | event->pdev_id); |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 18650 | |
| 18651 | return QDF_STATUS_SUCCESS; |
| 18652 | } |
| 18653 | |
| 18654 | /** |
| 18655 | * extract_pdev_tpc_ev_param_tlv() - extract tpc param from event |
| 18656 | * @wmi_handle: wmi handle |
| 18657 | * @param evt_buf: pointer to event buffer |
| 18658 | * @param param: Pointer to hold tpc param |
| 18659 | * |
| 18660 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18661 | */ |
| 18662 | static QDF_STATUS extract_pdev_tpc_ev_param_tlv(wmi_unified_t wmi_handle, |
| 18663 | void *evt_buf, |
| 18664 | wmi_host_pdev_tpc_event *param) |
| 18665 | { |
| 18666 | WMI_PDEV_TPC_EVENTID_param_tlvs *param_buf; |
| 18667 | wmi_pdev_tpc_event_fixed_param *event; |
| 18668 | |
| 18669 | param_buf = (WMI_PDEV_TPC_EVENTID_param_tlvs *)evt_buf; |
| 18670 | event = (wmi_pdev_tpc_event_fixed_param *)param_buf->fixed_param; |
| 18671 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18672 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18673 | event->pdev_id); |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 18674 | qdf_mem_copy(param->tpc, param_buf->tpc, sizeof(param->tpc)); |
| 18675 | |
| 18676 | return QDF_STATUS_SUCCESS; |
| 18677 | } |
| 18678 | |
| 18679 | |
| 18680 | #ifdef BIG_ENDIAN_HOST |
| 18681 | /** |
| 18682 | * wds_addr_ev_conv_data_be() - LE to BE conversion of wds addr event |
| 18683 | * @param data_len - data length |
| 18684 | * @param data - pointer to data |
| 18685 | * |
| 18686 | * Return: QDF_STATUS - success or error status |
| 18687 | */ |
| 18688 | static QDF_STATUS wds_addr_ev_conv_data_be(uint16_t data_len, uint8_t *ev) |
| 18689 | { |
| 18690 | uint8_t *datap = (uint8_t *)ev; |
Padma Raghunathan | 1edbf23 | 2017-08-31 15:26:47 +0530 | [diff] [blame] | 18691 | int i; |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 18692 | /* Skip swapping the first word */ |
| 18693 | datap += sizeof(uint32_t); |
| 18694 | for (i = 0; i < ((data_len / sizeof(uint32_t))-1); |
| 18695 | i++, datap += sizeof(uint32_t)) { |
| 18696 | *(uint32_t *)datap = qdf_le32_to_cpu(*(uint32_t *)datap); |
| 18697 | } |
| 18698 | |
| 18699 | return QDF_STATUS_SUCCESS; |
| 18700 | } |
| 18701 | #else |
| 18702 | /** |
| 18703 | * wds_addr_ev_conv_data_be() - Dummy operation for LE platforms |
| 18704 | * @param data_len - data length |
| 18705 | * @param data - pointer to data |
| 18706 | * |
| 18707 | * Return: QDF_STATUS - success or error status |
| 18708 | */ |
| 18709 | static QDF_STATUS wds_addr_ev_conv_data_be(uint32_t data_len, uint8_t *ev) |
| 18710 | { |
| 18711 | return QDF_STATUS_SUCCESS; |
| 18712 | } |
| 18713 | #endif |
| 18714 | |
| 18715 | /** |
| 18716 | * extract_wds_addr_event_tlv() - extract wds address from event |
| 18717 | * @wmi_handle: wmi handle |
| 18718 | * @param evt_buf: pointer to event buffer |
| 18719 | * @param wds_ev: Pointer to hold wds address |
| 18720 | * |
| 18721 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18722 | */ |
| 18723 | static QDF_STATUS extract_wds_addr_event_tlv(wmi_unified_t wmi_handle, |
| 18724 | void *evt_buf, |
| 18725 | uint16_t len, wds_addr_event_t *wds_ev) |
| 18726 | { |
| 18727 | WMI_WDS_PEER_EVENTID_param_tlvs *param_buf; |
| 18728 | wmi_wds_addr_event_fixed_param *ev; |
| 18729 | int i; |
| 18730 | |
| 18731 | param_buf = (WMI_WDS_PEER_EVENTID_param_tlvs *)evt_buf; |
| 18732 | ev = (wmi_wds_addr_event_fixed_param *)param_buf->fixed_param; |
| 18733 | |
| 18734 | if (wds_addr_ev_conv_data_be(len, (uint8_t *)ev) != QDF_STATUS_SUCCESS) |
| 18735 | return QDF_STATUS_E_FAILURE; |
| 18736 | |
| 18737 | qdf_mem_copy(wds_ev->event_type, ev->event_type, |
| 18738 | sizeof(wds_ev->event_type)); |
| 18739 | for (i = 0; i < 4; i++) { |
| 18740 | wds_ev->peer_mac[i] = |
| 18741 | ((u_int8_t *)&(ev->peer_mac.mac_addr31to0))[i]; |
| 18742 | wds_ev->dest_mac[i] = |
| 18743 | ((u_int8_t *)&(ev->dest_mac.mac_addr31to0))[i]; |
| 18744 | } |
| 18745 | for (i = 0; i < 2; i++) { |
| 18746 | wds_ev->peer_mac[4+i] = |
| 18747 | ((u_int8_t *)&(ev->peer_mac.mac_addr47to32))[i]; |
| 18748 | wds_ev->dest_mac[4+i] = |
| 18749 | ((u_int8_t *)&(ev->dest_mac.mac_addr47to32))[i]; |
| 18750 | } |
| 18751 | return QDF_STATUS_SUCCESS; |
| 18752 | } |
| 18753 | |
| 18754 | /** |
| 18755 | * extract_peer_sta_ps_statechange_ev_tlv() - extract peer sta ps state |
| 18756 | * from event |
| 18757 | * @wmi_handle: wmi handle |
| 18758 | * @param evt_buf: pointer to event buffer |
| 18759 | * @param ev: Pointer to hold peer param and ps state |
| 18760 | * |
| 18761 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18762 | */ |
| 18763 | static QDF_STATUS extract_peer_sta_ps_statechange_ev_tlv(wmi_unified_t wmi_handle, |
| 18764 | void *evt_buf, wmi_host_peer_sta_ps_statechange_event *ev) |
| 18765 | { |
| 18766 | WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *param_buf; |
| 18767 | wmi_peer_sta_ps_statechange_event_fixed_param *event; |
| 18768 | |
| 18769 | param_buf = (WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *)evt_buf; |
| 18770 | event = (wmi_peer_sta_ps_statechange_event_fixed_param *) |
| 18771 | param_buf->fixed_param; |
| 18772 | |
| 18773 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->peer_macaddr, ev->peer_macaddr); |
| 18774 | ev->peer_ps_state = event->peer_ps_state; |
| 18775 | |
| 18776 | return QDF_STATUS_SUCCESS; |
| 18777 | } |
| 18778 | |
| 18779 | /** |
| 18780 | * extract_inst_rssi_stats_event_tlv() - extract inst rssi stats from event |
| 18781 | * @wmi_handle: wmi handle |
| 18782 | * @param evt_buf: pointer to event buffer |
| 18783 | * @param inst_rssi_resp: Pointer to hold inst rssi response |
| 18784 | * |
| 18785 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18786 | */ |
| 18787 | static QDF_STATUS extract_inst_rssi_stats_event_tlv( |
| 18788 | wmi_unified_t wmi_handle, void *evt_buf, |
| 18789 | wmi_host_inst_stats_resp *inst_rssi_resp) |
| 18790 | { |
| 18791 | WMI_INST_RSSI_STATS_EVENTID_param_tlvs *param_buf; |
| 18792 | wmi_inst_rssi_stats_resp_fixed_param *event; |
| 18793 | |
| 18794 | param_buf = (WMI_INST_RSSI_STATS_EVENTID_param_tlvs *)evt_buf; |
| 18795 | event = (wmi_inst_rssi_stats_resp_fixed_param *)param_buf->fixed_param; |
| 18796 | |
| 18797 | qdf_mem_copy(&(inst_rssi_resp->peer_macaddr), |
| 18798 | &(event->peer_macaddr), sizeof(wmi_mac_addr)); |
| 18799 | inst_rssi_resp->iRSSI = event->iRSSI; |
| 18800 | |
| 18801 | return QDF_STATUS_SUCCESS; |
| 18802 | } |
| 18803 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18804 | static struct cur_reg_rule |
| 18805 | *create_reg_rules_from_wmi(uint32_t num_reg_rules, |
| 18806 | wmi_regulatory_rule_struct *wmi_reg_rule) |
| 18807 | { |
| 18808 | struct cur_reg_rule *reg_rule_ptr; |
| 18809 | uint32_t count; |
| 18810 | |
| 18811 | reg_rule_ptr = qdf_mem_malloc(num_reg_rules * sizeof(*reg_rule_ptr)); |
| 18812 | |
| 18813 | if (NULL == reg_rule_ptr) { |
| 18814 | WMI_LOGE("memory allocation failure"); |
| 18815 | return NULL; |
| 18816 | } |
| 18817 | |
| 18818 | for (count = 0; count < num_reg_rules; count++) { |
| 18819 | reg_rule_ptr[count].start_freq = |
| 18820 | WMI_REG_RULE_START_FREQ_GET( |
| 18821 | wmi_reg_rule[count].freq_info); |
| 18822 | reg_rule_ptr[count].end_freq = |
| 18823 | WMI_REG_RULE_END_FREQ_GET( |
| 18824 | wmi_reg_rule[count].freq_info); |
| 18825 | reg_rule_ptr[count].max_bw = |
| 18826 | WMI_REG_RULE_MAX_BW_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 18827 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18828 | reg_rule_ptr[count].reg_power = |
| 18829 | WMI_REG_RULE_REG_POWER_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 18830 | wmi_reg_rule[count].bw_pwr_info); |
Abhijit Pradhan | b5a1d24 | 2017-04-27 20:36:31 +0530 | [diff] [blame] | 18831 | reg_rule_ptr[count].ant_gain = |
| 18832 | WMI_REG_RULE_ANTENNA_GAIN_GET( |
| 18833 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18834 | reg_rule_ptr[count].flags = |
| 18835 | WMI_REG_RULE_FLAGS_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 18836 | wmi_reg_rule[count].flag_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18837 | } |
| 18838 | |
| 18839 | return reg_rule_ptr; |
| 18840 | } |
| 18841 | |
| 18842 | static QDF_STATUS extract_reg_chan_list_update_event_tlv( |
| 18843 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 18844 | struct cur_regulatory_info *reg_info, uint32_t len) |
| 18845 | { |
| 18846 | WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *param_buf; |
| 18847 | wmi_reg_chan_list_cc_event_fixed_param *chan_list_event_hdr; |
| 18848 | wmi_regulatory_rule_struct *wmi_reg_rule; |
| 18849 | uint32_t num_2g_reg_rules, num_5g_reg_rules; |
| 18850 | |
| 18851 | WMI_LOGD("processing regulatory channel list"); |
| 18852 | |
| 18853 | param_buf = (WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *)evt_buf; |
| 18854 | if (!param_buf) { |
| 18855 | WMI_LOGE("invalid channel list event buf"); |
| 18856 | return QDF_STATUS_E_FAILURE; |
| 18857 | } |
| 18858 | |
| 18859 | chan_list_event_hdr = param_buf->fixed_param; |
| 18860 | |
| 18861 | reg_info->num_2g_reg_rules = chan_list_event_hdr->num_2g_reg_rules; |
| 18862 | reg_info->num_5g_reg_rules = chan_list_event_hdr->num_5g_reg_rules; |
| 18863 | qdf_mem_copy(reg_info->alpha2, &(chan_list_event_hdr->alpha2), |
Amar Singhal | 7d20402 | 2017-06-23 12:17:00 +0530 | [diff] [blame] | 18864 | REG_ALPHA2_LEN); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18865 | reg_info->dfs_region = chan_list_event_hdr->dfs_region; |
| 18866 | reg_info->phybitmap = chan_list_event_hdr->phybitmap; |
Amar Singhal | a2d575f | 2017-05-04 17:12:34 -0700 | [diff] [blame] | 18867 | reg_info->offload_enabled = true; |
Amar Singhal | a522f21 | 2017-05-12 16:39:23 -0700 | [diff] [blame] | 18868 | reg_info->num_phy = chan_list_event_hdr->num_phy; |
Amar Singhal | 7d20402 | 2017-06-23 12:17:00 +0530 | [diff] [blame] | 18869 | reg_info->phy_id = chan_list_event_hdr->phy_id; |
Amar Singhal | a522f21 | 2017-05-12 16:39:23 -0700 | [diff] [blame] | 18870 | reg_info->ctry_code = chan_list_event_hdr->country_id; |
| 18871 | reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code; |
| 18872 | if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_PASS) |
| 18873 | reg_info->status_code = REG_SET_CC_STATUS_PASS; |
| 18874 | else if (chan_list_event_hdr->status_code == |
| 18875 | WMI_REG_CURRENT_ALPHA2_NOT_FOUND) |
| 18876 | reg_info->status_code = REG_CURRENT_ALPHA2_NOT_FOUND; |
| 18877 | else if (chan_list_event_hdr->status_code == |
| 18878 | WMI_REG_INIT_ALPHA2_NOT_FOUND) |
| 18879 | reg_info->status_code = REG_INIT_ALPHA2_NOT_FOUND; |
| 18880 | else if (chan_list_event_hdr->status_code == |
| 18881 | WMI_REG_SET_CC_CHANGE_NOT_ALLOWED) |
| 18882 | reg_info->status_code = REG_SET_CC_CHANGE_NOT_ALLOWED; |
| 18883 | else if (chan_list_event_hdr->status_code == |
| 18884 | WMI_REG_SET_CC_STATUS_NO_MEMORY) |
| 18885 | reg_info->status_code = REG_SET_CC_STATUS_NO_MEMORY; |
| 18886 | else if (chan_list_event_hdr->status_code == |
| 18887 | WMI_REG_SET_CC_STATUS_FAIL) |
| 18888 | reg_info->status_code = REG_SET_CC_STATUS_FAIL; |
| 18889 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18890 | reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g; |
| 18891 | reg_info->max_bw_2g = chan_list_event_hdr->max_bw_2g; |
| 18892 | reg_info->min_bw_5g = chan_list_event_hdr->min_bw_5g; |
| 18893 | reg_info->max_bw_5g = chan_list_event_hdr->max_bw_5g; |
| 18894 | |
| 18895 | num_2g_reg_rules = reg_info->num_2g_reg_rules; |
| 18896 | num_5g_reg_rules = reg_info->num_5g_reg_rules; |
| 18897 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 18898 | WMI_LOGD("%s:cc %s dsf %d BW: min_2g %d max_2g %d min_5g %d max_5g %d", |
| 18899 | __func__, reg_info->alpha2, reg_info->dfs_region, |
| 18900 | reg_info->min_bw_2g, reg_info->max_bw_2g, |
| 18901 | reg_info->min_bw_5g, reg_info->max_bw_5g); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18902 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 18903 | WMI_LOGD("%s: num_2g_reg_rules %d num_5g_reg_rules %d", __func__, |
| 18904 | num_2g_reg_rules, num_5g_reg_rules); |
Kiran Kumar Lokere | dd64e04 | 2017-03-31 15:50:26 -0700 | [diff] [blame] | 18905 | wmi_reg_rule = |
| 18906 | (wmi_regulatory_rule_struct *)((uint8_t *)chan_list_event_hdr |
| 18907 | + sizeof(wmi_reg_chan_list_cc_event_fixed_param) |
| 18908 | + WMI_TLV_HDR_SIZE); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18909 | reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules, |
| 18910 | wmi_reg_rule); |
| 18911 | wmi_reg_rule += num_2g_reg_rules; |
| 18912 | |
| 18913 | reg_info->reg_rules_5g_ptr = create_reg_rules_from_wmi(num_5g_reg_rules, |
| 18914 | wmi_reg_rule); |
| 18915 | |
| 18916 | WMI_LOGD("processed regulatory channel list"); |
| 18917 | |
| 18918 | return QDF_STATUS_SUCCESS; |
| 18919 | } |
| 18920 | |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 18921 | static QDF_STATUS extract_reg_11d_new_country_event_tlv( |
| 18922 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 18923 | struct reg_11d_new_country *reg_11d_country, uint32_t len) |
| 18924 | { |
| 18925 | wmi_11d_new_country_event_fixed_param *reg_11d_country_event; |
| 18926 | WMI_11D_NEW_COUNTRY_EVENTID_param_tlvs *param_buf; |
| 18927 | |
| 18928 | param_buf = (WMI_11D_NEW_COUNTRY_EVENTID_param_tlvs *)evt_buf; |
| 18929 | if (!param_buf) { |
| 18930 | WMI_LOGE("invalid 11d country event buf"); |
| 18931 | return QDF_STATUS_E_FAILURE; |
| 18932 | } |
| 18933 | |
| 18934 | reg_11d_country_event = param_buf->fixed_param; |
| 18935 | |
| 18936 | qdf_mem_copy(reg_11d_country->alpha2, |
| 18937 | ®_11d_country_event->new_alpha2, REG_ALPHA2_LEN); |
| 18938 | |
| 18939 | WMI_LOGD("processed 11d country event, new cc %s", |
| 18940 | reg_11d_country->alpha2); |
| 18941 | |
| 18942 | return QDF_STATUS_SUCCESS; |
| 18943 | } |
Kiran Kumar Lokere | ec65bb4 | 2017-06-30 19:13:02 -0700 | [diff] [blame] | 18944 | |
| 18945 | static QDF_STATUS extract_reg_ch_avoid_event_tlv( |
| 18946 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 18947 | struct ch_avoid_ind_type *ch_avoid_ind, uint32_t len) |
| 18948 | { |
| 18949 | wmi_avoid_freq_ranges_event_fixed_param *afr_fixed_param; |
| 18950 | wmi_avoid_freq_range_desc *afr_desc; |
| 18951 | uint32_t num_freq_ranges, freq_range_idx; |
| 18952 | WMI_WLAN_FREQ_AVOID_EVENTID_param_tlvs *param_buf = |
| 18953 | (WMI_WLAN_FREQ_AVOID_EVENTID_param_tlvs *) evt_buf; |
| 18954 | |
| 18955 | if (!param_buf) { |
| 18956 | WMI_LOGE("Invalid channel avoid event buffer"); |
| 18957 | return QDF_STATUS_E_INVAL; |
| 18958 | } |
| 18959 | |
| 18960 | afr_fixed_param = param_buf->fixed_param; |
| 18961 | if (!afr_fixed_param) { |
| 18962 | WMI_LOGE("Invalid channel avoid event fixed param buffer"); |
| 18963 | return QDF_STATUS_E_INVAL; |
| 18964 | } |
| 18965 | |
| 18966 | if (!ch_avoid_ind) { |
| 18967 | WMI_LOGE("Invalid channel avoid indication buffer"); |
| 18968 | return QDF_STATUS_E_INVAL; |
| 18969 | } |
| 18970 | num_freq_ranges = (afr_fixed_param->num_freq_ranges > |
| 18971 | CH_AVOID_MAX_RANGE) ? CH_AVOID_MAX_RANGE : |
| 18972 | afr_fixed_param->num_freq_ranges; |
| 18973 | |
| 18974 | WMI_LOGD("Channel avoid event received with %d ranges", |
| 18975 | num_freq_ranges); |
| 18976 | |
| 18977 | ch_avoid_ind->ch_avoid_range_cnt = num_freq_ranges; |
| 18978 | afr_desc = (wmi_avoid_freq_range_desc *)(param_buf->avd_freq_range); |
| 18979 | for (freq_range_idx = 0; freq_range_idx < num_freq_ranges; |
| 18980 | freq_range_idx++) { |
| 18981 | ch_avoid_ind->avoid_freq_range[freq_range_idx].start_freq = |
| 18982 | afr_desc->start_freq; |
| 18983 | ch_avoid_ind->avoid_freq_range[freq_range_idx].end_freq = |
| 18984 | afr_desc->end_freq; |
| 18985 | WMI_LOGD("range %d tlv id %u, start freq %u, end freq %u", |
| 18986 | freq_range_idx, afr_desc->tlv_header, |
| 18987 | afr_desc->start_freq, afr_desc->end_freq); |
| 18988 | afr_desc++; |
| 18989 | } |
| 18990 | |
| 18991 | return QDF_STATUS_SUCCESS; |
| 18992 | } |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 18993 | #ifdef DFS_COMPONENT_ENABLE |
| 18994 | /** |
| 18995 | * extract_dfs_cac_complete_event_tlv() - extract cac complete event |
| 18996 | * @wmi_handle: wma handle |
| 18997 | * @evt_buf: event buffer |
| 18998 | * @vdev_id: vdev id |
| 18999 | * @len: length of buffer |
| 19000 | * |
| 19001 | * Return: 0 for success or error code |
| 19002 | */ |
| 19003 | static QDF_STATUS extract_dfs_cac_complete_event_tlv(wmi_unified_t wmi_handle, |
| 19004 | uint8_t *evt_buf, |
| 19005 | uint32_t *vdev_id, |
| 19006 | uint32_t len) |
| 19007 | { |
| 19008 | WMI_VDEV_DFS_CAC_COMPLETE_EVENTID_param_tlvs *param_tlvs; |
| 19009 | wmi_vdev_dfs_cac_complete_event_fixed_param *cac_event; |
| 19010 | |
| 19011 | param_tlvs = (WMI_VDEV_DFS_CAC_COMPLETE_EVENTID_param_tlvs *) evt_buf; |
| 19012 | if (!param_tlvs) { |
| 19013 | WMI_LOGE("invalid cac complete event buf"); |
| 19014 | return QDF_STATUS_E_FAILURE; |
| 19015 | } |
| 19016 | |
| 19017 | cac_event = param_tlvs->fixed_param; |
| 19018 | *vdev_id = cac_event->vdev_id; |
| 19019 | WMI_LOGD("processed cac complete event vdev %d", *vdev_id); |
| 19020 | |
| 19021 | return QDF_STATUS_SUCCESS; |
| 19022 | } |
| 19023 | |
| 19024 | /** |
| 19025 | * extract_dfs_radar_detection_event_tlv() - extract radar found event |
| 19026 | * @wmi_handle: wma handle |
| 19027 | * @evt_buf: event buffer |
| 19028 | * @radar_found: radar found event info |
| 19029 | * @len: length of buffer |
| 19030 | * |
| 19031 | * Return: 0 for success or error code |
| 19032 | */ |
| 19033 | static QDF_STATUS extract_dfs_radar_detection_event_tlv( |
| 19034 | wmi_unified_t wmi_handle, |
| 19035 | uint8_t *evt_buf, |
| 19036 | struct radar_found_info *radar_found, |
| 19037 | uint32_t len) |
| 19038 | { |
| 19039 | WMI_PDEV_DFS_RADAR_DETECTION_EVENTID_param_tlvs *param_tlv; |
| 19040 | wmi_pdev_dfs_radar_detection_event_fixed_param *radar_event; |
| 19041 | |
| 19042 | param_tlv = (WMI_PDEV_DFS_RADAR_DETECTION_EVENTID_param_tlvs *) evt_buf; |
| 19043 | if (!param_tlv) { |
| 19044 | WMI_LOGE("invalid radar detection event buf"); |
| 19045 | return QDF_STATUS_E_FAILURE; |
| 19046 | } |
| 19047 | |
| 19048 | radar_event = param_tlv->fixed_param; |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame] | 19049 | radar_found->pdev_id = wmi_handle->ops-> |
| 19050 | convert_pdev_id_target_to_host(radar_event->pdev_id); |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 19051 | radar_found->detection_mode = radar_event->detection_mode; |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame] | 19052 | radar_found->chan_freq = radar_event->chan_freq; |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 19053 | radar_found->chan_width = radar_event->chan_width; |
| 19054 | radar_found->detector_id = radar_event->detector_id; |
| 19055 | radar_found->segment_id = radar_event->segment_id; |
| 19056 | radar_found->timestamp = radar_event->timestamp; |
| 19057 | radar_found->is_chirp = radar_event->is_chirp; |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame] | 19058 | radar_found->freq_offset = radar_event->freq_offset; |
| 19059 | radar_found->sidx = radar_event->sidx; |
| 19060 | |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 19061 | |
| 19062 | WMI_LOGD("processed radar found event pdev %d", radar_event->pdev_id); |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame] | 19063 | WMI_LOGD("Radar Event Info:"); |
| 19064 | WMI_LOGD("pdev_id %d", radar_event->pdev_id); |
| 19065 | WMI_LOGD("detection mode %d", radar_event->detection_mode); |
| 19066 | WMI_LOGD("chan_freq (dur) %d", radar_event->chan_freq); |
| 19067 | WMI_LOGD("chan_width (RSSI) %d", radar_event->chan_width); |
| 19068 | WMI_LOGD("detector_id (false_radar) %d", radar_event->detector_id); |
| 19069 | WMI_LOGD("segment_id %d", radar_event->segment_id); |
| 19070 | WMI_LOGD("timestamp %d", radar_event->timestamp); |
| 19071 | WMI_LOGD("is_chirp %d", radar_event->is_chirp); |
| 19072 | WMI_LOGD("freq_offset (radar_check) %d", radar_event->freq_offset); |
| 19073 | WMI_LOGD("sidx %d", radar_event->sidx); |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 19074 | |
| 19075 | return QDF_STATUS_SUCCESS; |
| 19076 | } |
| 19077 | #endif |
| 19078 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 19079 | /** |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 19080 | * convert_host_pdev_id_to_target_pdev_id_legacy() - Convert pdev_id from |
| 19081 | * host to target defines. For legacy there is not conversion |
| 19082 | * required. Just return pdev_id as it is. |
| 19083 | * @param pdev_id: host pdev_id to be converted. |
| 19084 | * Return: target pdev_id after conversion. |
| 19085 | */ |
| 19086 | static uint32_t convert_host_pdev_id_to_target_pdev_id_legacy( |
| 19087 | uint32_t pdev_id) |
| 19088 | { |
| 19089 | if (pdev_id == WMI_HOST_PDEV_ID_SOC) |
| 19090 | return WMI_PDEV_ID_SOC; |
| 19091 | |
| 19092 | /*No conversion required*/ |
| 19093 | return pdev_id; |
| 19094 | } |
| 19095 | |
| 19096 | /** |
| 19097 | * convert_target_pdev_id_to_host_pdev_id_legacy() - Convert pdev_id from |
| 19098 | * target to host defines. For legacy there is not conversion |
| 19099 | * required. Just return pdev_id as it is. |
| 19100 | * @param pdev_id: target pdev_id to be converted. |
| 19101 | * Return: host pdev_id after conversion. |
| 19102 | */ |
| 19103 | static uint32_t convert_target_pdev_id_to_host_pdev_id_legacy( |
| 19104 | uint32_t pdev_id) |
| 19105 | { |
| 19106 | /*No conversion required*/ |
| 19107 | return pdev_id; |
| 19108 | } |
| 19109 | |
| 19110 | /** |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 19111 | * send_set_country_cmd_tlv() - WMI scan channel list function |
| 19112 | * @param wmi_handle : handle to WMI. |
| 19113 | * @param param : pointer to hold scan channel list parameter |
| 19114 | * |
| 19115 | * Return: 0 on success and -ve on failure. |
| 19116 | */ |
| 19117 | static QDF_STATUS send_set_country_cmd_tlv(wmi_unified_t wmi_handle, |
| 19118 | struct set_country *params) |
| 19119 | { |
| 19120 | wmi_buf_t buf; |
| 19121 | QDF_STATUS qdf_status; |
| 19122 | wmi_set_current_country_cmd_fixed_param *cmd; |
| 19123 | uint16_t len = sizeof(*cmd); |
| 19124 | |
| 19125 | buf = wmi_buf_alloc(wmi_handle, len); |
| 19126 | if (!buf) { |
| 19127 | WMI_LOGE("Failed to allocate memory"); |
| 19128 | qdf_status = QDF_STATUS_E_NOMEM; |
| 19129 | goto end; |
| 19130 | } |
| 19131 | |
| 19132 | cmd = (wmi_set_current_country_cmd_fixed_param *)wmi_buf_data(buf); |
| 19133 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 19134 | WMITLV_TAG_STRUC_wmi_set_current_country_cmd_fixed_param, |
| 19135 | WMITLV_GET_STRUCT_TLVLEN |
| 19136 | (wmi_set_current_country_cmd_fixed_param)); |
| 19137 | |
| 19138 | WMI_LOGD("setting cuurnet country to %s", params->country); |
| 19139 | |
| 19140 | qdf_mem_copy((uint8_t *)&cmd->new_alpha2, params->country, 3); |
| 19141 | |
| 19142 | cmd->pdev_id = params->pdev_id; |
| 19143 | |
| 19144 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 19145 | buf, len, WMI_SET_CURRENT_COUNTRY_CMDID); |
| 19146 | |
| 19147 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 19148 | WMI_LOGE("Failed to send WMI_SET_CURRENT_COUNTRY_CMDID"); |
| 19149 | wmi_buf_free(buf); |
| 19150 | } |
| 19151 | |
| 19152 | end: |
| 19153 | return qdf_status; |
| 19154 | } |
| 19155 | |
Abhijit Pradhan | d38a269 | 2017-06-29 12:32:20 +0530 | [diff] [blame] | 19156 | #define WMI_REG_COUNTRY_ALPHA_SET(alpha, val0, val1, val2) do { \ |
| 19157 | WMI_SET_BITS(alpha, 0, 8, val0); \ |
| 19158 | WMI_SET_BITS(alpha, 8, 8, val1); \ |
| 19159 | WMI_SET_BITS(alpha, 16, 8, val2); \ |
| 19160 | } while (0) |
| 19161 | |
| 19162 | static QDF_STATUS send_user_country_code_cmd_tlv(wmi_unified_t wmi_handle, |
| 19163 | uint8_t pdev_id, struct cc_regdmn_s *rd) |
| 19164 | { |
| 19165 | wmi_set_init_country_cmd_fixed_param *cmd; |
| 19166 | uint16_t len; |
| 19167 | wmi_buf_t buf; |
| 19168 | int ret; |
| 19169 | |
| 19170 | len = sizeof(wmi_set_init_country_cmd_fixed_param); |
| 19171 | buf = wmi_buf_alloc(wmi_handle, len); |
| 19172 | if (!buf) { |
| 19173 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 19174 | return QDF_STATUS_E_NOMEM; |
| 19175 | } |
| 19176 | cmd = (wmi_set_init_country_cmd_fixed_param *) wmi_buf_data(buf); |
| 19177 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 19178 | WMITLV_TAG_STRUC_wmi_set_init_country_cmd_fixed_param, |
| 19179 | WMITLV_GET_STRUCT_TLVLEN |
| 19180 | (wmi_set_init_country_cmd_fixed_param)); |
| 19181 | |
| 19182 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
| 19183 | |
| 19184 | if (rd->flags == CC_IS_SET) { |
| 19185 | cmd->countrycode_type = WMI_COUNTRYCODE_COUNTRY_ID; |
| 19186 | cmd->country_code.country_id = rd->cc.country_code; |
| 19187 | } else if (rd->flags == ALPHA_IS_SET) { |
| 19188 | cmd->countrycode_type = WMI_COUNTRYCODE_ALPHA2; |
| 19189 | WMI_REG_COUNTRY_ALPHA_SET(cmd->country_code.alpha2, |
| 19190 | rd->cc.alpha[0], |
| 19191 | rd->cc.alpha[1], |
| 19192 | rd->cc.alpha[2]); |
| 19193 | } else if (rd->flags == REGDMN_IS_SET) { |
| 19194 | cmd->countrycode_type = WMI_COUNTRYCODE_DOMAIN_CODE; |
| 19195 | cmd->country_code.domain_code = rd->cc.regdmn_id; |
| 19196 | } |
| 19197 | |
| 19198 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 19199 | WMI_SET_INIT_COUNTRY_CMDID); |
| 19200 | if (ret) { |
| 19201 | WMI_LOGE("Failed to config wow wakeup event"); |
| 19202 | wmi_buf_free(buf); |
| 19203 | return QDF_STATUS_E_FAILURE; |
| 19204 | } |
| 19205 | |
| 19206 | return QDF_STATUS_SUCCESS; |
| 19207 | } |
| 19208 | |
Ganesh Kondabattini | 40252f5 | 2017-07-10 11:54:11 +0530 | [diff] [blame] | 19209 | /** |
| 19210 | * send_limit_off_chan_cmd_tlv() - send wmi cmd of limit off chan |
| 19211 | * configuration params |
| 19212 | * @wmi_handle: wmi handler |
| 19213 | * @limit_off_chan_param: pointer to wmi_off_chan_param |
| 19214 | * |
| 19215 | * Return: 0 for success and non zero for failure |
| 19216 | */ |
| 19217 | static |
| 19218 | QDF_STATUS send_limit_off_chan_cmd_tlv(wmi_unified_t wmi_handle, |
| 19219 | struct wmi_limit_off_chan_param *limit_off_chan_param) |
| 19220 | { |
| 19221 | wmi_vdev_limit_offchan_cmd_fixed_param *cmd; |
| 19222 | wmi_buf_t buf; |
| 19223 | uint32_t len = sizeof(*cmd); |
| 19224 | int err; |
| 19225 | |
| 19226 | buf = wmi_buf_alloc(wmi_handle, len); |
| 19227 | if (!buf) { |
| 19228 | WMI_LOGP("%s: failed to allocate memory for limit off chan cmd", |
| 19229 | __func__); |
| 19230 | return QDF_STATUS_E_NOMEM; |
| 19231 | } |
| 19232 | |
| 19233 | cmd = (wmi_vdev_limit_offchan_cmd_fixed_param *)wmi_buf_data(buf); |
| 19234 | |
| 19235 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 19236 | WMITLV_TAG_STRUC_wmi_vdev_limit_offchan_cmd_fixed_param, |
| 19237 | WMITLV_GET_STRUCT_TLVLEN( |
| 19238 | wmi_vdev_limit_offchan_cmd_fixed_param)); |
| 19239 | |
| 19240 | cmd->vdev_id = limit_off_chan_param->vdev_id; |
| 19241 | |
| 19242 | cmd->flags &= 0; |
| 19243 | if (limit_off_chan_param->status) |
| 19244 | cmd->flags |= WMI_VDEV_LIMIT_OFFCHAN_ENABLE; |
| 19245 | if (limit_off_chan_param->skip_dfs_chans) |
| 19246 | cmd->flags |= WMI_VDEV_LIMIT_OFFCHAN_SKIP_DFS; |
| 19247 | |
| 19248 | cmd->max_offchan_time = limit_off_chan_param->max_offchan_time; |
| 19249 | cmd->rest_time = limit_off_chan_param->rest_time; |
| 19250 | |
| 19251 | WMI_LOGE("%s: vdev_id=%d, flags =%x, max_offchan_time=%d, rest_time=%d", |
| 19252 | __func__, cmd->vdev_id, cmd->flags, cmd->max_offchan_time, |
| 19253 | cmd->rest_time); |
| 19254 | |
| 19255 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 19256 | len, WMI_VDEV_LIMIT_OFFCHAN_CMDID); |
| 19257 | if (QDF_IS_STATUS_ERROR(err)) { |
| 19258 | WMI_LOGE("Failed to send limit off chan cmd err=%d", err); |
| 19259 | wmi_buf_free(buf); |
| 19260 | return QDF_STATUS_E_FAILURE; |
| 19261 | } |
| 19262 | |
| 19263 | return QDF_STATUS_SUCCESS; |
| 19264 | } |
| 19265 | |
Anurag Chouhan | 97f0042 | 2017-09-11 14:56:30 +0530 | [diff] [blame] | 19266 | /** |
| 19267 | * send_set_arp_stats_req_cmd_tlv() - send wmi cmd to set arp stats request |
| 19268 | * @wmi_handle: wmi handler |
| 19269 | * @req_buf: set arp stats request buffer |
| 19270 | * |
| 19271 | * Return: 0 for success and non zero for failure |
| 19272 | */ |
| 19273 | static QDF_STATUS send_set_arp_stats_req_cmd_tlv(wmi_unified_t wmi_handle, |
| 19274 | struct set_arp_stats *req_buf) |
| 19275 | { |
| 19276 | wmi_buf_t buf = NULL; |
| 19277 | QDF_STATUS status; |
| 19278 | int len; |
| 19279 | uint8_t *buf_ptr; |
| 19280 | wmi_vdev_set_arp_stats_cmd_fixed_param *wmi_set_arp; |
| 19281 | |
| 19282 | len = sizeof(wmi_vdev_set_arp_stats_cmd_fixed_param); |
| 19283 | buf = wmi_buf_alloc(wmi_handle, len); |
| 19284 | if (!buf) { |
| 19285 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 19286 | return QDF_STATUS_E_NOMEM; |
| 19287 | } |
| 19288 | |
| 19289 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 19290 | wmi_set_arp = |
| 19291 | (wmi_vdev_set_arp_stats_cmd_fixed_param *) buf_ptr; |
| 19292 | WMITLV_SET_HDR(&wmi_set_arp->tlv_header, |
| 19293 | WMITLV_TAG_STRUC_wmi_vdev_set_arp_stats_cmd_fixed_param, |
| 19294 | WMITLV_GET_STRUCT_TLVLEN |
| 19295 | (wmi_vdev_set_arp_stats_cmd_fixed_param)); |
| 19296 | |
| 19297 | /* fill in per roam config values */ |
| 19298 | wmi_set_arp->vdev_id = req_buf->vdev_id; |
| 19299 | |
| 19300 | wmi_set_arp->set_clr = req_buf->flag; |
| 19301 | wmi_set_arp->pkt_type = req_buf->pkt_type; |
| 19302 | wmi_set_arp->ipv4 = req_buf->ip_addr; |
| 19303 | |
| 19304 | /* Send per roam config parameters */ |
| 19305 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 19306 | len, WMI_VDEV_SET_ARP_STAT_CMDID); |
| 19307 | if (QDF_IS_STATUS_ERROR(status)) { |
| 19308 | WMI_LOGE("WMI_SET_ARP_STATS_CMDID failed, Error %d", |
| 19309 | status); |
| 19310 | goto error; |
| 19311 | } |
| 19312 | |
| 19313 | WMI_LOGI(FL("set arp stats flag=%d, vdev=%d"), |
| 19314 | req_buf->flag, req_buf->vdev_id); |
| 19315 | return QDF_STATUS_SUCCESS; |
| 19316 | error: |
| 19317 | wmi_buf_free(buf); |
| 19318 | |
| 19319 | return status; |
| 19320 | } |
| 19321 | |
| 19322 | /** |
| 19323 | * send_get_arp_stats_req_cmd_tlv() - send wmi cmd to get arp stats request |
| 19324 | * @wmi_handle: wmi handler |
| 19325 | * @req_buf: get arp stats request buffer |
| 19326 | * |
| 19327 | * Return: 0 for success and non zero for failure |
| 19328 | */ |
| 19329 | static QDF_STATUS send_get_arp_stats_req_cmd_tlv(wmi_unified_t wmi_handle, |
| 19330 | struct get_arp_stats *req_buf) |
| 19331 | { |
| 19332 | wmi_buf_t buf = NULL; |
| 19333 | QDF_STATUS status; |
| 19334 | int len; |
| 19335 | uint8_t *buf_ptr; |
| 19336 | wmi_vdev_get_arp_stats_cmd_fixed_param *get_arp_stats; |
| 19337 | |
| 19338 | len = sizeof(wmi_vdev_get_arp_stats_cmd_fixed_param); |
| 19339 | buf = wmi_buf_alloc(wmi_handle, len); |
| 19340 | if (!buf) { |
| 19341 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 19342 | return QDF_STATUS_E_NOMEM; |
| 19343 | } |
| 19344 | |
| 19345 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 19346 | get_arp_stats = |
| 19347 | (wmi_vdev_get_arp_stats_cmd_fixed_param *) buf_ptr; |
| 19348 | WMITLV_SET_HDR(&get_arp_stats->tlv_header, |
| 19349 | WMITLV_TAG_STRUC_wmi_vdev_get_arp_stats_cmd_fixed_param, |
| 19350 | WMITLV_GET_STRUCT_TLVLEN |
| 19351 | (wmi_vdev_get_arp_stats_cmd_fixed_param)); |
| 19352 | |
| 19353 | /* fill in arp stats req cmd values */ |
| 19354 | get_arp_stats->vdev_id = req_buf->vdev_id; |
| 19355 | |
| 19356 | WMI_LOGI(FL("vdev=%d"), req_buf->vdev_id); |
| 19357 | /* Send per roam config parameters */ |
| 19358 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 19359 | len, WMI_VDEV_GET_ARP_STAT_CMDID); |
| 19360 | if (QDF_IS_STATUS_ERROR(status)) { |
| 19361 | WMI_LOGE("WMI_GET_ARP_STATS_CMDID failed, Error %d", |
| 19362 | status); |
| 19363 | goto error; |
| 19364 | } |
| 19365 | |
| 19366 | return QDF_STATUS_SUCCESS; |
| 19367 | error: |
| 19368 | wmi_buf_free(buf); |
| 19369 | |
| 19370 | return status; |
| 19371 | } |
| 19372 | |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 19373 | /** |
| 19374 | * send_set_del_pmkid_cache_cmd_tlv() - send wmi cmd of set del pmkid |
| 19375 | * @wmi_handle: wmi handler |
| 19376 | * @pmk_info: pointer to PMK cache entry |
| 19377 | * @vdev_id: vdev id |
| 19378 | * |
| 19379 | * Return: 0 for success and non zero for failure |
| 19380 | */ |
| 19381 | static QDF_STATUS send_set_del_pmkid_cache_cmd_tlv(wmi_unified_t wmi_handle, |
| 19382 | struct wmi_unified_pmk_cache *pmk_info) |
| 19383 | { |
| 19384 | wmi_pdev_update_pmk_cache_cmd_fixed_param *cmd; |
| 19385 | wmi_buf_t buf; |
| 19386 | QDF_STATUS status; |
| 19387 | uint8_t *buf_ptr; |
| 19388 | wmi_pmk_cache *pmksa; |
Vignesh Viswanathan | 6ee66d3 | 2017-10-11 20:40:58 +0530 | [diff] [blame] | 19389 | uint32_t len = sizeof(*cmd); |
| 19390 | |
| 19391 | if (pmk_info->pmk_len) |
| 19392 | len += WMI_TLV_HDR_SIZE + sizeof(*pmksa); |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 19393 | |
| 19394 | buf = wmi_buf_alloc(wmi_handle, len); |
| 19395 | if (!buf) { |
| 19396 | WMI_LOGP("%s: failed to allocate memory for set del pmkid cache", |
| 19397 | __func__); |
| 19398 | return QDF_STATUS_E_NOMEM; |
| 19399 | } |
| 19400 | |
| 19401 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 19402 | cmd = (wmi_pdev_update_pmk_cache_cmd_fixed_param *) buf_ptr; |
| 19403 | |
| 19404 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 19405 | WMITLV_TAG_STRUC_wmi_pdev_update_pmk_cache_cmd_fixed_param, |
| 19406 | WMITLV_GET_STRUCT_TLVLEN( |
| 19407 | wmi_pdev_update_pmk_cache_cmd_fixed_param)); |
| 19408 | |
| 19409 | cmd->vdev_id = pmk_info->session_id; |
Vignesh Viswanathan | 6ee66d3 | 2017-10-11 20:40:58 +0530 | [diff] [blame] | 19410 | |
| 19411 | /* If pmk_info->pmk_len is 0, this is a flush request */ |
| 19412 | if (!pmk_info->pmk_len) { |
| 19413 | cmd->op_flag = WMI_PMK_CACHE_OP_FLAG_FLUSH_ALL; |
| 19414 | cmd->num_cache = 0; |
| 19415 | goto send_cmd; |
| 19416 | } |
| 19417 | |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 19418 | cmd->num_cache = 1; |
| 19419 | buf_ptr += sizeof(*cmd); |
| 19420 | |
| 19421 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 19422 | sizeof(*pmksa)); |
| 19423 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 19424 | |
| 19425 | pmksa = (wmi_pmk_cache *)buf_ptr; |
| 19426 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_pmk_cache, |
| 19427 | WMITLV_GET_STRUCT_TLVLEN |
| 19428 | (wmi_pmk_cache)); |
| 19429 | pmksa->pmk_len = pmk_info->pmk_len; |
| 19430 | qdf_mem_copy(pmksa->pmk, pmk_info->pmk, pmksa->pmk_len); |
| 19431 | pmksa->pmkid_len = pmk_info->pmkid_len; |
| 19432 | qdf_mem_copy(pmksa->pmkid, pmk_info->pmkid, pmksa->pmkid_len); |
| 19433 | qdf_mem_copy(&(pmksa->bssid), &(pmk_info->bssid), sizeof(wmi_mac_addr)); |
| 19434 | pmksa->ssid.ssid_len = pmk_info->ssid.length; |
| 19435 | qdf_mem_copy(&(pmksa->ssid.ssid), &(pmk_info->ssid.mac_ssid), |
| 19436 | pmksa->ssid.ssid_len); |
| 19437 | pmksa->cache_id = pmk_info->cache_id; |
| 19438 | pmksa->cat_flag = pmk_info->cat_flag; |
| 19439 | pmksa->action_flag = pmk_info->action_flag; |
| 19440 | |
Vignesh Viswanathan | 6ee66d3 | 2017-10-11 20:40:58 +0530 | [diff] [blame] | 19441 | send_cmd: |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 19442 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 19443 | WMI_PDEV_UPDATE_PMK_CACHE_CMDID); |
| 19444 | if (status != QDF_STATUS_SUCCESS) { |
| 19445 | WMI_LOGE("%s: failed to send set del pmkid cache command %d", |
| 19446 | __func__, status); |
| 19447 | wmi_buf_free(buf); |
| 19448 | } |
| 19449 | |
| 19450 | return status; |
| 19451 | } |
| 19452 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19453 | struct wmi_ops tlv_ops = { |
| 19454 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 19455 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 19456 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 19457 | .send_vdev_start_cmd = send_vdev_start_cmd_tlv, |
| 19458 | .send_hidden_ssid_vdev_restart_cmd = |
| 19459 | send_hidden_ssid_vdev_restart_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19460 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 19461 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 19462 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 19463 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19464 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 19465 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 19466 | .send_peer_rx_reorder_queue_setup_cmd = |
| 19467 | send_peer_rx_reorder_queue_setup_cmd_tlv, |
| 19468 | .send_peer_rx_reorder_queue_remove_cmd = |
| 19469 | send_peer_rx_reorder_queue_remove_cmd_tlv, |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 19470 | .send_peer_add_wds_entry_cmd = send_peer_add_wds_entry_cmd_tlv, |
| 19471 | .send_peer_del_wds_entry_cmd = send_peer_del_wds_entry_cmd_tlv, |
| 19472 | .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] | 19473 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
| 19474 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 19475 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
| 19476 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 19477 | .send_resume_cmd = send_resume_cmd_tlv, |
| 19478 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 19479 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 19480 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 19481 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
| 19482 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
| 19483 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 19484 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 19485 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 19486 | .send_packet_log_disable_cmd = send_packet_log_disable_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19487 | .send_beacon_send_cmd = send_beacon_send_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 19488 | .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19489 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 19490 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 19491 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 19492 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 19493 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 19494 | .send_offchan_data_tx_cmd = send_offchan_data_tx_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 19495 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 19496 | .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] | 19497 | .send_set_sta_uapsd_auto_trig_cmd = |
| 19498 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 19499 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
| 19500 | .send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv, |
| 19501 | .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] | 19502 | #ifdef CONVERGED_P2P_ENABLE |
| 19503 | .send_p2p_lo_start_cmd = send_p2p_lo_start_cmd_tlv, |
| 19504 | .send_p2p_lo_stop_cmd = send_p2p_lo_stop_cmd_tlv, |
| 19505 | #endif |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 19506 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 19507 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 19508 | .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, |
| 19509 | .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, |
| 19510 | .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, |
| 19511 | .send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv, |
| 19512 | .send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv, |
| 19513 | .send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv, |
| 19514 | .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] | 19515 | .send_ocb_start_timing_advert_cmd = |
| 19516 | send_ocb_start_timing_advert_cmd_tlv, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 19517 | .send_set_enable_disable_mcc_adaptive_scheduler_cmd = |
| 19518 | send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, |
| 19519 | .send_set_mcc_channel_time_latency_cmd = |
| 19520 | send_set_mcc_channel_time_latency_cmd_tlv, |
| 19521 | .send_set_mcc_channel_time_quota_cmd = |
| 19522 | send_set_mcc_channel_time_quota_cmd_tlv, |
| 19523 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 19524 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 19525 | .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 19526 | .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, |
| 19527 | .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv, |
| 19528 | .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] | 19529 | .send_probe_rsp_tmpl_send_cmd = |
| 19530 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 19531 | .send_p2p_go_set_beacon_ie_cmd = |
| 19532 | send_p2p_go_set_beacon_ie_cmd_tlv, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 19533 | .send_setup_install_key_cmd = |
| 19534 | send_setup_install_key_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 19535 | .send_set_gateway_params_cmd = |
| 19536 | send_set_gateway_params_cmd_tlv, |
| 19537 | .send_set_rssi_monitoring_cmd = |
| 19538 | send_set_rssi_monitoring_cmd_tlv, |
| 19539 | .send_scan_probe_setoui_cmd = |
| 19540 | send_scan_probe_setoui_cmd_tlv, |
| 19541 | .send_reset_passpoint_network_list_cmd = |
| 19542 | send_reset_passpoint_network_list_cmd_tlv, |
| 19543 | .send_set_passpoint_network_list_cmd = |
| 19544 | send_set_passpoint_network_list_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 19545 | .send_roam_scan_offload_rssi_thresh_cmd = |
| 19546 | send_roam_scan_offload_rssi_thresh_cmd_tlv, |
Varun Reddy Yeturu | 412601c | 2017-07-20 09:45:01 -0700 | [diff] [blame] | 19547 | .send_roam_mawc_params_cmd = send_roam_mawc_params_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 19548 | .send_roam_scan_filter_cmd = |
| 19549 | send_roam_scan_filter_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 19550 | .send_set_epno_network_list_cmd = |
| 19551 | send_set_epno_network_list_cmd_tlv, |
| 19552 | .send_ipa_offload_control_cmd = |
| 19553 | send_ipa_offload_control_cmd_tlv, |
| 19554 | .send_extscan_get_capabilities_cmd = |
| 19555 | send_extscan_get_capabilities_cmd_tlv, |
| 19556 | .send_extscan_get_cached_results_cmd = |
| 19557 | send_extscan_get_cached_results_cmd_tlv, |
| 19558 | .send_extscan_stop_change_monitor_cmd = |
| 19559 | send_extscan_stop_change_monitor_cmd_tlv, |
| 19560 | .send_extscan_start_change_monitor_cmd = |
| 19561 | send_extscan_start_change_monitor_cmd_tlv, |
| 19562 | .send_extscan_stop_hotlist_monitor_cmd = |
| 19563 | send_extscan_stop_hotlist_monitor_cmd_tlv, |
| 19564 | .send_stop_extscan_cmd = send_stop_extscan_cmd_tlv, |
| 19565 | .send_start_extscan_cmd = send_start_extscan_cmd_tlv, |
| 19566 | .send_plm_stop_cmd = send_plm_stop_cmd_tlv, |
| 19567 | .send_plm_start_cmd = send_plm_start_cmd_tlv, |
| 19568 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
| 19569 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 19570 | .send_nlo_mawc_cmd = send_nlo_mawc_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 19571 | .send_set_ric_req_cmd = send_set_ric_req_cmd_tlv, |
| 19572 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 19573 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 19574 | .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 19575 | .send_congestion_cmd = send_congestion_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19576 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 19577 | .send_snr_cmd = send_snr_cmd_tlv, |
| 19578 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 19579 | #ifdef WLAN_PMO_ENABLE |
| 19580 | .send_add_wow_wakeup_event_cmd = send_add_wow_wakeup_event_cmd_tlv, |
| 19581 | .send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv, |
| 19582 | .send_enable_arp_ns_offload_cmd = send_enable_arp_ns_offload_cmd_tlv, |
| 19583 | .send_add_clear_mcbc_filter_cmd = send_add_clear_mcbc_filter_cmd_tlv, |
Poddar, Siddarth | 79ba820 | 2017-09-28 17:14:01 +0530 | [diff] [blame] | 19584 | .send_multiple_add_clear_mcbc_filter_cmd = |
| 19585 | send_multiple_add_clear_mcbc_filter_cmd_tlv, |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 19586 | .send_conf_hw_filter_cmd = send_conf_hw_filter_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 19587 | .send_gtk_offload_cmd = send_gtk_offload_cmd_tlv, |
| 19588 | .send_process_gtk_offload_getinfo_cmd = |
| 19589 | send_process_gtk_offload_getinfo_cmd_tlv, |
| 19590 | .send_enable_enhance_multicast_offload_cmd = |
| 19591 | send_enable_enhance_multicast_offload_tlv, |
| 19592 | .extract_gtk_rsp_event = extract_gtk_rsp_event_tlv, |
| 19593 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 19594 | .send_wow_sta_ra_filter_cmd = send_wow_sta_ra_filter_cmd_tlv, |
| 19595 | #endif |
| 19596 | .send_action_frame_patterns_cmd = send_action_frame_patterns_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19597 | .send_lphb_config_hbenable_cmd = send_lphb_config_hbenable_cmd_tlv, |
| 19598 | .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] | 19599 | .send_lphb_config_tcp_pkt_filter_cmd = |
| 19600 | send_lphb_config_tcp_pkt_filter_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19601 | .send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv, |
| 19602 | .send_lphb_config_udp_pkt_filter_cmd = |
| 19603 | send_lphb_config_udp_pkt_filter_cmd_tlv, |
Ravi Kumar Bokka | 0f3f04d | 2017-04-20 17:14:33 +0530 | [diff] [blame] | 19604 | .send_enable_disable_packet_filter_cmd = |
| 19605 | send_enable_disable_packet_filter_cmd_tlv, |
| 19606 | .send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 19607 | #endif /* End of WLAN_PMO_ENABLE */ |
| 19608 | #ifdef CONFIG_MCL |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19609 | .send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv, |
| 19610 | .send_get_link_speed_cmd = send_get_link_speed_cmd_tlv, |
| 19611 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 19612 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 19613 | .send_roam_scan_offload_mode_cmd = |
| 19614 | send_roam_scan_offload_mode_cmd_tlv, |
| 19615 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
| 19616 | .send_roam_scan_offload_ap_profile_cmd = |
| 19617 | send_roam_scan_offload_ap_profile_cmd_tlv, |
| 19618 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19619 | .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, |
| 19620 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19621 | .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, |
| 19622 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
Naveen Rawat | 42cd1e6 | 2017-05-13 15:56:57 -0700 | [diff] [blame] | 19623 | #ifdef WLAN_FEATURE_CIF_CFR |
| 19624 | .send_oem_dma_cfg_cmd = send_oem_dma_cfg_cmd_tlv, |
| 19625 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19626 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 19627 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19628 | .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv, |
| 19629 | .send_host_wakeup_ind_to_fw_cmd = send_host_wakeup_ind_to_fw_cmd_tlv, |
| 19630 | .send_del_ts_cmd = send_del_ts_cmd_tlv, |
| 19631 | .send_aggr_qos_cmd = send_aggr_qos_cmd_tlv, |
| 19632 | .send_add_ts_cmd = send_add_ts_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19633 | .send_process_add_periodic_tx_ptrn_cmd = |
| 19634 | send_process_add_periodic_tx_ptrn_cmd_tlv, |
| 19635 | .send_process_del_periodic_tx_ptrn_cmd = |
| 19636 | send_process_del_periodic_tx_ptrn_cmd_tlv, |
| 19637 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
| 19638 | .send_enable_ext_wow_cmd = send_enable_ext_wow_cmd_tlv, |
| 19639 | .send_set_app_type2_params_in_fw_cmd = |
| 19640 | send_set_app_type2_params_in_fw_cmd_tlv, |
| 19641 | .send_set_auto_shutdown_timer_cmd = |
| 19642 | send_set_auto_shutdown_timer_cmd_tlv, |
| 19643 | .send_nan_req_cmd = send_nan_req_cmd_tlv, |
| 19644 | .send_process_dhcpserver_offload_cmd = |
| 19645 | send_process_dhcpserver_offload_cmd_tlv, |
| 19646 | .send_set_led_flashing_cmd = send_set_led_flashing_cmd_tlv, |
| 19647 | .send_process_ch_avoid_update_cmd = |
| 19648 | send_process_ch_avoid_update_cmd_tlv, |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 19649 | .send_pdev_set_regdomain_cmd = |
| 19650 | send_pdev_set_regdomain_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19651 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
| 19652 | .send_set_tdls_offchan_mode_cmd = send_set_tdls_offchan_mode_cmd_tlv, |
| 19653 | .send_update_fw_tdls_state_cmd = send_update_fw_tdls_state_cmd_tlv, |
| 19654 | .send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv, |
| 19655 | .send_process_fw_mem_dump_cmd = send_process_fw_mem_dump_cmd_tlv, |
| 19656 | .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] | 19657 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 19658 | .send_init_cmd = send_init_cmd_tlv, |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 19659 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 19660 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19661 | .check_and_update_fw_version = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 19662 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 19663 | .send_saved_init_cmd = send_saved_init_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 19664 | .send_set_base_macaddr_indicate_cmd = |
| 19665 | send_set_base_macaddr_indicate_cmd_tlv, |
| 19666 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 19667 | .send_enable_specific_fw_logs_cmd = |
| 19668 | send_enable_specific_fw_logs_cmd_tlv, |
| 19669 | .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] | 19670 | .send_pdev_set_pcl_cmd = send_pdev_set_pcl_cmd_tlv, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 19671 | .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] | 19672 | .send_pdev_set_dual_mac_config_cmd = |
| 19673 | send_pdev_set_dual_mac_config_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 19674 | .send_app_type1_params_in_fw_cmd = |
| 19675 | send_app_type1_params_in_fw_cmd_tlv, |
| 19676 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
| 19677 | .send_process_roam_synch_complete_cmd = |
| 19678 | send_process_roam_synch_complete_cmd_tlv, |
| 19679 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
| 19680 | .send_roam_invoke_cmd = send_roam_invoke_cmd_tlv, |
| 19681 | .send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 19682 | .send_roam_scan_offload_scan_period_cmd = |
| 19683 | send_roam_scan_offload_scan_period_cmd_tlv, |
| 19684 | .send_roam_scan_offload_chan_list_cmd = |
| 19685 | send_roam_scan_offload_chan_list_cmd_tlv, |
| 19686 | .send_roam_scan_offload_rssi_change_cmd = |
| 19687 | send_roam_scan_offload_rssi_change_cmd_tlv, |
| 19688 | .send_get_buf_extscan_hotlist_cmd = |
| 19689 | send_get_buf_extscan_hotlist_cmd_tlv, |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 19690 | .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] | 19691 | .send_adapt_dwelltime_params_cmd = |
| 19692 | send_adapt_dwelltime_params_cmd_tlv, |
Nitesh Shah | 52323d0 | 2017-05-22 15:49:00 +0530 | [diff] [blame] | 19693 | .send_dbs_scan_sel_params_cmd = |
| 19694 | send_dbs_scan_sel_params_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19695 | .init_cmd_send = init_cmd_send_tlv, |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 19696 | .send_smart_ant_enable_cmd = send_smart_ant_enable_cmd_tlv, |
| 19697 | .send_smart_ant_set_rx_ant_cmd = send_smart_ant_set_rx_ant_cmd_tlv, |
| 19698 | .send_set_ctl_table_cmd = send_set_ctl_table_cmd_tlv, |
| 19699 | .send_set_mimogain_table_cmd = send_set_mimogain_table_cmd_tlv, |
| 19700 | .send_packet_power_info_get_cmd = send_packet_power_info_get_cmd_tlv, |
| 19701 | .send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_tlv, |
| 19702 | .send_set_vap_dscp_tid_map_cmd = send_set_vap_dscp_tid_map_cmd_tlv, |
| 19703 | .send_vdev_set_neighbour_rx_cmd = send_vdev_set_neighbour_rx_cmd_tlv, |
| 19704 | .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] | 19705 | .send_set_ant_switch_tbl_cmd = send_set_ant_switch_tbl_cmd_tlv, |
| 19706 | .send_smart_ant_set_training_info_cmd = |
| 19707 | send_smart_ant_set_training_info_cmd_tlv, |
| 19708 | .send_smart_ant_set_node_config_cmd = |
| 19709 | send_smart_ant_set_node_config_cmd_tlv, |
| 19710 | .send_set_atf_cmd = send_set_atf_cmd_tlv, |
| 19711 | .send_vdev_set_fwtest_param_cmd = send_vdev_set_fwtest_param_cmd_tlv, |
| 19712 | .send_set_qboost_param_cmd = send_set_qboost_param_cmd_tlv, |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 19713 | .send_gpio_config_cmd = send_gpio_config_cmd_tlv, |
| 19714 | .send_gpio_output_cmd = send_gpio_output_cmd_tlv, |
| 19715 | .send_phyerr_disable_cmd = send_phyerr_disable_cmd_tlv, |
| 19716 | .send_phyerr_enable_cmd = send_phyerr_enable_cmd_tlv, |
| 19717 | .send_nf_dbr_dbm_info_get_cmd = send_nf_dbr_dbm_info_get_cmd_tlv, |
| 19718 | .send_set_ht_ie_cmd = send_set_ht_ie_cmd_tlv, |
| 19719 | .send_set_vht_ie_cmd = send_set_vht_ie_cmd_tlv, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 19720 | .send_set_quiet_mode_cmd = send_set_quiet_mode_cmd_tlv, |
| 19721 | .send_set_bwf_cmd = send_set_bwf_cmd_tlv, |
| 19722 | .send_mcast_group_update_cmd = send_mcast_group_update_cmd_tlv, |
| 19723 | .send_vdev_spectral_configure_cmd = |
| 19724 | send_vdev_spectral_configure_cmd_tlv, |
| 19725 | .send_vdev_spectral_enable_cmd = |
| 19726 | send_vdev_spectral_enable_cmd_tlv, |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 19727 | .send_thermal_mitigation_param_cmd = |
| 19728 | send_thermal_mitigation_param_cmd_tlv, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 19729 | .send_pdev_qvit_cmd = send_pdev_qvit_cmd_tlv, |
| 19730 | .send_wmm_update_cmd = send_wmm_update_cmd_tlv, |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 19731 | .send_process_update_edca_param_cmd = |
| 19732 | send_process_update_edca_param_cmd_tlv, |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 19733 | .send_coex_config_cmd = send_coex_config_cmd_tlv, |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 19734 | .send_set_country_cmd = send_set_country_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19735 | .get_target_cap_from_service_ready = extract_service_ready_tlv, |
| 19736 | .extract_hal_reg_cap = extract_hal_reg_cap_tlv, |
| 19737 | .extract_host_mem_req = extract_host_mem_req_tlv, |
| 19738 | .save_service_bitmap = save_service_bitmap_tlv, |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 19739 | .save_ext_service_bitmap = save_ext_service_bitmap_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19740 | .is_service_enabled = is_service_enabled_tlv, |
| 19741 | .save_fw_version = save_fw_version_in_service_ready_tlv, |
| 19742 | .ready_extract_init_status = ready_extract_init_status_tlv, |
| 19743 | .ready_extract_mac_addr = ready_extract_mac_addr_tlv, |
Manoj Ekbote | dd27390 | 2017-07-09 23:28:56 -0700 | [diff] [blame] | 19744 | .ready_extract_mac_addr_list = ready_extract_mac_addr_list_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19745 | .extract_dbglog_data_len = extract_dbglog_data_len_tlv, |
| 19746 | .extract_vdev_start_resp = extract_vdev_start_resp_tlv, |
| 19747 | .extract_tbttoffset_update_params = |
| 19748 | extract_tbttoffset_update_params_tlv, |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 19749 | .extract_ext_tbttoffset_update_params = |
| 19750 | extract_ext_tbttoffset_update_params_tlv, |
| 19751 | .extract_tbttoffset_num_vdevs = |
| 19752 | extract_tbttoffset_num_vdevs_tlv, |
| 19753 | .extract_ext_tbttoffset_num_vdevs = |
| 19754 | extract_ext_tbttoffset_num_vdevs_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19755 | .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, |
| 19756 | .extract_vdev_stopped_param = extract_vdev_stopped_param_tlv, |
| 19757 | .extract_vdev_roam_param = extract_vdev_roam_param_tlv, |
| 19758 | .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 19759 | #ifdef CONVERGED_TDLS_ENABLE |
| 19760 | .extract_vdev_tdls_ev_param = extract_vdev_tdls_ev_param_tlv, |
| 19761 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19762 | .extract_mgmt_tx_compl_param = extract_mgmt_tx_compl_param_tlv, |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 19763 | .extract_swba_num_vdevs = extract_swba_num_vdevs_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19764 | .extract_swba_tim_info = extract_swba_tim_info_tlv, |
| 19765 | .extract_swba_noa_info = extract_swba_noa_info_tlv, |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 19766 | #ifdef CONVERGED_P2P_ENABLE |
| 19767 | .extract_p2p_noa_ev_param = extract_p2p_noa_ev_param_tlv, |
| 19768 | .extract_p2p_lo_stop_ev_param = |
| 19769 | extract_p2p_lo_stop_ev_param_tlv, |
| 19770 | #endif |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 19771 | .extract_offchan_data_tx_compl_param = |
| 19772 | extract_offchan_data_tx_compl_param_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19773 | .extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv, |
| 19774 | .extract_all_stats_count = extract_all_stats_counts_tlv, |
| 19775 | .extract_pdev_stats = extract_pdev_stats_tlv, |
| 19776 | .extract_pdev_ext_stats = extract_pdev_ext_stats_tlv, |
| 19777 | .extract_vdev_stats = extract_vdev_stats_tlv, |
| 19778 | .extract_peer_stats = extract_peer_stats_tlv, |
| 19779 | .extract_bcnflt_stats = extract_bcnflt_stats_tlv, |
| 19780 | .extract_peer_extd_stats = extract_peer_extd_stats_tlv, |
| 19781 | .extract_chan_stats = extract_chan_stats_tlv, |
| 19782 | .extract_profile_ctx = extract_profile_ctx_tlv, |
| 19783 | .extract_profile_data = extract_profile_data_tlv, |
| 19784 | .extract_chan_info_event = extract_chan_info_event_tlv, |
| 19785 | .extract_channel_hopping_event = extract_channel_hopping_event_tlv, |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 19786 | .send_fw_test_cmd = send_fw_test_cmd_tlv, |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 19787 | .send_encrypt_decrypt_send_cmd = |
| 19788 | send_encrypt_decrypt_send_cmd_tlv, |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 19789 | .send_sar_limit_cmd = send_sar_limit_cmd_tlv, |
Govind Singh | 09523e2 | 2016-09-12 12:29:21 +0530 | [diff] [blame] | 19790 | .send_power_dbg_cmd = send_power_dbg_cmd_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 19791 | .send_multiple_vdev_restart_req_cmd = |
| 19792 | send_multiple_vdev_restart_req_cmd_tlv, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19793 | .extract_service_ready_ext = extract_service_ready_ext_tlv, |
| 19794 | .extract_hw_mode_cap_service_ready_ext = |
| 19795 | extract_hw_mode_cap_service_ready_ext_tlv, |
| 19796 | .extract_mac_phy_cap_service_ready_ext = |
| 19797 | extract_mac_phy_cap_service_ready_ext_tlv, |
| 19798 | .extract_reg_cap_service_ready_ext = |
| 19799 | extract_reg_cap_service_ready_ext_tlv, |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 19800 | .extract_pdev_utf_event = extract_pdev_utf_event_tlv, |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 19801 | .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_tlv, |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 19802 | .extract_dcs_interference_type = extract_dcs_interference_type_tlv, |
| 19803 | .extract_dcs_cw_int = extract_dcs_cw_int_tlv, |
| 19804 | .extract_dcs_im_tgt_stats = extract_dcs_im_tgt_stats_tlv, |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 19805 | .extract_fips_event_data = extract_fips_event_data_tlv, |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 19806 | .send_pdev_fips_cmd = send_pdev_fips_cmd_tlv, |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 19807 | .extract_peer_delete_response_event = |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 19808 | extract_peer_delete_response_event_tlv, |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 19809 | .is_management_record = is_management_record_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 19810 | .extract_pdev_csa_switch_count_status = |
| 19811 | extract_pdev_csa_switch_count_status_tlv, |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 19812 | .extract_pdev_tpc_ev_param = extract_pdev_tpc_ev_param_tlv, |
| 19813 | .extract_wds_addr_event = extract_wds_addr_event_tlv, |
| 19814 | .extract_peer_sta_ps_statechange_ev = |
| 19815 | extract_peer_sta_ps_statechange_ev_tlv, |
| 19816 | .extract_inst_rssi_stats_event = extract_inst_rssi_stats_event_tlv, |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 19817 | .send_per_roam_config_cmd = send_per_roam_config_cmd_tlv, |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 19818 | .send_dfs_phyerr_offload_en_cmd = send_dfs_phyerr_offload_en_cmd_tlv, |
| 19819 | .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] | 19820 | .extract_reg_chan_list_update_event = |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 19821 | extract_reg_chan_list_update_event_tlv, |
| 19822 | .extract_chainmask_tables = |
| 19823 | extract_chainmask_tables_tlv, |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 19824 | .extract_thermal_stats = extract_thermal_stats_tlv, |
| 19825 | .extract_thermal_level_stats = extract_thermal_level_stats_tlv, |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 19826 | #ifdef DFS_COMPONENT_ENABLE |
| 19827 | .extract_dfs_cac_complete_event = extract_dfs_cac_complete_event_tlv, |
| 19828 | .extract_dfs_radar_detection_event = |
| 19829 | extract_dfs_radar_detection_event_tlv, |
| 19830 | #endif |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 19831 | .convert_pdev_id_host_to_target = |
| 19832 | convert_host_pdev_id_to_target_pdev_id_legacy, |
| 19833 | .convert_pdev_id_target_to_host = |
| 19834 | convert_target_pdev_id_to_host_pdev_id_legacy, |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 19835 | |
| 19836 | .send_start_11d_scan_cmd = send_start_11d_scan_cmd_tlv, |
| 19837 | .send_stop_11d_scan_cmd = send_stop_11d_scan_cmd_tlv, |
| 19838 | .extract_reg_11d_new_country_event = |
| 19839 | extract_reg_11d_new_country_event_tlv, |
Abhijit Pradhan | d38a269 | 2017-06-29 12:32:20 +0530 | [diff] [blame] | 19840 | .send_user_country_code_cmd = send_user_country_code_cmd_tlv, |
Ganesh Kondabattini | 40252f5 | 2017-07-10 11:54:11 +0530 | [diff] [blame] | 19841 | .send_limit_off_chan_cmd = |
| 19842 | send_limit_off_chan_cmd_tlv, |
Kiran Kumar Lokere | ec65bb4 | 2017-06-30 19:13:02 -0700 | [diff] [blame] | 19843 | .extract_reg_ch_avoid_event = |
| 19844 | extract_reg_ch_avoid_event_tlv, |
Anurag Chouhan | 97f0042 | 2017-09-11 14:56:30 +0530 | [diff] [blame] | 19845 | .send_set_arp_stats_req_cmd = send_set_arp_stats_req_cmd_tlv, |
| 19846 | .send_get_arp_stats_req_cmd = send_get_arp_stats_req_cmd_tlv, |
Vignesh Viswanathan | 81bde49 | 2017-09-25 14:36:38 +0530 | [diff] [blame] | 19847 | .send_set_del_pmkid_cache_cmd = send_set_del_pmkid_cache_cmd_tlv, |
| 19848 | #if defined(WLAN_FEATURE_FILS_SK) |
| 19849 | .send_roam_scan_hlp_cmd = send_roam_scan_send_hlp_cmd_tlv, |
| 19850 | #endif |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19851 | }; |
| 19852 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19853 | /** |
| 19854 | * populate_tlv_event_id() - populates wmi event ids |
| 19855 | * |
| 19856 | * @param event_ids: Pointer to hold event ids |
| 19857 | * Return: None |
| 19858 | */ |
| 19859 | static void populate_tlv_events_id(uint32_t *event_ids) |
| 19860 | { |
| 19861 | event_ids[wmi_service_ready_event_id] = WMI_SERVICE_READY_EVENTID; |
| 19862 | event_ids[wmi_ready_event_id] = WMI_READY_EVENTID; |
| 19863 | event_ids[wmi_scan_event_id] = WMI_SCAN_EVENTID; |
| 19864 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 19865 | event_ids[wmi_chan_info_event_id] = WMI_CHAN_INFO_EVENTID; |
| 19866 | event_ids[wmi_phyerr_event_id] = WMI_PHYERR_EVENTID; |
| 19867 | event_ids[wmi_pdev_dump_event_id] = WMI_PDEV_DUMP_EVENTID; |
| 19868 | event_ids[wmi_tx_pause_event_id] = WMI_TX_PAUSE_EVENTID; |
| 19869 | event_ids[wmi_dfs_radar_event_id] = WMI_DFS_RADAR_EVENTID; |
| 19870 | event_ids[wmi_pdev_l1ss_track_event_id] = WMI_PDEV_L1SS_TRACK_EVENTID; |
| 19871 | event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID; |
| 19872 | event_ids[wmi_service_ready_ext_event_id] = |
| 19873 | WMI_SERVICE_READY_EXT_EVENTID; |
| 19874 | event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID; |
| 19875 | event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID; |
| 19876 | event_ids[wmi_vdev_install_key_complete_event_id] = |
| 19877 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID; |
| 19878 | event_ids[wmi_vdev_mcc_bcn_intvl_change_req_event_id] = |
| 19879 | WMI_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID; |
| 19880 | |
| 19881 | event_ids[wmi_vdev_tsf_report_event_id] = WMI_VDEV_TSF_REPORT_EVENTID; |
| 19882 | event_ids[wmi_peer_sta_kickout_event_id] = WMI_PEER_STA_KICKOUT_EVENTID; |
| 19883 | event_ids[wmi_peer_info_event_id] = WMI_PEER_INFO_EVENTID; |
| 19884 | event_ids[wmi_peer_tx_fail_cnt_thr_event_id] = |
| 19885 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID; |
| 19886 | event_ids[wmi_peer_estimated_linkspeed_event_id] = |
| 19887 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID; |
| 19888 | event_ids[wmi_peer_state_event_id] = WMI_PEER_STATE_EVENTID; |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 19889 | event_ids[wmi_peer_delete_response_event_id] = |
| 19890 | WMI_PEER_DELETE_RESP_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19891 | event_ids[wmi_mgmt_rx_event_id] = WMI_MGMT_RX_EVENTID; |
| 19892 | event_ids[wmi_host_swba_event_id] = WMI_HOST_SWBA_EVENTID; |
| 19893 | event_ids[wmi_tbttoffset_update_event_id] = |
| 19894 | WMI_TBTTOFFSET_UPDATE_EVENTID; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 19895 | event_ids[wmi_ext_tbttoffset_update_event_id] = |
| 19896 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19897 | event_ids[wmi_offload_bcn_tx_status_event_id] = |
| 19898 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID; |
| 19899 | event_ids[wmi_offload_prob_resp_tx_status_event_id] = |
| 19900 | WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID; |
| 19901 | event_ids[wmi_mgmt_tx_completion_event_id] = |
| 19902 | WMI_MGMT_TX_COMPLETION_EVENTID; |
| 19903 | |
| 19904 | event_ids[wmi_tx_delba_complete_event_id] = |
| 19905 | WMI_TX_DELBA_COMPLETE_EVENTID; |
| 19906 | event_ids[wmi_tx_addba_complete_event_id] = |
| 19907 | WMI_TX_ADDBA_COMPLETE_EVENTID; |
| 19908 | event_ids[wmi_ba_rsp_ssn_event_id] = WMI_BA_RSP_SSN_EVENTID; |
| 19909 | |
| 19910 | event_ids[wmi_aggr_state_trig_event_id] = WMI_AGGR_STATE_TRIG_EVENTID; |
| 19911 | |
| 19912 | event_ids[wmi_roam_event_id] = WMI_ROAM_EVENTID; |
| 19913 | event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; |
| 19914 | |
| 19915 | event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; |
| 19916 | |
| 19917 | event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; |
| 19918 | |
| 19919 | event_ids[wmi_p2p_noa_event_id] = WMI_P2P_NOA_EVENTID; |
Wu Gao | 84ed340 | 2017-03-15 19:12:20 +0800 | [diff] [blame] | 19920 | event_ids[wmi_p2p_lo_stop_event_id] = |
| 19921 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19922 | event_ids[wmi_pdev_resume_event_id] = WMI_PDEV_RESUME_EVENTID; |
| 19923 | event_ids[wmi_wow_wakeup_host_event_id] = WMI_WOW_WAKEUP_HOST_EVENTID; |
| 19924 | event_ids[wmi_do_wow_disable_ack_event_id] = |
| 19925 | WMI_D0_WOW_DISABLE_ACK_EVENTID; |
| 19926 | event_ids[wmi_wow_initial_wakeup_event_id] = |
| 19927 | WMI_WOW_INITIAL_WAKEUP_EVENTID; |
| 19928 | |
| 19929 | event_ids[wmi_rtt_meas_report_event_id] = |
| 19930 | WMI_RTT_MEASUREMENT_REPORT_EVENTID; |
| 19931 | event_ids[wmi_tsf_meas_report_event_id] = |
| 19932 | WMI_TSF_MEASUREMENT_REPORT_EVENTID; |
| 19933 | event_ids[wmi_rtt_error_report_event_id] = WMI_RTT_ERROR_REPORT_EVENTID; |
| 19934 | event_ids[wmi_stats_ext_event_id] = WMI_STATS_EXT_EVENTID; |
| 19935 | event_ids[wmi_iface_link_stats_event_id] = WMI_IFACE_LINK_STATS_EVENTID; |
| 19936 | event_ids[wmi_peer_link_stats_event_id] = WMI_PEER_LINK_STATS_EVENTID; |
| 19937 | event_ids[wmi_radio_link_stats_link] = WMI_RADIO_LINK_STATS_EVENTID; |
| 19938 | event_ids[wmi_update_fw_mem_dump_event_id] = |
| 19939 | WMI_UPDATE_FW_MEM_DUMP_EVENTID; |
| 19940 | event_ids[wmi_diag_event_id_log_supported_event_id] = |
| 19941 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID; |
| 19942 | event_ids[wmi_nlo_match_event_id] = WMI_NLO_MATCH_EVENTID; |
| 19943 | event_ids[wmi_nlo_scan_complete_event_id] = |
| 19944 | WMI_NLO_SCAN_COMPLETE_EVENTID; |
| 19945 | event_ids[wmi_apfind_event_id] = WMI_APFIND_EVENTID; |
| 19946 | event_ids[wmi_passpoint_match_event_id] = WMI_PASSPOINT_MATCH_EVENTID; |
| 19947 | |
| 19948 | event_ids[wmi_gtk_offload_status_event_id] = |
| 19949 | WMI_GTK_OFFLOAD_STATUS_EVENTID; |
| 19950 | event_ids[wmi_gtk_rekey_fail_event_id] = WMI_GTK_REKEY_FAIL_EVENTID; |
| 19951 | event_ids[wmi_csa_handling_event_id] = WMI_CSA_HANDLING_EVENTID; |
| 19952 | event_ids[wmi_chatter_pc_query_event_id] = WMI_CHATTER_PC_QUERY_EVENTID; |
| 19953 | |
| 19954 | event_ids[wmi_echo_event_id] = WMI_ECHO_EVENTID; |
| 19955 | |
| 19956 | event_ids[wmi_pdev_utf_event_id] = WMI_PDEV_UTF_EVENTID; |
| 19957 | |
| 19958 | event_ids[wmi_dbg_msg_event_id] = WMI_DEBUG_MESG_EVENTID; |
| 19959 | event_ids[wmi_update_stats_event_id] = WMI_UPDATE_STATS_EVENTID; |
| 19960 | event_ids[wmi_debug_print_event_id] = WMI_DEBUG_PRINT_EVENTID; |
| 19961 | event_ids[wmi_dcs_interference_event_id] = WMI_DCS_INTERFERENCE_EVENTID; |
| 19962 | event_ids[wmi_pdev_qvit_event_id] = WMI_PDEV_QVIT_EVENTID; |
| 19963 | event_ids[wmi_wlan_profile_data_event_id] = |
| 19964 | WMI_WLAN_PROFILE_DATA_EVENTID; |
| 19965 | event_ids[wmi_pdev_ftm_intg_event_id] = WMI_PDEV_FTM_INTG_EVENTID; |
| 19966 | event_ids[wmi_wlan_freq_avoid_event_id] = WMI_WLAN_FREQ_AVOID_EVENTID; |
| 19967 | event_ids[wmi_vdev_get_keepalive_event_id] = |
| 19968 | WMI_VDEV_GET_KEEPALIVE_EVENTID; |
| 19969 | event_ids[wmi_thermal_mgmt_event_id] = WMI_THERMAL_MGMT_EVENTID; |
| 19970 | |
| 19971 | event_ids[wmi_diag_container_event_id] = |
| 19972 | WMI_DIAG_DATA_CONTAINER_EVENTID; |
| 19973 | |
| 19974 | event_ids[wmi_host_auto_shutdown_event_id] = |
| 19975 | WMI_HOST_AUTO_SHUTDOWN_EVENTID; |
| 19976 | |
| 19977 | event_ids[wmi_update_whal_mib_stats_event_id] = |
| 19978 | WMI_UPDATE_WHAL_MIB_STATS_EVENTID; |
| 19979 | |
| 19980 | /*update ht/vht info based on vdev (rx and tx NSS and preamble) */ |
| 19981 | event_ids[wmi_update_vdev_rate_stats_event_id] = |
| 19982 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID; |
| 19983 | |
| 19984 | event_ids[wmi_diag_event_id] = WMI_DIAG_EVENTID; |
| 19985 | |
| 19986 | /** Set OCB Sched Response, deprecated */ |
| 19987 | event_ids[wmi_ocb_set_sched_event_id] = WMI_OCB_SET_SCHED_EVENTID; |
| 19988 | |
| 19989 | event_ids[wmi_dbg_mesg_flush_complete_event_id] = |
| 19990 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID; |
| 19991 | event_ids[wmi_rssi_breach_event_id] = WMI_RSSI_BREACH_EVENTID; |
| 19992 | |
| 19993 | /* GPIO Event */ |
| 19994 | event_ids[wmi_gpio_input_event_id] = WMI_GPIO_INPUT_EVENTID; |
| 19995 | event_ids[wmi_uploadh_event_id] = WMI_UPLOADH_EVENTID; |
| 19996 | |
| 19997 | event_ids[wmi_captureh_event_id] = WMI_CAPTUREH_EVENTID; |
| 19998 | event_ids[wmi_rfkill_state_change_event_id] = |
| 19999 | WMI_RFKILL_STATE_CHANGE_EVENTID; |
| 20000 | |
| 20001 | /* TDLS Event */ |
| 20002 | event_ids[wmi_tdls_peer_event_id] = WMI_TDLS_PEER_EVENTID; |
| 20003 | |
| 20004 | event_ids[wmi_batch_scan_enabled_event_id] = |
| 20005 | WMI_BATCH_SCAN_ENABLED_EVENTID; |
| 20006 | event_ids[wmi_batch_scan_result_event_id] = |
| 20007 | WMI_BATCH_SCAN_RESULT_EVENTID; |
| 20008 | /* OEM Event */ |
| 20009 | event_ids[wmi_oem_cap_event_id] = WMI_OEM_CAPABILITY_EVENTID; |
| 20010 | event_ids[wmi_oem_meas_report_event_id] = |
| 20011 | WMI_OEM_MEASUREMENT_REPORT_EVENTID; |
| 20012 | event_ids[wmi_oem_report_event_id] = WMI_OEM_ERROR_REPORT_EVENTID; |
| 20013 | |
| 20014 | /* NAN Event */ |
| 20015 | event_ids[wmi_nan_event_id] = WMI_NAN_EVENTID; |
| 20016 | |
| 20017 | /* LPI Event */ |
| 20018 | event_ids[wmi_lpi_result_event_id] = WMI_LPI_RESULT_EVENTID; |
| 20019 | event_ids[wmi_lpi_status_event_id] = WMI_LPI_STATUS_EVENTID; |
| 20020 | event_ids[wmi_lpi_handoff_event_id] = WMI_LPI_HANDOFF_EVENTID; |
| 20021 | |
| 20022 | /* ExtScan events */ |
| 20023 | event_ids[wmi_extscan_start_stop_event_id] = |
| 20024 | WMI_EXTSCAN_START_STOP_EVENTID; |
| 20025 | event_ids[wmi_extscan_operation_event_id] = |
| 20026 | WMI_EXTSCAN_OPERATION_EVENTID; |
| 20027 | event_ids[wmi_extscan_table_usage_event_id] = |
| 20028 | WMI_EXTSCAN_TABLE_USAGE_EVENTID; |
| 20029 | event_ids[wmi_extscan_cached_results_event_id] = |
| 20030 | WMI_EXTSCAN_CACHED_RESULTS_EVENTID; |
| 20031 | event_ids[wmi_extscan_wlan_change_results_event_id] = |
| 20032 | WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID; |
| 20033 | event_ids[wmi_extscan_hotlist_match_event_id] = |
| 20034 | WMI_EXTSCAN_HOTLIST_MATCH_EVENTID; |
| 20035 | event_ids[wmi_extscan_capabilities_event_id] = |
| 20036 | WMI_EXTSCAN_CAPABILITIES_EVENTID; |
| 20037 | event_ids[wmi_extscan_hotlist_ssid_match_event_id] = |
| 20038 | WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID; |
| 20039 | |
| 20040 | /* mDNS offload events */ |
| 20041 | event_ids[wmi_mdns_stats_event_id] = WMI_MDNS_STATS_EVENTID; |
| 20042 | |
| 20043 | /* SAP Authentication offload events */ |
| 20044 | event_ids[wmi_sap_ofl_add_sta_event_id] = WMI_SAP_OFL_ADD_STA_EVENTID; |
| 20045 | event_ids[wmi_sap_ofl_del_sta_event_id] = WMI_SAP_OFL_DEL_STA_EVENTID; |
| 20046 | |
| 20047 | /** Out-of-context-of-bss (OCB) events */ |
| 20048 | event_ids[wmi_ocb_set_config_resp_event_id] = |
| 20049 | WMI_OCB_SET_CONFIG_RESP_EVENTID; |
| 20050 | event_ids[wmi_ocb_get_tsf_timer_resp_event_id] = |
| 20051 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID; |
| 20052 | event_ids[wmi_dcc_get_stats_resp_event_id] = |
| 20053 | WMI_DCC_GET_STATS_RESP_EVENTID; |
| 20054 | event_ids[wmi_dcc_update_ndl_resp_event_id] = |
| 20055 | WMI_DCC_UPDATE_NDL_RESP_EVENTID; |
| 20056 | event_ids[wmi_dcc_stats_event_id] = WMI_DCC_STATS_EVENTID; |
| 20057 | /* System-On-Chip events */ |
| 20058 | event_ids[wmi_soc_set_hw_mode_resp_event_id] = |
| 20059 | WMI_SOC_SET_HW_MODE_RESP_EVENTID; |
| 20060 | event_ids[wmi_soc_hw_mode_transition_event_id] = |
| 20061 | WMI_SOC_HW_MODE_TRANSITION_EVENTID; |
| 20062 | event_ids[wmi_soc_set_dual_mac_config_resp_event_id] = |
| 20063 | WMI_SOC_SET_DUAL_MAC_CONFIG_RESP_EVENTID; |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 20064 | event_ids[wmi_pdev_fips_event_id] = WMI_PDEV_FIPS_EVENTID; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 20065 | event_ids[wmi_pdev_csa_switch_count_status_event_id] = |
| 20066 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID; |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 20067 | 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] | 20068 | event_ids[wmi_inst_rssi_stats_event_id] = WMI_INST_RSSI_STATS_EVENTID; |
| 20069 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 20070 | event_ids[wmi_peer_sta_ps_statechg_event_id] = |
| 20071 | WMI_PEER_STA_PS_STATECHG_EVENTID; |
| 20072 | event_ids[wmi_pdev_channel_hopping_event_id] = |
| 20073 | WMI_PDEV_CHANNEL_HOPPING_EVENTID; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 20074 | event_ids[wmi_offchan_data_tx_completion_event] = |
| 20075 | WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID; |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 20076 | event_ids[wmi_dfs_cac_complete_id] = WMI_VDEV_DFS_CAC_COMPLETE_EVENTID; |
| 20077 | event_ids[wmi_dfs_radar_detection_event_id] = |
| 20078 | WMI_PDEV_DFS_RADAR_DETECTION_EVENTID; |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 20079 | event_ids[wmi_tt_stats_event_id] = WMI_THERM_THROT_STATS_EVENTID; |
Amar Singhal | 7db15c8 | 2017-05-19 16:39:34 -0700 | [diff] [blame] | 20080 | event_ids[wmi_11d_new_country_event_id] = WMI_11D_NEW_COUNTRY_EVENTID; |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 20081 | event_ids[wmi_pdev_tpc_event_id] = WMI_PDEV_TPC_EVENTID; |
Anurag Chouhan | 97f0042 | 2017-09-11 14:56:30 +0530 | [diff] [blame] | 20082 | event_ids[wmi_get_arp_stats_req_id] = WMI_VDEV_GET_ARP_STAT_EVENTID; |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 20083 | event_ids[wmi_service_available_event_id] = |
| 20084 | WMI_SERVICE_AVAILABLE_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20085 | } |
| 20086 | |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 20087 | #ifndef CONFIG_MCL |
| 20088 | /** |
| 20089 | * populate_tlv_service() - populates wmi services |
| 20090 | * |
| 20091 | * @param wmi_service: Pointer to hold wmi_service |
| 20092 | * Return: None |
| 20093 | */ |
| 20094 | static void populate_tlv_service(uint32_t *wmi_service) |
| 20095 | { |
| 20096 | wmi_service[wmi_service_beacon_offload] = WMI_SERVICE_BEACON_OFFLOAD; |
Sathish Kumar | eefe27e | 2017-10-04 09:58:00 +0530 | [diff] [blame] | 20097 | wmi_service[wmi_service_ack_timeout] = WMI_SERVICE_ACK_TIMEOUT; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 20098 | wmi_service[wmi_service_scan_offload] = WMI_SERVICE_SCAN_OFFLOAD; |
| 20099 | wmi_service[wmi_service_roam_scan_offload] = |
| 20100 | WMI_SERVICE_ROAM_SCAN_OFFLOAD; |
| 20101 | wmi_service[wmi_service_bcn_miss_offload] = |
| 20102 | WMI_SERVICE_BCN_MISS_OFFLOAD; |
| 20103 | wmi_service[wmi_service_sta_pwrsave] = WMI_SERVICE_STA_PWRSAVE; |
| 20104 | wmi_service[wmi_service_sta_advanced_pwrsave] = |
| 20105 | WMI_SERVICE_STA_ADVANCED_PWRSAVE; |
| 20106 | wmi_service[wmi_service_ap_uapsd] = WMI_SERVICE_AP_UAPSD; |
| 20107 | wmi_service[wmi_service_ap_dfs] = WMI_SERVICE_AP_DFS; |
| 20108 | wmi_service[wmi_service_11ac] = WMI_SERVICE_11AC; |
| 20109 | wmi_service[wmi_service_blockack] = WMI_SERVICE_BLOCKACK; |
| 20110 | wmi_service[wmi_service_phyerr] = WMI_SERVICE_PHYERR; |
| 20111 | wmi_service[wmi_service_bcn_filter] = WMI_SERVICE_BCN_FILTER; |
| 20112 | wmi_service[wmi_service_rtt] = WMI_SERVICE_RTT; |
| 20113 | wmi_service[wmi_service_wow] = WMI_SERVICE_WOW; |
| 20114 | wmi_service[wmi_service_ratectrl_cache] = WMI_SERVICE_RATECTRL_CACHE; |
| 20115 | wmi_service[wmi_service_iram_tids] = WMI_SERVICE_IRAM_TIDS; |
| 20116 | wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_ARPNS_OFFLOAD; |
| 20117 | wmi_service[wmi_service_nlo] = WMI_SERVICE_NLO; |
| 20118 | wmi_service[wmi_service_gtk_offload] = WMI_SERVICE_GTK_OFFLOAD; |
| 20119 | wmi_service[wmi_service_scan_sch] = WMI_SERVICE_SCAN_SCH; |
| 20120 | wmi_service[wmi_service_csa_offload] = WMI_SERVICE_CSA_OFFLOAD; |
| 20121 | wmi_service[wmi_service_chatter] = WMI_SERVICE_CHATTER; |
| 20122 | wmi_service[wmi_service_coex_freqavoid] = WMI_SERVICE_COEX_FREQAVOID; |
| 20123 | wmi_service[wmi_service_packet_power_save] = |
| 20124 | WMI_SERVICE_PACKET_POWER_SAVE; |
| 20125 | wmi_service[wmi_service_force_fw_hang] = WMI_SERVICE_FORCE_FW_HANG; |
| 20126 | wmi_service[wmi_service_gpio] = WMI_SERVICE_GPIO; |
| 20127 | wmi_service[wmi_service_sta_dtim_ps_modulated_dtim] = |
| 20128 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM; |
| 20129 | wmi_service[wmi_sta_uapsd_basic_auto_trig] = |
| 20130 | WMI_STA_UAPSD_BASIC_AUTO_TRIG; |
| 20131 | wmi_service[wmi_sta_uapsd_var_auto_trig] = WMI_STA_UAPSD_VAR_AUTO_TRIG; |
| 20132 | wmi_service[wmi_service_sta_keep_alive] = WMI_SERVICE_STA_KEEP_ALIVE; |
| 20133 | wmi_service[wmi_service_tx_encap] = WMI_SERVICE_TX_ENCAP; |
| 20134 | wmi_service[wmi_service_ap_ps_detect_out_of_sync] = |
| 20135 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC; |
| 20136 | wmi_service[wmi_service_early_rx] = WMI_SERVICE_EARLY_RX; |
| 20137 | wmi_service[wmi_service_sta_smps] = WMI_SERVICE_STA_SMPS; |
| 20138 | wmi_service[wmi_service_fwtest] = WMI_SERVICE_FWTEST; |
| 20139 | wmi_service[wmi_service_sta_wmmac] = WMI_SERVICE_STA_WMMAC; |
| 20140 | wmi_service[wmi_service_tdls] = WMI_SERVICE_TDLS; |
| 20141 | wmi_service[wmi_service_burst] = WMI_SERVICE_BURST; |
| 20142 | wmi_service[wmi_service_mcc_bcn_interval_change] = |
| 20143 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE; |
| 20144 | wmi_service[wmi_service_adaptive_ocs] = WMI_SERVICE_ADAPTIVE_OCS; |
| 20145 | wmi_service[wmi_service_ba_ssn_support] = WMI_SERVICE_BA_SSN_SUPPORT; |
| 20146 | wmi_service[wmi_service_filter_ipsec_natkeepalive] = |
| 20147 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE; |
| 20148 | wmi_service[wmi_service_wlan_hb] = WMI_SERVICE_WLAN_HB; |
| 20149 | wmi_service[wmi_service_lte_ant_share_support] = |
| 20150 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT; |
| 20151 | wmi_service[wmi_service_batch_scan] = WMI_SERVICE_BATCH_SCAN; |
| 20152 | wmi_service[wmi_service_qpower] = WMI_SERVICE_QPOWER; |
| 20153 | wmi_service[wmi_service_plmreq] = WMI_SERVICE_PLMREQ; |
| 20154 | wmi_service[wmi_service_thermal_mgmt] = WMI_SERVICE_THERMAL_MGMT; |
| 20155 | wmi_service[wmi_service_rmc] = WMI_SERVICE_RMC; |
| 20156 | wmi_service[wmi_service_mhf_offload] = WMI_SERVICE_MHF_OFFLOAD; |
| 20157 | wmi_service[wmi_service_coex_sar] = WMI_SERVICE_COEX_SAR; |
| 20158 | wmi_service[wmi_service_bcn_txrate_override] = |
| 20159 | WMI_SERVICE_BCN_TXRATE_OVERRIDE; |
| 20160 | wmi_service[wmi_service_nan] = WMI_SERVICE_NAN; |
| 20161 | wmi_service[wmi_service_l1ss_stat] = WMI_SERVICE_L1SS_STAT; |
| 20162 | wmi_service[wmi_service_estimate_linkspeed] = |
| 20163 | WMI_SERVICE_ESTIMATE_LINKSPEED; |
| 20164 | wmi_service[wmi_service_obss_scan] = WMI_SERVICE_OBSS_SCAN; |
| 20165 | wmi_service[wmi_service_tdls_offchan] = WMI_SERVICE_TDLS_OFFCHAN; |
| 20166 | wmi_service[wmi_service_tdls_uapsd_buffer_sta] = |
| 20167 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA; |
| 20168 | wmi_service[wmi_service_tdls_uapsd_sleep_sta] = |
| 20169 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA; |
| 20170 | wmi_service[wmi_service_ibss_pwrsave] = WMI_SERVICE_IBSS_PWRSAVE; |
| 20171 | wmi_service[wmi_service_lpass] = WMI_SERVICE_LPASS; |
| 20172 | wmi_service[wmi_service_extscan] = WMI_SERVICE_EXTSCAN; |
| 20173 | wmi_service[wmi_service_d0wow] = WMI_SERVICE_D0WOW; |
| 20174 | wmi_service[wmi_service_hsoffload] = WMI_SERVICE_HSOFFLOAD; |
| 20175 | wmi_service[wmi_service_roam_ho_offload] = WMI_SERVICE_ROAM_HO_OFFLOAD; |
| 20176 | wmi_service[wmi_service_rx_full_reorder] = WMI_SERVICE_RX_FULL_REORDER; |
| 20177 | wmi_service[wmi_service_dhcp_offload] = WMI_SERVICE_DHCP_OFFLOAD; |
| 20178 | wmi_service[wmi_service_sta_rx_ipa_offload_support] = |
| 20179 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT; |
| 20180 | wmi_service[wmi_service_mdns_offload] = WMI_SERVICE_MDNS_OFFLOAD; |
| 20181 | wmi_service[wmi_service_sap_auth_offload] = |
| 20182 | WMI_SERVICE_SAP_AUTH_OFFLOAD; |
| 20183 | wmi_service[wmi_service_dual_band_simultaneous_support] = |
| 20184 | WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT; |
| 20185 | wmi_service[wmi_service_ocb] = WMI_SERVICE_OCB; |
| 20186 | wmi_service[wmi_service_ap_arpns_offload] = |
| 20187 | WMI_SERVICE_AP_ARPNS_OFFLOAD; |
| 20188 | wmi_service[wmi_service_per_band_chainmask_support] = |
| 20189 | WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT; |
| 20190 | wmi_service[wmi_service_packet_filter_offload] = |
| 20191 | WMI_SERVICE_PACKET_FILTER_OFFLOAD; |
| 20192 | wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT; |
| 20193 | wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI; |
| 20194 | wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG; |
| 20195 | wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC; |
| 20196 | wmi_service[wmi_service_multiple_vdev_restart] = |
| 20197 | WMI_SERVICE_MULTIPLE_VDEV_RESTART; |
| 20198 | |
| 20199 | wmi_service[wmi_service_roam_offload] = WMI_SERVICE_UNAVAILABLE; |
| 20200 | wmi_service[wmi_service_ratectrl] = WMI_SERVICE_UNAVAILABLE; |
| 20201 | wmi_service[wmi_service_smart_antenna_sw_support] = |
| 20202 | WMI_SERVICE_UNAVAILABLE; |
| 20203 | wmi_service[wmi_service_smart_antenna_hw_support] = |
| 20204 | WMI_SERVICE_UNAVAILABLE; |
| 20205 | wmi_service[wmi_service_enhanced_proxy_sta] = WMI_SERVICE_UNAVAILABLE; |
| 20206 | wmi_service[wmi_service_tt] = WMI_SERVICE_UNAVAILABLE; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 20207 | wmi_service[wmi_service_atf] = WMI_SERVICE_ATF; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 20208 | wmi_service[wmi_service_peer_caching] = WMI_SERVICE_UNAVAILABLE; |
| 20209 | wmi_service[wmi_service_coex_gpio] = WMI_SERVICE_UNAVAILABLE; |
| 20210 | wmi_service[wmi_service_aux_spectral_intf] = WMI_SERVICE_UNAVAILABLE; |
| 20211 | wmi_service[wmi_service_aux_chan_load_intf] = WMI_SERVICE_UNAVAILABLE; |
| 20212 | wmi_service[wmi_service_bss_channel_info_64] = WMI_SERVICE_UNAVAILABLE; |
| 20213 | wmi_service[wmi_service_ext_res_cfg_support] = WMI_SERVICE_UNAVAILABLE; |
| 20214 | wmi_service[wmi_service_mesh] = WMI_SERVICE_UNAVAILABLE; |
| 20215 | wmi_service[wmi_service_restrt_chnl_support] = WMI_SERVICE_UNAVAILABLE; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 20216 | wmi_service[wmi_service_peer_stats] = WMI_SERVICE_UNAVAILABLE; |
| 20217 | wmi_service[wmi_service_mesh_11s] = WMI_SERVICE_UNAVAILABLE; |
| 20218 | wmi_service[wmi_service_periodic_chan_stat_support] = |
| 20219 | WMI_SERVICE_UNAVAILABLE; |
| 20220 | wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE; |
| 20221 | wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE; |
| 20222 | wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE; |
| 20223 | wmi_service[wmi_service_btcoex_duty_cycle] = WMI_SERVICE_UNAVAILABLE; |
| 20224 | wmi_service[wmi_service_4_wire_coex_support] = WMI_SERVICE_UNAVAILABLE; |
| 20225 | wmi_service[wmi_service_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
Kiran Venkatappa | 95c82a6 | 2017-05-10 14:34:17 +0530 | [diff] [blame] | 20226 | wmi_service[wmi_service_peer_assoc_conf] = WMI_SERVICE_PEER_ASSOC_CONF; |
| 20227 | wmi_service[wmi_service_egap] = WMI_SERVICE_EGAP; |
| 20228 | wmi_service[wmi_service_sta_pmf_offload] = WMI_SERVICE_STA_PMF_OFFLOAD; |
| 20229 | wmi_service[wmi_service_unified_wow_capability] = |
| 20230 | WMI_SERVICE_UNIFIED_WOW_CAPABILITY; |
| 20231 | wmi_service[wmi_service_enterprise_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
| 20232 | wmi_service[wmi_service_bpf_offload] = WMI_SERVICE_BPF_OFFLOAD; |
| 20233 | wmi_service[wmi_service_sync_delete_cmds] = |
| 20234 | WMI_SERVICE_SYNC_DELETE_CMDS; |
| 20235 | wmi_service[wmi_service_ratectrl_limit_max_min_rates] = |
| 20236 | WMI_SERVICE_RATECTRL_LIMIT_MAX_MIN_RATES; |
| 20237 | wmi_service[wmi_service_nan_data] = WMI_SERVICE_NAN_DATA; |
| 20238 | wmi_service[wmi_service_nan_rtt] = WMI_SERVICE_NAN_RTT; |
| 20239 | wmi_service[wmi_service_11ax] = WMI_SERVICE_11AX; |
| 20240 | wmi_service[wmi_service_deprecated_replace] = |
| 20241 | WMI_SERVICE_DEPRECATED_REPLACE; |
| 20242 | wmi_service[wmi_service_tdls_conn_tracker_in_host_mode] = |
| 20243 | WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE; |
| 20244 | wmi_service[wmi_service_enhanced_mcast_filter] = |
| 20245 | WMI_SERVICE_ENHANCED_MCAST_FILTER; |
| 20246 | wmi_service[wmi_service_half_rate_quarter_rate_support] = |
| 20247 | WMI_SERVICE_HALF_RATE_QUARTER_RATE_SUPPORT; |
| 20248 | wmi_service[wmi_service_vdev_rx_filter] = WMI_SERVICE_VDEV_RX_FILTER; |
| 20249 | wmi_service[wmi_service_p2p_listen_offload_support] = |
| 20250 | WMI_SERVICE_P2P_LISTEN_OFFLOAD_SUPPORT; |
| 20251 | wmi_service[wmi_service_mark_first_wakeup_packet] = |
| 20252 | WMI_SERVICE_MARK_FIRST_WAKEUP_PACKET; |
| 20253 | wmi_service[wmi_service_multiple_mcast_filter_set] = |
| 20254 | WMI_SERVICE_MULTIPLE_MCAST_FILTER_SET; |
| 20255 | wmi_service[wmi_service_host_managed_rx_reorder] = |
| 20256 | WMI_SERVICE_HOST_MANAGED_RX_REORDER; |
| 20257 | wmi_service[wmi_service_flash_rdwr_support] = |
| 20258 | WMI_SERVICE_FLASH_RDWR_SUPPORT; |
| 20259 | wmi_service[wmi_service_wlan_stats_report] = |
| 20260 | WMI_SERVICE_WLAN_STATS_REPORT; |
| 20261 | wmi_service[wmi_service_tx_msdu_id_new_partition_support] = |
| 20262 | WMI_SERVICE_TX_MSDU_ID_NEW_PARTITION_SUPPORT; |
| 20263 | wmi_service[wmi_service_dfs_phyerr_offload] = |
| 20264 | WMI_SERVICE_DFS_PHYERR_OFFLOAD; |
| 20265 | wmi_service[wmi_service_rcpi_support] = WMI_SERVICE_RCPI_SUPPORT; |
| 20266 | wmi_service[wmi_service_fw_mem_dump_support] = |
| 20267 | WMI_SERVICE_FW_MEM_DUMP_SUPPORT; |
| 20268 | wmi_service[wmi_service_peer_stats_info] = WMI_SERVICE_PEER_STATS_INFO; |
| 20269 | wmi_service[wmi_service_regulatory_db] = WMI_SERVICE_REGULATORY_DB; |
| 20270 | wmi_service[wmi_service_11d_offload] = WMI_SERVICE_11D_OFFLOAD; |
| 20271 | wmi_service[wmi_service_hw_data_filtering] = |
| 20272 | WMI_SERVICE_HW_DATA_FILTERING; |
| 20273 | wmi_service[wmi_service_pkt_routing] = WMI_SERVICE_PKT_ROUTING; |
| 20274 | wmi_service[wmi_service_offchan_tx_wmi] = WMI_SERVICE_OFFCHAN_TX_WMI; |
Venkateswara Swamy Bandaru | 23e00ed | 2017-06-07 20:57:28 +0530 | [diff] [blame] | 20275 | wmi_service[wmi_service_chan_load_info] = WMI_SERVICE_CHAN_LOAD_INFO; |
Soumya Bhat | 8db697d | 2017-08-29 18:49:13 +0530 | [diff] [blame] | 20276 | wmi_service[wmi_service_extended_nss_support] = |
| 20277 | WMI_SERVICE_EXTENDED_NSS_SUPPORT; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 20278 | } |
| 20279 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20280 | /** |
| 20281 | * populate_pdev_param_tlv() - populates pdev params |
| 20282 | * |
| 20283 | * @param pdev_param: Pointer to hold pdev params |
| 20284 | * Return: None |
| 20285 | */ |
| 20286 | static void populate_pdev_param_tlv(uint32_t *pdev_param) |
| 20287 | { |
| 20288 | pdev_param[wmi_pdev_param_tx_chain_mask] = WMI_PDEV_PARAM_TX_CHAIN_MASK; |
| 20289 | pdev_param[wmi_pdev_param_rx_chain_mask] = WMI_PDEV_PARAM_RX_CHAIN_MASK; |
| 20290 | pdev_param[wmi_pdev_param_txpower_limit2g] = |
| 20291 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G; |
| 20292 | pdev_param[wmi_pdev_param_txpower_limit5g] = |
| 20293 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G; |
| 20294 | pdev_param[wmi_pdev_param_txpower_scale] = WMI_PDEV_PARAM_TXPOWER_SCALE; |
| 20295 | pdev_param[wmi_pdev_param_beacon_gen_mode] = |
| 20296 | WMI_PDEV_PARAM_BEACON_GEN_MODE; |
| 20297 | pdev_param[wmi_pdev_param_beacon_tx_mode] = |
| 20298 | WMI_PDEV_PARAM_BEACON_TX_MODE; |
| 20299 | pdev_param[wmi_pdev_param_resmgr_offchan_mode] = |
| 20300 | WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE; |
| 20301 | pdev_param[wmi_pdev_param_protection_mode] = |
| 20302 | WMI_PDEV_PARAM_PROTECTION_MODE; |
| 20303 | pdev_param[wmi_pdev_param_dynamic_bw] = WMI_PDEV_PARAM_DYNAMIC_BW; |
| 20304 | pdev_param[wmi_pdev_param_non_agg_sw_retry_th] = |
| 20305 | WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH; |
| 20306 | pdev_param[wmi_pdev_param_agg_sw_retry_th] = |
| 20307 | WMI_PDEV_PARAM_AGG_SW_RETRY_TH; |
| 20308 | pdev_param[wmi_pdev_param_sta_kickout_th] = |
| 20309 | WMI_PDEV_PARAM_STA_KICKOUT_TH; |
| 20310 | pdev_param[wmi_pdev_param_ac_aggrsize_scaling] = |
| 20311 | WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING; |
| 20312 | pdev_param[wmi_pdev_param_ltr_enable] = WMI_PDEV_PARAM_LTR_ENABLE; |
| 20313 | pdev_param[wmi_pdev_param_ltr_ac_latency_be] = |
| 20314 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BE; |
| 20315 | pdev_param[wmi_pdev_param_ltr_ac_latency_bk] = |
| 20316 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BK; |
| 20317 | pdev_param[wmi_pdev_param_ltr_ac_latency_vi] = |
| 20318 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VI; |
| 20319 | pdev_param[wmi_pdev_param_ltr_ac_latency_vo] = |
| 20320 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VO; |
| 20321 | pdev_param[wmi_pdev_param_ltr_ac_latency_timeout] = |
| 20322 | WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT; |
| 20323 | pdev_param[wmi_pdev_param_ltr_sleep_override] = |
| 20324 | WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE; |
| 20325 | pdev_param[wmi_pdev_param_ltr_rx_override] = |
| 20326 | WMI_PDEV_PARAM_LTR_RX_OVERRIDE; |
| 20327 | pdev_param[wmi_pdev_param_ltr_tx_activity_timeout] = |
| 20328 | WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT; |
| 20329 | pdev_param[wmi_pdev_param_l1ss_enable] = WMI_PDEV_PARAM_L1SS_ENABLE; |
| 20330 | pdev_param[wmi_pdev_param_dsleep_enable] = WMI_PDEV_PARAM_DSLEEP_ENABLE; |
| 20331 | pdev_param[wmi_pdev_param_pcielp_txbuf_flush] = |
| 20332 | WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH; |
| 20333 | pdev_param[wmi_pdev_param_pcielp_txbuf_watermark] = |
| 20334 | WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK; |
| 20335 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_en] = |
| 20336 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN; |
| 20337 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_value] = |
| 20338 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE; |
| 20339 | pdev_param[wmi_pdev_param_pdev_stats_update_period] = |
| 20340 | WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD; |
| 20341 | pdev_param[wmi_pdev_param_vdev_stats_update_period] = |
| 20342 | WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD; |
| 20343 | pdev_param[wmi_pdev_param_peer_stats_update_period] = |
| 20344 | WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD; |
| 20345 | pdev_param[wmi_pdev_param_bcnflt_stats_update_period] = |
| 20346 | WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD; |
| 20347 | pdev_param[wmi_pdev_param_pmf_qos] = WMI_PDEV_PARAM_PMF_QOS; |
| 20348 | pdev_param[wmi_pdev_param_arp_ac_override] = |
| 20349 | WMI_PDEV_PARAM_ARP_AC_OVERRIDE; |
| 20350 | pdev_param[wmi_pdev_param_dcs] = WMI_PDEV_PARAM_DCS; |
| 20351 | pdev_param[wmi_pdev_param_ani_enable] = WMI_PDEV_PARAM_ANI_ENABLE; |
| 20352 | pdev_param[wmi_pdev_param_ani_poll_period] = |
| 20353 | WMI_PDEV_PARAM_ANI_POLL_PERIOD; |
| 20354 | pdev_param[wmi_pdev_param_ani_listen_period] = |
| 20355 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD; |
| 20356 | pdev_param[wmi_pdev_param_ani_ofdm_level] = |
| 20357 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL; |
| 20358 | pdev_param[wmi_pdev_param_ani_cck_level] = WMI_PDEV_PARAM_ANI_CCK_LEVEL; |
| 20359 | pdev_param[wmi_pdev_param_dyntxchain] = WMI_PDEV_PARAM_DYNTXCHAIN; |
| 20360 | pdev_param[wmi_pdev_param_proxy_sta] = WMI_PDEV_PARAM_PROXY_STA; |
| 20361 | pdev_param[wmi_pdev_param_idle_ps_config] = |
| 20362 | WMI_PDEV_PARAM_IDLE_PS_CONFIG; |
| 20363 | pdev_param[wmi_pdev_param_power_gating_sleep] = |
| 20364 | WMI_PDEV_PARAM_POWER_GATING_SLEEP; |
| 20365 | pdev_param[wmi_pdev_param_rfkill_enable] = WMI_PDEV_PARAM_RFKILL_ENABLE; |
| 20366 | pdev_param[wmi_pdev_param_burst_dur] = WMI_PDEV_PARAM_BURST_DUR; |
| 20367 | pdev_param[wmi_pdev_param_burst_enable] = WMI_PDEV_PARAM_BURST_ENABLE; |
| 20368 | pdev_param[wmi_pdev_param_hw_rfkill_config] = |
| 20369 | WMI_PDEV_PARAM_HW_RFKILL_CONFIG; |
| 20370 | pdev_param[wmi_pdev_param_low_power_rf_enable] = |
| 20371 | WMI_PDEV_PARAM_LOW_POWER_RF_ENABLE; |
| 20372 | pdev_param[wmi_pdev_param_l1ss_track] = WMI_PDEV_PARAM_L1SS_TRACK; |
| 20373 | pdev_param[wmi_pdev_param_hyst_en] = WMI_PDEV_PARAM_HYST_EN; |
| 20374 | pdev_param[wmi_pdev_param_power_collapse_enable] = |
| 20375 | WMI_PDEV_PARAM_POWER_COLLAPSE_ENABLE; |
| 20376 | pdev_param[wmi_pdev_param_led_sys_state] = WMI_PDEV_PARAM_LED_SYS_STATE; |
| 20377 | pdev_param[wmi_pdev_param_led_enable] = WMI_PDEV_PARAM_LED_ENABLE; |
| 20378 | pdev_param[wmi_pdev_param_audio_over_wlan_latency] = |
| 20379 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY; |
| 20380 | pdev_param[wmi_pdev_param_audio_over_wlan_enable] = |
| 20381 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE; |
| 20382 | pdev_param[wmi_pdev_param_whal_mib_stats_update_enable] = |
| 20383 | WMI_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE; |
| 20384 | pdev_param[wmi_pdev_param_vdev_rate_stats_update_period] = |
| 20385 | WMI_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD; |
| 20386 | pdev_param[wmi_pdev_param_cts_cbw] = WMI_PDEV_PARAM_CTS_CBW; |
| 20387 | pdev_param[wmi_pdev_param_wnts_config] = WMI_PDEV_PARAM_WNTS_CONFIG; |
| 20388 | pdev_param[wmi_pdev_param_adaptive_early_rx_enable] = |
| 20389 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_ENABLE; |
| 20390 | pdev_param[wmi_pdev_param_adaptive_early_rx_min_sleep_slop] = |
| 20391 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_MIN_SLEEP_SLOP; |
| 20392 | pdev_param[wmi_pdev_param_adaptive_early_rx_inc_dec_step] = |
| 20393 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_INC_DEC_STEP; |
| 20394 | pdev_param[wmi_pdev_param_early_rx_fix_sleep_slop] = |
| 20395 | WMI_PDEV_PARAM_EARLY_RX_FIX_SLEEP_SLOP; |
| 20396 | pdev_param[wmi_pdev_param_bmiss_based_adaptive_bto_enable] = |
| 20397 | WMI_PDEV_PARAM_BMISS_BASED_ADAPTIVE_BTO_ENABLE; |
| 20398 | pdev_param[wmi_pdev_param_bmiss_bto_min_bcn_timeout] = |
| 20399 | WMI_PDEV_PARAM_BMISS_BTO_MIN_BCN_TIMEOUT; |
| 20400 | pdev_param[wmi_pdev_param_bmiss_bto_inc_dec_step] = |
| 20401 | WMI_PDEV_PARAM_BMISS_BTO_INC_DEC_STEP; |
| 20402 | pdev_param[wmi_pdev_param_bto_fix_bcn_timeout] = |
| 20403 | WMI_PDEV_PARAM_BTO_FIX_BCN_TIMEOUT; |
| 20404 | pdev_param[wmi_pdev_param_ce_based_adaptive_bto_enable] = |
| 20405 | WMI_PDEV_PARAM_CE_BASED_ADAPTIVE_BTO_ENABLE; |
| 20406 | pdev_param[wmi_pdev_param_ce_bto_combo_ce_value] = |
| 20407 | WMI_PDEV_PARAM_CE_BTO_COMBO_CE_VALUE; |
| 20408 | pdev_param[wmi_pdev_param_tx_chain_mask_2g] = |
| 20409 | WMI_PDEV_PARAM_TX_CHAIN_MASK_2G; |
| 20410 | pdev_param[wmi_pdev_param_rx_chain_mask_2g] = |
| 20411 | WMI_PDEV_PARAM_RX_CHAIN_MASK_2G; |
| 20412 | pdev_param[wmi_pdev_param_tx_chain_mask_5g] = |
| 20413 | WMI_PDEV_PARAM_TX_CHAIN_MASK_5G; |
| 20414 | pdev_param[wmi_pdev_param_rx_chain_mask_5g] = |
| 20415 | WMI_PDEV_PARAM_RX_CHAIN_MASK_5G; |
| 20416 | pdev_param[wmi_pdev_param_tx_chain_mask_cck] = |
| 20417 | WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK; |
| 20418 | pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = |
| 20419 | WMI_PDEV_PARAM_TX_CHAIN_MASK_1SS; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20420 | pdev_param[wmi_pdev_param_rx_filter] = WMI_PDEV_PARAM_RX_FILTER; |
| 20421 | pdev_param[wmi_pdev_set_mcast_to_ucast_tid] = |
| 20422 | WMI_PDEV_SET_MCAST_TO_UCAST_TID; |
Sathish Kumar | d99852a | 2017-07-08 12:32:27 +0530 | [diff] [blame] | 20423 | pdev_param[wmi_pdev_param_mgmt_retry_limit] = |
| 20424 | WMI_PDEV_PARAM_MGMT_RETRY_LIMIT; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20425 | pdev_param[wmi_pdev_param_aggr_burst] = WMI_PDEV_PARAM_AGGR_BURST; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20426 | pdev_param[wmi_pdev_peer_sta_ps_statechg_enable] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20427 | WMI_PDEV_PEER_STA_PS_STATECHG_ENABLE; |
| 20428 | pdev_param[wmi_pdev_param_proxy_sta_mode] = |
| 20429 | WMI_PDEV_PARAM_PROXY_STA_MODE; |
| 20430 | pdev_param[wmi_pdev_param_mu_group_policy] = |
| 20431 | WMI_PDEV_PARAM_MU_GROUP_POLICY; |
| 20432 | pdev_param[wmi_pdev_param_noise_detection] = |
| 20433 | WMI_PDEV_PARAM_NOISE_DETECTION; |
| 20434 | pdev_param[wmi_pdev_param_noise_threshold] = |
| 20435 | WMI_PDEV_PARAM_NOISE_THRESHOLD; |
| 20436 | pdev_param[wmi_pdev_param_dpd_enable] = WMI_PDEV_PARAM_DPD_ENABLE; |
| 20437 | pdev_param[wmi_pdev_param_set_mcast_bcast_echo] = |
| 20438 | WMI_PDEV_PARAM_SET_MCAST_BCAST_ECHO; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 20439 | pdev_param[wmi_pdev_param_atf_strict_sch] = |
| 20440 | WMI_PDEV_PARAM_ATF_STRICT_SCH; |
| 20441 | pdev_param[wmi_pdev_param_atf_sched_duration] = |
| 20442 | WMI_PDEV_PARAM_ATF_SCHED_DURATION; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20443 | pdev_param[wmi_pdev_param_ant_plzn] = WMI_PDEV_PARAM_ANT_PLZN; |
| 20444 | pdev_param[wmi_pdev_param_sensitivity_level] = |
| 20445 | WMI_PDEV_PARAM_SENSITIVITY_LEVEL; |
| 20446 | pdev_param[wmi_pdev_param_signed_txpower_2g] = |
| 20447 | WMI_PDEV_PARAM_SIGNED_TXPOWER_2G; |
| 20448 | pdev_param[wmi_pdev_param_signed_txpower_5g] = |
| 20449 | WMI_PDEV_PARAM_SIGNED_TXPOWER_5G; |
Karunakar Dasineni | 39a5ff7 | 2017-08-10 12:12:28 -0700 | [diff] [blame] | 20450 | pdev_param[wmi_pdev_param_enable_per_tid_amsdu] = |
| 20451 | WMI_PDEV_PARAM_ENABLE_PER_TID_AMSDU; |
| 20452 | pdev_param[wmi_pdev_param_enable_per_tid_ampdu] = |
| 20453 | WMI_PDEV_PARAM_ENABLE_PER_TID_AMPDU; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20454 | pdev_param[wmi_pdev_param_cca_threshold] = |
| 20455 | WMI_PDEV_PARAM_CCA_THRESHOLD; |
| 20456 | pdev_param[wmi_pdev_param_rts_fixed_rate] = |
| 20457 | WMI_PDEV_PARAM_RTS_FIXED_RATE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20458 | pdev_param[wmi_pdev_param_cal_period] = WMI_UNAVAILABLE_PARAM; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20459 | pdev_param[wmi_pdev_param_pdev_reset] = WMI_PDEV_PARAM_PDEV_RESET; |
| 20460 | pdev_param[wmi_pdev_param_wapi_mbssid_offset] = |
| 20461 | WMI_PDEV_PARAM_WAPI_MBSSID_OFFSET; |
| 20462 | pdev_param[wmi_pdev_param_arp_srcaddr] = |
| 20463 | WMI_PDEV_PARAM_ARP_DBG_SRCADDR; |
| 20464 | pdev_param[wmi_pdev_param_arp_dstaddr] = |
| 20465 | WMI_PDEV_PARAM_ARP_DBG_DSTADDR; |
| 20466 | pdev_param[wmi_pdev_param_txpower_decr_db] = |
| 20467 | WMI_PDEV_PARAM_TXPOWER_DECR_DB; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20468 | pdev_param[wmi_pdev_param_rx_batchmode] = WMI_UNAVAILABLE_PARAM; |
| 20469 | pdev_param[wmi_pdev_param_packet_aggr_delay] = WMI_UNAVAILABLE_PARAM; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 20470 | pdev_param[wmi_pdev_param_atf_obss_noise_sch] = |
| 20471 | WMI_PDEV_PARAM_ATF_OBSS_NOISE_SCH; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20472 | pdev_param[wmi_pdev_param_atf_obss_noise_scaling_factor] = |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 20473 | WMI_PDEV_PARAM_ATF_OBSS_NOISE_SCALING_FACTOR; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20474 | pdev_param[wmi_pdev_param_cust_txpower_scale] = |
| 20475 | WMI_PDEV_PARAM_CUST_TXPOWER_SCALE; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 20476 | pdev_param[wmi_pdev_param_atf_dynamic_enable] = |
| 20477 | WMI_PDEV_PARAM_ATF_DYNAMIC_ENABLE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20478 | pdev_param[wmi_pdev_param_atf_ssid_group_policy] = |
| 20479 | WMI_UNAVAILABLE_PARAM; |
| 20480 | pdev_param[wmi_pdev_param_igmpmld_override] = WMI_UNAVAILABLE_PARAM; |
| 20481 | pdev_param[wmi_pdev_param_igmpmld_tid] = WMI_UNAVAILABLE_PARAM; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20482 | pdev_param[wmi_pdev_param_antenna_gain] = WMI_PDEV_PARAM_ANTENNA_GAIN; |
| 20483 | pdev_param[wmi_pdev_param_block_interbss] = |
| 20484 | WMI_PDEV_PARAM_BLOCK_INTERBSS; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20485 | pdev_param[wmi_pdev_param_set_disable_reset_cmdid] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20486 | WMI_PDEV_PARAM_SET_DISABLE_RESET_CMDID; |
| 20487 | pdev_param[wmi_pdev_param_set_msdu_ttl_cmdid] = |
| 20488 | WMI_PDEV_PARAM_SET_MSDU_TTL_CMDID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20489 | pdev_param[wmi_pdev_param_txbf_sound_period_cmdid] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20490 | WMI_PDEV_PARAM_TXBF_SOUND_PERIOD_CMDID; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 20491 | pdev_param[wmi_pdev_param_set_burst_mode_cmdid] = |
| 20492 | WMI_PDEV_PARAM_SET_BURST_MODE_CMDID; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20493 | pdev_param[wmi_pdev_param_en_stats] = WMI_PDEV_PARAM_EN_STATS; |
Venkateswara Swamy Bandaru | 21cc1ca | 2017-02-24 17:09:46 +0530 | [diff] [blame] | 20494 | pdev_param[wmi_pdev_param_mesh_mcast_enable] = |
| 20495 | WMI_PDEV_PARAM_MESH_MCAST_ENABLE; |
Sathish Kumar | a059f41 | 2017-03-22 19:10:28 +0530 | [diff] [blame] | 20496 | pdev_param[wmi_pdev_param_set_promisc_mode_cmdid] = |
| 20497 | WMI_PDEV_PARAM_SET_PROMISC_MODE_CMDID; |
| 20498 | pdev_param[wmi_pdev_param_set_ppdu_duration_cmdid] = |
| 20499 | WMI_PDEV_PARAM_SET_PPDU_DURATION_CMDID; |
| 20500 | pdev_param[wmi_pdev_param_igmpmld_ac_override] = |
| 20501 | WMI_PDEV_PARAM_IGMPMLD_AC_OVERRIDE; |
| 20502 | pdev_param[wmi_pdev_param_remove_mcast2ucast_buffer] = |
| 20503 | WMI_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER; |
| 20504 | pdev_param[wmi_pdev_param_set_mcast2ucast_buffer] = |
| 20505 | WMI_PDEV_PARAM_SET_MCAST2UCAST_BUFFER; |
| 20506 | pdev_param[wmi_pdev_param_set_mcast2ucast_mode] = |
| 20507 | WMI_PDEV_PARAM_SET_MCAST2UCAST_MODE; |
| 20508 | pdev_param[wmi_pdev_param_smart_antenna_default_antenna] = |
| 20509 | WMI_PDEV_PARAM_SMART_ANTENNA_DEFAULT_ANTENNA; |
| 20510 | pdev_param[wmi_pdev_param_fast_channel_reset] = |
| 20511 | WMI_PDEV_PARAM_FAST_CHANNEL_RESET; |
| 20512 | pdev_param[wmi_pdev_param_rx_decap_mode] = WMI_PDEV_PARAM_RX_DECAP_MODE; |
Sathish Kumar | eefe27e | 2017-10-04 09:58:00 +0530 | [diff] [blame] | 20513 | pdev_param[wmi_pdev_param_tx_ack_timeout] = WMI_PDEV_PARAM_ACK_TIMEOUT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20514 | } |
| 20515 | |
| 20516 | /** |
| 20517 | * populate_vdev_param_tlv() - populates vdev params |
| 20518 | * |
| 20519 | * @param vdev_param: Pointer to hold vdev params |
| 20520 | * Return: None |
| 20521 | */ |
| 20522 | static void populate_vdev_param_tlv(uint32_t *vdev_param) |
| 20523 | { |
| 20524 | vdev_param[wmi_vdev_param_rts_threshold] = WMI_VDEV_PARAM_RTS_THRESHOLD; |
| 20525 | vdev_param[wmi_vdev_param_fragmentation_threshold] = |
| 20526 | WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD; |
| 20527 | vdev_param[wmi_vdev_param_beacon_interval] = |
| 20528 | WMI_VDEV_PARAM_BEACON_INTERVAL; |
| 20529 | vdev_param[wmi_vdev_param_listen_interval] = |
| 20530 | WMI_VDEV_PARAM_LISTEN_INTERVAL; |
| 20531 | vdev_param[wmi_vdev_param_multicast_rate] = |
| 20532 | WMI_VDEV_PARAM_MULTICAST_RATE; |
| 20533 | vdev_param[wmi_vdev_param_mgmt_tx_rate] = WMI_VDEV_PARAM_MGMT_TX_RATE; |
| 20534 | vdev_param[wmi_vdev_param_slot_time] = WMI_VDEV_PARAM_SLOT_TIME; |
| 20535 | vdev_param[wmi_vdev_param_preamble] = WMI_VDEV_PARAM_PREAMBLE; |
| 20536 | vdev_param[wmi_vdev_param_swba_time] = WMI_VDEV_PARAM_SWBA_TIME; |
| 20537 | vdev_param[wmi_vdev_stats_update_period] = WMI_VDEV_STATS_UPDATE_PERIOD; |
| 20538 | vdev_param[wmi_vdev_pwrsave_ageout_time] = WMI_VDEV_PWRSAVE_AGEOUT_TIME; |
| 20539 | vdev_param[wmi_vdev_host_swba_interval] = WMI_VDEV_HOST_SWBA_INTERVAL; |
| 20540 | vdev_param[wmi_vdev_param_dtim_period] = WMI_VDEV_PARAM_DTIM_PERIOD; |
| 20541 | vdev_param[wmi_vdev_oc_scheduler_air_time_limit] = |
| 20542 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT; |
| 20543 | vdev_param[wmi_vdev_param_wds] = WMI_VDEV_PARAM_WDS; |
| 20544 | vdev_param[wmi_vdev_param_atim_window] = WMI_VDEV_PARAM_ATIM_WINDOW; |
| 20545 | vdev_param[wmi_vdev_param_bmiss_count_max] = |
| 20546 | WMI_VDEV_PARAM_BMISS_COUNT_MAX; |
| 20547 | vdev_param[wmi_vdev_param_bmiss_first_bcnt] = |
| 20548 | WMI_VDEV_PARAM_BMISS_FIRST_BCNT; |
| 20549 | vdev_param[wmi_vdev_param_bmiss_final_bcnt] = |
| 20550 | WMI_VDEV_PARAM_BMISS_FINAL_BCNT; |
| 20551 | vdev_param[wmi_vdev_param_feature_wmm] = WMI_VDEV_PARAM_FEATURE_WMM; |
| 20552 | vdev_param[wmi_vdev_param_chwidth] = WMI_VDEV_PARAM_CHWIDTH; |
| 20553 | vdev_param[wmi_vdev_param_chextoffset] = WMI_VDEV_PARAM_CHEXTOFFSET; |
| 20554 | vdev_param[wmi_vdev_param_disable_htprotection] = |
| 20555 | WMI_VDEV_PARAM_DISABLE_HTPROTECTION; |
| 20556 | vdev_param[wmi_vdev_param_sta_quickkickout] = |
| 20557 | WMI_VDEV_PARAM_STA_QUICKKICKOUT; |
| 20558 | vdev_param[wmi_vdev_param_mgmt_rate] = WMI_VDEV_PARAM_MGMT_RATE; |
| 20559 | vdev_param[wmi_vdev_param_protection_mode] = |
| 20560 | WMI_VDEV_PARAM_PROTECTION_MODE; |
| 20561 | vdev_param[wmi_vdev_param_fixed_rate] = WMI_VDEV_PARAM_FIXED_RATE; |
| 20562 | vdev_param[wmi_vdev_param_sgi] = WMI_VDEV_PARAM_SGI; |
| 20563 | vdev_param[wmi_vdev_param_ldpc] = WMI_VDEV_PARAM_LDPC; |
| 20564 | vdev_param[wmi_vdev_param_tx_stbc] = WMI_VDEV_PARAM_TX_STBC; |
| 20565 | vdev_param[wmi_vdev_param_rx_stbc] = WMI_VDEV_PARAM_RX_STBC; |
| 20566 | vdev_param[wmi_vdev_param_intra_bss_fwd] = WMI_VDEV_PARAM_INTRA_BSS_FWD; |
| 20567 | vdev_param[wmi_vdev_param_def_keyid] = WMI_VDEV_PARAM_DEF_KEYID; |
| 20568 | vdev_param[wmi_vdev_param_nss] = WMI_VDEV_PARAM_NSS; |
| 20569 | vdev_param[wmi_vdev_param_bcast_data_rate] = |
| 20570 | WMI_VDEV_PARAM_BCAST_DATA_RATE; |
| 20571 | vdev_param[wmi_vdev_param_mcast_data_rate] = |
| 20572 | WMI_VDEV_PARAM_MCAST_DATA_RATE; |
| 20573 | vdev_param[wmi_vdev_param_mcast_indicate] = |
| 20574 | WMI_VDEV_PARAM_MCAST_INDICATE; |
| 20575 | vdev_param[wmi_vdev_param_dhcp_indicate] = |
| 20576 | WMI_VDEV_PARAM_DHCP_INDICATE; |
| 20577 | vdev_param[wmi_vdev_param_unknown_dest_indicate] = |
| 20578 | WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE; |
| 20579 | vdev_param[wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs] = |
| 20580 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS; |
| 20581 | vdev_param[wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs] = |
| 20582 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS; |
| 20583 | vdev_param[wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs] = |
| 20584 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS; |
| 20585 | vdev_param[wmi_vdev_param_ap_enable_nawds] = |
| 20586 | WMI_VDEV_PARAM_AP_ENABLE_NAWDS; |
| 20587 | vdev_param[wmi_vdev_param_enable_rtscts] = WMI_VDEV_PARAM_ENABLE_RTSCTS; |
| 20588 | vdev_param[wmi_vdev_param_txbf] = WMI_VDEV_PARAM_TXBF; |
| 20589 | vdev_param[wmi_vdev_param_packet_powersave] = |
| 20590 | WMI_VDEV_PARAM_PACKET_POWERSAVE; |
| 20591 | vdev_param[wmi_vdev_param_drop_unencry] = WMI_VDEV_PARAM_DROP_UNENCRY; |
| 20592 | vdev_param[wmi_vdev_param_tx_encap_type] = WMI_VDEV_PARAM_TX_ENCAP_TYPE; |
| 20593 | vdev_param[wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs] = |
| 20594 | WMI_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS; |
| 20595 | vdev_param[wmi_vdev_param_early_rx_adjust_enable] = |
| 20596 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE; |
| 20597 | vdev_param[wmi_vdev_param_early_rx_tgt_bmiss_num] = |
| 20598 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM; |
| 20599 | vdev_param[wmi_vdev_param_early_rx_bmiss_sample_cycle] = |
| 20600 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE; |
| 20601 | vdev_param[wmi_vdev_param_early_rx_slop_step] = |
| 20602 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP; |
| 20603 | vdev_param[wmi_vdev_param_early_rx_init_slop] = |
| 20604 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP; |
| 20605 | vdev_param[wmi_vdev_param_early_rx_adjust_pause] = |
| 20606 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE; |
| 20607 | vdev_param[wmi_vdev_param_tx_pwrlimit] = WMI_VDEV_PARAM_TX_PWRLIMIT; |
| 20608 | vdev_param[wmi_vdev_param_snr_num_for_cal] = |
| 20609 | WMI_VDEV_PARAM_SNR_NUM_FOR_CAL; |
| 20610 | vdev_param[wmi_vdev_param_roam_fw_offload] = |
| 20611 | WMI_VDEV_PARAM_ROAM_FW_OFFLOAD; |
| 20612 | vdev_param[wmi_vdev_param_enable_rmc] = WMI_VDEV_PARAM_ENABLE_RMC; |
| 20613 | vdev_param[wmi_vdev_param_ibss_max_bcn_lost_ms] = |
| 20614 | WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS; |
| 20615 | vdev_param[wmi_vdev_param_max_rate] = WMI_VDEV_PARAM_MAX_RATE; |
| 20616 | vdev_param[wmi_vdev_param_early_rx_drift_sample] = |
| 20617 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE; |
| 20618 | vdev_param[wmi_vdev_param_set_ibss_tx_fail_cnt_thr] = |
| 20619 | WMI_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR; |
| 20620 | vdev_param[wmi_vdev_param_ebt_resync_timeout] = |
| 20621 | WMI_VDEV_PARAM_EBT_RESYNC_TIMEOUT; |
| 20622 | vdev_param[wmi_vdev_param_aggr_trig_event_enable] = |
| 20623 | WMI_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE; |
| 20624 | vdev_param[wmi_vdev_param_is_ibss_power_save_allowed] = |
| 20625 | WMI_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED; |
| 20626 | vdev_param[wmi_vdev_param_is_power_collapse_allowed] = |
| 20627 | WMI_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED; |
| 20628 | vdev_param[wmi_vdev_param_is_awake_on_txrx_enabled] = |
| 20629 | WMI_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED; |
| 20630 | vdev_param[wmi_vdev_param_inactivity_cnt] = |
| 20631 | WMI_VDEV_PARAM_INACTIVITY_CNT; |
| 20632 | vdev_param[wmi_vdev_param_txsp_end_inactivity_time_ms] = |
| 20633 | WMI_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS; |
| 20634 | vdev_param[wmi_vdev_param_dtim_policy] = WMI_VDEV_PARAM_DTIM_POLICY; |
| 20635 | vdev_param[wmi_vdev_param_ibss_ps_warmup_time_secs] = |
| 20636 | WMI_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS; |
| 20637 | vdev_param[wmi_vdev_param_ibss_ps_1rx_chain_in_atim_window_enable] = |
| 20638 | WMI_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE; |
| 20639 | vdev_param[wmi_vdev_param_rx_leak_window] = |
| 20640 | WMI_VDEV_PARAM_RX_LEAK_WINDOW; |
| 20641 | vdev_param[wmi_vdev_param_stats_avg_factor] = |
| 20642 | WMI_VDEV_PARAM_STATS_AVG_FACTOR; |
| 20643 | vdev_param[wmi_vdev_param_disconnect_th] = WMI_VDEV_PARAM_DISCONNECT_TH; |
| 20644 | vdev_param[wmi_vdev_param_rtscts_rate] = WMI_VDEV_PARAM_RTSCTS_RATE; |
| 20645 | vdev_param[wmi_vdev_param_mcc_rtscts_protection_enable] = |
| 20646 | WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE; |
| 20647 | vdev_param[wmi_vdev_param_mcc_broadcast_probe_enable] = |
| 20648 | WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 20649 | vdev_param[wmi_vdev_param_mgmt_tx_power] = WMI_VDEV_PARAM_MGMT_TX_POWER; |
| 20650 | vdev_param[wmi_vdev_param_beacon_rate] = WMI_VDEV_PARAM_BEACON_RATE; |
Kalyan Tallapragada | d9a6abd | 2017-01-30 14:25:27 +0530 | [diff] [blame] | 20651 | 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] | 20652 | vdev_param[wmi_vdev_param_he_dcm_enable] = WMI_VDEV_PARAM_HE_DCM; |
| 20653 | vdev_param[wmi_vdev_param_he_range_ext_enable] = |
| 20654 | WMI_VDEV_PARAM_HE_RANGE_EXT; |
| 20655 | vdev_param[wmi_vdev_param_he_bss_color] = WMI_VDEV_PARAM_BSS_COLOR; |
| 20656 | 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] | 20657 | vdev_param[wmi_vdev_param_sensor_ap] = WMI_VDEV_PARAM_SENSOR_AP; |
| 20658 | vdev_param[wmi_vdev_param_dtim_enable_cts] = |
| 20659 | WMI_VDEV_PARAM_DTIM_ENABLE_CTS; |
| 20660 | vdev_param[wmi_vdev_param_atf_ssid_sched_policy] = |
| 20661 | WMI_VDEV_PARAM_ATF_SSID_SCHED_POLICY; |
| 20662 | vdev_param[wmi_vdev_param_disable_dyn_bw_rts] = |
| 20663 | WMI_VDEV_PARAM_DISABLE_DYN_BW_RTS; |
Sathish Kumar | 2ac4070 | 2017-03-22 19:18:45 +0530 | [diff] [blame] | 20664 | vdev_param[wmi_vdev_param_mcast2ucast_set] = |
| 20665 | WMI_VDEV_PARAM_MCAST2UCAST_SET; |
| 20666 | vdev_param[wmi_vdev_param_rc_num_retries] = |
| 20667 | WMI_VDEV_PARAM_RC_NUM_RETRIES; |
| 20668 | vdev_param[wmi_vdev_param_cabq_maxdur] = WMI_VDEV_PARAM_CABQ_MAXDUR; |
| 20669 | vdev_param[wmi_vdev_param_mfptest_set] = WMI_VDEV_PARAM_MFPTEST_SET; |
| 20670 | vdev_param[wmi_vdev_param_rts_fixed_rate] = |
| 20671 | WMI_VDEV_PARAM_RTS_FIXED_RATE; |
| 20672 | vdev_param[wmi_vdev_param_vht_sgimask] = WMI_VDEV_PARAM_VHT_SGIMASK; |
| 20673 | vdev_param[wmi_vdev_param_vht80_ratemask] = |
| 20674 | WMI_VDEV_PARAM_VHT80_RATEMASK; |
| 20675 | vdev_param[wmi_vdev_param_proxy_sta] = WMI_VDEV_PARAM_PROXY_STA; |
| 20676 | vdev_param[wmi_vdev_param_bw_nss_ratemask] = |
| 20677 | WMI_VDEV_PARAM_BW_NSS_RATEMASK; |
Gyanranjan Hazarika | 88e1183 | 2017-09-18 15:59:34 -0700 | [diff] [blame] | 20678 | vdev_param[wmi_vdev_param_set_he_ltf] = WMI_VDEV_PARAM_HE_LTF; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20679 | } |
| 20680 | #endif |
| 20681 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20682 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20683 | * populate_target_defines_tlv() - Populate target defines and params |
| 20684 | * @wmi_handle: pointer to wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20685 | * |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 20686 | * Return: None |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20687 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 20688 | #ifndef CONFIG_MCL |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20689 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20690 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20691 | populate_tlv_service(wmi_handle->services); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20692 | populate_pdev_param_tlv(wmi_handle->pdev_param); |
| 20693 | populate_vdev_param_tlv(wmi_handle->vdev_param); |
| 20694 | } |
| 20695 | #else |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20696 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
| 20697 | { } |
| 20698 | #endif |
| 20699 | |
| 20700 | /** |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 20701 | * convert_host_pdev_id_to_target_pdev_id() - Convert pdev_id from |
| 20702 | * host to target defines. |
| 20703 | * @param pdev_id: host pdev_id to be converted. |
| 20704 | * Return: target pdev_id after conversion. |
| 20705 | */ |
| 20706 | static uint32_t convert_host_pdev_id_to_target_pdev_id(uint32_t pdev_id) |
| 20707 | { |
| 20708 | switch (pdev_id) { |
| 20709 | case WMI_HOST_PDEV_ID_SOC: |
| 20710 | return WMI_PDEV_ID_SOC; |
| 20711 | case WMI_HOST_PDEV_ID_0: |
| 20712 | return WMI_PDEV_ID_1ST; |
| 20713 | case WMI_HOST_PDEV_ID_1: |
| 20714 | return WMI_PDEV_ID_2ND; |
| 20715 | case WMI_HOST_PDEV_ID_2: |
| 20716 | return WMI_PDEV_ID_3RD; |
| 20717 | } |
| 20718 | |
| 20719 | QDF_ASSERT(0); |
| 20720 | |
| 20721 | return WMI_PDEV_ID_SOC; |
| 20722 | } |
| 20723 | |
| 20724 | /** |
| 20725 | * convert_target_pdev_id_to_host_pdev_id() - Convert pdev_id from |
| 20726 | * target to host defines. |
| 20727 | * @param pdev_id: target pdev_id to be converted. |
| 20728 | * Return: host pdev_id after conversion. |
| 20729 | */ |
| 20730 | static uint32_t convert_target_pdev_id_to_host_pdev_id(uint32_t pdev_id) |
| 20731 | { |
| 20732 | switch (pdev_id) { |
| 20733 | case WMI_PDEV_ID_SOC: |
| 20734 | return WMI_HOST_PDEV_ID_SOC; |
| 20735 | case WMI_PDEV_ID_1ST: |
| 20736 | return WMI_HOST_PDEV_ID_0; |
| 20737 | case WMI_PDEV_ID_2ND: |
| 20738 | return WMI_HOST_PDEV_ID_1; |
| 20739 | case WMI_PDEV_ID_3RD: |
| 20740 | return WMI_HOST_PDEV_ID_2; |
| 20741 | } |
| 20742 | |
| 20743 | QDF_ASSERT(0); |
| 20744 | |
| 20745 | return WMI_HOST_PDEV_ID_SOC; |
| 20746 | } |
| 20747 | |
| 20748 | /** |
| 20749 | * wmi_tlv_pdev_id_conversion_enable() - Enable pdev_id conversion |
| 20750 | * |
| 20751 | * Return None. |
| 20752 | */ |
| 20753 | void wmi_tlv_pdev_id_conversion_enable(wmi_unified_t wmi_handle) |
| 20754 | { |
| 20755 | wmi_handle->ops->convert_pdev_id_host_to_target = |
| 20756 | convert_host_pdev_id_to_target_pdev_id; |
| 20757 | wmi_handle->ops->convert_pdev_id_target_to_host = |
| 20758 | convert_target_pdev_id_to_host_pdev_id; |
| 20759 | } |
| 20760 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20761 | * wmi_tlv_attach() - Attach TLV APIs |
| 20762 | * |
| 20763 | * Return: None |
| 20764 | */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 20765 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20766 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 20767 | wmi_handle->ops = &tlv_ops; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 20768 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 20769 | wmi_handle->log_info.buf_offset_command = 2; |
| 20770 | wmi_handle->log_info.buf_offset_event = 4; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 20771 | #endif |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 20772 | populate_tlv_events_id(wmi_handle->wmi_events); |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20773 | populate_target_defines_tlv(wmi_handle); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20774 | } |