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 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5493 | /** |
| 5494 | * send_roam_scan_offload_mode_cmd_tlv() - send roam scan mode request to fw |
| 5495 | * @wmi_handle: wmi handle |
| 5496 | * @scan_cmd_fp: start scan command ptr |
| 5497 | * @roam_req: roam request param |
| 5498 | * |
| 5499 | * send WMI_ROAM_SCAN_MODE TLV to firmware. It has a piggyback |
| 5500 | * of WMI_ROAM_SCAN_MODE. |
| 5501 | * |
| 5502 | * Return: QDF status |
| 5503 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5504 | 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] | 5505 | wmi_start_scan_cmd_fixed_param * |
| 5506 | scan_cmd_fp, |
| 5507 | struct roam_offload_scan_params *roam_req) |
| 5508 | { |
| 5509 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5510 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5511 | int len; |
| 5512 | uint8_t *buf_ptr; |
| 5513 | wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5514 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5515 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5516 | int auth_mode = roam_req->auth_mode; |
| 5517 | wmi_roam_offload_tlv_param *roam_offload_params; |
| 5518 | wmi_roam_11i_offload_tlv_param *roam_offload_11i; |
| 5519 | wmi_roam_11r_offload_tlv_param *roam_offload_11r; |
| 5520 | wmi_roam_ese_offload_tlv_param *roam_offload_ese; |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5521 | wmi_tlv_buf_len_param *assoc_ies; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5522 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5523 | /* Need to create a buf with roam_scan command at |
| 5524 | * front and piggyback with scan command */ |
| 5525 | len = sizeof(wmi_roam_scan_mode_fixed_param) + |
| 5526 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5527 | (2 * WMI_TLV_HDR_SIZE) + |
| 5528 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5529 | sizeof(wmi_start_scan_cmd_fixed_param); |
| 5530 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | 1339928 | 2017-09-21 21:10:43 -0700 | [diff] [blame] | 5531 | WMI_LOGD("auth_mode = %d", auth_mode); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5532 | if (roam_req->is_roam_req_valid && |
| 5533 | roam_req->roam_offload_enabled) { |
| 5534 | len += sizeof(wmi_roam_offload_tlv_param); |
| 5535 | len += WMI_TLV_HDR_SIZE; |
| 5536 | if ((auth_mode != WMI_AUTH_NONE) && |
| 5537 | ((auth_mode != WMI_AUTH_OPEN) || |
| 5538 | (auth_mode == WMI_AUTH_OPEN && |
| 5539 | roam_req->mdid.mdie_present) || |
| 5540 | roam_req->is_ese_assoc)) { |
| 5541 | len += WMI_TLV_HDR_SIZE; |
| 5542 | if (roam_req->is_ese_assoc) |
| 5543 | len += |
| 5544 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 5545 | else if (auth_mode == WMI_AUTH_FT_RSNA || |
| 5546 | auth_mode == WMI_AUTH_FT_RSNA_PSK || |
| 5547 | (auth_mode == WMI_AUTH_OPEN && |
| 5548 | roam_req->mdid.mdie_present)) |
| 5549 | len += |
| 5550 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 5551 | else |
| 5552 | len += |
| 5553 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 5554 | } else { |
| 5555 | len += WMI_TLV_HDR_SIZE; |
| 5556 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5557 | |
| 5558 | len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE) |
| 5559 | + roundup(roam_req->assoc_ie_length, |
| 5560 | sizeof(uint32_t))); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5561 | } else { |
| 5562 | if (roam_req->is_roam_req_valid) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5563 | WMI_LOGD("%s : roam offload = %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5564 | __func__, roam_req->roam_offload_enabled); |
| 5565 | else |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5566 | WMI_LOGD("%s : roam_req is NULL", __func__); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5567 | len += (4 * WMI_TLV_HDR_SIZE); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5568 | } |
| 5569 | if (roam_req->is_roam_req_valid && |
| 5570 | roam_req->roam_offload_enabled) { |
| 5571 | roam_req->mode = roam_req->mode | |
| 5572 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; |
| 5573 | } |
| 5574 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 5575 | |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5576 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE |
| 5577 | |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) |
| 5578 | len = sizeof(wmi_roam_scan_mode_fixed_param); |
| 5579 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5580 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5581 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5582 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5583 | return QDF_STATUS_E_NOMEM; |
| 5584 | } |
| 5585 | |
| 5586 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5587 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5588 | roam_scan_mode_fp = (wmi_roam_scan_mode_fixed_param *) buf_ptr; |
| 5589 | WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, |
| 5590 | WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, |
| 5591 | WMITLV_GET_STRUCT_TLVLEN |
| 5592 | (wmi_roam_scan_mode_fixed_param)); |
| 5593 | |
| 5594 | roam_scan_mode_fp->roam_scan_mode = roam_req->mode; |
| 5595 | roam_scan_mode_fp->vdev_id = roam_req->vdev_id; |
Sreelakshmi Konamki | 400a40d | 2017-02-24 14:28:34 +0530 | [diff] [blame] | 5596 | if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE | |
| 5597 | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) { |
| 5598 | roam_scan_mode_fp->flags |= |
| 5599 | WMI_ROAM_SCAN_MODE_FLAG_REPORT_STATUS; |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5600 | goto send_roam_scan_mode_cmd; |
Sreelakshmi Konamki | 400a40d | 2017-02-24 14:28:34 +0530 | [diff] [blame] | 5601 | } |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5602 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5603 | /* Fill in scan parameters suitable for roaming scan */ |
| 5604 | buf_ptr += sizeof(wmi_roam_scan_mode_fixed_param); |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5605 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5606 | qdf_mem_copy(buf_ptr, scan_cmd_fp, |
| 5607 | sizeof(wmi_start_scan_cmd_fixed_param)); |
| 5608 | /* Ensure there is no additional IEs */ |
| 5609 | scan_cmd_fp->ie_len = 0; |
| 5610 | WMITLV_SET_HDR(buf_ptr, |
| 5611 | WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, |
| 5612 | WMITLV_GET_STRUCT_TLVLEN |
| 5613 | (wmi_start_scan_cmd_fixed_param)); |
| 5614 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5615 | buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); |
| 5616 | if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { |
| 5617 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5618 | sizeof(wmi_roam_offload_tlv_param)); |
| 5619 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5620 | roam_offload_params = (wmi_roam_offload_tlv_param *) buf_ptr; |
| 5621 | WMITLV_SET_HDR(buf_ptr, |
| 5622 | WMITLV_TAG_STRUC_wmi_roam_offload_tlv_param, |
| 5623 | WMITLV_GET_STRUCT_TLVLEN |
| 5624 | (wmi_roam_offload_tlv_param)); |
| 5625 | roam_offload_params->prefer_5g = roam_req->prefer_5ghz; |
| 5626 | roam_offload_params->rssi_cat_gap = roam_req->roam_rssi_cat_gap; |
| 5627 | roam_offload_params->select_5g_margin = |
| 5628 | roam_req->select_5ghz_margin; |
| 5629 | roam_offload_params->reassoc_failure_timeout = |
| 5630 | roam_req->reassoc_failure_timeout; |
| 5631 | |
| 5632 | /* Fill the capabilities */ |
| 5633 | roam_offload_params->capability = |
| 5634 | roam_req->roam_offload_params.capability; |
| 5635 | roam_offload_params->ht_caps_info = |
| 5636 | roam_req->roam_offload_params.ht_caps_info; |
| 5637 | roam_offload_params->ampdu_param = |
| 5638 | roam_req->roam_offload_params.ampdu_param; |
| 5639 | roam_offload_params->ht_ext_cap = |
| 5640 | roam_req->roam_offload_params.ht_ext_cap; |
| 5641 | roam_offload_params->ht_txbf = |
| 5642 | roam_req->roam_offload_params.ht_txbf; |
| 5643 | roam_offload_params->asel_cap = |
| 5644 | roam_req->roam_offload_params.asel_cap; |
| 5645 | roam_offload_params->qos_caps = |
| 5646 | roam_req->roam_offload_params.qos_caps; |
Naveen Rawat | 1dcabaf | 2016-11-18 17:27:29 -0800 | [diff] [blame] | 5647 | roam_offload_params->qos_enabled = |
| 5648 | roam_req->roam_offload_params.qos_enabled; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5649 | roam_offload_params->wmm_caps = |
| 5650 | roam_req->roam_offload_params.wmm_caps; |
| 5651 | qdf_mem_copy((uint8_t *)roam_offload_params->mcsset, |
| 5652 | (uint8_t *)roam_req->roam_offload_params.mcsset, |
| 5653 | ROAM_OFFLOAD_NUM_MCS_SET); |
| 5654 | |
| 5655 | buf_ptr += sizeof(wmi_roam_offload_tlv_param); |
| 5656 | /* The TLV's are in the order of 11i, 11R, ESE. Hence, |
| 5657 | * they are filled in the same order.Depending on the |
| 5658 | * authentication type, the other mode TLV's are nullified |
| 5659 | * and only headers are filled.*/ |
| 5660 | if ((auth_mode != WMI_AUTH_NONE) && |
| 5661 | ((auth_mode != WMI_AUTH_OPEN) || |
| 5662 | (auth_mode == WMI_AUTH_OPEN |
| 5663 | && roam_req->mdid.mdie_present) || |
| 5664 | roam_req->is_ese_assoc)) { |
| 5665 | if (roam_req->is_ese_assoc) { |
| 5666 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5667 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5668 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5669 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5670 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5671 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5672 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5673 | sizeof(wmi_roam_ese_offload_tlv_param)); |
| 5674 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5675 | roam_offload_ese = |
| 5676 | (wmi_roam_ese_offload_tlv_param *) buf_ptr; |
| 5677 | qdf_mem_copy(roam_offload_ese->krk, |
| 5678 | roam_req->krk, |
| 5679 | sizeof(roam_req->krk)); |
| 5680 | qdf_mem_copy(roam_offload_ese->btk, |
| 5681 | roam_req->btk, |
| 5682 | sizeof(roam_req->btk)); |
| 5683 | WMITLV_SET_HDR(&roam_offload_ese->tlv_header, |
| 5684 | WMITLV_TAG_STRUC_wmi_roam_ese_offload_tlv_param, |
| 5685 | WMITLV_GET_STRUCT_TLVLEN |
| 5686 | (wmi_roam_ese_offload_tlv_param)); |
| 5687 | buf_ptr += |
| 5688 | sizeof(wmi_roam_ese_offload_tlv_param); |
| 5689 | } else if (auth_mode == WMI_AUTH_FT_RSNA |
| 5690 | || auth_mode == WMI_AUTH_FT_RSNA_PSK |
| 5691 | || (auth_mode == WMI_AUTH_OPEN |
| 5692 | && roam_req->mdid.mdie_present)) { |
| 5693 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5694 | 0); |
| 5695 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5696 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5697 | sizeof(wmi_roam_11r_offload_tlv_param)); |
| 5698 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5699 | roam_offload_11r = |
| 5700 | (wmi_roam_11r_offload_tlv_param *) buf_ptr; |
| 5701 | roam_offload_11r->r0kh_id_len = |
| 5702 | roam_req->rokh_id_length; |
| 5703 | qdf_mem_copy(roam_offload_11r->r0kh_id, |
| 5704 | roam_req->rokh_id, |
| 5705 | roam_offload_11r->r0kh_id_len); |
| 5706 | qdf_mem_copy(roam_offload_11r->psk_msk, |
| 5707 | roam_req->psk_pmk, |
| 5708 | sizeof(roam_req->psk_pmk)); |
| 5709 | roam_offload_11r->psk_msk_len = |
| 5710 | roam_req->pmk_len; |
| 5711 | roam_offload_11r->mdie_present = |
| 5712 | roam_req->mdid.mdie_present; |
| 5713 | roam_offload_11r->mdid = |
| 5714 | roam_req->mdid.mobility_domain; |
| 5715 | if (auth_mode == WMI_AUTH_OPEN) { |
| 5716 | /* If FT-Open ensure pmk length |
| 5717 | and r0khid len are zero */ |
| 5718 | roam_offload_11r->r0kh_id_len = 0; |
| 5719 | roam_offload_11r->psk_msk_len = 0; |
| 5720 | } |
| 5721 | WMITLV_SET_HDR(&roam_offload_11r->tlv_header, |
| 5722 | WMITLV_TAG_STRUC_wmi_roam_11r_offload_tlv_param, |
| 5723 | WMITLV_GET_STRUCT_TLVLEN |
| 5724 | (wmi_roam_11r_offload_tlv_param)); |
| 5725 | buf_ptr += |
| 5726 | sizeof(wmi_roam_11r_offload_tlv_param); |
| 5727 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5728 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5729 | buf_ptr += WMI_TLV_HDR_SIZE; |
Varun Reddy Yeturu | 1339928 | 2017-09-21 21:10:43 -0700 | [diff] [blame] | 5730 | WMI_LOGD("psk_msk_len = %d", |
| 5731 | roam_offload_11r->psk_msk_len); |
| 5732 | if (roam_offload_11r->psk_msk_len) |
| 5733 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, |
| 5734 | QDF_TRACE_LEVEL_DEBUG, |
| 5735 | roam_offload_11r->psk_msk, |
| 5736 | roam_offload_11r->psk_msk_len); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5737 | } else { |
| 5738 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5739 | sizeof(wmi_roam_11i_offload_tlv_param)); |
| 5740 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5741 | roam_offload_11i = |
| 5742 | (wmi_roam_11i_offload_tlv_param *) buf_ptr; |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 5743 | |
Deepak Dhamdhere | 70504a1 | 2016-08-22 18:04:00 -0700 | [diff] [blame] | 5744 | if (roam_req->roam_key_mgmt_offload_enabled && |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 5745 | roam_req->fw_okc) { |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5746 | WMI_SET_ROAM_OFFLOAD_OKC_ENABLED |
| 5747 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 5748 | WMI_LOGI("LFR3:OKC enabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5749 | } else { |
| 5750 | WMI_SET_ROAM_OFFLOAD_OKC_DISABLED |
| 5751 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 5752 | WMI_LOGI("LFR3:OKC disabled"); |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 5753 | } |
| 5754 | if (roam_req->roam_key_mgmt_offload_enabled && |
| 5755 | roam_req->fw_pmksa_cache) { |
| 5756 | WMI_SET_ROAM_OFFLOAD_PMK_CACHE_ENABLED |
| 5757 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 5758 | WMI_LOGI("LFR3:PMKSA caching enabled"); |
Deepak Dhamdhere | 2eff012 | 2017-02-09 19:40:26 -0800 | [diff] [blame] | 5759 | } else { |
| 5760 | WMI_SET_ROAM_OFFLOAD_PMK_CACHE_DISABLED |
| 5761 | (roam_offload_11i->flags); |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 5762 | WMI_LOGI("LFR3:PMKSA caching disabled"); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5763 | } |
| 5764 | |
| 5765 | qdf_mem_copy(roam_offload_11i->pmk, |
| 5766 | roam_req->psk_pmk, |
| 5767 | sizeof(roam_req->psk_pmk)); |
| 5768 | roam_offload_11i->pmk_len = roam_req->pmk_len; |
| 5769 | WMITLV_SET_HDR(&roam_offload_11i->tlv_header, |
| 5770 | WMITLV_TAG_STRUC_wmi_roam_11i_offload_tlv_param, |
| 5771 | WMITLV_GET_STRUCT_TLVLEN |
| 5772 | (wmi_roam_11i_offload_tlv_param)); |
| 5773 | buf_ptr += |
| 5774 | sizeof(wmi_roam_11i_offload_tlv_param); |
| 5775 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5776 | 0); |
| 5777 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5778 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5779 | 0); |
| 5780 | buf_ptr += WMI_TLV_HDR_SIZE; |
Varun Reddy Yeturu | 1339928 | 2017-09-21 21:10:43 -0700 | [diff] [blame] | 5781 | WMI_LOGD("pmk_len = %d", |
| 5782 | roam_offload_11i->pmk_len); |
| 5783 | if (roam_offload_11i->pmk_len) |
| 5784 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, |
| 5785 | QDF_TRACE_LEVEL_DEBUG, |
| 5786 | roam_offload_11i->pmk, |
| 5787 | roam_offload_11i->pmk_len); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5788 | } |
| 5789 | } else { |
| 5790 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5791 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5792 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5793 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5794 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5795 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5796 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5797 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5798 | buf_ptr += WMI_TLV_HDR_SIZE; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5799 | } |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5800 | |
| 5801 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5802 | sizeof(*assoc_ies)); |
| 5803 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5804 | |
| 5805 | assoc_ies = (wmi_tlv_buf_len_param *) buf_ptr; |
| 5806 | WMITLV_SET_HDR(&assoc_ies->tlv_header, |
| 5807 | WMITLV_TAG_STRUC_wmi_tlv_buf_len_param, |
| 5808 | WMITLV_GET_STRUCT_TLVLEN(wmi_tlv_buf_len_param)); |
| 5809 | assoc_ies->buf_len = roam_req->assoc_ie_length; |
| 5810 | |
| 5811 | buf_ptr += sizeof(*assoc_ies); |
| 5812 | |
| 5813 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5814 | roundup(assoc_ies->buf_len, sizeof(uint32_t))); |
| 5815 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5816 | |
| 5817 | if (assoc_ies->buf_len != 0) { |
| 5818 | qdf_mem_copy(buf_ptr, roam_req->assoc_ie, |
| 5819 | assoc_ies->buf_len); |
| 5820 | } |
| 5821 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5822 | } else { |
| 5823 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5824 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5825 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5826 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5827 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5828 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5829 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5830 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5831 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5832 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5833 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Selvaraj, Sridhar | f36770f | 2016-07-04 21:40:23 +0530 | [diff] [blame] | 5834 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5835 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 5836 | WMITLV_GET_STRUCT_TLVLEN(0)); |
| 5837 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5838 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 5839 | WMITLV_GET_STRUCT_TLVLEN(0)); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5840 | } |
| 5841 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
Selvaraj, Sridhar | 1b1fdae | 2016-10-17 20:36:10 +0530 | [diff] [blame] | 5842 | |
| 5843 | send_roam_scan_mode_cmd: |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5844 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5845 | len, WMI_ROAM_SCAN_MODE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5846 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5847 | WMI_LOGE( |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5848 | "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", |
| 5849 | status); |
| 5850 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5851 | } |
| 5852 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5853 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5854 | } |
| 5855 | |
Varun Reddy Yeturu | 412601c | 2017-07-20 09:45:01 -0700 | [diff] [blame] | 5856 | static QDF_STATUS send_roam_mawc_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 5857 | struct wmi_mawc_roam_params *params) |
| 5858 | { |
| 5859 | wmi_buf_t buf = NULL; |
| 5860 | QDF_STATUS status; |
| 5861 | int len; |
| 5862 | uint8_t *buf_ptr; |
| 5863 | wmi_roam_configure_mawc_cmd_fixed_param *wmi_roam_mawc_params; |
| 5864 | |
| 5865 | len = sizeof(*wmi_roam_mawc_params); |
| 5866 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5867 | if (!buf) { |
| 5868 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 5869 | return QDF_STATUS_E_NOMEM; |
| 5870 | } |
| 5871 | |
| 5872 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5873 | wmi_roam_mawc_params = |
| 5874 | (wmi_roam_configure_mawc_cmd_fixed_param *) buf_ptr; |
| 5875 | WMITLV_SET_HDR(&wmi_roam_mawc_params->tlv_header, |
| 5876 | WMITLV_TAG_STRUC_wmi_roam_configure_mawc_cmd_fixed_param, |
| 5877 | WMITLV_GET_STRUCT_TLVLEN |
| 5878 | (wmi_roam_configure_mawc_cmd_fixed_param)); |
| 5879 | wmi_roam_mawc_params->vdev_id = params->vdev_id; |
| 5880 | if (params->enable) |
| 5881 | wmi_roam_mawc_params->enable = 1; |
| 5882 | else |
| 5883 | wmi_roam_mawc_params->enable = 0; |
| 5884 | wmi_roam_mawc_params->traffic_load_threshold = |
| 5885 | params->traffic_load_threshold; |
| 5886 | wmi_roam_mawc_params->best_ap_rssi_threshold = |
| 5887 | params->best_ap_rssi_threshold; |
| 5888 | wmi_roam_mawc_params->rssi_stationary_high_adjust = |
| 5889 | params->rssi_stationary_high_adjust; |
| 5890 | wmi_roam_mawc_params->rssi_stationary_low_adjust = |
| 5891 | params->rssi_stationary_low_adjust; |
| 5892 | |
| 5893 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 5894 | len, WMI_ROAM_CONFIGURE_MAWC_CMDID); |
| 5895 | if (QDF_IS_STATUS_ERROR(status)) { |
| 5896 | WMI_LOGE("WMI_ROAM_CONFIGURE_MAWC_CMDID failed, Error %d", |
| 5897 | status); |
| 5898 | wmi_buf_free(buf); |
| 5899 | return status; |
| 5900 | } |
| 5901 | WMI_LOGD(FL("MAWC roam en=%d, vdev=%d, tr=%d, ap=%d, high=%d, low=%d"), |
| 5902 | wmi_roam_mawc_params->enable, wmi_roam_mawc_params->vdev_id, |
| 5903 | wmi_roam_mawc_params->traffic_load_threshold, |
| 5904 | wmi_roam_mawc_params->best_ap_rssi_threshold, |
| 5905 | wmi_roam_mawc_params->rssi_stationary_high_adjust, |
| 5906 | wmi_roam_mawc_params->rssi_stationary_low_adjust); |
| 5907 | |
| 5908 | return QDF_STATUS_SUCCESS; |
| 5909 | } |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5910 | |
| 5911 | /** |
| 5912 | * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload |
| 5913 | * rssi threashold |
| 5914 | * @wmi_handle: wmi handle |
| 5915 | * @roam_req: Roaming request buffer |
| 5916 | * |
| 5917 | * Send WMI_ROAM_SCAN_RSSI_THRESHOLD TLV to firmware |
| 5918 | * |
| 5919 | * Return: QDF status |
| 5920 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 5921 | 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] | 5922 | struct roam_offload_scan_rssi_params *roam_req) |
| 5923 | { |
| 5924 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 5925 | QDF_STATUS status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5926 | int len; |
| 5927 | uint8_t *buf_ptr; |
| 5928 | wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; |
| 5929 | wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; |
| 5930 | wmi_roam_earlystop_rssi_thres_param *early_stop_thresholds = NULL; |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5931 | wmi_roam_dense_thres_param *dense_thresholds = NULL; |
Varun Reddy Yeturu | 7f4cff8 | 2017-07-26 10:59:39 -0700 | [diff] [blame] | 5932 | wmi_roam_bg_scan_roaming_param *bg_scan_params = NULL; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5933 | |
| 5934 | len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5935 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 5936 | len += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5937 | len += WMI_TLV_HDR_SIZE; |
| 5938 | len += sizeof(wmi_roam_earlystop_rssi_thres_param); |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 5939 | len += WMI_TLV_HDR_SIZE; /* TLV for dense thresholds*/ |
| 5940 | len += sizeof(wmi_roam_dense_thres_param); |
Varun Reddy Yeturu | 7f4cff8 | 2017-07-26 10:59:39 -0700 | [diff] [blame] | 5941 | len += WMI_TLV_HDR_SIZE; /* TLV for BG Scan*/ |
| 5942 | len += sizeof(wmi_roam_bg_scan_roaming_param); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5943 | buf = wmi_buf_alloc(wmi_handle, len); |
| 5944 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 5945 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5946 | return QDF_STATUS_E_NOMEM; |
| 5947 | } |
| 5948 | |
| 5949 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 5950 | rssi_threshold_fp = |
| 5951 | (wmi_roam_scan_rssi_threshold_fixed_param *) buf_ptr; |
| 5952 | WMITLV_SET_HDR(&rssi_threshold_fp->tlv_header, |
| 5953 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_threshold_fixed_param, |
| 5954 | WMITLV_GET_STRUCT_TLVLEN |
| 5955 | (wmi_roam_scan_rssi_threshold_fixed_param)); |
| 5956 | /* fill in threshold values */ |
| 5957 | rssi_threshold_fp->vdev_id = roam_req->session_id; |
| 5958 | rssi_threshold_fp->roam_scan_rssi_thresh = roam_req->rssi_thresh; |
| 5959 | rssi_threshold_fp->roam_rssi_thresh_diff = roam_req->rssi_thresh_diff; |
| 5960 | rssi_threshold_fp->hirssi_scan_max_count = |
| 5961 | roam_req->hi_rssi_scan_max_count; |
| 5962 | rssi_threshold_fp->hirssi_scan_delta = |
| 5963 | roam_req->hi_rssi_scan_rssi_delta; |
| 5964 | 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] | 5965 | rssi_threshold_fp->rssi_thresh_offset_5g = |
| 5966 | roam_req->rssi_thresh_offset_5g; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 5967 | |
| 5968 | buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); |
| 5969 | WMITLV_SET_HDR(buf_ptr, |
| 5970 | WMITLV_TAG_ARRAY_STRUC, |
| 5971 | sizeof(wmi_roam_scan_extended_threshold_param)); |
| 5972 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5973 | ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; |
| 5974 | |
| 5975 | ext_thresholds->penalty_threshold_5g = roam_req->penalty_threshold_5g; |
| 5976 | if (roam_req->raise_rssi_thresh_5g >= WMI_NOISE_FLOOR_DBM_DEFAULT) |
| 5977 | ext_thresholds->boost_threshold_5g = |
| 5978 | roam_req->boost_threshold_5g; |
| 5979 | |
| 5980 | ext_thresholds->boost_algorithm_5g = |
| 5981 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5982 | ext_thresholds->boost_factor_5g = roam_req->raise_factor_5g; |
| 5983 | ext_thresholds->penalty_algorithm_5g = |
| 5984 | WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; |
| 5985 | ext_thresholds->penalty_factor_5g = roam_req->drop_factor_5g; |
| 5986 | ext_thresholds->max_boost_5g = roam_req->max_raise_rssi_5g; |
| 5987 | ext_thresholds->max_penalty_5g = roam_req->max_drop_rssi_5g; |
| 5988 | ext_thresholds->good_rssi_threshold = roam_req->good_rssi_threshold; |
| 5989 | |
| 5990 | WMITLV_SET_HDR(&ext_thresholds->tlv_header, |
| 5991 | WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, |
| 5992 | WMITLV_GET_STRUCT_TLVLEN |
| 5993 | (wmi_roam_scan_extended_threshold_param)); |
| 5994 | buf_ptr += sizeof(wmi_roam_scan_extended_threshold_param); |
| 5995 | WMITLV_SET_HDR(buf_ptr, |
| 5996 | WMITLV_TAG_ARRAY_STRUC, |
| 5997 | sizeof(wmi_roam_earlystop_rssi_thres_param)); |
| 5998 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 5999 | early_stop_thresholds = (wmi_roam_earlystop_rssi_thres_param *) buf_ptr; |
| 6000 | early_stop_thresholds->roam_earlystop_thres_min = |
| 6001 | roam_req->roam_earlystop_thres_min; |
| 6002 | early_stop_thresholds->roam_earlystop_thres_max = |
| 6003 | roam_req->roam_earlystop_thres_max; |
| 6004 | WMITLV_SET_HDR(&early_stop_thresholds->tlv_header, |
| 6005 | WMITLV_TAG_STRUC_wmi_roam_earlystop_rssi_thres_param, |
| 6006 | WMITLV_GET_STRUCT_TLVLEN |
| 6007 | (wmi_roam_earlystop_rssi_thres_param)); |
| 6008 | |
Gupta, Kapil | 7e65292 | 2016-04-12 15:02:00 +0530 | [diff] [blame] | 6009 | buf_ptr += sizeof(wmi_roam_earlystop_rssi_thres_param); |
| 6010 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6011 | sizeof(wmi_roam_dense_thres_param)); |
| 6012 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6013 | dense_thresholds = (wmi_roam_dense_thres_param *) buf_ptr; |
| 6014 | dense_thresholds->roam_dense_rssi_thres_offset = |
| 6015 | roam_req->dense_rssi_thresh_offset; |
| 6016 | dense_thresholds->roam_dense_min_aps = roam_req->dense_min_aps_cnt; |
| 6017 | dense_thresholds->roam_dense_traffic_thres = |
| 6018 | roam_req->traffic_threshold; |
| 6019 | dense_thresholds->roam_dense_status = roam_req->initial_dense_status; |
| 6020 | WMITLV_SET_HDR(&dense_thresholds->tlv_header, |
| 6021 | WMITLV_TAG_STRUC_wmi_roam_dense_thres_param, |
| 6022 | WMITLV_GET_STRUCT_TLVLEN |
| 6023 | (wmi_roam_dense_thres_param)); |
| 6024 | |
Varun Reddy Yeturu | 7f4cff8 | 2017-07-26 10:59:39 -0700 | [diff] [blame] | 6025 | buf_ptr += sizeof(wmi_roam_dense_thres_param); |
| 6026 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6027 | sizeof(wmi_roam_bg_scan_roaming_param)); |
| 6028 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6029 | bg_scan_params = (wmi_roam_bg_scan_roaming_param *) buf_ptr; |
| 6030 | bg_scan_params->roam_bg_scan_bad_rssi_thresh = |
| 6031 | roam_req->bg_scan_bad_rssi_thresh; |
| 6032 | bg_scan_params->roam_bg_scan_client_bitmap = |
| 6033 | roam_req->bg_scan_client_bitmap; |
Vignesh Viswanathan | 5f1ccf6 | 2017-09-07 18:58:08 +0530 | [diff] [blame] | 6034 | bg_scan_params->bad_rssi_thresh_offset_2g = |
| 6035 | roam_req->roam_bad_rssi_thresh_offset_2g; |
| 6036 | bg_scan_params->flags = roam_req->flags; |
Varun Reddy Yeturu | 7f4cff8 | 2017-07-26 10:59:39 -0700 | [diff] [blame] | 6037 | WMITLV_SET_HDR(&bg_scan_params->tlv_header, |
| 6038 | WMITLV_TAG_STRUC_wmi_roam_bg_scan_roaming_param, |
| 6039 | WMITLV_GET_STRUCT_TLVLEN |
| 6040 | (wmi_roam_bg_scan_roaming_param)); |
| 6041 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6042 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6043 | len, WMI_ROAM_SCAN_RSSI_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6044 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6045 | WMI_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6046 | status); |
| 6047 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6048 | } |
| 6049 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6050 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6051 | } |
| 6052 | |
| 6053 | /** |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6054 | * send_adapt_dwelltime_params_cmd_tlv() - send wmi cmd of adaptive dwelltime |
| 6055 | * configuration params |
| 6056 | * @wma_handle: wma handler |
| 6057 | * @dwelltime_params: pointer to dwelltime_params |
| 6058 | * |
| 6059 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 6060 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 6061 | static |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6062 | QDF_STATUS send_adapt_dwelltime_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 6063 | struct wmi_adaptive_dwelltime_params *dwelltime_params) |
| 6064 | { |
| 6065 | wmi_scan_adaptive_dwell_config_fixed_param *dwell_param; |
| 6066 | wmi_scan_adaptive_dwell_parameters_tlv *cmd; |
| 6067 | wmi_buf_t buf; |
| 6068 | uint8_t *buf_ptr; |
| 6069 | int32_t err; |
| 6070 | int len; |
| 6071 | |
| 6072 | len = sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 6073 | len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ |
| 6074 | len += sizeof(wmi_scan_adaptive_dwell_parameters_tlv); |
| 6075 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6076 | if (!buf) { |
| 6077 | WMI_LOGE("%s :Failed to allocate buffer to send cmd", |
| 6078 | __func__); |
| 6079 | return QDF_STATUS_E_NOMEM; |
| 6080 | } |
| 6081 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6082 | dwell_param = (wmi_scan_adaptive_dwell_config_fixed_param *) buf_ptr; |
| 6083 | WMITLV_SET_HDR(&dwell_param->tlv_header, |
| 6084 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_config_fixed_param, |
| 6085 | WMITLV_GET_STRUCT_TLVLEN |
| 6086 | (wmi_scan_adaptive_dwell_config_fixed_param)); |
| 6087 | |
| 6088 | dwell_param->enable = dwelltime_params->is_enabled; |
| 6089 | buf_ptr += sizeof(wmi_scan_adaptive_dwell_config_fixed_param); |
| 6090 | WMITLV_SET_HDR(buf_ptr, |
| 6091 | WMITLV_TAG_ARRAY_STRUC, |
| 6092 | sizeof(wmi_scan_adaptive_dwell_parameters_tlv)); |
| 6093 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6094 | |
| 6095 | cmd = (wmi_scan_adaptive_dwell_parameters_tlv *) buf_ptr; |
| 6096 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6097 | WMITLV_TAG_STRUC_wmi_scan_adaptive_dwell_parameters_tlv, |
| 6098 | WMITLV_GET_STRUCT_TLVLEN( |
| 6099 | wmi_scan_adaptive_dwell_parameters_tlv)); |
| 6100 | |
| 6101 | cmd->default_adaptive_dwell_mode = dwelltime_params->dwelltime_mode; |
| 6102 | cmd->adapative_lpf_weight = dwelltime_params->lpf_weight; |
| 6103 | cmd->passive_monitor_interval_ms = dwelltime_params->passive_mon_intval; |
| 6104 | cmd->wifi_activity_threshold_pct = dwelltime_params->wifi_act_threshold; |
| 6105 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 6106 | len, WMI_SCAN_ADAPTIVE_DWELL_CONFIG_CMDID); |
| 6107 | if (err) { |
| 6108 | WMI_LOGE("Failed to send adapt dwelltime cmd err=%d", err); |
| 6109 | wmi_buf_free(buf); |
| 6110 | return QDF_STATUS_E_FAILURE; |
| 6111 | } |
| 6112 | |
| 6113 | return QDF_STATUS_SUCCESS; |
| 6114 | } |
| 6115 | |
Nitesh Shah | 52323d0 | 2017-05-22 15:49:00 +0530 | [diff] [blame] | 6116 | /** |
| 6117 | * send_dbs_scan_sel_params_cmd_tlv() - send wmi cmd of DBS scan selection |
| 6118 | * configuration params |
| 6119 | * @wmi_handle: wmi handler |
| 6120 | * @dbs_scan_params: pointer to wmi_dbs_scan_sel_params |
| 6121 | * |
| 6122 | * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure |
| 6123 | */ |
| 6124 | static QDF_STATUS send_dbs_scan_sel_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 6125 | struct wmi_dbs_scan_sel_params *dbs_scan_params) |
| 6126 | { |
| 6127 | wmi_scan_dbs_duty_cycle_fixed_param *dbs_scan_param; |
| 6128 | wmi_scan_dbs_duty_cycle_tlv_param *cmd; |
| 6129 | wmi_buf_t buf; |
| 6130 | uint8_t *buf_ptr; |
| 6131 | QDF_STATUS err; |
| 6132 | uint32_t i; |
| 6133 | int len; |
| 6134 | |
| 6135 | len = sizeof(*dbs_scan_param); |
| 6136 | len += WMI_TLV_HDR_SIZE; |
| 6137 | len += dbs_scan_params->num_clients * sizeof(*cmd); |
| 6138 | |
| 6139 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6140 | if (!buf) { |
| 6141 | WMI_LOGE("%s:Failed to allocate buffer to send cmd", __func__); |
| 6142 | return QDF_STATUS_E_NOMEM; |
| 6143 | } |
| 6144 | |
| 6145 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 6146 | dbs_scan_param = (wmi_scan_dbs_duty_cycle_fixed_param *) buf_ptr; |
| 6147 | WMITLV_SET_HDR(&dbs_scan_param->tlv_header, |
| 6148 | WMITLV_TAG_STRUC_wmi_scan_dbs_duty_cycle_fixed_param, |
| 6149 | WMITLV_GET_STRUCT_TLVLEN |
| 6150 | (wmi_scan_dbs_duty_cycle_fixed_param)); |
| 6151 | |
| 6152 | dbs_scan_param->num_clients = dbs_scan_params->num_clients; |
| 6153 | dbs_scan_param->pdev_id = dbs_scan_params->pdev_id; |
| 6154 | buf_ptr += sizeof(*dbs_scan_param); |
| 6155 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6156 | (sizeof(*cmd) * dbs_scan_params->num_clients)); |
| 6157 | buf_ptr = buf_ptr + (uint8_t) WMI_TLV_HDR_SIZE; |
| 6158 | |
| 6159 | for (i = 0; i < dbs_scan_params->num_clients; i++) { |
| 6160 | cmd = (wmi_scan_dbs_duty_cycle_tlv_param *) buf_ptr; |
| 6161 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6162 | WMITLV_TAG_STRUC_wmi_scan_dbs_duty_cycle_param_tlv, |
| 6163 | WMITLV_GET_STRUCT_TLVLEN( |
| 6164 | wmi_scan_dbs_duty_cycle_tlv_param)); |
| 6165 | cmd->module_id = dbs_scan_params->module_id[i]; |
| 6166 | cmd->num_dbs_scans = dbs_scan_params->num_dbs_scans[i]; |
| 6167 | cmd->num_non_dbs_scans = dbs_scan_params->num_non_dbs_scans[i]; |
| 6168 | buf_ptr = buf_ptr + (uint8_t) sizeof(*cmd); |
| 6169 | } |
| 6170 | |
| 6171 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 6172 | len, WMI_SET_SCAN_DBS_DUTY_CYCLE_CMDID); |
| 6173 | if (QDF_IS_STATUS_ERROR(err)) { |
| 6174 | WMI_LOGE("Failed to send dbs scan selection cmd err=%d", err); |
| 6175 | wmi_buf_free(buf); |
| 6176 | return QDF_STATUS_E_FAILURE; |
| 6177 | } |
| 6178 | |
| 6179 | return QDF_STATUS_SUCCESS; |
| 6180 | } |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 6181 | |
| 6182 | /** |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6183 | * send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming |
| 6184 | * @wmi_handle: wmi handle |
| 6185 | * @roam_req: Request which contains the filters |
| 6186 | * |
| 6187 | * There are filters such as whitelist, blacklist and preferred |
| 6188 | * list that need to be applied to the scan results to form the |
| 6189 | * probable candidates for roaming. |
| 6190 | * |
| 6191 | * Return: Return success upon succesfully passing the |
| 6192 | * parameters to the firmware, otherwise failure. |
| 6193 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6194 | 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] | 6195 | struct roam_scan_filter_params *roam_req) |
| 6196 | { |
| 6197 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6198 | QDF_STATUS status; |
| 6199 | uint32_t i; |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6200 | uint32_t len, blist_len = 0; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6201 | uint8_t *buf_ptr; |
| 6202 | wmi_roam_filter_fixed_param *roam_filter; |
| 6203 | uint8_t *bssid_src_ptr = NULL; |
| 6204 | wmi_mac_addr *bssid_dst_ptr = NULL; |
| 6205 | wmi_ssid *ssid_ptr = NULL; |
| 6206 | uint32_t *bssid_preferred_factor_ptr = NULL; |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6207 | wmi_roam_lca_disallow_config_tlv_param *blist_param; |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6208 | wmi_roam_rssi_rejection_oce_config_param *rssi_rej; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6209 | |
| 6210 | len = sizeof(wmi_roam_filter_fixed_param); |
Abhishek Singh | 54aa620 | 2017-07-06 11:25:15 +0530 | [diff] [blame] | 6211 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6212 | len += WMI_TLV_HDR_SIZE; |
Abhishek Singh | 54aa620 | 2017-07-06 11:25:15 +0530 | [diff] [blame] | 6213 | if (roam_req->num_bssid_black_list) |
| 6214 | len += roam_req->num_bssid_black_list * sizeof(wmi_mac_addr); |
| 6215 | len += WMI_TLV_HDR_SIZE; |
| 6216 | if (roam_req->num_ssid_white_list) |
| 6217 | len += roam_req->num_ssid_white_list * sizeof(wmi_ssid); |
| 6218 | len += 2 * WMI_TLV_HDR_SIZE; |
| 6219 | if (roam_req->num_bssid_preferred_list) { |
| 6220 | len += roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr); |
| 6221 | len += roam_req->num_bssid_preferred_list * sizeof(A_UINT32); |
| 6222 | } |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6223 | len += WMI_TLV_HDR_SIZE; |
| 6224 | if (roam_req->lca_disallow_config_present) { |
| 6225 | len += sizeof(*blist_param); |
| 6226 | blist_len = sizeof(*blist_param); |
| 6227 | } |
| 6228 | |
| 6229 | len += WMI_TLV_HDR_SIZE; |
| 6230 | if (roam_req->num_rssi_rejection_ap) |
| 6231 | len += roam_req->num_rssi_rejection_ap * sizeof(*rssi_rej); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6232 | |
| 6233 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6234 | if (!buf) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6235 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6236 | return QDF_STATUS_E_NOMEM; |
| 6237 | } |
| 6238 | |
| 6239 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
| 6240 | roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; |
| 6241 | WMITLV_SET_HDR(&roam_filter->tlv_header, |
| 6242 | WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, |
| 6243 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); |
| 6244 | /* fill in fixed values */ |
| 6245 | roam_filter->vdev_id = roam_req->session_id; |
| 6246 | roam_filter->flags = 0; |
| 6247 | roam_filter->op_bitmap = roam_req->op_bitmap; |
| 6248 | roam_filter->num_bssid_black_list = roam_req->num_bssid_black_list; |
| 6249 | roam_filter->num_ssid_white_list = roam_req->num_ssid_white_list; |
| 6250 | roam_filter->num_bssid_preferred_list = |
| 6251 | roam_req->num_bssid_preferred_list; |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6252 | roam_filter->num_rssi_rejection_ap = |
| 6253 | roam_req->num_rssi_rejection_ap; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6254 | buf_ptr += sizeof(wmi_roam_filter_fixed_param); |
| 6255 | |
| 6256 | WMITLV_SET_HDR((buf_ptr), |
| 6257 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6258 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr))); |
| 6259 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_avoid_list; |
| 6260 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6261 | for (i = 0; i < roam_req->num_bssid_black_list; i++) { |
| 6262 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, bssid_dst_ptr); |
| 6263 | bssid_src_ptr += ATH_MAC_LEN; |
| 6264 | bssid_dst_ptr++; |
| 6265 | } |
| 6266 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6267 | (roam_req->num_bssid_black_list * sizeof(wmi_mac_addr)); |
| 6268 | WMITLV_SET_HDR((buf_ptr), |
| 6269 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6270 | (roam_req->num_ssid_white_list * sizeof(wmi_ssid))); |
| 6271 | ssid_ptr = (wmi_ssid *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6272 | for (i = 0; i < roam_req->num_ssid_white_list; i++) { |
| 6273 | qdf_mem_copy(&ssid_ptr->ssid, |
| 6274 | &roam_req->ssid_allowed_list[i].mac_ssid, |
| 6275 | roam_req->ssid_allowed_list[i].length); |
| 6276 | ssid_ptr->ssid_len = roam_req->ssid_allowed_list[i].length; |
| 6277 | ssid_ptr++; |
| 6278 | } |
| 6279 | buf_ptr += WMI_TLV_HDR_SIZE + (roam_req->num_ssid_white_list * |
| 6280 | sizeof(wmi_ssid)); |
| 6281 | WMITLV_SET_HDR((buf_ptr), |
| 6282 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 6283 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr))); |
| 6284 | bssid_src_ptr = (uint8_t *)&roam_req->bssid_favored; |
| 6285 | bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6286 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 6287 | WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid_src_ptr, |
| 6288 | (wmi_mac_addr *)bssid_dst_ptr); |
| 6289 | bssid_src_ptr += ATH_MAC_LEN; |
| 6290 | bssid_dst_ptr++; |
| 6291 | } |
| 6292 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6293 | (roam_req->num_bssid_preferred_list * sizeof(wmi_mac_addr)); |
| 6294 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 6295 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t))); |
| 6296 | bssid_preferred_factor_ptr = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 6297 | for (i = 0; i < roam_req->num_bssid_preferred_list; i++) { |
| 6298 | *bssid_preferred_factor_ptr = |
| 6299 | roam_req->bssid_favored_factor[i]; |
| 6300 | bssid_preferred_factor_ptr++; |
| 6301 | } |
| 6302 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6303 | (roam_req->num_bssid_preferred_list * sizeof(uint32_t)); |
| 6304 | |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6305 | WMITLV_SET_HDR(buf_ptr, |
| 6306 | WMITLV_TAG_ARRAY_STRUC, blist_len); |
| 6307 | buf_ptr += WMI_TLV_HDR_SIZE; |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6308 | if (roam_req->lca_disallow_config_present) { |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6309 | blist_param = |
| 6310 | (wmi_roam_lca_disallow_config_tlv_param *) buf_ptr; |
| 6311 | WMITLV_SET_HDR(&blist_param->tlv_header, |
| 6312 | WMITLV_TAG_STRUC_wmi_roam_lca_disallow_config_tlv_param, |
| 6313 | WMITLV_GET_STRUCT_TLVLEN( |
| 6314 | wmi_roam_lca_disallow_config_tlv_param)); |
| 6315 | |
| 6316 | blist_param->disallow_duration = roam_req->disallow_duration; |
| 6317 | blist_param->rssi_channel_penalization = |
| 6318 | roam_req->rssi_channel_penalization; |
| 6319 | blist_param->num_disallowed_aps = roam_req->num_disallowed_aps; |
Vignesh Viswanathan | a9497fc | 2017-09-14 17:47:48 +0530 | [diff] [blame] | 6320 | blist_param->disallow_lca_enable_source_bitmap = |
| 6321 | (WMI_ROAM_LCA_DISALLOW_SOURCE_PER | |
| 6322 | WMI_ROAM_LCA_DISALLOW_SOURCE_BACKGROUND); |
Selvaraj, Sridhar | 55f1d1e | 2017-05-29 18:38:52 +0530 | [diff] [blame] | 6323 | buf_ptr += (sizeof(wmi_roam_lca_disallow_config_tlv_param)); |
| 6324 | } |
| 6325 | |
Abhishek Singh | 7c7c0e7 | 2017-07-05 11:21:32 +0530 | [diff] [blame] | 6326 | WMITLV_SET_HDR(buf_ptr, |
| 6327 | WMITLV_TAG_ARRAY_STRUC, |
| 6328 | (roam_req->num_rssi_rejection_ap * sizeof(*rssi_rej))); |
| 6329 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6330 | for (i = 0; i < roam_req->num_rssi_rejection_ap; i++) { |
| 6331 | rssi_rej = |
| 6332 | (wmi_roam_rssi_rejection_oce_config_param *) buf_ptr; |
| 6333 | WMITLV_SET_HDR(&rssi_rej->tlv_header, |
| 6334 | WMITLV_TAG_STRUC_wmi_roam_rssi_rejection_oce_config_param, |
| 6335 | WMITLV_GET_STRUCT_TLVLEN( |
| 6336 | wmi_roam_rssi_rejection_oce_config_param)); |
| 6337 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
| 6338 | roam_req->rssi_rejection_ap[i].bssid.bytes, |
| 6339 | &rssi_rej->bssid); |
| 6340 | rssi_rej->remaining_disallow_duration = |
| 6341 | roam_req->rssi_rejection_ap[i].remaining_duration; |
| 6342 | rssi_rej->requested_rssi = |
| 6343 | (A_INT32)roam_req->rssi_rejection_ap[i].expected_rssi; |
| 6344 | buf_ptr += |
| 6345 | (sizeof(wmi_roam_rssi_rejection_oce_config_param)); |
| 6346 | } |
| 6347 | |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6348 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 6349 | len, WMI_ROAM_FILTER_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6350 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 6351 | WMI_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d", |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6352 | status); |
| 6353 | wmi_buf_free(buf); |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6354 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6355 | |
| 6356 | return status; |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 6357 | } |
| 6358 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6359 | /** send_set_epno_network_list_cmd_tlv() - set epno network list |
| 6360 | * @wmi_handle: wmi handle |
| 6361 | * @req: epno config params request structure |
| 6362 | * |
| 6363 | * This function reads the incoming epno config request structure |
| 6364 | * and constructs the WMI message to the firmware. |
| 6365 | * |
| 6366 | * Returns: 0 on success, error number otherwise |
| 6367 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6368 | 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] | 6369 | struct wifi_enhanched_pno_params *req) |
| 6370 | { |
| 6371 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 6372 | nlo_configured_parameters *nlo_list; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6373 | enlo_candidate_score_params *cand_score_params; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6374 | u_int8_t i, *buf_ptr; |
| 6375 | wmi_buf_t buf; |
| 6376 | uint32_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6377 | QDF_STATUS ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6378 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6379 | /* Fixed Params */ |
| 6380 | len = sizeof(*cmd); |
| 6381 | if (req->num_networks) { |
| 6382 | /* TLV place holder for array of structures |
| 6383 | * then each nlo_configured_parameters(nlo_list) TLV. |
| 6384 | */ |
| 6385 | len += WMI_TLV_HDR_SIZE; |
| 6386 | len += (sizeof(nlo_configured_parameters) |
| 6387 | * QDF_MIN(req->num_networks, WMI_NLO_MAX_SSIDS)); |
| 6388 | /* TLV for array of uint32 channel_list */ |
| 6389 | len += WMI_TLV_HDR_SIZE; |
| 6390 | /* TLV for nlo_channel_prediction_cfg */ |
| 6391 | len += WMI_TLV_HDR_SIZE; |
| 6392 | /* TLV for candidate score params */ |
| 6393 | len += sizeof(enlo_candidate_score_params); |
| 6394 | } |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6395 | |
| 6396 | buf = wmi_buf_alloc(wmi_handle, len); |
| 6397 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6398 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 6399 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6400 | } |
| 6401 | |
| 6402 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 6403 | |
| 6404 | buf_ptr = (u_int8_t *) cmd; |
| 6405 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6406 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 6407 | WMITLV_GET_STRUCT_TLVLEN( |
| 6408 | wmi_nlo_config_cmd_fixed_param)); |
| 6409 | cmd->vdev_id = req->session_id; |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6410 | |
| 6411 | /* set flag to reset if num of networks are 0 */ |
| 6412 | cmd->flags = (req->num_networks == 0 ? |
| 6413 | WMI_NLO_CONFIG_ENLO_RESET : WMI_NLO_CONFIG_ENLO); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6414 | |
| 6415 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 6416 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6417 | 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] | 6418 | WMI_LOGD("SSID count: %d flags: %d", |
| 6419 | cmd->no_of_ssids, cmd->flags); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6420 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6421 | /* Fill nlo_config only when num_networks are non zero */ |
| 6422 | if (cmd->no_of_ssids) { |
| 6423 | /* Fill networks */ |
| 6424 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 6425 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 6426 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6427 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6428 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 6429 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 6430 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 6431 | WMITLV_TAG_ARRAY_BYTE, |
| 6432 | WMITLV_GET_STRUCT_TLVLEN( |
| 6433 | nlo_configured_parameters)); |
| 6434 | /* Copy ssid and it's length */ |
| 6435 | nlo_list[i].ssid.valid = true; |
| 6436 | nlo_list[i].ssid.ssid.ssid_len = |
| 6437 | req->networks[i].ssid.length; |
| 6438 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
| 6439 | req->networks[i].ssid.mac_ssid, |
| 6440 | nlo_list[i].ssid.ssid.ssid_len); |
| 6441 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
| 6442 | nlo_list[i].ssid.ssid.ssid_len, |
| 6443 | (char *) nlo_list[i].ssid.ssid.ssid, |
| 6444 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6445 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6446 | /* Copy pno flags */ |
| 6447 | nlo_list[i].bcast_nw_type.valid = true; |
| 6448 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
| 6449 | req->networks[i].flags; |
| 6450 | WMI_LOGD("PNO flags (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6451 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 6452 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6453 | /* Copy auth bit field */ |
| 6454 | nlo_list[i].auth_type.valid = true; |
| 6455 | nlo_list[i].auth_type.auth_type = |
| 6456 | req->networks[i].auth_bit_field; |
| 6457 | WMI_LOGD("Auth bit field (%u)", |
| 6458 | nlo_list[i].auth_type.auth_type); |
| 6459 | } |
| 6460 | |
| 6461 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 6462 | /* Fill the channel list */ |
| 6463 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 6464 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6465 | |
| 6466 | /* Fill prediction_param */ |
| 6467 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 6468 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 6469 | |
| 6470 | /* Fill epno candidate score params */ |
| 6471 | cand_score_params = (enlo_candidate_score_params *) buf_ptr; |
| 6472 | WMITLV_SET_HDR(buf_ptr, |
| 6473 | WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 6474 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 6475 | cand_score_params->min5GHz_rssi = |
| 6476 | req->min_5ghz_rssi; |
| 6477 | cand_score_params->min24GHz_rssi = |
| 6478 | req->min_24ghz_rssi; |
| 6479 | cand_score_params->initial_score_max = |
| 6480 | req->initial_score_max; |
| 6481 | cand_score_params->current_connection_bonus = |
| 6482 | req->current_connection_bonus; |
| 6483 | cand_score_params->same_network_bonus = |
| 6484 | req->same_network_bonus; |
| 6485 | cand_score_params->secure_bonus = |
| 6486 | req->secure_bonus; |
| 6487 | cand_score_params->band5GHz_bonus = |
| 6488 | req->band_5ghz_bonus; |
| 6489 | buf_ptr += sizeof(enlo_candidate_score_params); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6490 | } |
| 6491 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6492 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6493 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6494 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6495 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6496 | wmi_buf_free(buf); |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6497 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6498 | } |
| 6499 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6500 | WMI_LOGD("set ePNO list request sent successfully for vdev %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6501 | req->session_id); |
| 6502 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 6503 | return ret; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6504 | } |
| 6505 | |
Mukul Sharma | bf3bc65 | 2016-10-03 15:04:20 +0530 | [diff] [blame] | 6506 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6507 | /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter |
| 6508 | * @wmi_handle: wmi handle |
| 6509 | * @ipa_offload: ipa offload control parameter |
| 6510 | * |
| 6511 | * Returns: 0 on success, error number otherwise |
| 6512 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6513 | 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] | 6514 | struct ipa_offload_control_params *ipa_offload) |
| 6515 | { |
| 6516 | wmi_ipa_offload_enable_disable_cmd_fixed_param *cmd; |
| 6517 | wmi_buf_t wmi_buf; |
| 6518 | uint32_t len; |
| 6519 | u_int8_t *buf_ptr; |
| 6520 | |
| 6521 | len = sizeof(*cmd); |
| 6522 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6523 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6524 | WMI_LOGE("%s: wmi_buf_alloc failed (len=%d)", __func__, len); |
| 6525 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6526 | } |
| 6527 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 6528 | WMI_LOGD("%s: offload_type=%d, enable=%d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6529 | ipa_offload->offload_type, ipa_offload->enable); |
| 6530 | |
| 6531 | buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf); |
| 6532 | |
| 6533 | cmd = (wmi_ipa_offload_enable_disable_cmd_fixed_param *)buf_ptr; |
| 6534 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6535 | WMITLV_TAG_STRUCT_wmi_ipa_offload_enable_disable_cmd_fixed_param, |
| 6536 | WMITLV_GET_STRUCT_TLVLEN( |
| 6537 | wmi_ipa_offload_enable_disable_cmd_fixed_param)); |
| 6538 | |
| 6539 | cmd->offload_type = ipa_offload->offload_type; |
| 6540 | cmd->vdev_id = ipa_offload->vdev_id; |
| 6541 | cmd->enable = ipa_offload->enable; |
| 6542 | |
| 6543 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6544 | WMI_IPA_OFFLOAD_ENABLE_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6545 | WMI_LOGE("%s: failed to command", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6546 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6547 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6548 | } |
| 6549 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6550 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6551 | } |
| 6552 | |
| 6553 | /** |
| 6554 | * send_extscan_get_capabilities_cmd_tlv() - extscan get capabilities |
| 6555 | * @wmi_handle: wmi handle |
| 6556 | * @pgetcapab: get capabilities params |
| 6557 | * |
| 6558 | * This function send request to fw to get extscan capabilities. |
| 6559 | * |
| 6560 | * Return: CDF status |
| 6561 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6562 | 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] | 6563 | struct extscan_capabilities_params *pgetcapab) |
| 6564 | { |
| 6565 | wmi_extscan_get_capabilities_cmd_fixed_param *cmd; |
| 6566 | wmi_buf_t wmi_buf; |
| 6567 | uint32_t len; |
| 6568 | uint8_t *buf_ptr; |
| 6569 | |
| 6570 | len = sizeof(*cmd); |
| 6571 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6572 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6573 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6574 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6575 | } |
| 6576 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6577 | |
| 6578 | cmd = (wmi_extscan_get_capabilities_cmd_fixed_param *) buf_ptr; |
| 6579 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6580 | WMITLV_TAG_STRUC_wmi_extscan_get_capabilities_cmd_fixed_param, |
| 6581 | WMITLV_GET_STRUCT_TLVLEN |
| 6582 | (wmi_extscan_get_capabilities_cmd_fixed_param)); |
| 6583 | |
| 6584 | cmd->request_id = pgetcapab->request_id; |
| 6585 | |
| 6586 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6587 | WMI_EXTSCAN_GET_CAPABILITIES_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6588 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6589 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6590 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6591 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6592 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6593 | } |
| 6594 | |
| 6595 | /** |
| 6596 | * send_extscan_get_cached_results_cmd_tlv() - extscan get cached results |
| 6597 | * @wmi_handle: wmi handle |
| 6598 | * @pcached_results: cached results parameters |
| 6599 | * |
| 6600 | * This function send request to fw to get cached results. |
| 6601 | * |
| 6602 | * Return: CDF status |
| 6603 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6604 | 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] | 6605 | struct extscan_cached_result_params *pcached_results) |
| 6606 | { |
| 6607 | wmi_extscan_get_cached_results_cmd_fixed_param *cmd; |
| 6608 | wmi_buf_t wmi_buf; |
| 6609 | uint32_t len; |
| 6610 | uint8_t *buf_ptr; |
| 6611 | |
| 6612 | len = sizeof(*cmd); |
| 6613 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6614 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6615 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6616 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6617 | } |
| 6618 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6619 | |
| 6620 | cmd = (wmi_extscan_get_cached_results_cmd_fixed_param *) buf_ptr; |
| 6621 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6622 | WMITLV_TAG_STRUC_wmi_extscan_get_cached_results_cmd_fixed_param, |
| 6623 | WMITLV_GET_STRUCT_TLVLEN |
| 6624 | (wmi_extscan_get_cached_results_cmd_fixed_param)); |
| 6625 | |
| 6626 | cmd->request_id = pcached_results->request_id; |
| 6627 | cmd->vdev_id = pcached_results->session_id; |
| 6628 | cmd->control_flags = pcached_results->flush; |
| 6629 | |
| 6630 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6631 | WMI_EXTSCAN_GET_CACHED_RESULTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6632 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6633 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6634 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6635 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6636 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6637 | } |
| 6638 | |
| 6639 | /** |
| 6640 | * send_extscan_stop_change_monitor_cmd_tlv() - send stop change monitor cmd |
| 6641 | * @wmi_handle: wmi handle |
| 6642 | * @reset_req: Reset change request params |
| 6643 | * |
| 6644 | * This function sends stop change monitor request to fw. |
| 6645 | * |
| 6646 | * Return: CDF status |
| 6647 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6648 | 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] | 6649 | struct extscan_capabilities_reset_params *reset_req) |
| 6650 | { |
| 6651 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 6652 | wmi_buf_t wmi_buf; |
| 6653 | uint32_t len; |
| 6654 | uint8_t *buf_ptr; |
| 6655 | int change_list = 0; |
| 6656 | |
| 6657 | len = sizeof(*cmd); |
| 6658 | |
| 6659 | /* reset significant change tlv is set to 0 */ |
| 6660 | len += WMI_TLV_HDR_SIZE; |
| 6661 | len += change_list * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 6662 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6663 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6664 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6665 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6666 | } |
| 6667 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6668 | |
| 6669 | cmd = (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 6670 | buf_ptr; |
| 6671 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6672 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 6673 | WMITLV_GET_STRUCT_TLVLEN |
| 6674 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 6675 | |
| 6676 | cmd->request_id = reset_req->request_id; |
| 6677 | cmd->vdev_id = reset_req->session_id; |
| 6678 | cmd->mode = 0; |
| 6679 | |
| 6680 | buf_ptr += sizeof(*cmd); |
| 6681 | WMITLV_SET_HDR(buf_ptr, |
| 6682 | WMITLV_TAG_ARRAY_STRUC, |
| 6683 | change_list * |
| 6684 | sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6685 | buf_ptr += WMI_TLV_HDR_SIZE + (change_list * |
| 6686 | sizeof |
| 6687 | (wmi_extscan_wlan_change_bssid_param)); |
| 6688 | |
| 6689 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6690 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6691 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6692 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6693 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6694 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6695 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6696 | } |
| 6697 | |
| 6698 | /** |
| 6699 | * wmi_get_buf_extscan_change_monitor_cmd() - fill change monitor request |
| 6700 | * @wmi_handle: wmi handle |
| 6701 | * @psigchange: change monitor request params |
| 6702 | * @buf: wmi buffer |
| 6703 | * @buf_len: buffer length |
| 6704 | * |
| 6705 | * This function fills elements of change monitor request buffer. |
| 6706 | * |
| 6707 | * Return: CDF status |
| 6708 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6709 | 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] | 6710 | struct extscan_set_sig_changereq_params |
| 6711 | *psigchange, wmi_buf_t *buf, int *buf_len) |
| 6712 | { |
| 6713 | wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *cmd; |
| 6714 | wmi_extscan_wlan_change_bssid_param *dest_chglist; |
| 6715 | uint8_t *buf_ptr; |
| 6716 | int j; |
| 6717 | int len = sizeof(*cmd); |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 6718 | uint32_t numap = psigchange->num_ap; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6719 | struct ap_threshold_params *src_ap = psigchange->ap; |
| 6720 | |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 6721 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_SIGNIFICANT_CHANGE_APS)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6722 | WMI_LOGE("%s: Invalid number of bssid's", __func__); |
| 6723 | return QDF_STATUS_E_INVAL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6724 | } |
| 6725 | len += WMI_TLV_HDR_SIZE; |
| 6726 | len += numap * sizeof(wmi_extscan_wlan_change_bssid_param); |
| 6727 | |
| 6728 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 6729 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6730 | WMI_LOGP("%s: failed to allocate memory for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6731 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6732 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6733 | } |
| 6734 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 6735 | cmd = |
| 6736 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param *) |
| 6737 | buf_ptr; |
| 6738 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6739 | WMITLV_TAG_STRUC_wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param, |
| 6740 | WMITLV_GET_STRUCT_TLVLEN |
| 6741 | (wmi_extscan_configure_wlan_change_monitor_cmd_fixed_param)); |
| 6742 | |
| 6743 | cmd->request_id = psigchange->request_id; |
| 6744 | cmd->vdev_id = psigchange->session_id; |
| 6745 | cmd->total_entries = numap; |
| 6746 | cmd->mode = 1; |
| 6747 | cmd->num_entries_in_page = numap; |
| 6748 | cmd->lost_ap_scan_count = psigchange->lostap_sample_size; |
| 6749 | cmd->max_rssi_samples = psigchange->rssi_sample_size; |
| 6750 | cmd->rssi_averaging_samples = psigchange->rssi_sample_size; |
| 6751 | cmd->max_out_of_range_count = psigchange->min_breaching; |
| 6752 | |
| 6753 | buf_ptr += sizeof(*cmd); |
| 6754 | WMITLV_SET_HDR(buf_ptr, |
| 6755 | WMITLV_TAG_ARRAY_STRUC, |
| 6756 | numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6757 | dest_chglist = (wmi_extscan_wlan_change_bssid_param *) |
| 6758 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 6759 | |
| 6760 | for (j = 0; j < numap; j++) { |
| 6761 | WMITLV_SET_HDR(dest_chglist, |
| 6762 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 6763 | WMITLV_GET_STRUCT_TLVLEN |
| 6764 | (wmi_extscan_wlan_change_bssid_param)); |
| 6765 | |
| 6766 | dest_chglist->lower_rssi_limit = src_ap->low; |
| 6767 | dest_chglist->upper_rssi_limit = src_ap->high; |
| 6768 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 6769 | &dest_chglist->bssid); |
| 6770 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6771 | WMI_LOGD("%s: min_rssi %d", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6772 | dest_chglist->lower_rssi_limit); |
| 6773 | dest_chglist++; |
| 6774 | src_ap++; |
| 6775 | } |
| 6776 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6777 | (numap * sizeof(wmi_extscan_wlan_change_bssid_param)); |
| 6778 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6779 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6780 | } |
| 6781 | |
| 6782 | /** |
| 6783 | * send_extscan_start_change_monitor_cmd_tlv() - send start change monitor cmd |
| 6784 | * @wmi_handle: wmi handle |
| 6785 | * @psigchange: change monitor request params |
| 6786 | * |
| 6787 | * This function sends start change monitor request to fw. |
| 6788 | * |
| 6789 | * Return: CDF status |
| 6790 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6791 | 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] | 6792 | struct extscan_set_sig_changereq_params * |
| 6793 | psigchange) |
| 6794 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6795 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6796 | wmi_buf_t buf; |
| 6797 | int len; |
| 6798 | |
| 6799 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6800 | qdf_status = wmi_get_buf_extscan_change_monitor_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6801 | psigchange, &buf, |
| 6802 | &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6803 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 6804 | WMI_LOGE("%s: Failed to get buffer for change monitor cmd", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6805 | __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6806 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6807 | } |
| 6808 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6809 | WMI_LOGE("%s: Failed to get buffer", __func__); |
| 6810 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6811 | } |
| 6812 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 6813 | WMI_EXTSCAN_CONFIGURE_WLAN_CHANGE_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6814 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6815 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6816 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6817 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6818 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6819 | } |
| 6820 | |
| 6821 | /** |
| 6822 | * send_extscan_stop_hotlist_monitor_cmd_tlv() - stop hotlist monitor |
| 6823 | * @wmi_handle: wmi handle |
| 6824 | * @photlist_reset: hotlist reset params |
| 6825 | * |
| 6826 | * This function configures hotlist monitor to stop in fw. |
| 6827 | * |
| 6828 | * Return: CDF status |
| 6829 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6830 | 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] | 6831 | struct extscan_bssid_hotlist_reset_params *photlist_reset) |
| 6832 | { |
| 6833 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd; |
| 6834 | wmi_buf_t wmi_buf; |
| 6835 | uint32_t len; |
| 6836 | uint8_t *buf_ptr; |
| 6837 | int hotlist_entries = 0; |
| 6838 | |
| 6839 | len = sizeof(*cmd); |
| 6840 | |
| 6841 | /* reset bssid hotlist with tlv set to 0 */ |
| 6842 | len += WMI_TLV_HDR_SIZE; |
| 6843 | len += hotlist_entries * sizeof(wmi_extscan_hotlist_entry); |
| 6844 | |
| 6845 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6846 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6847 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6848 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6849 | } |
| 6850 | |
| 6851 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6852 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 6853 | buf_ptr; |
| 6854 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6855 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 6856 | WMITLV_GET_STRUCT_TLVLEN |
| 6857 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 6858 | |
| 6859 | cmd->request_id = photlist_reset->request_id; |
| 6860 | cmd->vdev_id = photlist_reset->session_id; |
| 6861 | cmd->mode = 0; |
| 6862 | |
| 6863 | buf_ptr += sizeof(*cmd); |
| 6864 | WMITLV_SET_HDR(buf_ptr, |
| 6865 | WMITLV_TAG_ARRAY_STRUC, |
| 6866 | hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 6867 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 6868 | (hotlist_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 6869 | |
| 6870 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6871 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6872 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6873 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6874 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6875 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6876 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6877 | } |
| 6878 | |
| 6879 | /** |
| 6880 | * send_stop_extscan_cmd_tlv() - stop extscan command to fw. |
| 6881 | * @wmi_handle: wmi handle |
| 6882 | * @pstopcmd: stop scan command request params |
| 6883 | * |
| 6884 | * This function sends stop extscan request to fw. |
| 6885 | * |
| 6886 | * Return: CDF Status. |
| 6887 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 6888 | 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] | 6889 | struct extscan_stop_req_params *pstopcmd) |
| 6890 | { |
| 6891 | wmi_extscan_stop_cmd_fixed_param *cmd; |
| 6892 | wmi_buf_t wmi_buf; |
| 6893 | uint32_t len; |
| 6894 | uint8_t *buf_ptr; |
| 6895 | |
| 6896 | len = sizeof(*cmd); |
| 6897 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 6898 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6899 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 6900 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6901 | } |
| 6902 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 6903 | cmd = (wmi_extscan_stop_cmd_fixed_param *) buf_ptr; |
| 6904 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6905 | WMITLV_TAG_STRUC_wmi_extscan_stop_cmd_fixed_param, |
| 6906 | WMITLV_GET_STRUCT_TLVLEN |
| 6907 | (wmi_extscan_stop_cmd_fixed_param)); |
| 6908 | |
| 6909 | cmd->request_id = pstopcmd->request_id; |
| 6910 | cmd->vdev_id = pstopcmd->session_id; |
| 6911 | |
| 6912 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 6913 | WMI_EXTSCAN_STOP_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6914 | WMI_LOGE("%s: failed to command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 6915 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6916 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6917 | } |
| 6918 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6919 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6920 | } |
| 6921 | |
| 6922 | /** |
| 6923 | * wmi_get_buf_extscan_start_cmd() - Fill extscan start request |
| 6924 | * @wmi_handle: wmi handle |
| 6925 | * @pstart: scan command request params |
| 6926 | * @buf: event buffer |
| 6927 | * @buf_len: length of buffer |
| 6928 | * |
| 6929 | * This function fills individual elements of extscan request and |
| 6930 | * TLV for buckets, channel list. |
| 6931 | * |
| 6932 | * Return: CDF Status. |
| 6933 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 6934 | static |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6935 | 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] | 6936 | struct wifi_scan_cmd_req_params *pstart, |
| 6937 | wmi_buf_t *buf, int *buf_len) |
| 6938 | { |
| 6939 | wmi_extscan_start_cmd_fixed_param *cmd; |
| 6940 | wmi_extscan_bucket *dest_blist; |
| 6941 | wmi_extscan_bucket_channel *dest_clist; |
| 6942 | struct wifi_scan_bucket_params *src_bucket = pstart->buckets; |
| 6943 | struct wifi_scan_channelspec_params *src_channel = src_bucket->channels; |
| 6944 | struct wifi_scan_channelspec_params save_channel[WMI_WLAN_EXTSCAN_MAX_CHANNELS]; |
| 6945 | |
| 6946 | uint8_t *buf_ptr; |
| 6947 | int i, k, count = 0; |
| 6948 | int len = sizeof(*cmd); |
| 6949 | int nbuckets = pstart->numBuckets; |
| 6950 | int nchannels = 0; |
| 6951 | |
| 6952 | /* These TLV's are are NULL by default */ |
| 6953 | uint32_t ie_len_with_pad = 0; |
| 6954 | int num_ssid = 0; |
| 6955 | int num_bssid = 0; |
| 6956 | int ie_len = 0; |
| 6957 | |
| 6958 | uint32_t base_period = pstart->basePeriod; |
| 6959 | |
| 6960 | /* TLV placeholder for ssid_list (NULL) */ |
| 6961 | len += WMI_TLV_HDR_SIZE; |
| 6962 | len += num_ssid * sizeof(wmi_ssid); |
| 6963 | |
| 6964 | /* TLV placeholder for bssid_list (NULL) */ |
| 6965 | len += WMI_TLV_HDR_SIZE; |
| 6966 | len += num_bssid * sizeof(wmi_mac_addr); |
| 6967 | |
| 6968 | /* TLV placeholder for ie_data (NULL) */ |
| 6969 | len += WMI_TLV_HDR_SIZE; |
| 6970 | len += ie_len * sizeof(uint32_t); |
| 6971 | |
| 6972 | /* TLV placeholder for bucket */ |
| 6973 | len += WMI_TLV_HDR_SIZE; |
| 6974 | len += nbuckets * sizeof(wmi_extscan_bucket); |
| 6975 | |
| 6976 | /* TLV channel placeholder */ |
| 6977 | len += WMI_TLV_HDR_SIZE; |
| 6978 | for (i = 0; i < nbuckets; i++) { |
| 6979 | nchannels += src_bucket->numChannels; |
| 6980 | src_bucket++; |
| 6981 | } |
| 6982 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6983 | WMI_LOGD("%s: Total buckets: %d total #of channels is %d", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6984 | __func__, nbuckets, nchannels); |
| 6985 | len += nchannels * sizeof(wmi_extscan_bucket_channel); |
| 6986 | /* Allocate the memory */ |
| 6987 | *buf = wmi_buf_alloc(wmi_handle, len); |
| 6988 | if (!*buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6989 | WMI_LOGP("%s: failed to allocate memory" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6990 | " for start extscan cmd", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 6991 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 6992 | } |
| 6993 | buf_ptr = (uint8_t *) wmi_buf_data(*buf); |
| 6994 | cmd = (wmi_extscan_start_cmd_fixed_param *) buf_ptr; |
| 6995 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 6996 | WMITLV_TAG_STRUC_wmi_extscan_start_cmd_fixed_param, |
| 6997 | WMITLV_GET_STRUCT_TLVLEN |
| 6998 | (wmi_extscan_start_cmd_fixed_param)); |
| 6999 | |
| 7000 | cmd->request_id = pstart->requestId; |
| 7001 | cmd->vdev_id = pstart->sessionId; |
| 7002 | cmd->base_period = pstart->basePeriod; |
| 7003 | cmd->num_buckets = nbuckets; |
| 7004 | cmd->configuration_flags = 0; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 7005 | if (pstart->configuration_flags & WMI_EXTSCAN_LP_EXTENDED_BATCHING) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7006 | cmd->configuration_flags |= WMI_EXTSCAN_EXTENDED_BATCHING_EN; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7007 | WMI_LOGI("%s: configuration_flags: 0x%x", __func__, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7008 | cmd->configuration_flags); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7009 | #ifdef FEATURE_WLAN_EXTSCAN |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7010 | cmd->min_rest_time = WMI_EXTSCAN_REST_TIME; |
| 7011 | cmd->max_rest_time = WMI_EXTSCAN_REST_TIME; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7012 | cmd->max_scan_time = WMI_EXTSCAN_MAX_SCAN_TIME; |
| 7013 | cmd->burst_duration = WMI_EXTSCAN_BURST_DURATION; |
| 7014 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7015 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 7016 | |
| 7017 | /* The max dwell time is retrieved from the first channel |
| 7018 | * of the first bucket and kept common for all channels. |
| 7019 | */ |
| 7020 | cmd->min_dwell_time_active = pstart->min_dwell_time_active; |
| 7021 | cmd->max_dwell_time_active = pstart->max_dwell_time_active; |
| 7022 | cmd->min_dwell_time_passive = pstart->min_dwell_time_passive; |
| 7023 | cmd->max_dwell_time_passive = pstart->max_dwell_time_passive; |
| 7024 | cmd->max_bssids_per_scan_cycle = pstart->maxAPperScan; |
| 7025 | cmd->max_table_usage = pstart->report_threshold_percent; |
| 7026 | cmd->report_threshold_num_scans = pstart->report_threshold_num_scans; |
| 7027 | |
| 7028 | cmd->repeat_probe_time = cmd->max_dwell_time_active / |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7029 | WMI_SCAN_NPROBES_DEFAULT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7030 | cmd->probe_delay = 0; |
| 7031 | cmd->probe_spacing_time = 0; |
| 7032 | cmd->idle_time = 0; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7033 | cmd->scan_ctrl_flags = WMI_SCAN_ADD_BCAST_PROBE_REQ | |
| 7034 | WMI_SCAN_ADD_CCK_RATES | |
| 7035 | WMI_SCAN_ADD_OFDM_RATES | |
| 7036 | WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ | |
| 7037 | WMI_SCAN_ADD_DS_IE_IN_PROBE_REQ; |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 7038 | WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, |
| 7039 | pstart->extscan_adaptive_dwell_mode); |
Kapil Gupta | 4a95ef2 | 2016-09-29 18:07:01 +0530 | [diff] [blame] | 7040 | cmd->scan_priority = WMI_SCAN_PRIORITY_VERY_LOW; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7041 | cmd->num_ssids = 0; |
| 7042 | cmd->num_bssid = 0; |
| 7043 | cmd->ie_len = 0; |
| 7044 | cmd->n_probes = (cmd->repeat_probe_time > 0) ? |
| 7045 | cmd->max_dwell_time_active / cmd->repeat_probe_time : 0; |
| 7046 | |
| 7047 | buf_ptr += sizeof(*cmd); |
| 7048 | WMITLV_SET_HDR(buf_ptr, |
| 7049 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 7050 | num_ssid * sizeof(wmi_ssid)); |
| 7051 | buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid * sizeof(wmi_ssid)); |
| 7052 | |
| 7053 | WMITLV_SET_HDR(buf_ptr, |
| 7054 | WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 7055 | num_bssid * sizeof(wmi_mac_addr)); |
| 7056 | buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid * sizeof(wmi_mac_addr)); |
| 7057 | |
| 7058 | ie_len_with_pad = 0; |
| 7059 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 7060 | ie_len_with_pad); |
| 7061 | buf_ptr += WMI_TLV_HDR_SIZE + ie_len_with_pad; |
| 7062 | |
| 7063 | WMITLV_SET_HDR(buf_ptr, |
| 7064 | WMITLV_TAG_ARRAY_STRUC, |
| 7065 | nbuckets * sizeof(wmi_extscan_bucket)); |
| 7066 | dest_blist = (wmi_extscan_bucket *) |
| 7067 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 7068 | src_bucket = pstart->buckets; |
| 7069 | |
| 7070 | /* Retrieve scanning information from each bucket and |
| 7071 | * channels and send it to the target |
| 7072 | */ |
| 7073 | for (i = 0; i < nbuckets; i++) { |
| 7074 | WMITLV_SET_HDR(dest_blist, |
| 7075 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 7076 | WMITLV_GET_STRUCT_TLVLEN(wmi_extscan_bucket)); |
| 7077 | |
| 7078 | dest_blist->bucket_id = src_bucket->bucket; |
| 7079 | dest_blist->base_period_multiplier = |
| 7080 | src_bucket->period / base_period; |
| 7081 | dest_blist->min_period = src_bucket->period; |
| 7082 | dest_blist->max_period = src_bucket->max_period; |
| 7083 | dest_blist->exp_backoff = src_bucket->exponent; |
| 7084 | dest_blist->exp_max_step_count = src_bucket->step_count; |
| 7085 | dest_blist->channel_band = src_bucket->band; |
| 7086 | dest_blist->num_channels = src_bucket->numChannels; |
| 7087 | dest_blist->notify_extscan_events = 0; |
| 7088 | |
| 7089 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_EACH_SCAN) |
| 7090 | dest_blist->notify_extscan_events = |
Deepak Dhamdhere | 583283c | 2016-09-02 00:03:12 -0700 | [diff] [blame] | 7091 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT | |
| 7092 | WMI_EXTSCAN_CYCLE_STARTED_EVENT; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7093 | |
| 7094 | if (src_bucket->reportEvents & |
| 7095 | WMI_EXTSCAN_REPORT_EVENTS_FULL_RESULTS) { |
| 7096 | dest_blist->forwarding_flags = |
| 7097 | WMI_EXTSCAN_FORWARD_FRAME_TO_HOST; |
| 7098 | dest_blist->notify_extscan_events |= |
| 7099 | WMI_EXTSCAN_BUCKET_COMPLETED_EVENT | |
| 7100 | WMI_EXTSCAN_CYCLE_STARTED_EVENT | |
| 7101 | WMI_EXTSCAN_CYCLE_COMPLETED_EVENT; |
| 7102 | } else { |
| 7103 | dest_blist->forwarding_flags = |
| 7104 | WMI_EXTSCAN_NO_FORWARDING; |
| 7105 | } |
| 7106 | |
| 7107 | if (src_bucket->reportEvents & WMI_EXTSCAN_REPORT_EVENTS_NO_BATCH) |
| 7108 | dest_blist->configuration_flags = 0; |
| 7109 | else |
| 7110 | dest_blist->configuration_flags = |
| 7111 | WMI_EXTSCAN_BUCKET_CACHE_RESULTS; |
| 7112 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7113 | 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] | 7114 | __func__, dest_blist->notify_extscan_events, |
| 7115 | dest_blist->configuration_flags, |
| 7116 | dest_blist->forwarding_flags); |
| 7117 | |
| 7118 | dest_blist->min_dwell_time_active = |
| 7119 | src_bucket->min_dwell_time_active; |
| 7120 | dest_blist->max_dwell_time_active = |
| 7121 | src_bucket->max_dwell_time_active; |
| 7122 | dest_blist->min_dwell_time_passive = |
| 7123 | src_bucket->min_dwell_time_passive; |
| 7124 | dest_blist->max_dwell_time_passive = |
| 7125 | src_bucket->max_dwell_time_passive; |
| 7126 | src_channel = src_bucket->channels; |
| 7127 | |
| 7128 | /* save the channel info to later populate |
| 7129 | * the channel TLV |
| 7130 | */ |
| 7131 | for (k = 0; k < src_bucket->numChannels; k++) { |
| 7132 | save_channel[count++].channel = src_channel->channel; |
| 7133 | src_channel++; |
| 7134 | } |
| 7135 | dest_blist++; |
| 7136 | src_bucket++; |
| 7137 | } |
| 7138 | buf_ptr += WMI_TLV_HDR_SIZE + (nbuckets * sizeof(wmi_extscan_bucket)); |
| 7139 | WMITLV_SET_HDR(buf_ptr, |
| 7140 | WMITLV_TAG_ARRAY_STRUC, |
| 7141 | nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 7142 | dest_clist = (wmi_extscan_bucket_channel *) |
| 7143 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 7144 | |
| 7145 | /* Active or passive scan is based on the bucket dwell time |
| 7146 | * and channel specific active,passive scans are not |
| 7147 | * supported yet |
| 7148 | */ |
| 7149 | for (i = 0; i < nchannels; i++) { |
| 7150 | WMITLV_SET_HDR(dest_clist, |
| 7151 | WMITLV_TAG_STRUC_wmi_extscan_bucket_channel_event_fixed_param, |
| 7152 | WMITLV_GET_STRUCT_TLVLEN |
| 7153 | (wmi_extscan_bucket_channel)); |
| 7154 | dest_clist->channel = save_channel[i].channel; |
| 7155 | dest_clist++; |
| 7156 | } |
| 7157 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 7158 | (nchannels * sizeof(wmi_extscan_bucket_channel)); |
| 7159 | *buf_len = len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7160 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7161 | } |
| 7162 | |
| 7163 | /** |
| 7164 | * send_start_extscan_cmd_tlv() - start extscan command to fw. |
| 7165 | * @wmi_handle: wmi handle |
| 7166 | * @pstart: scan command request params |
| 7167 | * |
| 7168 | * This function sends start extscan request to fw. |
| 7169 | * |
| 7170 | * Return: CDF Status. |
| 7171 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7172 | 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] | 7173 | struct wifi_scan_cmd_req_params *pstart) |
| 7174 | { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7175 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7176 | wmi_buf_t buf; |
| 7177 | int len; |
| 7178 | |
| 7179 | /* Fill individual elements of extscan request and |
| 7180 | * TLV for buckets, channel list. |
| 7181 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7182 | qdf_status = wmi_get_buf_extscan_start_cmd(wmi_handle, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7183 | pstart, &buf, &len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7184 | if (qdf_status != QDF_STATUS_SUCCESS) { |
| 7185 | WMI_LOGE("%s: Failed to get buffer for ext scan cmd", __func__); |
| 7186 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7187 | } |
| 7188 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7189 | WMI_LOGE("%s:Failed to get buffer" |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7190 | "for current extscan info", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7191 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7192 | } |
| 7193 | if (wmi_unified_cmd_send(wmi_handle, buf, |
| 7194 | len, WMI_EXTSCAN_START_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7195 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7196 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7197 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7198 | } |
| 7199 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7200 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7201 | } |
| 7202 | |
| 7203 | /** |
| 7204 | * send_plm_stop_cmd_tlv() - plm stop request |
| 7205 | * @wmi_handle: wmi handle |
| 7206 | * @plm: plm request parameters |
| 7207 | * |
| 7208 | * This function request FW to stop PLM. |
| 7209 | * |
| 7210 | * Return: CDF status |
| 7211 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7212 | 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] | 7213 | const struct plm_req_params *plm) |
| 7214 | { |
| 7215 | wmi_vdev_plmreq_stop_cmd_fixed_param *cmd; |
| 7216 | int32_t len; |
| 7217 | wmi_buf_t buf; |
| 7218 | uint8_t *buf_ptr; |
| 7219 | int ret; |
| 7220 | |
| 7221 | len = sizeof(*cmd); |
| 7222 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7223 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7224 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7225 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7226 | } |
| 7227 | |
| 7228 | cmd = (wmi_vdev_plmreq_stop_cmd_fixed_param *) wmi_buf_data(buf); |
| 7229 | |
| 7230 | buf_ptr = (uint8_t *) cmd; |
| 7231 | |
| 7232 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7233 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_stop_cmd_fixed_param, |
| 7234 | WMITLV_GET_STRUCT_TLVLEN |
| 7235 | (wmi_vdev_plmreq_stop_cmd_fixed_param)); |
| 7236 | |
| 7237 | cmd->vdev_id = plm->session_id; |
| 7238 | |
| 7239 | cmd->meas_token = plm->meas_token; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7240 | 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] | 7241 | |
| 7242 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7243 | WMI_VDEV_PLMREQ_STOP_CMDID); |
| 7244 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7245 | WMI_LOGE("%s: Failed to send plm stop wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7246 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7247 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7248 | } |
| 7249 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7250 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7251 | } |
| 7252 | |
| 7253 | /** |
| 7254 | * send_plm_start_cmd_tlv() - plm start request |
| 7255 | * @wmi_handle: wmi handle |
| 7256 | * @plm: plm request parameters |
| 7257 | * |
| 7258 | * This function request FW to start PLM. |
| 7259 | * |
| 7260 | * Return: CDF status |
| 7261 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7262 | 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] | 7263 | const struct plm_req_params *plm, |
| 7264 | uint32_t *gchannel_list) |
| 7265 | { |
| 7266 | wmi_vdev_plmreq_start_cmd_fixed_param *cmd; |
| 7267 | uint32_t *channel_list; |
| 7268 | int32_t len; |
| 7269 | wmi_buf_t buf; |
| 7270 | uint8_t *buf_ptr; |
| 7271 | uint8_t count; |
| 7272 | int ret; |
| 7273 | |
| 7274 | /* TLV place holder for channel_list */ |
| 7275 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 7276 | len += sizeof(uint32_t) * plm->plm_num_ch; |
| 7277 | |
| 7278 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7279 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7280 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7281 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7282 | } |
| 7283 | cmd = (wmi_vdev_plmreq_start_cmd_fixed_param *) wmi_buf_data(buf); |
| 7284 | |
| 7285 | buf_ptr = (uint8_t *) cmd; |
| 7286 | |
| 7287 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7288 | WMITLV_TAG_STRUC_wmi_vdev_plmreq_start_cmd_fixed_param, |
| 7289 | WMITLV_GET_STRUCT_TLVLEN |
| 7290 | (wmi_vdev_plmreq_start_cmd_fixed_param)); |
| 7291 | |
| 7292 | cmd->vdev_id = plm->session_id; |
| 7293 | |
| 7294 | cmd->meas_token = plm->meas_token; |
| 7295 | cmd->dialog_token = plm->diag_token; |
| 7296 | cmd->number_bursts = plm->num_bursts; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7297 | cmd->burst_interval = WMI_SEC_TO_MSEC(plm->burst_int); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7298 | cmd->off_duration = plm->meas_duration; |
| 7299 | cmd->burst_cycle = plm->burst_len; |
| 7300 | cmd->tx_power = plm->desired_tx_pwr; |
| 7301 | WMI_CHAR_ARRAY_TO_MAC_ADDR(plm->mac_addr.bytes, &cmd->dest_mac); |
| 7302 | cmd->num_chans = plm->plm_num_ch; |
| 7303 | |
| 7304 | buf_ptr += sizeof(wmi_vdev_plmreq_start_cmd_fixed_param); |
| 7305 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7306 | WMI_LOGD("vdev : %d measu token : %d", cmd->vdev_id, cmd->meas_token); |
| 7307 | WMI_LOGD("dialog_token: %d", cmd->dialog_token); |
| 7308 | WMI_LOGD("number_bursts: %d", cmd->number_bursts); |
| 7309 | WMI_LOGD("burst_interval: %d", cmd->burst_interval); |
| 7310 | WMI_LOGD("off_duration: %d", cmd->off_duration); |
| 7311 | WMI_LOGD("burst_cycle: %d", cmd->burst_cycle); |
| 7312 | WMI_LOGD("tx_power: %d", cmd->tx_power); |
| 7313 | WMI_LOGD("Number of channels : %d", cmd->num_chans); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7314 | |
| 7315 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 7316 | (cmd->num_chans * sizeof(uint32_t))); |
| 7317 | |
| 7318 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7319 | if (cmd->num_chans) { |
| 7320 | channel_list = (uint32_t *) buf_ptr; |
| 7321 | for (count = 0; count < cmd->num_chans; count++) { |
| 7322 | channel_list[count] = plm->plm_ch_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7323 | if (channel_list[count] < WMI_NLO_FREQ_THRESH) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7324 | channel_list[count] = |
| 7325 | gchannel_list[count]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7326 | WMI_LOGD("Ch[%d]: %d MHz", count, channel_list[count]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7327 | } |
| 7328 | buf_ptr += cmd->num_chans * sizeof(uint32_t); |
| 7329 | } |
| 7330 | |
| 7331 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7332 | WMI_VDEV_PLMREQ_START_CMDID); |
| 7333 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7334 | WMI_LOGE("%s: Failed to send plm start wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7335 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7336 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7337 | } |
| 7338 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7339 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7340 | } |
| 7341 | |
| 7342 | /** |
| 7343 | * send_pno_stop_cmd_tlv() - PNO stop request |
| 7344 | * @wmi_handle: wmi handle |
| 7345 | * @vdev_id: vdev id |
| 7346 | * |
| 7347 | * This function request FW to stop ongoing PNO operation. |
| 7348 | * |
| 7349 | * Return: CDF status |
| 7350 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7351 | 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] | 7352 | { |
| 7353 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 7354 | int32_t len = sizeof(*cmd); |
| 7355 | wmi_buf_t buf; |
| 7356 | uint8_t *buf_ptr; |
| 7357 | int ret; |
| 7358 | |
| 7359 | /* |
| 7360 | * TLV place holder for array of structures nlo_configured_parameters |
| 7361 | * TLV place holder for array of uint32_t channel_list |
| 7362 | * TLV place holder for chnl prediction cfg |
| 7363 | */ |
| 7364 | len += WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
| 7365 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7366 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7367 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7368 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7369 | } |
| 7370 | |
| 7371 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 7372 | buf_ptr = (uint8_t *) cmd; |
| 7373 | |
| 7374 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7375 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 7376 | WMITLV_GET_STRUCT_TLVLEN |
| 7377 | (wmi_nlo_config_cmd_fixed_param)); |
| 7378 | |
| 7379 | cmd->vdev_id = vdev_id; |
| 7380 | cmd->flags = WMI_NLO_CONFIG_STOP; |
| 7381 | buf_ptr += sizeof(*cmd); |
| 7382 | |
| 7383 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7384 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7385 | |
| 7386 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 7387 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7388 | |
| 7389 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 7390 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7391 | |
| 7392 | |
| 7393 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7394 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 7395 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7396 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7397 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7398 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7399 | } |
| 7400 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7401 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7402 | } |
| 7403 | |
| 7404 | /** |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7405 | * wmi_set_pno_channel_prediction() - Set PNO channel prediction |
| 7406 | * @buf_ptr: Buffer passed by upper layers |
| 7407 | * @pno: Buffer to be sent to the firmware |
| 7408 | * |
| 7409 | * Copy the PNO Channel prediction configuration parameters |
| 7410 | * passed by the upper layers to a WMI format TLV and send it |
| 7411 | * down to the firmware. |
| 7412 | * |
| 7413 | * Return: None |
| 7414 | */ |
| 7415 | static void wmi_set_pno_channel_prediction(uint8_t *buf_ptr, |
| 7416 | struct pno_scan_req_params *pno) |
| 7417 | { |
| 7418 | nlo_channel_prediction_cfg *channel_prediction_cfg = |
| 7419 | (nlo_channel_prediction_cfg *) buf_ptr; |
| 7420 | WMITLV_SET_HDR(&channel_prediction_cfg->tlv_header, |
| 7421 | WMITLV_TAG_ARRAY_BYTE, |
| 7422 | WMITLV_GET_STRUCT_TLVLEN(nlo_channel_prediction_cfg)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7423 | #ifdef FEATURE_WLAN_SCAN_PNO |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7424 | channel_prediction_cfg->enable = pno->pno_channel_prediction; |
| 7425 | channel_prediction_cfg->top_k_num = pno->top_k_num_of_channels; |
| 7426 | channel_prediction_cfg->stationary_threshold = pno->stationary_thresh; |
| 7427 | channel_prediction_cfg->full_scan_period_ms = |
| 7428 | pno->channel_prediction_full_scan; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7429 | #endif |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7430 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
| 7431 | WMI_LOGD("enable: %d, top_k_num: %d, stat_thresh: %d, full_scan: %d", |
| 7432 | channel_prediction_cfg->enable, |
| 7433 | channel_prediction_cfg->top_k_num, |
| 7434 | channel_prediction_cfg->stationary_threshold, |
| 7435 | channel_prediction_cfg->full_scan_period_ms); |
| 7436 | } |
| 7437 | |
| 7438 | /** |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 7439 | * send_nlo_mawc_cmd_tlv() - Send MAWC NLO configuration |
| 7440 | * @wmi_handle: wmi handle |
| 7441 | * @params: configuration parameters |
| 7442 | * |
| 7443 | * Return: QDF_STATUS |
| 7444 | */ |
| 7445 | static QDF_STATUS send_nlo_mawc_cmd_tlv(wmi_unified_t wmi_handle, |
| 7446 | struct nlo_mawc_params *params) |
| 7447 | { |
| 7448 | wmi_buf_t buf = NULL; |
| 7449 | QDF_STATUS status; |
| 7450 | int len; |
| 7451 | uint8_t *buf_ptr; |
| 7452 | wmi_nlo_configure_mawc_cmd_fixed_param *wmi_nlo_mawc_params; |
| 7453 | |
| 7454 | len = sizeof(*wmi_nlo_mawc_params); |
| 7455 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7456 | if (!buf) { |
| 7457 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 7458 | return QDF_STATUS_E_NOMEM; |
| 7459 | } |
| 7460 | |
| 7461 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7462 | wmi_nlo_mawc_params = |
| 7463 | (wmi_nlo_configure_mawc_cmd_fixed_param *) buf_ptr; |
| 7464 | WMITLV_SET_HDR(&wmi_nlo_mawc_params->tlv_header, |
| 7465 | WMITLV_TAG_STRUC_wmi_nlo_configure_mawc_cmd_fixed_param, |
| 7466 | WMITLV_GET_STRUCT_TLVLEN |
| 7467 | (wmi_nlo_configure_mawc_cmd_fixed_param)); |
| 7468 | wmi_nlo_mawc_params->vdev_id = params->vdev_id; |
| 7469 | if (params->enable) |
| 7470 | wmi_nlo_mawc_params->enable = 1; |
| 7471 | else |
| 7472 | wmi_nlo_mawc_params->enable = 0; |
| 7473 | wmi_nlo_mawc_params->exp_backoff_ratio = params->exp_backoff_ratio; |
| 7474 | wmi_nlo_mawc_params->init_scan_interval = params->init_scan_interval; |
| 7475 | wmi_nlo_mawc_params->max_scan_interval = params->max_scan_interval; |
| 7476 | |
| 7477 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 7478 | len, WMI_NLO_CONFIGURE_MAWC_CMDID); |
| 7479 | if (QDF_IS_STATUS_ERROR(status)) { |
| 7480 | WMI_LOGE("WMI_NLO_CONFIGURE_MAWC_CMDID failed, Error %d", |
| 7481 | status); |
| 7482 | wmi_buf_free(buf); |
| 7483 | return QDF_STATUS_E_FAILURE; |
| 7484 | } |
| 7485 | WMI_LOGD(FL("MAWC NLO en=%d, vdev=%d, ratio=%d, SCAN init=%d, max=%d"), |
| 7486 | wmi_nlo_mawc_params->enable, wmi_nlo_mawc_params->vdev_id, |
| 7487 | wmi_nlo_mawc_params->exp_backoff_ratio, |
| 7488 | wmi_nlo_mawc_params->init_scan_interval, |
| 7489 | wmi_nlo_mawc_params->max_scan_interval); |
| 7490 | |
| 7491 | return QDF_STATUS_SUCCESS; |
| 7492 | } |
| 7493 | |
| 7494 | /** |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7495 | * send_pno_start_cmd_tlv() - PNO start request |
| 7496 | * @wmi_handle: wmi handle |
| 7497 | * @pno: PNO request |
| 7498 | * |
| 7499 | * This function request FW to start PNO request. |
| 7500 | * Request: CDF status |
| 7501 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7502 | 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] | 7503 | struct pno_scan_req_params *pno) |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7504 | { |
| 7505 | wmi_nlo_config_cmd_fixed_param *cmd; |
| 7506 | nlo_configured_parameters *nlo_list; |
| 7507 | uint32_t *channel_list; |
| 7508 | int32_t len; |
| 7509 | wmi_buf_t buf; |
| 7510 | uint8_t *buf_ptr; |
| 7511 | uint8_t i; |
| 7512 | int ret; |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7513 | struct probe_req_whitelist_attr *ie_whitelist = &pno->ie_whitelist; |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7514 | connected_nlo_rssi_params *nlo_relative_rssi; |
| 7515 | connected_nlo_bss_band_rssi_pref *nlo_band_rssi; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7516 | |
| 7517 | /* |
| 7518 | * TLV place holder for array nlo_configured_parameters(nlo_list) |
| 7519 | * TLV place holder for array of uint32_t channel_list |
| 7520 | * TLV place holder for chnnl prediction cfg |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7521 | * TLV place holder for array of wmi_vendor_oui |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7522 | * TLV place holder for array of connected_nlo_bss_band_rssi_pref |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7523 | */ |
| 7524 | len = sizeof(*cmd) + |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7525 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE + |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7526 | WMI_TLV_HDR_SIZE + WMI_TLV_HDR_SIZE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7527 | |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7528 | len += sizeof(uint32_t) * QDF_MIN(pno->networks_list[0].channel_cnt, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7529 | WMI_NLO_MAX_CHAN); |
| 7530 | len += sizeof(nlo_configured_parameters) * |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7531 | QDF_MIN(pno->networks_cnt, WMI_NLO_MAX_SSIDS); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7532 | len += sizeof(nlo_channel_prediction_cfg); |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7533 | len += sizeof(enlo_candidate_score_params); |
| 7534 | len += sizeof(wmi_vendor_oui) * ie_whitelist->num_vendor_oui; |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7535 | len += sizeof(connected_nlo_rssi_params); |
| 7536 | len += sizeof(connected_nlo_bss_band_rssi_pref); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7537 | |
| 7538 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7539 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7540 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7541 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7542 | } |
| 7543 | |
| 7544 | cmd = (wmi_nlo_config_cmd_fixed_param *) wmi_buf_data(buf); |
| 7545 | |
| 7546 | buf_ptr = (uint8_t *) cmd; |
| 7547 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7548 | WMITLV_TAG_STRUC_wmi_nlo_config_cmd_fixed_param, |
| 7549 | WMITLV_GET_STRUCT_TLVLEN |
| 7550 | (wmi_nlo_config_cmd_fixed_param)); |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7551 | cmd->vdev_id = pno->vdev_id; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7552 | cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; |
| 7553 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7554 | #ifdef FEATURE_WLAN_SCAN_PNO |
Gupta, Kapil | 2e68598 | 2016-04-25 19:14:19 +0530 | [diff] [blame] | 7555 | WMI_SCAN_SET_DWELL_MODE(cmd->flags, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7556 | pno->adaptive_dwell_mode); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7557 | #endif |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7558 | /* Current FW does not support min-max range for dwell time */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7559 | cmd->active_dwell_time = pno->active_dwell_time; |
| 7560 | cmd->passive_dwell_time = pno->passive_dwell_time; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7561 | |
Manjeet Singh | cd2dc06 | 2016-08-11 15:31:34 +0530 | [diff] [blame] | 7562 | if (pno->do_passive_scan) |
| 7563 | cmd->flags |= WMI_NLO_CONFIG_SCAN_PASSIVE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7564 | /* Copy scan interval */ |
| 7565 | cmd->fast_scan_period = pno->fast_scan_period; |
| 7566 | cmd->slow_scan_period = pno->slow_scan_period; |
Arif Hussain | 17ff203 | 2017-03-02 11:56:04 -0800 | [diff] [blame] | 7567 | cmd->delay_start_time = WMI_SEC_TO_MSEC(pno->delay_start_time); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7568 | cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; |
Dustin Brown | 9d86564 | 2017-04-24 10:47:42 -0700 | [diff] [blame] | 7569 | cmd->scan_backoff_multiplier = pno->scan_backoff_multiplier; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7570 | WMI_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7571 | cmd->fast_scan_period, cmd->slow_scan_period); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7572 | WMI_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7573 | |
Rajeev Kumar Sirasanagandla | 0c5b307 | 2017-06-08 18:12:50 +0530 | [diff] [blame] | 7574 | /* mac randomization attributes */ |
| 7575 | if (pno->scan_random.randomize) { |
| 7576 | cmd->flags |= WMI_NLO_CONFIG_SPOOFED_MAC_IN_PROBE_REQ | |
| 7577 | WMI_NLO_CONFIG_RANDOM_SEQ_NO_IN_PROBE_REQ; |
| 7578 | wmi_copy_scan_random_mac(pno->scan_random.mac_addr, |
| 7579 | pno->scan_random.mac_mask, |
| 7580 | &cmd->mac_addr, |
| 7581 | &cmd->mac_mask); |
| 7582 | } |
| 7583 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7584 | buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param); |
| 7585 | |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7586 | 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] | 7587 | WMI_LOGD("SSID count : %d", cmd->no_of_ssids); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7588 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7589 | cmd->no_of_ssids * sizeof(nlo_configured_parameters)); |
| 7590 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7591 | |
| 7592 | nlo_list = (nlo_configured_parameters *) buf_ptr; |
| 7593 | for (i = 0; i < cmd->no_of_ssids; i++) { |
| 7594 | WMITLV_SET_HDR(&nlo_list[i].tlv_header, |
| 7595 | WMITLV_TAG_ARRAY_BYTE, |
| 7596 | WMITLV_GET_STRUCT_TLVLEN |
| 7597 | (nlo_configured_parameters)); |
| 7598 | /* Copy ssid and it's length */ |
| 7599 | nlo_list[i].ssid.valid = true; |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7600 | nlo_list[i].ssid.ssid.ssid_len = |
| 7601 | pno->networks_list[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7602 | qdf_mem_copy(nlo_list[i].ssid.ssid.ssid, |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7603 | pno->networks_list[i].ssid.ssid, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7604 | nlo_list[i].ssid.ssid.ssid_len); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7605 | WMI_LOGD("index: %d ssid: %.*s len: %d", i, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7606 | nlo_list[i].ssid.ssid.ssid_len, |
| 7607 | (char *)nlo_list[i].ssid.ssid.ssid, |
| 7608 | nlo_list[i].ssid.ssid.ssid_len); |
| 7609 | |
| 7610 | /* Copy rssi threshold */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7611 | if (pno->networks_list[i].rssi_thresh && |
| 7612 | pno->networks_list[i].rssi_thresh > |
| 7613 | WMI_RSSI_THOLD_DEFAULT) { |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7614 | nlo_list[i].rssi_cond.valid = true; |
| 7615 | nlo_list[i].rssi_cond.rssi = |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7616 | pno->networks_list[i].rssi_thresh; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7617 | WMI_LOGD("RSSI threshold : %d dBm", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7618 | nlo_list[i].rssi_cond.rssi); |
| 7619 | } |
| 7620 | nlo_list[i].bcast_nw_type.valid = true; |
| 7621 | nlo_list[i].bcast_nw_type.bcast_nw_type = |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7622 | pno->networks_list[i].bc_new_type; |
Srinivas Girigowda | 61e086f | 2017-06-19 17:20:20 -0700 | [diff] [blame] | 7623 | WMI_LOGD("Broadcast NW type (%u)", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7624 | nlo_list[i].bcast_nw_type.bcast_nw_type); |
| 7625 | } |
| 7626 | buf_ptr += cmd->no_of_ssids * sizeof(nlo_configured_parameters); |
| 7627 | |
| 7628 | /* Copy channel info */ |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7629 | cmd->num_of_channels = QDF_MIN(pno->networks_list[0].channel_cnt, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7630 | WMI_NLO_MAX_CHAN); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7631 | WMI_LOGD("Channel count: %d", cmd->num_of_channels); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7632 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 7633 | (cmd->num_of_channels * sizeof(uint32_t))); |
| 7634 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7635 | |
| 7636 | channel_list = (uint32_t *) buf_ptr; |
| 7637 | for (i = 0; i < cmd->num_of_channels; i++) { |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7638 | channel_list[i] = pno->networks_list[0].channels[i]; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7639 | |
| 7640 | if (channel_list[i] < WMI_NLO_FREQ_THRESH) |
Abhishek Singh | 5987b63 | 2017-03-03 22:09:07 +0530 | [diff] [blame] | 7641 | channel_list[i] = |
| 7642 | wlan_chan_to_freq(pno-> |
| 7643 | networks_list[0].channels[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7644 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7645 | WMI_LOGD("Ch[%d]: %d MHz", i, channel_list[i]); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7646 | } |
| 7647 | buf_ptr += cmd->num_of_channels * sizeof(uint32_t); |
| 7648 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7649 | sizeof(nlo_channel_prediction_cfg)); |
| 7650 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | ccb0c27 | 2016-04-01 16:30:08 +0530 | [diff] [blame] | 7651 | wmi_set_pno_channel_prediction(buf_ptr, pno); |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7652 | buf_ptr += sizeof(nlo_channel_prediction_cfg); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7653 | /** TODO: Discrete firmware doesn't have command/option to configure |
| 7654 | * App IE which comes from wpa_supplicant as of part PNO start request. |
| 7655 | */ |
Rajeev Kumar Sirasanagandla | 0f8402c | 2017-06-21 12:01:22 +0530 | [diff] [blame] | 7656 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_enlo_candidate_score_param, |
| 7657 | WMITLV_GET_STRUCT_TLVLEN(enlo_candidate_score_params)); |
| 7658 | buf_ptr += sizeof(enlo_candidate_score_params); |
| 7659 | |
| 7660 | if (ie_whitelist->white_list) { |
| 7661 | cmd->flags |= WMI_NLO_CONFIG_ENABLE_IE_WHITELIST_IN_PROBE_REQ; |
| 7662 | wmi_fill_ie_whitelist_attrs(cmd->ie_bitmap, |
| 7663 | &cmd->num_vendor_oui, |
| 7664 | ie_whitelist); |
| 7665 | } |
| 7666 | |
| 7667 | /* ie white list */ |
| 7668 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 7669 | ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui)); |
| 7670 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7671 | if (cmd->num_vendor_oui != 0) { |
| 7672 | wmi_fill_vendor_oui(buf_ptr, cmd->num_vendor_oui, |
| 7673 | ie_whitelist->voui); |
| 7674 | buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); |
| 7675 | } |
| 7676 | |
Sreelakshmi Konamki | d9bdeb7 | 2017-07-21 17:37:30 +0530 | [diff] [blame] | 7677 | if (pno->relative_rssi_set) |
| 7678 | cmd->flags |= WMI_NLO_CONFIG_ENABLE_CNLO_RSSI_CONFIG; |
| 7679 | |
| 7680 | /* |
| 7681 | * Firmware calculation using connected PNO params: |
| 7682 | * New AP's RSSI >= (Connected AP's RSSI + relative_rssi +/- rssi_pref) |
| 7683 | * deduction of rssi_pref for chosen band_pref and |
| 7684 | * addition of rssi_pref for remaining bands (other than chosen band). |
| 7685 | */ |
| 7686 | nlo_relative_rssi = (connected_nlo_rssi_params *) buf_ptr; |
| 7687 | WMITLV_SET_HDR(&nlo_relative_rssi->tlv_header, |
| 7688 | WMITLV_TAG_STRUC_wmi_connected_nlo_rssi_params, |
| 7689 | WMITLV_GET_STRUCT_TLVLEN(connected_nlo_rssi_params)); |
| 7690 | nlo_relative_rssi->relative_rssi = pno->relative_rssi; |
| 7691 | WMI_LOGD("relative_rssi %d", nlo_relative_rssi->relative_rssi); |
| 7692 | buf_ptr += sizeof(*nlo_relative_rssi); |
| 7693 | |
| 7694 | /* |
| 7695 | * As of now Kernel and Host supports one band and rssi preference. |
| 7696 | * Firmware supports array of band and rssi preferences |
| 7697 | */ |
| 7698 | cmd->num_cnlo_band_pref = 1; |
| 7699 | WMITLV_SET_HDR(buf_ptr, |
| 7700 | WMITLV_TAG_ARRAY_STRUC, |
| 7701 | cmd->num_cnlo_band_pref * |
| 7702 | sizeof(connected_nlo_bss_band_rssi_pref)); |
| 7703 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7704 | |
| 7705 | nlo_band_rssi = (connected_nlo_bss_band_rssi_pref *) buf_ptr; |
| 7706 | for (i = 0; i < cmd->num_cnlo_band_pref; i++) { |
| 7707 | WMITLV_SET_HDR(&nlo_band_rssi[i].tlv_header, |
| 7708 | WMITLV_TAG_STRUC_wmi_connected_nlo_bss_band_rssi_pref, |
| 7709 | WMITLV_GET_STRUCT_TLVLEN( |
| 7710 | connected_nlo_bss_band_rssi_pref)); |
| 7711 | nlo_band_rssi[i].band = pno->band_rssi_pref.band; |
| 7712 | nlo_band_rssi[i].rssi_pref = pno->band_rssi_pref.rssi; |
| 7713 | WMI_LOGI("band_pref %d, rssi_pref %d", |
| 7714 | nlo_band_rssi[i].band, |
| 7715 | nlo_band_rssi[i].rssi_pref); |
| 7716 | } |
| 7717 | buf_ptr += cmd->num_cnlo_band_pref * sizeof(*nlo_band_rssi); |
| 7718 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7719 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7720 | WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); |
| 7721 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7722 | WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7723 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7724 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7725 | } |
| 7726 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7727 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7728 | } |
| 7729 | |
| 7730 | /* send_set_ric_req_cmd_tlv() - set ric request element |
| 7731 | * @wmi_handle: wmi handle |
| 7732 | * @msg: message |
| 7733 | * @is_add_ts: is addts required |
| 7734 | * |
| 7735 | * This function sets ric request element for 11r roaming. |
| 7736 | * |
| 7737 | * Return: CDF status |
| 7738 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7739 | 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] | 7740 | void *msg, uint8_t is_add_ts) |
| 7741 | { |
| 7742 | wmi_ric_request_fixed_param *cmd; |
| 7743 | wmi_ric_tspec *tspec_param; |
| 7744 | wmi_buf_t buf; |
| 7745 | uint8_t *buf_ptr; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7746 | struct mac_tspec_ie *ptspecIE = NULL; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7747 | int32_t len = sizeof(wmi_ric_request_fixed_param) + |
| 7748 | WMI_TLV_HDR_SIZE + sizeof(wmi_ric_tspec); |
| 7749 | |
| 7750 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7751 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7752 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 7753 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7754 | } |
| 7755 | |
| 7756 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 7757 | |
| 7758 | cmd = (wmi_ric_request_fixed_param *) buf_ptr; |
| 7759 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7760 | WMITLV_TAG_STRUC_wmi_ric_request_fixed_param, |
| 7761 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_request_fixed_param)); |
| 7762 | if (is_add_ts) |
Deepak Dhamdhere | 990df85 | 2017-04-24 16:17:48 -0700 | [diff] [blame] | 7763 | cmd->vdev_id = ((struct add_ts_param *) msg)->sme_session_id; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7764 | else |
| 7765 | cmd->vdev_id = ((struct del_ts_params *) msg)->sessionId; |
| 7766 | cmd->num_ric_request = 1; |
| 7767 | cmd->is_add_ric = is_add_ts; |
| 7768 | |
| 7769 | buf_ptr += sizeof(wmi_ric_request_fixed_param); |
| 7770 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_ric_tspec)); |
| 7771 | |
| 7772 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 7773 | tspec_param = (wmi_ric_tspec *) buf_ptr; |
| 7774 | WMITLV_SET_HDR(&tspec_param->tlv_header, |
| 7775 | WMITLV_TAG_STRUC_wmi_ric_tspec, |
| 7776 | WMITLV_GET_STRUCT_TLVLEN(wmi_ric_tspec)); |
| 7777 | |
| 7778 | if (is_add_ts) |
| 7779 | ptspecIE = &(((struct add_ts_param *) msg)->tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7780 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7781 | else |
| 7782 | ptspecIE = &(((struct del_ts_params *) msg)->delTsInfo.tspec); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7783 | #endif |
| 7784 | if (ptspecIE) { |
| 7785 | /* Fill the tsinfo in the format expected by firmware */ |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7786 | #ifndef ANI_LITTLE_BIT_ENDIAN |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7787 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info) + 1, |
| 7788 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7789 | #else |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7790 | qdf_mem_copy(((uint8_t *) &tspec_param->ts_info), |
| 7791 | ((uint8_t *) &ptspecIE->tsinfo) + 1, 2); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7792 | #endif /* ANI_LITTLE_BIT_ENDIAN */ |
| 7793 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 7794 | tspec_param->nominal_msdu_size = ptspecIE->nomMsduSz; |
| 7795 | tspec_param->maximum_msdu_size = ptspecIE->maxMsduSz; |
| 7796 | tspec_param->min_service_interval = ptspecIE->minSvcInterval; |
| 7797 | tspec_param->max_service_interval = ptspecIE->maxSvcInterval; |
| 7798 | tspec_param->inactivity_interval = ptspecIE->inactInterval; |
| 7799 | tspec_param->suspension_interval = ptspecIE->suspendInterval; |
| 7800 | tspec_param->svc_start_time = ptspecIE->svcStartTime; |
| 7801 | tspec_param->min_data_rate = ptspecIE->minDataRate; |
| 7802 | tspec_param->mean_data_rate = ptspecIE->meanDataRate; |
| 7803 | tspec_param->peak_data_rate = ptspecIE->peakDataRate; |
| 7804 | tspec_param->max_burst_size = ptspecIE->maxBurstSz; |
| 7805 | tspec_param->delay_bound = ptspecIE->delayBound; |
| 7806 | tspec_param->min_phy_rate = ptspecIE->minPhyRate; |
| 7807 | tspec_param->surplus_bw_allowance = ptspecIE->surplusBw; |
| 7808 | tspec_param->medium_time = 0; |
| 7809 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7810 | 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] | 7811 | |
| 7812 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7813 | WMI_ROAM_SET_RIC_REQUEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7814 | WMI_LOGP("%s: Failed to send vdev Set RIC Req command", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7815 | __func__); |
| 7816 | if (is_add_ts) |
| 7817 | ((struct add_ts_param *) msg)->status = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7818 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 7819 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7820 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7821 | } |
| 7822 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7823 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7824 | } |
| 7825 | |
| 7826 | /** |
| 7827 | * send_process_ll_stats_clear_cmd_tlv() - clear link layer stats |
| 7828 | * @wmi_handle: wmi handle |
| 7829 | * @clear_req: ll stats clear request command params |
| 7830 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7831 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7832 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7833 | 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] | 7834 | const struct ll_stats_clear_params *clear_req, |
| 7835 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7836 | { |
| 7837 | wmi_clear_link_stats_cmd_fixed_param *cmd; |
| 7838 | int32_t len; |
| 7839 | wmi_buf_t buf; |
| 7840 | uint8_t *buf_ptr; |
| 7841 | int ret; |
| 7842 | |
| 7843 | len = sizeof(*cmd); |
| 7844 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7845 | |
| 7846 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7847 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7848 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7849 | } |
| 7850 | |
| 7851 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7852 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7853 | cmd = (wmi_clear_link_stats_cmd_fixed_param *) buf_ptr; |
| 7854 | |
| 7855 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7856 | WMITLV_TAG_STRUC_wmi_clear_link_stats_cmd_fixed_param, |
| 7857 | WMITLV_GET_STRUCT_TLVLEN |
| 7858 | (wmi_clear_link_stats_cmd_fixed_param)); |
| 7859 | |
| 7860 | cmd->stop_stats_collection_req = clear_req->stop_req; |
| 7861 | cmd->vdev_id = clear_req->sta_id; |
| 7862 | cmd->stats_clear_req_mask = clear_req->stats_clear_mask; |
| 7863 | |
| 7864 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 7865 | &cmd->peer_macaddr); |
| 7866 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7867 | WMI_LOGD("LINK_LAYER_STATS - Clear Request Params"); |
| 7868 | WMI_LOGD("StopReq : %d", cmd->stop_stats_collection_req); |
| 7869 | WMI_LOGD("Vdev Id : %d", cmd->vdev_id); |
| 7870 | WMI_LOGD("Clear Stat Mask : %d", cmd->stats_clear_req_mask); |
| 7871 | /* WMI_LOGD("Peer MAC Addr : %pM", |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7872 | cmd->peer_macaddr); */ |
| 7873 | |
| 7874 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7875 | WMI_CLEAR_LINK_STATS_CMDID); |
| 7876 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7877 | WMI_LOGE("%s: Failed to send clear link stats req", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7878 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7879 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7880 | } |
| 7881 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7882 | WMI_LOGD("Clear Link Layer Stats request sent successfully"); |
| 7883 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7884 | } |
| 7885 | |
| 7886 | /** |
| 7887 | * send_process_ll_stats_set_cmd_tlv() - link layer stats set request |
| 7888 | * @wmi_handle: wmi handle |
| 7889 | * @setReq: ll stats set request command params |
| 7890 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7891 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7892 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7893 | 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] | 7894 | const struct ll_stats_set_params *set_req) |
| 7895 | { |
| 7896 | wmi_start_link_stats_cmd_fixed_param *cmd; |
| 7897 | int32_t len; |
| 7898 | wmi_buf_t buf; |
| 7899 | uint8_t *buf_ptr; |
| 7900 | int ret; |
| 7901 | |
| 7902 | len = sizeof(*cmd); |
| 7903 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7904 | |
| 7905 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7906 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 7907 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7908 | } |
| 7909 | |
| 7910 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7911 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7912 | cmd = (wmi_start_link_stats_cmd_fixed_param *) buf_ptr; |
| 7913 | |
| 7914 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7915 | WMITLV_TAG_STRUC_wmi_start_link_stats_cmd_fixed_param, |
| 7916 | WMITLV_GET_STRUCT_TLVLEN |
| 7917 | (wmi_start_link_stats_cmd_fixed_param)); |
| 7918 | |
| 7919 | cmd->mpdu_size_threshold = set_req->mpdu_size_threshold; |
| 7920 | cmd->aggressive_statistics_gathering = |
| 7921 | set_req->aggressive_statistics_gathering; |
| 7922 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7923 | WMI_LOGD("LINK_LAYER_STATS - Start/Set Request Params"); |
| 7924 | WMI_LOGD("MPDU Size Thresh : %d", cmd->mpdu_size_threshold); |
| 7925 | WMI_LOGD("Aggressive Gather: %d", cmd->aggressive_statistics_gathering); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7926 | |
| 7927 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7928 | WMI_START_LINK_STATS_CMDID); |
| 7929 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7930 | WMI_LOGE("%s: Failed to send set link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7931 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7932 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7933 | } |
| 7934 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7935 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7936 | } |
| 7937 | |
| 7938 | /** |
| 7939 | * send_process_ll_stats_get_cmd_tlv() - link layer stats get request |
| 7940 | * @wmi_handle:wmi handle |
| 7941 | * @get_req:ll stats get request command params |
| 7942 | * @addr: mac address |
| 7943 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7944 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7945 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 7946 | 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] | 7947 | const struct ll_stats_get_params *get_req, |
| 7948 | uint8_t addr[IEEE80211_ADDR_LEN]) |
| 7949 | { |
| 7950 | wmi_request_link_stats_cmd_fixed_param *cmd; |
| 7951 | int32_t len; |
| 7952 | wmi_buf_t buf; |
| 7953 | uint8_t *buf_ptr; |
| 7954 | int ret; |
| 7955 | |
| 7956 | len = sizeof(*cmd); |
| 7957 | buf = wmi_buf_alloc(wmi_handle, len); |
| 7958 | |
Himanshu Agarwal | ac3869b | 2016-06-30 18:04:14 +0530 | [diff] [blame] | 7959 | if (!buf) { |
| 7960 | WMI_LOGE("%s: buf allocation failed", __func__); |
| 7961 | return QDF_STATUS_E_NOMEM; |
| 7962 | } |
| 7963 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7964 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7965 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7966 | cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr; |
| 7967 | |
| 7968 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 7969 | WMITLV_TAG_STRUC_wmi_request_link_stats_cmd_fixed_param, |
| 7970 | WMITLV_GET_STRUCT_TLVLEN |
| 7971 | (wmi_request_link_stats_cmd_fixed_param)); |
| 7972 | |
| 7973 | cmd->request_id = get_req->req_id; |
| 7974 | cmd->stats_type = get_req->param_id_mask; |
| 7975 | cmd->vdev_id = get_req->sta_id; |
| 7976 | |
| 7977 | WMI_CHAR_ARRAY_TO_MAC_ADDR(addr, |
| 7978 | &cmd->peer_macaddr); |
| 7979 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7980 | WMI_LOGD("LINK_LAYER_STATS - Get Request Params"); |
Krishna Kumaar Natarajan | f6a996c | 2017-03-10 17:24:55 -0800 | [diff] [blame] | 7981 | WMI_LOGD("Request ID : %u", cmd->request_id); |
| 7982 | WMI_LOGD("Stats Type : %0x", cmd->stats_type); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7983 | WMI_LOGD("Vdev ID : %d", cmd->vdev_id); |
| 7984 | WMI_LOGD("Peer MAC Addr : %pM", addr); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7985 | |
| 7986 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 7987 | WMI_REQUEST_LINK_STATS_CMDID); |
| 7988 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7989 | WMI_LOGE("%s: Failed to send get link stats request", __func__); |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7990 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7991 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7992 | } |
| 7993 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 7994 | return QDF_STATUS_SUCCESS; |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7995 | } |
| 7996 | |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 7997 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 7998 | /** |
Padma, Santhosh Kumar | cb1ee46 | 2017-03-21 19:09:35 +0530 | [diff] [blame] | 7999 | * send_congestion_cmd_tlv() - send request to fw to get CCA |
| 8000 | * @wmi_handle: wmi handle |
| 8001 | * @vdev_id: vdev id |
| 8002 | * |
| 8003 | * Return: CDF status |
| 8004 | */ |
| 8005 | static QDF_STATUS send_congestion_cmd_tlv(wmi_unified_t wmi_handle, |
| 8006 | A_UINT8 vdev_id) |
| 8007 | { |
| 8008 | wmi_buf_t buf; |
| 8009 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8010 | uint8_t len; |
| 8011 | uint8_t *buf_ptr; |
| 8012 | |
| 8013 | len = sizeof(*cmd); |
| 8014 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8015 | if (!buf) { |
| 8016 | WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); |
| 8017 | return QDF_STATUS_E_FAILURE; |
| 8018 | } |
| 8019 | |
| 8020 | buf_ptr = wmi_buf_data(buf); |
| 8021 | cmd = (wmi_request_stats_cmd_fixed_param *)buf_ptr; |
| 8022 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8023 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8024 | WMITLV_GET_STRUCT_TLVLEN |
| 8025 | (wmi_request_stats_cmd_fixed_param)); |
| 8026 | |
| 8027 | cmd->stats_id = WMI_REQUEST_CONGESTION_STAT; |
| 8028 | cmd->vdev_id = vdev_id; |
| 8029 | WMI_LOGD("STATS REQ VDEV_ID:%d stats_id %d -->", |
| 8030 | cmd->vdev_id, cmd->stats_id); |
| 8031 | |
| 8032 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8033 | WMI_REQUEST_STATS_CMDID)) { |
| 8034 | WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", |
| 8035 | __func__); |
| 8036 | wmi_buf_free(buf); |
| 8037 | return QDF_STATUS_E_FAILURE; |
| 8038 | } |
| 8039 | |
| 8040 | return QDF_STATUS_SUCCESS; |
| 8041 | } |
| 8042 | |
| 8043 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8044 | * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats |
| 8045 | * @wmi_handle: wmi handle |
| 8046 | * @rssi_req: get RSSI request |
| 8047 | * |
| 8048 | * Return: CDF status |
| 8049 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8050 | 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] | 8051 | { |
| 8052 | wmi_buf_t buf; |
| 8053 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8054 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 8055 | |
| 8056 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8057 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8058 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8059 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8060 | } |
| 8061 | |
| 8062 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 8063 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8064 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8065 | WMITLV_GET_STRUCT_TLVLEN |
| 8066 | (wmi_request_stats_cmd_fixed_param)); |
| 8067 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 8068 | if (wmi_unified_cmd_send |
| 8069 | (wmi_handle, buf, len, WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8070 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8071 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8072 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8073 | } |
| 8074 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8075 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8076 | } |
| 8077 | |
| 8078 | /** |
| 8079 | * send_snr_cmd_tlv() - get RSSI from fw |
| 8080 | * @wmi_handle: wmi handle |
| 8081 | * @vdev_id: vdev id |
| 8082 | * |
| 8083 | * Return: CDF status |
| 8084 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8085 | 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] | 8086 | { |
| 8087 | wmi_buf_t buf; |
| 8088 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8089 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 8090 | |
| 8091 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8092 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8093 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8094 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8095 | } |
| 8096 | |
| 8097 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 8098 | cmd->vdev_id = vdev_id; |
| 8099 | |
| 8100 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8101 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8102 | WMITLV_GET_STRUCT_TLVLEN |
| 8103 | (wmi_request_stats_cmd_fixed_param)); |
| 8104 | cmd->stats_id = WMI_REQUEST_VDEV_STAT; |
| 8105 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8106 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8107 | WMI_LOGE("Failed to send host stats request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8108 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8109 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8110 | } |
| 8111 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8112 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8113 | } |
| 8114 | |
| 8115 | /** |
| 8116 | * send_link_status_req_cmd_tlv() - process link status request from UMAC |
| 8117 | * @wmi_handle: wmi handle |
| 8118 | * @link_status: get link params |
| 8119 | * |
| 8120 | * Return: CDF status |
| 8121 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8122 | 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] | 8123 | struct link_status_params *link_status) |
| 8124 | { |
| 8125 | wmi_buf_t buf; |
| 8126 | wmi_request_stats_cmd_fixed_param *cmd; |
| 8127 | uint8_t len = sizeof(wmi_request_stats_cmd_fixed_param); |
| 8128 | |
| 8129 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8130 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8131 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8132 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8133 | } |
| 8134 | |
| 8135 | cmd = (wmi_request_stats_cmd_fixed_param *) wmi_buf_data(buf); |
| 8136 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8137 | WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, |
| 8138 | WMITLV_GET_STRUCT_TLVLEN |
| 8139 | (wmi_request_stats_cmd_fixed_param)); |
| 8140 | cmd->stats_id = WMI_REQUEST_VDEV_RATE_STAT; |
| 8141 | cmd->vdev_id = link_status->session_id; |
| 8142 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8143 | WMI_REQUEST_STATS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8144 | WMI_LOGE("Failed to send WMI link status request to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8145 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8146 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8147 | } |
| 8148 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8149 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8150 | } |
| 8151 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8152 | /** |
| 8153 | * send_process_dhcp_ind_cmd_tlv() - process dhcp indication from SME |
| 8154 | * @wmi_handle: wmi handle |
| 8155 | * @ta_dhcp_ind: DHCP indication parameter |
| 8156 | * |
| 8157 | * Return: CDF Status |
| 8158 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8159 | 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] | 8160 | wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind) |
| 8161 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8162 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8163 | wmi_buf_t buf = NULL; |
| 8164 | uint8_t *buf_ptr; |
| 8165 | wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp; |
| 8166 | int len = sizeof(wmi_peer_set_param_cmd_fixed_param); |
| 8167 | |
| 8168 | |
| 8169 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8170 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8171 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 8172 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8173 | } |
| 8174 | |
| 8175 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 8176 | peer_set_param_fp = (wmi_peer_set_param_cmd_fixed_param *) buf_ptr; |
| 8177 | WMITLV_SET_HDR(&peer_set_param_fp->tlv_header, |
| 8178 | WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param, |
| 8179 | WMITLV_GET_STRUCT_TLVLEN |
| 8180 | (wmi_peer_set_param_cmd_fixed_param)); |
| 8181 | |
| 8182 | /* fill in values */ |
| 8183 | peer_set_param_fp->vdev_id = ta_dhcp_ind->vdev_id; |
| 8184 | peer_set_param_fp->param_id = ta_dhcp_ind->param_id; |
| 8185 | peer_set_param_fp->param_value = ta_dhcp_ind->param_value; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8186 | qdf_mem_copy(&peer_set_param_fp->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8187 | &ta_dhcp_ind->peer_macaddr, |
| 8188 | sizeof(ta_dhcp_ind->peer_macaddr)); |
| 8189 | |
| 8190 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 8191 | len, WMI_PEER_SET_PARAM_CMDID); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 8192 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8193 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8194 | " returned Error %d", __func__, status); |
Govind Singh | 2d8a88c | 2016-08-08 19:07:00 +0530 | [diff] [blame] | 8195 | wmi_buf_free(buf); |
| 8196 | } |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8197 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8198 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8199 | } |
| 8200 | |
| 8201 | /** |
| 8202 | * send_get_link_speed_cmd_tlv() -send command to get linkspeed |
| 8203 | * @wmi_handle: wmi handle |
| 8204 | * @pLinkSpeed: link speed info |
| 8205 | * |
| 8206 | * Return: CDF status |
| 8207 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8208 | 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] | 8209 | wmi_mac_addr peer_macaddr) |
| 8210 | { |
| 8211 | wmi_peer_get_estimated_linkspeed_cmd_fixed_param *cmd; |
| 8212 | wmi_buf_t wmi_buf; |
| 8213 | uint32_t len; |
| 8214 | uint8_t *buf_ptr; |
| 8215 | |
| 8216 | len = sizeof(wmi_peer_get_estimated_linkspeed_cmd_fixed_param); |
| 8217 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 8218 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8219 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 8220 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8221 | } |
| 8222 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 8223 | |
| 8224 | cmd = (wmi_peer_get_estimated_linkspeed_cmd_fixed_param *) buf_ptr; |
| 8225 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8226 | WMITLV_TAG_STRUC_wmi_peer_get_estimated_linkspeed_cmd_fixed_param, |
| 8227 | WMITLV_GET_STRUCT_TLVLEN |
| 8228 | (wmi_peer_get_estimated_linkspeed_cmd_fixed_param)); |
| 8229 | |
| 8230 | /* Copy the peer macaddress to the wma buffer */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8231 | qdf_mem_copy(&cmd->peer_macaddr, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8232 | &peer_macaddr, |
| 8233 | sizeof(peer_macaddr)); |
| 8234 | |
| 8235 | |
| 8236 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 8237 | WMI_PEER_GET_ESTIMATED_LINKSPEED_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8238 | WMI_LOGE("%s: failed to send link speed command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8239 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8240 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8241 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8242 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8243 | } |
| 8244 | |
| 8245 | /** |
| 8246 | * send_egap_conf_params_cmd_tlv() - send wmi cmd of egap configuration params |
| 8247 | * @wmi_handle: wmi handler |
| 8248 | * @egap_params: pointer to egap_params |
| 8249 | * |
| 8250 | * Return: 0 for success, otherwise appropriate error code |
| 8251 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8252 | 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] | 8253 | wmi_ap_ps_egap_param_cmd_fixed_param *egap_params) |
| 8254 | { |
| 8255 | wmi_ap_ps_egap_param_cmd_fixed_param *cmd; |
| 8256 | wmi_buf_t buf; |
| 8257 | int32_t err; |
| 8258 | |
| 8259 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 8260 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8261 | WMI_LOGE("Failed to allocate buffer to send ap_ps_egap cmd"); |
| 8262 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8263 | } |
| 8264 | cmd = (wmi_ap_ps_egap_param_cmd_fixed_param *) wmi_buf_data(buf); |
| 8265 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8266 | WMITLV_TAG_STRUC_wmi_ap_ps_egap_param_cmd_fixed_param, |
| 8267 | WMITLV_GET_STRUCT_TLVLEN( |
| 8268 | wmi_ap_ps_egap_param_cmd_fixed_param)); |
| 8269 | |
| 8270 | cmd->enable = egap_params->enable; |
| 8271 | cmd->inactivity_time = egap_params->inactivity_time; |
| 8272 | cmd->wait_time = egap_params->wait_time; |
| 8273 | cmd->flags = egap_params->flags; |
| 8274 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 8275 | sizeof(*cmd), WMI_AP_PS_EGAP_PARAM_CMDID); |
| 8276 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8277 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8278 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8279 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8280 | } |
| 8281 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8282 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8283 | } |
| 8284 | |
| 8285 | /** |
| 8286 | * send_fw_profiling_cmd_tlv() - send FW profiling cmd to WLAN FW |
| 8287 | * @wmi_handl: wmi handle |
| 8288 | * @cmd: Profiling command index |
| 8289 | * @value1: parameter1 value |
| 8290 | * @value2: parameter2 value |
| 8291 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8292 | * Return: QDF_STATUS_SUCCESS for success else error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8293 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8294 | 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] | 8295 | uint32_t cmd, uint32_t value1, uint32_t value2) |
| 8296 | { |
| 8297 | wmi_buf_t buf; |
| 8298 | int32_t len = 0; |
| 8299 | int ret; |
| 8300 | wmi_wlan_profile_trigger_cmd_fixed_param *prof_trig_cmd; |
| 8301 | wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *hist_intvl_cmd; |
| 8302 | wmi_wlan_profile_enable_profile_id_cmd_fixed_param *profile_enable_cmd; |
| 8303 | wmi_wlan_profile_get_prof_data_cmd_fixed_param *profile_getdata_cmd; |
| 8304 | |
| 8305 | switch (cmd) { |
| 8306 | case WMI_WLAN_PROFILE_TRIGGER_CMDID: |
| 8307 | len = sizeof(wmi_wlan_profile_trigger_cmd_fixed_param); |
| 8308 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8309 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8310 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8311 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8312 | } |
| 8313 | prof_trig_cmd = |
| 8314 | (wmi_wlan_profile_trigger_cmd_fixed_param *) |
| 8315 | wmi_buf_data(buf); |
| 8316 | WMITLV_SET_HDR(&prof_trig_cmd->tlv_header, |
| 8317 | WMITLV_TAG_STRUC_wmi_wlan_profile_trigger_cmd_fixed_param, |
| 8318 | WMITLV_GET_STRUCT_TLVLEN |
| 8319 | (wmi_wlan_profile_trigger_cmd_fixed_param)); |
| 8320 | prof_trig_cmd->enable = value1; |
| 8321 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8322 | WMI_WLAN_PROFILE_TRIGGER_CMDID); |
| 8323 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8324 | WMI_LOGE("PROFILE_TRIGGER cmd Failed with value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8325 | value1); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8326 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8327 | return ret; |
| 8328 | } |
| 8329 | break; |
| 8330 | |
| 8331 | case WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID: |
| 8332 | len = sizeof(wmi_wlan_profile_get_prof_data_cmd_fixed_param); |
| 8333 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8334 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8335 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8336 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8337 | } |
| 8338 | profile_getdata_cmd = |
| 8339 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param *) |
| 8340 | wmi_buf_data(buf); |
| 8341 | WMITLV_SET_HDR(&profile_getdata_cmd->tlv_header, |
| 8342 | WMITLV_TAG_STRUC_wmi_wlan_profile_get_prof_data_cmd_fixed_param, |
| 8343 | WMITLV_GET_STRUCT_TLVLEN |
| 8344 | (wmi_wlan_profile_get_prof_data_cmd_fixed_param)); |
| 8345 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8346 | WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID); |
| 8347 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8348 | WMI_LOGE("PROFILE_DATA cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8349 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8350 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8351 | return ret; |
| 8352 | } |
| 8353 | break; |
| 8354 | |
| 8355 | case WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID: |
| 8356 | len = sizeof(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param); |
| 8357 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8358 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8359 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8360 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8361 | } |
| 8362 | hist_intvl_cmd = |
| 8363 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *) |
| 8364 | wmi_buf_data(buf); |
| 8365 | WMITLV_SET_HDR(&hist_intvl_cmd->tlv_header, |
| 8366 | WMITLV_TAG_STRUC_wmi_wlan_profile_set_hist_intvl_cmd_fixed_param, |
| 8367 | WMITLV_GET_STRUCT_TLVLEN |
| 8368 | (wmi_wlan_profile_set_hist_intvl_cmd_fixed_param)); |
| 8369 | hist_intvl_cmd->profile_id = value1; |
| 8370 | hist_intvl_cmd->value = value2; |
| 8371 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8372 | WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID); |
| 8373 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8374 | WMI_LOGE("HIST_INTVL cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8375 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8376 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8377 | return ret; |
| 8378 | } |
| 8379 | break; |
| 8380 | |
| 8381 | case WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID: |
| 8382 | len = |
| 8383 | sizeof(wmi_wlan_profile_enable_profile_id_cmd_fixed_param); |
| 8384 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8385 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8386 | WMI_LOGP("%s: wmi_buf_alloc Failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8387 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8388 | } |
| 8389 | profile_enable_cmd = |
| 8390 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param *) |
| 8391 | wmi_buf_data(buf); |
| 8392 | WMITLV_SET_HDR(&profile_enable_cmd->tlv_header, |
| 8393 | WMITLV_TAG_STRUC_wmi_wlan_profile_enable_profile_id_cmd_fixed_param, |
| 8394 | WMITLV_GET_STRUCT_TLVLEN |
| 8395 | (wmi_wlan_profile_enable_profile_id_cmd_fixed_param)); |
| 8396 | profile_enable_cmd->profile_id = value1; |
| 8397 | profile_enable_cmd->enable = value2; |
| 8398 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8399 | WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID); |
| 8400 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8401 | WMI_LOGE("enable cmd Failed for id %d value %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8402 | value1, value2); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8403 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8404 | return ret; |
| 8405 | } |
| 8406 | break; |
| 8407 | |
| 8408 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8409 | WMI_LOGD("%s: invalid profiling command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8410 | break; |
| 8411 | } |
| 8412 | |
| 8413 | return 0; |
| 8414 | } |
| 8415 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8416 | /** |
| 8417 | * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter |
| 8418 | * @wmi_handle: wmi handle |
| 8419 | * @vdev_id: vdev id |
| 8420 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8421 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8422 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8423 | 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] | 8424 | { |
| 8425 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *cmd; |
| 8426 | wmi_buf_t buf; |
| 8427 | int32_t len = sizeof(*cmd); |
| 8428 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8429 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 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 | cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *) |
| 8436 | wmi_buf_data(buf); |
| 8437 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8438 | WMITLV_TAG_STRUC_WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param, |
| 8439 | WMITLV_GET_STRUCT_TLVLEN |
| 8440 | (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param)); |
| 8441 | cmd->vdev_id = vdev_id; |
| 8442 | cmd->action = IPSEC_NATKEEPALIVE_FILTER_ENABLE; |
| 8443 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8444 | WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8445 | WMI_LOGP("%s: Failed to send NAT keepalive enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8446 | __func__); |
| 8447 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8448 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8449 | } |
| 8450 | |
| 8451 | return 0; |
| 8452 | } |
| 8453 | |
| 8454 | /** |
| 8455 | * wmi_unified_csa_offload_enable() - sen CSA offload enable command |
| 8456 | * @wmi_handle: wmi handle |
| 8457 | * @vdev_id: vdev id |
| 8458 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 8459 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8460 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8461 | 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] | 8462 | uint8_t vdev_id) |
| 8463 | { |
| 8464 | wmi_csa_offload_enable_cmd_fixed_param *cmd; |
| 8465 | wmi_buf_t buf; |
| 8466 | int32_t len = sizeof(*cmd); |
| 8467 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8468 | WMI_LOGD("%s: vdev_id %d", __func__, vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8469 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8470 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8471 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8472 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8473 | } |
| 8474 | cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 8475 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8476 | WMITLV_TAG_STRUC_wmi_csa_offload_enable_cmd_fixed_param, |
| 8477 | WMITLV_GET_STRUCT_TLVLEN |
| 8478 | (wmi_csa_offload_enable_cmd_fixed_param)); |
| 8479 | cmd->vdev_id = vdev_id; |
| 8480 | cmd->csa_offload_enable = WMI_CSA_OFFLOAD_ENABLE; |
| 8481 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8482 | WMI_CSA_OFFLOAD_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8483 | WMI_LOGP("%s: Failed to send CSA offload enable command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8484 | __func__); |
| 8485 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8486 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8487 | } |
| 8488 | |
| 8489 | return 0; |
| 8490 | } |
| 8491 | |
Naveen Rawat | 42cd1e6 | 2017-05-13 15:56:57 -0700 | [diff] [blame] | 8492 | #ifdef WLAN_FEATURE_CIF_CFR |
| 8493 | /** |
| 8494 | * send_oem_dma_cfg_cmd_tlv() - configure OEM DMA rings |
| 8495 | * @wmi_handle: wmi handle |
| 8496 | * @data_len: len of dma cfg req |
| 8497 | * @data: dma cfg req |
| 8498 | * |
| 8499 | * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure |
| 8500 | */ |
| 8501 | static QDF_STATUS send_oem_dma_cfg_cmd_tlv(wmi_unified_t wmi_handle, |
| 8502 | wmi_oem_dma_ring_cfg_req_fixed_param *cfg) |
| 8503 | { |
| 8504 | wmi_buf_t buf; |
| 8505 | uint8_t *cmd; |
| 8506 | QDF_STATUS ret; |
| 8507 | |
| 8508 | WMITLV_SET_HDR(cfg, |
| 8509 | WMITLV_TAG_STRUC_wmi_oem_dma_ring_cfg_req_fixed_param, |
| 8510 | (sizeof(*cfg) - WMI_TLV_HDR_SIZE)); |
| 8511 | |
| 8512 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cfg)); |
| 8513 | if (!buf) { |
| 8514 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 8515 | return QDF_STATUS_E_FAILURE; |
| 8516 | } |
| 8517 | |
| 8518 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 8519 | qdf_mem_copy(cmd, cfg, sizeof(*cfg)); |
| 8520 | WMI_LOGI(FL("Sending OEM Data Request to target, data len %lu"), |
| 8521 | sizeof(*cfg)); |
| 8522 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cfg), |
| 8523 | WMI_OEM_DMA_RING_CFG_REQ_CMDID); |
| 8524 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 8525 | WMI_LOGE(FL(":wmi cmd send failed")); |
| 8526 | wmi_buf_free(buf); |
| 8527 | } |
| 8528 | |
| 8529 | return ret; |
| 8530 | } |
| 8531 | #endif |
| 8532 | |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8533 | /** |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 8534 | * send_start_11d_scan_cmd_tlv() - start 11d scan request |
| 8535 | * @wmi_handle: wmi handle |
| 8536 | * @start_11d_scan: 11d scan start request parameters |
| 8537 | * |
| 8538 | * This function request FW to start 11d scan. |
| 8539 | * |
| 8540 | * Return: QDF status |
| 8541 | */ |
| 8542 | static QDF_STATUS send_start_11d_scan_cmd_tlv(wmi_unified_t wmi_handle, |
| 8543 | struct reg_start_11d_scan_req *start_11d_scan) |
| 8544 | { |
| 8545 | wmi_11d_scan_start_cmd_fixed_param *cmd; |
| 8546 | int32_t len; |
| 8547 | wmi_buf_t buf; |
| 8548 | int ret; |
| 8549 | |
| 8550 | len = sizeof(*cmd); |
| 8551 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8552 | if (!buf) { |
| 8553 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8554 | return QDF_STATUS_E_NOMEM; |
| 8555 | } |
| 8556 | |
| 8557 | cmd = (wmi_11d_scan_start_cmd_fixed_param *)wmi_buf_data(buf); |
| 8558 | |
| 8559 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8560 | WMITLV_TAG_STRUC_wmi_11d_scan_start_cmd_fixed_param, |
| 8561 | WMITLV_GET_STRUCT_TLVLEN |
| 8562 | (wmi_11d_scan_start_cmd_fixed_param)); |
| 8563 | |
| 8564 | cmd->vdev_id = start_11d_scan->vdev_id; |
| 8565 | cmd->scan_period_msec = start_11d_scan->scan_period_msec; |
| 8566 | cmd->start_interval_msec = start_11d_scan->start_interval_msec; |
| 8567 | |
| 8568 | WMI_LOGD("vdev %d sending 11D scan start req", cmd->vdev_id); |
| 8569 | |
| 8570 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8571 | WMI_11D_SCAN_START_CMDID); |
| 8572 | if (ret) { |
| 8573 | WMI_LOGE("%s: Failed to send start 11d scan wmi cmd", __func__); |
| 8574 | wmi_buf_free(buf); |
| 8575 | return QDF_STATUS_E_FAILURE; |
| 8576 | } |
| 8577 | |
| 8578 | return QDF_STATUS_SUCCESS; |
| 8579 | } |
| 8580 | |
| 8581 | /** |
| 8582 | * send_stop_11d_scan_cmd_tlv() - stop 11d scan request |
| 8583 | * @wmi_handle: wmi handle |
| 8584 | * @start_11d_scan: 11d scan stop request parameters |
| 8585 | * |
| 8586 | * This function request FW to stop 11d scan. |
| 8587 | * |
| 8588 | * Return: QDF status |
| 8589 | */ |
| 8590 | static QDF_STATUS send_stop_11d_scan_cmd_tlv(wmi_unified_t wmi_handle, |
| 8591 | struct reg_stop_11d_scan_req *stop_11d_scan) |
| 8592 | { |
| 8593 | wmi_11d_scan_stop_cmd_fixed_param *cmd; |
| 8594 | int32_t len; |
| 8595 | wmi_buf_t buf; |
| 8596 | int ret; |
| 8597 | |
| 8598 | len = sizeof(*cmd); |
| 8599 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8600 | if (!buf) { |
| 8601 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8602 | return QDF_STATUS_E_NOMEM; |
| 8603 | } |
| 8604 | |
| 8605 | cmd = (wmi_11d_scan_stop_cmd_fixed_param *)wmi_buf_data(buf); |
| 8606 | |
| 8607 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8608 | WMITLV_TAG_STRUC_wmi_11d_scan_stop_cmd_fixed_param, |
| 8609 | WMITLV_GET_STRUCT_TLVLEN |
| 8610 | (wmi_11d_scan_stop_cmd_fixed_param)); |
| 8611 | |
| 8612 | cmd->vdev_id = stop_11d_scan->vdev_id; |
| 8613 | |
| 8614 | WMI_LOGD("vdev %d sending 11D scan stop req", cmd->vdev_id); |
| 8615 | |
| 8616 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8617 | WMI_11D_SCAN_STOP_CMDID); |
| 8618 | if (ret) { |
| 8619 | WMI_LOGE("%s: Failed to send stop 11d scan wmi cmd", __func__); |
| 8620 | wmi_buf_free(buf); |
| 8621 | return QDF_STATUS_E_FAILURE; |
| 8622 | } |
| 8623 | |
| 8624 | return QDF_STATUS_SUCCESS; |
| 8625 | } |
| 8626 | |
| 8627 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8628 | * send_start_oem_data_cmd_tlv() - start OEM data request to target |
| 8629 | * @wmi_handle: wmi handle |
| 8630 | * @startOemDataReq: start request params |
| 8631 | * |
| 8632 | * Return: CDF status |
| 8633 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8634 | 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] | 8635 | uint32_t data_len, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8636 | uint8_t *data) |
| 8637 | { |
| 8638 | wmi_buf_t buf; |
| 8639 | uint8_t *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8640 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8641 | |
| 8642 | buf = wmi_buf_alloc(wmi_handle, |
| 8643 | (data_len + WMI_TLV_HDR_SIZE)); |
| 8644 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8645 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 8646 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8647 | } |
| 8648 | |
| 8649 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 8650 | |
| 8651 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, data_len); |
| 8652 | cmd += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8653 | qdf_mem_copy(cmd, data, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8654 | data_len); |
| 8655 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 8656 | WMI_LOGD(FL("Sending OEM Data Request to target, data len %d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8657 | data_len); |
| 8658 | |
| 8659 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 8660 | (data_len + |
| 8661 | WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID); |
| 8662 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8663 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8664 | WMI_LOGE(FL(":wmi cmd send failed")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8665 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8666 | } |
| 8667 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8668 | return ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8669 | } |
| 8670 | |
| 8671 | /** |
| 8672 | * send_dfs_phyerr_filter_offload_en_cmd_tlv() - enable dfs phyerr filter |
| 8673 | * @wmi_handle: wmi handle |
| 8674 | * @dfs_phyerr_filter_offload: is dfs phyerr filter offload |
| 8675 | * |
| 8676 | * Send WMI_DFS_PHYERR_FILTER_ENA_CMDID or |
| 8677 | * WMI_DFS_PHYERR_FILTER_DIS_CMDID command |
| 8678 | * to firmware based on phyerr filtering |
| 8679 | * offload status. |
| 8680 | * |
| 8681 | * Return: 1 success, 0 failure |
| 8682 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8683 | static QDF_STATUS |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8684 | send_dfs_phyerr_filter_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 8685 | bool dfs_phyerr_filter_offload) |
| 8686 | { |
| 8687 | wmi_dfs_phyerr_filter_ena_cmd_fixed_param *enable_phyerr_offload_cmd; |
| 8688 | wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd; |
| 8689 | wmi_buf_t buf; |
| 8690 | uint16_t len; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8691 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8692 | |
| 8693 | |
Arif Hussain | 4ab1c4c | 2016-06-30 15:57:49 -0700 | [diff] [blame] | 8694 | if (false == dfs_phyerr_filter_offload) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8695 | WMI_LOGD("%s:Phyerror Filtering offload is Disabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8696 | __func__); |
| 8697 | len = sizeof(*disable_phyerr_offload_cmd); |
| 8698 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8699 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8700 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8701 | return 0; |
| 8702 | } |
| 8703 | disable_phyerr_offload_cmd = |
| 8704 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param *) |
| 8705 | wmi_buf_data(buf); |
| 8706 | |
| 8707 | WMITLV_SET_HDR(&disable_phyerr_offload_cmd->tlv_header, |
| 8708 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_dis_cmd_fixed_param, |
| 8709 | WMITLV_GET_STRUCT_TLVLEN |
| 8710 | (wmi_dfs_phyerr_filter_dis_cmd_fixed_param)); |
| 8711 | |
| 8712 | /* |
| 8713 | * Send WMI_DFS_PHYERR_FILTER_DIS_CMDID |
| 8714 | * to the firmware to disable the phyerror |
| 8715 | * filtering offload. |
| 8716 | */ |
| 8717 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8718 | WMI_DFS_PHYERR_FILTER_DIS_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8719 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8720 | 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] | 8721 | __func__, ret); |
| 8722 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8723 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8724 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8725 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_DIS_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8726 | __func__); |
| 8727 | } else { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8728 | WMI_LOGD("%s:Phyerror Filtering offload is Enabled in ini", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8729 | __func__); |
| 8730 | |
| 8731 | len = sizeof(*enable_phyerr_offload_cmd); |
| 8732 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8733 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8734 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8735 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8736 | } |
| 8737 | |
| 8738 | enable_phyerr_offload_cmd = |
| 8739 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param *) |
| 8740 | wmi_buf_data(buf); |
| 8741 | |
| 8742 | WMITLV_SET_HDR(&enable_phyerr_offload_cmd->tlv_header, |
| 8743 | WMITLV_TAG_STRUC_wmi_dfs_phyerr_filter_ena_cmd_fixed_param, |
| 8744 | WMITLV_GET_STRUCT_TLVLEN |
| 8745 | (wmi_dfs_phyerr_filter_ena_cmd_fixed_param)); |
| 8746 | |
| 8747 | /* |
| 8748 | * Send a WMI_DFS_PHYERR_FILTER_ENA_CMDID |
| 8749 | * to the firmware to enable the phyerror |
| 8750 | * filtering offload. |
| 8751 | */ |
| 8752 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8753 | WMI_DFS_PHYERR_FILTER_ENA_CMDID); |
| 8754 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 8755 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8756 | WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8757 | __func__, ret); |
| 8758 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8759 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8760 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8761 | WMI_LOGD("%s: WMI_DFS_PHYERR_FILTER_ENA_CMDID Send Success", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8762 | __func__); |
| 8763 | } |
| 8764 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8765 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8766 | } |
| 8767 | |
| 8768 | #if !defined(REMOVE_PKT_LOG) |
| 8769 | /** |
| 8770 | * send_pktlog_wmi_send_cmd_tlv() - send pktlog enable/disable command to target |
| 8771 | * @wmi_handle: wmi handle |
| 8772 | * @pktlog_event: pktlog event |
| 8773 | * @cmd_id: pktlog cmd id |
| 8774 | * |
| 8775 | * Return: CDF status |
| 8776 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8777 | 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] | 8778 | WMI_PKTLOG_EVENT pktlog_event, |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 8779 | WMI_CMD_ID cmd_id, uint8_t user_triggered) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8780 | { |
| 8781 | WMI_PKTLOG_EVENT PKTLOG_EVENT; |
| 8782 | WMI_CMD_ID CMD_ID; |
| 8783 | wmi_pdev_pktlog_enable_cmd_fixed_param *cmd; |
| 8784 | wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd; |
| 8785 | int len = 0; |
| 8786 | wmi_buf_t buf; |
| 8787 | |
| 8788 | PKTLOG_EVENT = pktlog_event; |
| 8789 | CMD_ID = cmd_id; |
| 8790 | |
| 8791 | switch (CMD_ID) { |
| 8792 | case WMI_PDEV_PKTLOG_ENABLE_CMDID: |
| 8793 | len = sizeof(*cmd); |
| 8794 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8795 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8796 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8797 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8798 | } |
| 8799 | cmd = (wmi_pdev_pktlog_enable_cmd_fixed_param *) |
| 8800 | wmi_buf_data(buf); |
| 8801 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8802 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param, |
| 8803 | WMITLV_GET_STRUCT_TLVLEN |
| 8804 | (wmi_pdev_pktlog_enable_cmd_fixed_param)); |
| 8805 | cmd->evlist = PKTLOG_EVENT; |
Nirav Shah | 47ec248 | 2016-07-27 19:06:13 +0530 | [diff] [blame] | 8806 | cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE |
| 8807 | : WMI_PKTLOG_ENABLE_AUTO; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 8808 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 8809 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8810 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8811 | WMI_PDEV_PKTLOG_ENABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8812 | WMI_LOGE("failed to send pktlog enable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8813 | goto wmi_send_failed; |
| 8814 | } |
| 8815 | break; |
| 8816 | case WMI_PDEV_PKTLOG_DISABLE_CMDID: |
| 8817 | len = sizeof(*disable_cmd); |
| 8818 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8819 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8820 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 8821 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8822 | } |
| 8823 | disable_cmd = (wmi_pdev_pktlog_disable_cmd_fixed_param *) |
| 8824 | wmi_buf_data(buf); |
| 8825 | WMITLV_SET_HDR(&disable_cmd->tlv_header, |
| 8826 | WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param, |
| 8827 | WMITLV_GET_STRUCT_TLVLEN |
| 8828 | (wmi_pdev_pktlog_disable_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 8829 | disable_cmd->pdev_id = |
| 8830 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 8831 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8832 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8833 | WMI_PDEV_PKTLOG_DISABLE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8834 | WMI_LOGE("failed to send pktlog disable cmdid"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8835 | goto wmi_send_failed; |
| 8836 | } |
| 8837 | break; |
| 8838 | default: |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8839 | WMI_LOGD("%s: invalid PKTLOG command", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8840 | break; |
| 8841 | } |
| 8842 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8843 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8844 | |
| 8845 | wmi_send_failed: |
| 8846 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8847 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8848 | } |
| 8849 | #endif /* REMOVE_PKT_LOG */ |
| 8850 | |
| 8851 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8852 | * send_wow_delete_pattern_cmd_tlv() - delete wow pattern in target |
| 8853 | * @wmi_handle: wmi handle |
| 8854 | * @ptrn_id: pattern id |
| 8855 | * @vdev_id: vdev id |
| 8856 | * |
| 8857 | * Return: CDF status |
| 8858 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 8859 | static QDF_STATUS send_wow_delete_pattern_cmd_tlv(wmi_unified_t wmi_handle, |
| 8860 | uint8_t ptrn_id, uint8_t vdev_id) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8861 | { |
| 8862 | WMI_WOW_DEL_PATTERN_CMD_fixed_param *cmd; |
| 8863 | wmi_buf_t buf; |
| 8864 | int32_t len; |
| 8865 | int ret; |
| 8866 | |
| 8867 | len = sizeof(WMI_WOW_DEL_PATTERN_CMD_fixed_param); |
| 8868 | |
| 8869 | |
| 8870 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8871 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8872 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8873 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8874 | } |
| 8875 | |
| 8876 | cmd = (WMI_WOW_DEL_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 8877 | |
| 8878 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8879 | WMITLV_TAG_STRUC_WMI_WOW_DEL_PATTERN_CMD_fixed_param, |
| 8880 | WMITLV_GET_STRUCT_TLVLEN( |
| 8881 | WMI_WOW_DEL_PATTERN_CMD_fixed_param)); |
| 8882 | cmd->vdev_id = vdev_id; |
| 8883 | cmd->pattern_id = ptrn_id; |
| 8884 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 8885 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8886 | WMI_LOGI("Deleting pattern id: %d vdev id %d in fw", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8887 | cmd->pattern_id, vdev_id); |
| 8888 | |
| 8889 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8890 | WMI_WOW_DEL_WAKE_PATTERN_CMDID); |
| 8891 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8892 | WMI_LOGE("%s: Failed to delete wow ptrn from fw", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8893 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8894 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8895 | } |
| 8896 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8897 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8898 | } |
| 8899 | |
| 8900 | /** |
| 8901 | * send_host_wakeup_ind_to_fw_cmd_tlv() - send wakeup ind to fw |
| 8902 | * @wmi_handle: wmi handle |
| 8903 | * |
| 8904 | * Sends host wakeup indication to FW. On receiving this indication, |
| 8905 | * FW will come out of WOW. |
| 8906 | * |
| 8907 | * Return: CDF status |
| 8908 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8909 | 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] | 8910 | { |
| 8911 | wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *cmd; |
| 8912 | wmi_buf_t buf; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8913 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8914 | int32_t len; |
| 8915 | int ret; |
| 8916 | |
| 8917 | len = sizeof(wmi_wow_hostwakeup_from_sleep_cmd_fixed_param); |
| 8918 | |
| 8919 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8920 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8921 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 8922 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8923 | } |
| 8924 | |
| 8925 | cmd = (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param *) |
| 8926 | wmi_buf_data(buf); |
| 8927 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8928 | WMITLV_TAG_STRUC_wmi_wow_hostwakeup_from_sleep_cmd_fixed_param, |
| 8929 | WMITLV_GET_STRUCT_TLVLEN |
| 8930 | (wmi_wow_hostwakeup_from_sleep_cmd_fixed_param)); |
| 8931 | |
| 8932 | |
| 8933 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8934 | WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID); |
| 8935 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8936 | WMI_LOGE("Failed to send host wakeup indication to fw"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8937 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8938 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8939 | } |
| 8940 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8941 | return qdf_status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8942 | } |
| 8943 | |
| 8944 | /** |
| 8945 | * send_del_ts_cmd_tlv() - send DELTS request to fw |
| 8946 | * @wmi_handle: wmi handle |
| 8947 | * @msg: delts params |
| 8948 | * |
| 8949 | * Return: CDF status |
| 8950 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8951 | 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] | 8952 | uint8_t ac) |
| 8953 | { |
| 8954 | wmi_vdev_wmm_delts_cmd_fixed_param *cmd; |
| 8955 | wmi_buf_t buf; |
| 8956 | int32_t len = sizeof(*cmd); |
| 8957 | |
| 8958 | buf = wmi_buf_alloc(wmi_handle, len); |
| 8959 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8960 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 8961 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8962 | } |
| 8963 | cmd = (wmi_vdev_wmm_delts_cmd_fixed_param *) wmi_buf_data(buf); |
| 8964 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 8965 | WMITLV_TAG_STRUC_wmi_vdev_wmm_delts_cmd_fixed_param, |
| 8966 | WMITLV_GET_STRUCT_TLVLEN |
| 8967 | (wmi_vdev_wmm_delts_cmd_fixed_param)); |
| 8968 | cmd->vdev_id = vdev_id; |
| 8969 | cmd->ac = ac; |
| 8970 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8971 | WMI_LOGD("Delts vdev:%d, ac:%d, %s:%d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8972 | cmd->vdev_id, cmd->ac, __func__, __LINE__); |
| 8973 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 8974 | WMI_VDEV_WMM_DELTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8975 | WMI_LOGP("%s: Failed to send vdev DELTS command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 8976 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8977 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8978 | } |
| 8979 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8980 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8981 | } |
| 8982 | |
| 8983 | /** |
| 8984 | * send_aggr_qos_cmd_tlv() - send aggr qos request to fw |
| 8985 | * @wmi_handle: handle to wmi |
| 8986 | * @aggr_qos_rsp_msg - combined struct for all ADD_TS requests. |
| 8987 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 8988 | * A function to handle WMI_AGGR_QOS_REQ. This will send out |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 8989 | * ADD_TS requestes to firmware in loop for all the ACs with |
| 8990 | * active flow. |
| 8991 | * |
| 8992 | * Return: CDF status |
| 8993 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 8994 | 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] | 8995 | struct aggr_add_ts_param *aggr_qos_rsp_msg) |
| 8996 | { |
| 8997 | int i = 0; |
| 8998 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 8999 | wmi_buf_t buf; |
| 9000 | int32_t len = sizeof(*cmd); |
| 9001 | |
| 9002 | for (i = 0; i < WMI_QOS_NUM_AC_MAX; i++) { |
| 9003 | /* if flow in this AC is active */ |
| 9004 | if (((1 << i) & aggr_qos_rsp_msg->tspecIdx)) { |
| 9005 | /* |
| 9006 | * as per implementation of wma_add_ts_req() we |
| 9007 | * are not waiting any response from firmware so |
| 9008 | * apart from sending ADDTS to firmware just send |
| 9009 | * success to upper layers |
| 9010 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9011 | aggr_qos_rsp_msg->status[i] = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9012 | |
| 9013 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9014 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9015 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9016 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9017 | } |
| 9018 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) |
| 9019 | wmi_buf_data(buf); |
| 9020 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9021 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 9022 | WMITLV_GET_STRUCT_TLVLEN |
| 9023 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 9024 | cmd->vdev_id = aggr_qos_rsp_msg->sessionId; |
| 9025 | cmd->ac = |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 9026 | WMI_TID_TO_AC(aggr_qos_rsp_msg->tspec[i].tsinfo. |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9027 | traffic.userPrio); |
| 9028 | cmd->medium_time_us = |
| 9029 | aggr_qos_rsp_msg->tspec[i].mediumTime * 32; |
| 9030 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DEPRIO; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9031 | 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] | 9032 | __func__, __LINE__, cmd->vdev_id, cmd->ac, |
| 9033 | cmd->medium_time_us, cmd->downgrade_type); |
| 9034 | if (wmi_unified_cmd_send |
| 9035 | (wmi_handle, buf, len, |
| 9036 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9037 | WMI_LOGP("%s: Failed to send vdev ADDTS command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9038 | __func__); |
| 9039 | aggr_qos_rsp_msg->status[i] = |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9040 | QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9041 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9042 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9043 | } |
| 9044 | } |
| 9045 | } |
| 9046 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9047 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9048 | } |
| 9049 | |
| 9050 | /** |
| 9051 | * send_add_ts_cmd_tlv() - send ADDTS request to fw |
| 9052 | * @wmi_handle: wmi handle |
| 9053 | * @msg: ADDTS params |
| 9054 | * |
| 9055 | * Return: CDF status |
| 9056 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9057 | 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] | 9058 | struct add_ts_param *msg) |
| 9059 | { |
| 9060 | wmi_vdev_wmm_addts_cmd_fixed_param *cmd; |
| 9061 | wmi_buf_t buf; |
| 9062 | int32_t len = sizeof(*cmd); |
| 9063 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9064 | msg->status = QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9065 | |
| 9066 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9067 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9068 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9069 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9070 | } |
| 9071 | cmd = (wmi_vdev_wmm_addts_cmd_fixed_param *) wmi_buf_data(buf); |
| 9072 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9073 | WMITLV_TAG_STRUC_wmi_vdev_wmm_addts_cmd_fixed_param, |
| 9074 | WMITLV_GET_STRUCT_TLVLEN |
| 9075 | (wmi_vdev_wmm_addts_cmd_fixed_param)); |
| 9076 | cmd->vdev_id = msg->sme_session_id; |
| 9077 | cmd->ac = msg->tspec.tsinfo.traffic.userPrio; |
| 9078 | cmd->medium_time_us = msg->tspec.mediumTime * 32; |
| 9079 | cmd->downgrade_type = WMM_AC_DOWNGRADE_DROP; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9080 | 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] | 9081 | cmd->vdev_id, cmd->ac, cmd->medium_time_us, |
| 9082 | cmd->downgrade_type, __func__, __LINE__); |
| 9083 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9084 | WMI_VDEV_WMM_ADDTS_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9085 | WMI_LOGP("%s: Failed to send vdev ADDTS command", __func__); |
| 9086 | msg->status = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9087 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9088 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9089 | } |
| 9090 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9091 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9092 | } |
| 9093 | |
| 9094 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9095 | * send_process_add_periodic_tx_ptrn_cmd_tlv - add periodic tx ptrn |
| 9096 | * @wmi_handle: wmi handle |
| 9097 | * @pAddPeriodicTxPtrnParams: tx ptrn params |
| 9098 | * |
| 9099 | * Retrun: CDF status |
| 9100 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9101 | 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] | 9102 | struct periodic_tx_pattern * |
| 9103 | pAddPeriodicTxPtrnParams, |
| 9104 | uint8_t vdev_id) |
| 9105 | { |
| 9106 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 9107 | wmi_buf_t wmi_buf; |
| 9108 | uint32_t len; |
| 9109 | uint8_t *buf_ptr; |
| 9110 | uint32_t ptrn_len, ptrn_len_aligned; |
| 9111 | int j; |
| 9112 | |
| 9113 | ptrn_len = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 9114 | ptrn_len_aligned = roundup(ptrn_len, sizeof(uint32_t)); |
| 9115 | len = sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param) + |
| 9116 | WMI_TLV_HDR_SIZE + ptrn_len_aligned; |
| 9117 | |
| 9118 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9119 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9120 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9121 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9122 | } |
| 9123 | |
| 9124 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9125 | |
| 9126 | cmd = (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) buf_ptr; |
| 9127 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9128 | WMITLV_TAG_STRUC_WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 9129 | WMITLV_GET_STRUCT_TLVLEN |
| 9130 | (WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 9131 | |
| 9132 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 9133 | cmd->vdev_id = vdev_id; |
| 9134 | cmd->pattern_id = pAddPeriodicTxPtrnParams->ucPtrnId; |
| 9135 | cmd->timeout = pAddPeriodicTxPtrnParams->usPtrnIntervalMs; |
| 9136 | cmd->length = pAddPeriodicTxPtrnParams->ucPtrnSize; |
| 9137 | |
| 9138 | /* Pattern info */ |
| 9139 | buf_ptr += sizeof(WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 9140 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ptrn_len_aligned); |
| 9141 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9142 | qdf_mem_copy(buf_ptr, pAddPeriodicTxPtrnParams->ucPattern, ptrn_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9143 | for (j = 0; j < pAddPeriodicTxPtrnParams->ucPtrnSize; j++) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9144 | WMI_LOGD("%s: Add Ptrn: %02x", __func__, buf_ptr[j] & 0xff); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9145 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9146 | WMI_LOGD("%s: Add ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9147 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 9148 | |
| 9149 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9150 | WMI_ADD_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9151 | WMI_LOGE("%s: failed to add pattern set state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9152 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9153 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9154 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9155 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9156 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9157 | } |
| 9158 | |
| 9159 | /** |
| 9160 | * send_process_del_periodic_tx_ptrn_cmd_tlv - del periodic tx ptrn |
| 9161 | * @wmi_handle: wmi handle |
| 9162 | * @vdev_id: vdev id |
| 9163 | * @pattern_id: pattern id |
| 9164 | * |
| 9165 | * Retrun: CDF status |
| 9166 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9167 | 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] | 9168 | uint8_t vdev_id, |
| 9169 | uint8_t pattern_id) |
| 9170 | { |
| 9171 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *cmd; |
| 9172 | wmi_buf_t wmi_buf; |
| 9173 | uint32_t len = |
| 9174 | sizeof(WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param); |
| 9175 | |
| 9176 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9177 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9178 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9179 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9180 | } |
| 9181 | |
| 9182 | cmd = (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param *) |
| 9183 | wmi_buf_data(wmi_buf); |
| 9184 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9185 | WMITLV_TAG_STRUC_WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param, |
| 9186 | WMITLV_GET_STRUCT_TLVLEN |
| 9187 | (WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMD_fixed_param)); |
| 9188 | |
| 9189 | /* Pass the pattern id to delete for the corresponding vdev id */ |
| 9190 | cmd->vdev_id = vdev_id; |
| 9191 | cmd->pattern_id = pattern_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9192 | WMI_LOGD("%s: Del ptrn id: %d vdev_id: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9193 | __func__, cmd->pattern_id, cmd->vdev_id); |
| 9194 | |
| 9195 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9196 | WMI_DEL_PROACTIVE_ARP_RSP_PATTERN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9197 | WMI_LOGE("%s: failed to send del pattern command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9198 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9199 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9200 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9201 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9202 | } |
| 9203 | |
| 9204 | /** |
| 9205 | * send_stats_ext_req_cmd_tlv() - request ext stats from fw |
| 9206 | * @wmi_handle: wmi handle |
| 9207 | * @preq: stats ext params |
| 9208 | * |
| 9209 | * Return: CDF status |
| 9210 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9211 | 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] | 9212 | struct stats_ext_params *preq) |
| 9213 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9214 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9215 | wmi_req_stats_ext_cmd_fixed_param *cmd; |
| 9216 | wmi_buf_t buf; |
| 9217 | uint16_t len; |
| 9218 | uint8_t *buf_ptr; |
| 9219 | |
| 9220 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; |
| 9221 | |
| 9222 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9223 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9224 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9225 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9226 | } |
| 9227 | |
| 9228 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9229 | cmd = (wmi_req_stats_ext_cmd_fixed_param *) buf_ptr; |
| 9230 | |
| 9231 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9232 | WMITLV_TAG_STRUC_wmi_req_stats_ext_cmd_fixed_param, |
| 9233 | WMITLV_GET_STRUCT_TLVLEN |
| 9234 | (wmi_req_stats_ext_cmd_fixed_param)); |
| 9235 | cmd->vdev_id = preq->vdev_id; |
| 9236 | cmd->data_len = preq->request_data_len; |
| 9237 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9238 | 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] | 9239 | __func__, preq->request_data_len, preq->vdev_id); |
| 9240 | |
| 9241 | buf_ptr += sizeof(wmi_req_stats_ext_cmd_fixed_param); |
| 9242 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->data_len); |
| 9243 | |
| 9244 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9245 | qdf_mem_copy(buf_ptr, preq->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9246 | |
| 9247 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9248 | WMI_REQUEST_STATS_EXT_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9249 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9250 | WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9251 | ret); |
| 9252 | wmi_buf_free(buf); |
| 9253 | } |
| 9254 | |
| 9255 | return ret; |
| 9256 | } |
| 9257 | |
| 9258 | /** |
| 9259 | * send_enable_ext_wow_cmd_tlv() - enable ext wow in fw |
| 9260 | * @wmi_handle: wmi handle |
| 9261 | * @params: ext wow params |
| 9262 | * |
| 9263 | * Return:0 for success or error code |
| 9264 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9265 | 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] | 9266 | struct ext_wow_params *params) |
| 9267 | { |
| 9268 | wmi_extwow_enable_cmd_fixed_param *cmd; |
| 9269 | wmi_buf_t buf; |
| 9270 | int32_t len; |
| 9271 | int ret; |
| 9272 | |
| 9273 | len = sizeof(wmi_extwow_enable_cmd_fixed_param); |
| 9274 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9275 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9276 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9277 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9278 | } |
| 9279 | |
| 9280 | cmd = (wmi_extwow_enable_cmd_fixed_param *) wmi_buf_data(buf); |
| 9281 | |
| 9282 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9283 | WMITLV_TAG_STRUC_wmi_extwow_enable_cmd_fixed_param, |
| 9284 | WMITLV_GET_STRUCT_TLVLEN |
| 9285 | (wmi_extwow_enable_cmd_fixed_param)); |
| 9286 | |
| 9287 | cmd->vdev_id = params->vdev_id; |
| 9288 | cmd->type = params->type; |
| 9289 | cmd->wakeup_pin_num = params->wakeup_pin_num; |
| 9290 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9291 | WMI_LOGD("%s: vdev_id %d type %d Wakeup_pin_num %x", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9292 | __func__, cmd->vdev_id, cmd->type, cmd->wakeup_pin_num); |
| 9293 | |
| 9294 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9295 | WMI_EXTWOW_ENABLE_CMDID); |
| 9296 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9297 | WMI_LOGE("%s: Failed to set EXTWOW Enable", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9298 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9299 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9300 | } |
| 9301 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9302 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9303 | |
| 9304 | } |
| 9305 | |
| 9306 | /** |
| 9307 | * send_app_type1_params_in_fw_cmd_tlv() - set app type1 params in fw |
| 9308 | * @wmi_handle: wmi handle |
| 9309 | * @app_type1_params: app type1 params |
| 9310 | * |
| 9311 | * Return: CDF status |
| 9312 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9313 | 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] | 9314 | struct app_type1_params *app_type1_params) |
| 9315 | { |
| 9316 | wmi_extwow_set_app_type1_params_cmd_fixed_param *cmd; |
| 9317 | wmi_buf_t buf; |
| 9318 | int32_t len; |
| 9319 | int ret; |
| 9320 | |
| 9321 | len = sizeof(wmi_extwow_set_app_type1_params_cmd_fixed_param); |
| 9322 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9323 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9324 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9325 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9326 | } |
| 9327 | |
| 9328 | cmd = (wmi_extwow_set_app_type1_params_cmd_fixed_param *) |
| 9329 | wmi_buf_data(buf); |
| 9330 | |
| 9331 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9332 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type1_params_cmd_fixed_param, |
| 9333 | WMITLV_GET_STRUCT_TLVLEN |
| 9334 | (wmi_extwow_set_app_type1_params_cmd_fixed_param)); |
| 9335 | |
| 9336 | cmd->vdev_id = app_type1_params->vdev_id; |
| 9337 | WMI_CHAR_ARRAY_TO_MAC_ADDR(app_type1_params->wakee_mac_addr.bytes, |
| 9338 | &cmd->wakee_mac); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9339 | qdf_mem_copy(cmd->ident, app_type1_params->identification_id, 8); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9340 | cmd->ident_len = app_type1_params->id_length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9341 | qdf_mem_copy(cmd->passwd, app_type1_params->password, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9342 | cmd->passwd_len = app_type1_params->pass_length; |
| 9343 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9344 | WMI_LOGD("%s: vdev_id %d wakee_mac_addr %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9345 | "identification_id %.8s id_length %u " |
| 9346 | "password %.16s pass_length %u", |
| 9347 | __func__, cmd->vdev_id, app_type1_params->wakee_mac_addr.bytes, |
| 9348 | cmd->ident, cmd->ident_len, cmd->passwd, cmd->passwd_len); |
| 9349 | |
| 9350 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9351 | WMI_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID); |
| 9352 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9353 | WMI_LOGE("%s: Failed to set APP TYPE1 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9354 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9355 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9356 | } |
| 9357 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9358 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9359 | } |
| 9360 | |
| 9361 | /** |
| 9362 | * send_set_app_type2_params_in_fw_cmd_tlv() - set app type2 params in fw |
| 9363 | * @wmi_handle: wmi handle |
| 9364 | * @appType2Params: app type2 params |
| 9365 | * |
| 9366 | * Return: CDF status |
| 9367 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9368 | 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] | 9369 | struct app_type2_params *appType2Params) |
| 9370 | { |
| 9371 | wmi_extwow_set_app_type2_params_cmd_fixed_param *cmd; |
| 9372 | wmi_buf_t buf; |
| 9373 | int32_t len; |
| 9374 | int ret; |
| 9375 | |
| 9376 | len = sizeof(wmi_extwow_set_app_type2_params_cmd_fixed_param); |
| 9377 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9378 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9379 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 9380 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9381 | } |
| 9382 | |
| 9383 | cmd = (wmi_extwow_set_app_type2_params_cmd_fixed_param *) |
| 9384 | wmi_buf_data(buf); |
| 9385 | |
| 9386 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9387 | WMITLV_TAG_STRUC_wmi_extwow_set_app_type2_params_cmd_fixed_param, |
| 9388 | WMITLV_GET_STRUCT_TLVLEN |
| 9389 | (wmi_extwow_set_app_type2_params_cmd_fixed_param)); |
| 9390 | |
| 9391 | cmd->vdev_id = appType2Params->vdev_id; |
| 9392 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9393 | qdf_mem_copy(cmd->rc4_key, appType2Params->rc4_key, 16); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9394 | cmd->rc4_key_len = appType2Params->rc4_key_len; |
| 9395 | |
| 9396 | cmd->ip_id = appType2Params->ip_id; |
| 9397 | cmd->ip_device_ip = appType2Params->ip_device_ip; |
| 9398 | cmd->ip_server_ip = appType2Params->ip_server_ip; |
| 9399 | |
| 9400 | cmd->tcp_src_port = appType2Params->tcp_src_port; |
| 9401 | cmd->tcp_dst_port = appType2Params->tcp_dst_port; |
| 9402 | cmd->tcp_seq = appType2Params->tcp_seq; |
| 9403 | cmd->tcp_ack_seq = appType2Params->tcp_ack_seq; |
| 9404 | |
| 9405 | cmd->keepalive_init = appType2Params->keepalive_init; |
| 9406 | cmd->keepalive_min = appType2Params->keepalive_min; |
| 9407 | cmd->keepalive_max = appType2Params->keepalive_max; |
| 9408 | cmd->keepalive_inc = appType2Params->keepalive_inc; |
| 9409 | |
| 9410 | WMI_CHAR_ARRAY_TO_MAC_ADDR(appType2Params->gateway_mac.bytes, |
| 9411 | &cmd->gateway_mac); |
| 9412 | cmd->tcp_tx_timeout_val = appType2Params->tcp_tx_timeout_val; |
| 9413 | cmd->tcp_rx_timeout_val = appType2Params->tcp_rx_timeout_val; |
| 9414 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9415 | WMI_LOGD("%s: vdev_id %d gateway_mac %pM " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9416 | "rc4_key %.16s rc4_key_len %u " |
| 9417 | "ip_id %x ip_device_ip %x ip_server_ip %x " |
| 9418 | "tcp_src_port %u tcp_dst_port %u tcp_seq %u " |
| 9419 | "tcp_ack_seq %u keepalive_init %u keepalive_min %u " |
| 9420 | "keepalive_max %u keepalive_inc %u " |
| 9421 | "tcp_tx_timeout_val %u tcp_rx_timeout_val %u", |
| 9422 | __func__, cmd->vdev_id, appType2Params->gateway_mac.bytes, |
| 9423 | cmd->rc4_key, cmd->rc4_key_len, |
| 9424 | cmd->ip_id, cmd->ip_device_ip, cmd->ip_server_ip, |
| 9425 | cmd->tcp_src_port, cmd->tcp_dst_port, cmd->tcp_seq, |
| 9426 | cmd->tcp_ack_seq, cmd->keepalive_init, cmd->keepalive_min, |
| 9427 | cmd->keepalive_max, cmd->keepalive_inc, |
| 9428 | cmd->tcp_tx_timeout_val, cmd->tcp_rx_timeout_val); |
| 9429 | |
| 9430 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9431 | WMI_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID); |
| 9432 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9433 | WMI_LOGE("%s: Failed to set APP TYPE2 PARAMS", __func__); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9434 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9435 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9436 | } |
| 9437 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9438 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9439 | |
| 9440 | } |
| 9441 | |
| 9442 | /** |
| 9443 | * send_set_auto_shutdown_timer_cmd_tlv() - sets auto shutdown timer in firmware |
| 9444 | * @wmi_handle: wmi handle |
| 9445 | * @timer_val: auto shutdown timer value |
| 9446 | * |
| 9447 | * Return: CDF status |
| 9448 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9449 | 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] | 9450 | uint32_t timer_val) |
| 9451 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9452 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9453 | wmi_buf_t buf = NULL; |
| 9454 | uint8_t *buf_ptr; |
| 9455 | wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd; |
| 9456 | int len = sizeof(wmi_host_auto_shutdown_cfg_cmd_fixed_param); |
| 9457 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9458 | 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] | 9459 | __func__, timer_val); |
| 9460 | |
| 9461 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9462 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9463 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9464 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9465 | } |
| 9466 | |
| 9467 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9468 | wmi_auto_sh_cmd = |
| 9469 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param *) buf_ptr; |
| 9470 | wmi_auto_sh_cmd->timer_value = timer_val; |
| 9471 | |
| 9472 | WMITLV_SET_HDR(&wmi_auto_sh_cmd->tlv_header, |
| 9473 | WMITLV_TAG_STRUC_wmi_host_auto_shutdown_cfg_cmd_fixed_param, |
| 9474 | WMITLV_GET_STRUCT_TLVLEN |
| 9475 | (wmi_host_auto_shutdown_cfg_cmd_fixed_param)); |
| 9476 | |
| 9477 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9478 | len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9479 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9480 | WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9481 | __func__, status); |
| 9482 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9483 | } |
| 9484 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9485 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9486 | } |
| 9487 | |
| 9488 | /** |
| 9489 | * send_nan_req_cmd_tlv() - to send nan request to target |
| 9490 | * @wmi_handle: wmi handle |
| 9491 | * @nan_req: request data which will be non-null |
| 9492 | * |
| 9493 | * Return: CDF status |
| 9494 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9495 | 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] | 9496 | struct nan_req_params *nan_req) |
| 9497 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9498 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9499 | wmi_nan_cmd_param *cmd; |
| 9500 | wmi_buf_t buf; |
| 9501 | uint16_t len = sizeof(*cmd); |
| 9502 | uint16_t nan_data_len, nan_data_len_aligned; |
| 9503 | uint8_t *buf_ptr; |
| 9504 | |
| 9505 | /* |
| 9506 | * <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ----> |
| 9507 | * +------------+----------+-----------------------+--------------+ |
| 9508 | * | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data | |
| 9509 | * +------------+----------+-----------------------+--------------+ |
| 9510 | */ |
| 9511 | if (!nan_req) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9512 | WMI_LOGE("%s:nan req is not valid", __func__); |
| 9513 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9514 | } |
| 9515 | nan_data_len = nan_req->request_data_len; |
| 9516 | nan_data_len_aligned = roundup(nan_req->request_data_len, |
| 9517 | sizeof(uint32_t)); |
| 9518 | len += WMI_TLV_HDR_SIZE + nan_data_len_aligned; |
| 9519 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9520 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9521 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 9522 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9523 | } |
| 9524 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9525 | cmd = (wmi_nan_cmd_param *) buf_ptr; |
| 9526 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9527 | WMITLV_TAG_STRUC_wmi_nan_cmd_param, |
| 9528 | WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param)); |
| 9529 | cmd->data_len = nan_req->request_data_len; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9530 | WMI_LOGD("%s: The data len value is %u", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9531 | __func__, nan_req->request_data_len); |
| 9532 | buf_ptr += sizeof(wmi_nan_cmd_param); |
| 9533 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned); |
| 9534 | buf_ptr += WMI_TLV_HDR_SIZE; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9535 | qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9536 | |
| 9537 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9538 | WMI_NAN_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9539 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9540 | WMI_LOGE("%s Failed to send set param command ret = %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9541 | __func__, ret); |
| 9542 | wmi_buf_free(buf); |
| 9543 | } |
| 9544 | |
| 9545 | return ret; |
| 9546 | } |
| 9547 | |
| 9548 | /** |
| 9549 | * send_process_dhcpserver_offload_cmd_tlv() - enable DHCP server offload |
| 9550 | * @wmi_handle: wmi handle |
| 9551 | * @pDhcpSrvOffloadInfo: DHCP server offload info |
| 9552 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9553 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9554 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9555 | static QDF_STATUS send_process_dhcpserver_offload_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9556 | struct dhcp_offload_info_params *pDhcpSrvOffloadInfo) |
| 9557 | { |
| 9558 | wmi_set_dhcp_server_offload_cmd_fixed_param *cmd; |
| 9559 | wmi_buf_t buf; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9560 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9561 | |
| 9562 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 9563 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9564 | WMI_LOGE("Failed to allocate buffer to send " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9565 | "set_dhcp_server_offload cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9566 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9567 | } |
| 9568 | |
| 9569 | cmd = (wmi_set_dhcp_server_offload_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9570 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9571 | |
| 9572 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9573 | WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param, |
| 9574 | WMITLV_GET_STRUCT_TLVLEN |
| 9575 | (wmi_set_dhcp_server_offload_cmd_fixed_param)); |
| 9576 | cmd->vdev_id = pDhcpSrvOffloadInfo->vdev_id; |
| 9577 | cmd->enable = pDhcpSrvOffloadInfo->dhcpSrvOffloadEnabled; |
| 9578 | cmd->num_client = pDhcpSrvOffloadInfo->dhcpClientNum; |
| 9579 | cmd->srv_ipv4 = pDhcpSrvOffloadInfo->dhcpSrvIP; |
| 9580 | cmd->start_lsb = 0; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9581 | status = wmi_unified_cmd_send(wmi_handle, buf, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9582 | sizeof(*cmd), |
| 9583 | WMI_SET_DHCP_SERVER_OFFLOAD_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9584 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9585 | WMI_LOGE("Failed to send set_dhcp_server_offload cmd"); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9586 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9587 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9588 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9589 | WMI_LOGD("Set dhcp server offload to vdevId %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9590 | pDhcpSrvOffloadInfo->vdev_id); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9591 | |
| 9592 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9593 | } |
| 9594 | |
| 9595 | /** |
| 9596 | * send_set_led_flashing_cmd_tlv() - set led flashing in fw |
| 9597 | * @wmi_handle: wmi handle |
| 9598 | * @flashing: flashing request |
| 9599 | * |
| 9600 | * Return: CDF status |
| 9601 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9602 | 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] | 9603 | struct flashing_req_params *flashing) |
| 9604 | { |
| 9605 | wmi_set_led_flashing_cmd_fixed_param *cmd; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9606 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9607 | wmi_buf_t buf; |
| 9608 | uint8_t *buf_ptr; |
| 9609 | int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param); |
| 9610 | |
| 9611 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9612 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9613 | WMI_LOGP(FL("wmi_buf_alloc failed")); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9614 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9615 | } |
| 9616 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9617 | cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr; |
| 9618 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9619 | WMITLV_TAG_STRUC_wmi_set_led_flashing_cmd_fixed_param, |
| 9620 | WMITLV_GET_STRUCT_TLVLEN |
| 9621 | (wmi_set_led_flashing_cmd_fixed_param)); |
| 9622 | cmd->pattern_id = flashing->pattern_id; |
| 9623 | cmd->led_x0 = flashing->led_x0; |
| 9624 | cmd->led_x1 = flashing->led_x1; |
| 9625 | |
| 9626 | status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9627 | WMI_PDEV_SET_LED_FLASHING_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9628 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9629 | WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9630 | " returned Error %d", __func__, status); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9631 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9632 | } |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9633 | |
| 9634 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9635 | } |
| 9636 | |
| 9637 | /** |
| 9638 | * send_process_ch_avoid_update_cmd_tlv() - handles channel avoid update request |
| 9639 | * @wmi_handle: wmi handle |
| 9640 | * @ch_avoid_update_req: channel avoid update params |
| 9641 | * |
| 9642 | * Return: CDF status |
| 9643 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9644 | 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] | 9645 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9646 | QDF_STATUS status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9647 | wmi_buf_t buf = NULL; |
| 9648 | uint8_t *buf_ptr; |
| 9649 | wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp; |
| 9650 | int len = sizeof(wmi_chan_avoid_update_cmd_param); |
| 9651 | |
| 9652 | |
| 9653 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9654 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9655 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 9656 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9657 | } |
| 9658 | |
| 9659 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 9660 | ch_avoid_update_fp = (wmi_chan_avoid_update_cmd_param *) buf_ptr; |
| 9661 | WMITLV_SET_HDR(&ch_avoid_update_fp->tlv_header, |
| 9662 | WMITLV_TAG_STRUC_wmi_chan_avoid_update_cmd_param, |
| 9663 | WMITLV_GET_STRUCT_TLVLEN |
| 9664 | (wmi_chan_avoid_update_cmd_param)); |
| 9665 | |
| 9666 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 9667 | len, WMI_CHAN_AVOID_UPDATE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9668 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9669 | WMI_LOGE("wmi_unified_cmd_send" |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9670 | " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE" |
| 9671 | " returned Error %d", status); |
| 9672 | wmi_buf_free(buf); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9673 | } |
| 9674 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 9675 | return status; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9676 | } |
| 9677 | |
| 9678 | /** |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 9679 | * send_pdev_set_regdomain_cmd_tlv() - send set regdomain command to fw |
| 9680 | * @wmi_handle: wmi handle |
| 9681 | * @param: pointer to pdev regdomain params |
| 9682 | * |
| 9683 | * Return: 0 for success or error code |
| 9684 | */ |
| 9685 | static QDF_STATUS |
| 9686 | send_pdev_set_regdomain_cmd_tlv(wmi_unified_t wmi_handle, |
| 9687 | struct pdev_set_regdomain_params *param) |
| 9688 | { |
| 9689 | wmi_buf_t buf; |
| 9690 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 9691 | int32_t len = sizeof(*cmd); |
| 9692 | |
| 9693 | |
| 9694 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9695 | if (!buf) { |
| 9696 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9697 | return QDF_STATUS_E_NOMEM; |
| 9698 | } |
| 9699 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 9700 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9701 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 9702 | WMITLV_GET_STRUCT_TLVLEN |
| 9703 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 9704 | |
| 9705 | cmd->reg_domain = param->currentRDinuse; |
| 9706 | cmd->reg_domain_2G = param->currentRD2G; |
| 9707 | cmd->reg_domain_5G = param->currentRD5G; |
| 9708 | cmd->conformance_test_limit_2G = param->ctl_2G; |
| 9709 | cmd->conformance_test_limit_5G = param->ctl_5G; |
| 9710 | cmd->dfs_domain = param->dfsDomain; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 9711 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 9712 | param->pdev_id); |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 9713 | |
| 9714 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9715 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
| 9716 | WMI_LOGE("%s: Failed to send pdev set regdomain command", |
| 9717 | __func__); |
| 9718 | wmi_buf_free(buf); |
| 9719 | return QDF_STATUS_E_FAILURE; |
| 9720 | } |
| 9721 | |
| 9722 | return QDF_STATUS_SUCCESS; |
| 9723 | } |
| 9724 | |
| 9725 | /** |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9726 | * send_regdomain_info_to_fw_cmd_tlv() - send regdomain info to fw |
| 9727 | * @wmi_handle: wmi handle |
| 9728 | * @reg_dmn: reg domain |
| 9729 | * @regdmn2G: 2G reg domain |
| 9730 | * @regdmn5G: 5G reg domain |
| 9731 | * @ctl2G: 2G test limit |
| 9732 | * @ctl5G: 5G test limit |
| 9733 | * |
| 9734 | * Return: none |
| 9735 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9736 | 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] | 9737 | uint32_t reg_dmn, uint16_t regdmn2G, |
Rajeev Kumar Sirasanagandla | 4c1fecd | 2017-06-06 13:27:56 +0530 | [diff] [blame] | 9738 | uint16_t regdmn5G, uint8_t ctl2G, |
| 9739 | uint8_t ctl5G) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9740 | { |
| 9741 | wmi_buf_t buf; |
| 9742 | wmi_pdev_set_regdomain_cmd_fixed_param *cmd; |
| 9743 | int32_t len = sizeof(*cmd); |
| 9744 | |
| 9745 | |
| 9746 | buf = wmi_buf_alloc(wmi_handle, len); |
| 9747 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9748 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 9749 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9750 | } |
| 9751 | cmd = (wmi_pdev_set_regdomain_cmd_fixed_param *) wmi_buf_data(buf); |
| 9752 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9753 | WMITLV_TAG_STRUC_wmi_pdev_set_regdomain_cmd_fixed_param, |
| 9754 | WMITLV_GET_STRUCT_TLVLEN |
| 9755 | (wmi_pdev_set_regdomain_cmd_fixed_param)); |
| 9756 | cmd->reg_domain = reg_dmn; |
| 9757 | cmd->reg_domain_2G = regdmn2G; |
| 9758 | cmd->reg_domain_5G = regdmn5G; |
| 9759 | cmd->conformance_test_limit_2G = ctl2G; |
| 9760 | cmd->conformance_test_limit_5G = ctl5G; |
| 9761 | |
| 9762 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 9763 | WMI_PDEV_SET_REGDOMAIN_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9764 | WMI_LOGP("%s: Failed to send pdev set regdomain command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9765 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9766 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9767 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9768 | } |
| 9769 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9770 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9771 | } |
| 9772 | |
| 9773 | |
| 9774 | /** |
| 9775 | * send_set_tdls_offchan_mode_cmd_tlv() - set tdls off channel mode |
| 9776 | * @wmi_handle: wmi handle |
| 9777 | * @chan_switch_params: Pointer to tdls channel switch parameter structure |
| 9778 | * |
| 9779 | * This function sets tdls off channel mode |
| 9780 | * |
| 9781 | * Return: 0 on success; Negative errno otherwise |
| 9782 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9783 | 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] | 9784 | struct tdls_channel_switch_params *chan_switch_params) |
| 9785 | { |
| 9786 | wmi_tdls_set_offchan_mode_cmd_fixed_param *cmd; |
| 9787 | wmi_buf_t wmi_buf; |
| 9788 | u_int16_t len = sizeof(wmi_tdls_set_offchan_mode_cmd_fixed_param); |
| 9789 | |
| 9790 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9791 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9792 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 9793 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9794 | } |
| 9795 | cmd = (wmi_tdls_set_offchan_mode_cmd_fixed_param *) |
| 9796 | wmi_buf_data(wmi_buf); |
| 9797 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9798 | WMITLV_TAG_STRUC_wmi_tdls_set_offchan_mode_cmd_fixed_param, |
| 9799 | WMITLV_GET_STRUCT_TLVLEN( |
| 9800 | wmi_tdls_set_offchan_mode_cmd_fixed_param)); |
| 9801 | |
| 9802 | WMI_CHAR_ARRAY_TO_MAC_ADDR(chan_switch_params->peer_mac_addr, |
| 9803 | &cmd->peer_macaddr); |
| 9804 | cmd->vdev_id = chan_switch_params->vdev_id; |
| 9805 | cmd->offchan_mode = chan_switch_params->tdls_sw_mode; |
| 9806 | cmd->is_peer_responder = chan_switch_params->is_responder; |
| 9807 | cmd->offchan_num = chan_switch_params->tdls_off_ch; |
| 9808 | cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset; |
| 9809 | cmd->offchan_oper_class = chan_switch_params->oper_class; |
| 9810 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9811 | 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] | 9812 | cmd->peer_macaddr.mac_addr31to0, |
| 9813 | cmd->peer_macaddr.mac_addr47to32); |
| 9814 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9815 | WMI_LOGD(FL( |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9816 | "vdev_id: %d, off channel mode: %d, off channel Num: %d, " |
| 9817 | "off channel offset: 0x%x, is_peer_responder: %d, operating class: %d" |
| 9818 | ), |
| 9819 | cmd->vdev_id, |
| 9820 | cmd->offchan_mode, |
| 9821 | cmd->offchan_num, |
| 9822 | cmd->offchan_bw_bitmap, |
| 9823 | cmd->is_peer_responder, |
| 9824 | cmd->offchan_oper_class); |
| 9825 | |
| 9826 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9827 | WMI_TDLS_SET_OFFCHAN_MODE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9828 | WMI_LOGP(FL("failed to send tdls off chan command")); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9829 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9830 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9831 | } |
| 9832 | |
| 9833 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9834 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9835 | } |
| 9836 | |
| 9837 | /** |
| 9838 | * send_update_fw_tdls_state_cmd_tlv() - send enable/disable tdls for a vdev |
| 9839 | * @wmi_handle: wmi handle |
| 9840 | * @pwmaTdlsparams: TDLS params |
| 9841 | * |
| 9842 | * Return: 0 for sucess or error code |
| 9843 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9844 | 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] | 9845 | void *tdls_param, uint8_t tdls_state) |
| 9846 | { |
| 9847 | wmi_tdls_set_state_cmd_fixed_param *cmd; |
| 9848 | wmi_buf_t wmi_buf; |
| 9849 | |
| 9850 | struct wmi_tdls_params *wmi_tdls = (struct wmi_tdls_params *) tdls_param; |
| 9851 | uint16_t len = sizeof(wmi_tdls_set_state_cmd_fixed_param); |
| 9852 | |
| 9853 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9854 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9855 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 9856 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9857 | } |
| 9858 | cmd = (wmi_tdls_set_state_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 9859 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9860 | WMITLV_TAG_STRUC_wmi_tdls_set_state_cmd_fixed_param, |
| 9861 | WMITLV_GET_STRUCT_TLVLEN |
| 9862 | (wmi_tdls_set_state_cmd_fixed_param)); |
| 9863 | cmd->vdev_id = wmi_tdls->vdev_id; |
| 9864 | cmd->state = tdls_state; |
| 9865 | cmd->notification_interval_ms = wmi_tdls->notification_interval_ms; |
| 9866 | cmd->tx_discovery_threshold = wmi_tdls->tx_discovery_threshold; |
| 9867 | cmd->tx_teardown_threshold = wmi_tdls->tx_teardown_threshold; |
| 9868 | cmd->rssi_teardown_threshold = wmi_tdls->rssi_teardown_threshold; |
| 9869 | cmd->rssi_delta = wmi_tdls->rssi_delta; |
| 9870 | cmd->tdls_options = wmi_tdls->tdls_options; |
| 9871 | cmd->tdls_peer_traffic_ind_window = wmi_tdls->peer_traffic_ind_window; |
| 9872 | cmd->tdls_peer_traffic_response_timeout_ms = |
| 9873 | wmi_tdls->peer_traffic_response_timeout; |
| 9874 | cmd->tdls_puapsd_mask = wmi_tdls->puapsd_mask; |
| 9875 | cmd->tdls_puapsd_inactivity_time_ms = wmi_tdls->puapsd_inactivity_time; |
| 9876 | cmd->tdls_puapsd_rx_frame_threshold = |
| 9877 | wmi_tdls->puapsd_rx_frame_threshold; |
| 9878 | cmd->teardown_notification_ms = |
| 9879 | wmi_tdls->teardown_notification_ms; |
| 9880 | cmd->tdls_peer_kickout_threshold = |
| 9881 | wmi_tdls->tdls_peer_kickout_threshold; |
| 9882 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9883 | WMI_LOGD("%s: tdls_state: %d, state: %d, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9884 | "notification_interval_ms: %d, " |
| 9885 | "tx_discovery_threshold: %d, " |
| 9886 | "tx_teardown_threshold: %d, " |
| 9887 | "rssi_teardown_threshold: %d, " |
| 9888 | "rssi_delta: %d, " |
| 9889 | "tdls_options: 0x%x, " |
| 9890 | "tdls_peer_traffic_ind_window: %d, " |
| 9891 | "tdls_peer_traffic_response_timeout: %d, " |
| 9892 | "tdls_puapsd_mask: 0x%x, " |
| 9893 | "tdls_puapsd_inactivity_time: %d, " |
| 9894 | "tdls_puapsd_rx_frame_threshold: %d, " |
| 9895 | "teardown_notification_ms: %d, " |
| 9896 | "tdls_peer_kickout_threshold: %d", |
| 9897 | __func__, tdls_state, cmd->state, |
| 9898 | cmd->notification_interval_ms, |
| 9899 | cmd->tx_discovery_threshold, |
| 9900 | cmd->tx_teardown_threshold, |
| 9901 | cmd->rssi_teardown_threshold, |
| 9902 | cmd->rssi_delta, |
| 9903 | cmd->tdls_options, |
| 9904 | cmd->tdls_peer_traffic_ind_window, |
| 9905 | cmd->tdls_peer_traffic_response_timeout_ms, |
| 9906 | cmd->tdls_puapsd_mask, |
| 9907 | cmd->tdls_puapsd_inactivity_time_ms, |
| 9908 | cmd->tdls_puapsd_rx_frame_threshold, |
| 9909 | cmd->teardown_notification_ms, |
| 9910 | cmd->tdls_peer_kickout_threshold); |
| 9911 | |
| 9912 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 9913 | WMI_TDLS_SET_STATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9914 | WMI_LOGP("%s: failed to send tdls set state command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 9915 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9916 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9917 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9918 | WMI_LOGD("%s: vdev_id %d", __func__, wmi_tdls->vdev_id); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9919 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9920 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9921 | } |
| 9922 | |
| 9923 | /** |
| 9924 | * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state |
| 9925 | * @wmi_handle: wmi handle |
| 9926 | * @peerStateParams: TDLS peer state params |
| 9927 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 9928 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9929 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 9930 | 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] | 9931 | struct tdls_peer_state_params *peerStateParams, |
| 9932 | uint32_t *ch_mhz) |
| 9933 | { |
| 9934 | wmi_tdls_peer_update_cmd_fixed_param *cmd; |
| 9935 | wmi_tdls_peer_capabilities *peer_cap; |
| 9936 | wmi_channel *chan_info; |
| 9937 | wmi_buf_t wmi_buf; |
| 9938 | uint8_t *buf_ptr; |
| 9939 | uint32_t i; |
| 9940 | int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) + |
| 9941 | sizeof(wmi_tdls_peer_capabilities); |
| 9942 | |
| 9943 | |
| 9944 | len += WMI_TLV_HDR_SIZE + |
| 9945 | sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen; |
| 9946 | |
| 9947 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 9948 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9949 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 9950 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9951 | } |
| 9952 | |
| 9953 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 9954 | cmd = (wmi_tdls_peer_update_cmd_fixed_param *) buf_ptr; |
| 9955 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 9956 | WMITLV_TAG_STRUC_wmi_tdls_peer_update_cmd_fixed_param, |
| 9957 | WMITLV_GET_STRUCT_TLVLEN |
| 9958 | (wmi_tdls_peer_update_cmd_fixed_param)); |
| 9959 | |
| 9960 | cmd->vdev_id = peerStateParams->vdevId; |
| 9961 | WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr, |
| 9962 | &cmd->peer_macaddr); |
| 9963 | |
| 9964 | |
| 9965 | cmd->peer_state = peerStateParams->peerState; |
| 9966 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 9967 | WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, " |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 9968 | "peer_macaddr.mac_addr31to0: 0x%x, " |
| 9969 | "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d", |
| 9970 | __func__, cmd->vdev_id, peerStateParams->peerMacAddr, |
| 9971 | cmd->peer_macaddr.mac_addr31to0, |
| 9972 | cmd->peer_macaddr.mac_addr47to32, cmd->peer_state); |
| 9973 | |
| 9974 | buf_ptr += sizeof(wmi_tdls_peer_update_cmd_fixed_param); |
| 9975 | peer_cap = (wmi_tdls_peer_capabilities *) buf_ptr; |
| 9976 | WMITLV_SET_HDR(&peer_cap->tlv_header, |
| 9977 | WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities, |
| 9978 | WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities)); |
| 9979 | |
| 9980 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3) |
| 9981 | WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap); |
| 9982 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2) |
| 9983 | WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap); |
| 9984 | if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1) |
| 9985 | WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap); |
| 9986 | if (peerStateParams->peerCap.peerUapsdQueue & 0x01) |
| 9987 | WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap); |
| 9988 | |
| 9989 | /* Ack and More Data Ack are sent as 0, so no need to set |
| 9990 | * but fill SP |
| 9991 | */ |
| 9992 | WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, |
| 9993 | peerStateParams->peerCap.peerMaxSp); |
| 9994 | |
| 9995 | peer_cap->buff_sta_support = |
| 9996 | peerStateParams->peerCap.peerBuffStaSupport; |
| 9997 | peer_cap->off_chan_support = |
| 9998 | peerStateParams->peerCap.peerOffChanSupport; |
| 9999 | peer_cap->peer_curr_operclass = |
| 10000 | peerStateParams->peerCap.peerCurrOperClass; |
| 10001 | /* self curr operclass is not being used and so pass op class for |
| 10002 | * preferred off chan in it. |
| 10003 | */ |
| 10004 | peer_cap->self_curr_operclass = |
| 10005 | peerStateParams->peerCap.opClassForPrefOffChan; |
| 10006 | peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 10007 | peer_cap->peer_operclass_len = |
| 10008 | peerStateParams->peerCap.peerOperClassLen; |
| 10009 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10010 | WMI_LOGD("%s: peer_operclass_len: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10011 | __func__, peer_cap->peer_operclass_len); |
| 10012 | for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 10013 | peer_cap->peer_operclass[i] = |
| 10014 | peerStateParams->peerCap.peerOperClass[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10015 | WMI_LOGD("%s: peer_operclass[%d]: %d", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10016 | __func__, i, peer_cap->peer_operclass[i]); |
| 10017 | } |
| 10018 | |
| 10019 | peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder; |
| 10020 | peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum; |
| 10021 | peer_cap->pref_offchan_bw = |
| 10022 | peerStateParams->peerCap.prefOffChanBandwidth; |
| 10023 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10024 | WMI_LOGD |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10025 | ("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, " |
| 10026 | "peer_curr_operclass: %d, self_curr_operclass: %d, peer_chan_len: " |
| 10027 | "%d, peer_operclass_len: %d, is_peer_responder: %d, pref_offchan_num:" |
| 10028 | " %d, pref_offchan_bw: %d", |
| 10029 | __func__, peer_cap->peer_qos, peer_cap->buff_sta_support, |
| 10030 | peer_cap->off_chan_support, peer_cap->peer_curr_operclass, |
| 10031 | peer_cap->self_curr_operclass, peer_cap->peer_chan_len, |
| 10032 | peer_cap->peer_operclass_len, peer_cap->is_peer_responder, |
| 10033 | peer_cap->pref_offchan_num, peer_cap->pref_offchan_bw); |
| 10034 | |
| 10035 | /* next fill variable size array of peer chan info */ |
| 10036 | buf_ptr += sizeof(wmi_tdls_peer_capabilities); |
| 10037 | WMITLV_SET_HDR(buf_ptr, |
| 10038 | WMITLV_TAG_ARRAY_STRUC, |
| 10039 | sizeof(wmi_channel) * |
| 10040 | peerStateParams->peerCap.peerChanLen); |
| 10041 | chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 10042 | |
| 10043 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) { |
| 10044 | WMITLV_SET_HDR(&chan_info->tlv_header, |
| 10045 | WMITLV_TAG_STRUC_wmi_channel, |
| 10046 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
| 10047 | chan_info->mhz = ch_mhz[i]; |
| 10048 | chan_info->band_center_freq1 = chan_info->mhz; |
| 10049 | chan_info->band_center_freq2 = 0; |
| 10050 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10051 | WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10052 | |
| 10053 | if (peerStateParams->peerCap.peerChan[i].dfsSet) { |
| 10054 | WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10055 | WMI_LOGI("chan[%d] DFS[%d]\n", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10056 | peerStateParams->peerCap.peerChan[i].chanId, |
| 10057 | peerStateParams->peerCap.peerChan[i].dfsSet); |
| 10058 | } |
| 10059 | |
| 10060 | if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ) |
| 10061 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11G); |
| 10062 | else |
| 10063 | WMI_SET_CHANNEL_MODE(chan_info, MODE_11A); |
| 10064 | |
| 10065 | WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, |
| 10066 | peerStateParams->peerCap. |
| 10067 | peerChan[i].pwr); |
| 10068 | |
| 10069 | WMI_SET_CHANNEL_REG_POWER(chan_info, |
| 10070 | peerStateParams->peerCap.peerChan[i]. |
| 10071 | pwr); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10072 | WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10073 | peerStateParams->peerCap.peerChan[i].pwr); |
| 10074 | |
| 10075 | chan_info++; |
| 10076 | } |
| 10077 | |
| 10078 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 10079 | WMI_TDLS_PEER_UPDATE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10080 | WMI_LOGE("%s: failed to send tdls peer update state command", |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10081 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 10082 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10083 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10084 | } |
| 10085 | |
| 10086 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10087 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10088 | } |
| 10089 | |
| 10090 | /* |
| 10091 | * send_process_fw_mem_dump_cmd_tlv() - Function to request fw memory dump from |
| 10092 | * firmware |
| 10093 | * @wmi_handle: Pointer to wmi handle |
| 10094 | * @mem_dump_req: Pointer for mem_dump_req |
| 10095 | * |
| 10096 | * This function sends memory dump request to firmware |
| 10097 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10098 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10099 | * |
| 10100 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10101 | 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] | 10102 | struct fw_dump_req_param *mem_dump_req) |
| 10103 | { |
| 10104 | wmi_get_fw_mem_dump_fixed_param *cmd; |
| 10105 | wmi_fw_mem_dump *dump_params; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 10106 | struct wmi_fw_dump_seg_req *seg_req; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10107 | int32_t len; |
| 10108 | wmi_buf_t buf; |
| 10109 | u_int8_t *buf_ptr; |
| 10110 | int ret, loop; |
| 10111 | |
| 10112 | /* |
| 10113 | * len = sizeof(fixed param) that includes tlv header + |
| 10114 | * tlv header for array of struc + |
| 10115 | * sizeof (each struct) |
| 10116 | */ |
| 10117 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10118 | len += mem_dump_req->num_seg * sizeof(wmi_fw_mem_dump); |
| 10119 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10120 | |
| 10121 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10122 | WMI_LOGE(FL("Failed allocate wmi buffer")); |
| 10123 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10124 | } |
| 10125 | |
| 10126 | buf_ptr = (u_int8_t *) wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10127 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10128 | cmd = (wmi_get_fw_mem_dump_fixed_param *) buf_ptr; |
| 10129 | |
| 10130 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10131 | WMITLV_TAG_STRUC_wmi_get_fw_mem_dump_fixed_param, |
| 10132 | WMITLV_GET_STRUCT_TLVLEN(wmi_get_fw_mem_dump_fixed_param)); |
| 10133 | |
| 10134 | cmd->request_id = mem_dump_req->request_id; |
| 10135 | cmd->num_fw_mem_dump_segs = mem_dump_req->num_seg; |
| 10136 | |
| 10137 | /* TLV indicating array of structures to follow */ |
| 10138 | buf_ptr += sizeof(wmi_get_fw_mem_dump_fixed_param); |
| 10139 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10140 | sizeof(wmi_fw_mem_dump) * |
| 10141 | cmd->num_fw_mem_dump_segs); |
| 10142 | |
| 10143 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10144 | dump_params = (wmi_fw_mem_dump *) buf_ptr; |
| 10145 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10146 | WMI_LOGI(FL("request_id:%d num_seg:%d"), |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10147 | mem_dump_req->request_id, mem_dump_req->num_seg); |
| 10148 | for (loop = 0; loop < cmd->num_fw_mem_dump_segs; loop++) { |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 10149 | seg_req = (struct wmi_fw_dump_seg_req *) |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10150 | ((uint8_t *)(mem_dump_req->segment) + |
| 10151 | loop * sizeof(*seg_req)); |
| 10152 | WMITLV_SET_HDR(&dump_params->tlv_header, |
| 10153 | WMITLV_TAG_STRUC_wmi_fw_mem_dump_params, |
| 10154 | WMITLV_GET_STRUCT_TLVLEN(wmi_fw_mem_dump)); |
| 10155 | dump_params->seg_id = seg_req->seg_id; |
| 10156 | dump_params->seg_start_addr_lo = seg_req->seg_start_addr_lo; |
| 10157 | dump_params->seg_start_addr_hi = seg_req->seg_start_addr_hi; |
| 10158 | dump_params->seg_length = seg_req->seg_length; |
| 10159 | dump_params->dest_addr_lo = seg_req->dst_addr_lo; |
| 10160 | dump_params->dest_addr_hi = seg_req->dst_addr_hi; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10161 | WMI_LOGI(FL("seg_number:%d"), loop); |
| 10162 | 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] | 10163 | dump_params->seg_id, dump_params->seg_start_addr_lo, |
| 10164 | dump_params->seg_start_addr_hi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10165 | 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] | 10166 | dump_params->seg_length, dump_params->dest_addr_lo, |
| 10167 | dump_params->dest_addr_hi); |
| 10168 | dump_params++; |
| 10169 | } |
| 10170 | |
| 10171 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10172 | WMI_GET_FW_MEM_DUMP_CMDID); |
| 10173 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10174 | WMI_LOGE(FL("Failed to send get firmware mem dump request")); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10175 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10176 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10177 | } |
| 10178 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10179 | WMI_LOGI(FL("Get firmware mem dump request sent successfully")); |
| 10180 | return QDF_STATUS_SUCCESS; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10181 | } |
| 10182 | |
| 10183 | /* |
| 10184 | * send_process_set_ie_info_cmd_tlv() - Function to send IE info to firmware |
| 10185 | * @wmi_handle: Pointer to WMi handle |
| 10186 | * @ie_data: Pointer for ie data |
| 10187 | * |
| 10188 | * This function sends IE information to firmware |
| 10189 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10190 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10191 | * |
| 10192 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 10193 | 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] | 10194 | struct vdev_ie_info_param *ie_info) |
| 10195 | { |
| 10196 | wmi_vdev_set_ie_cmd_fixed_param *cmd; |
| 10197 | wmi_buf_t buf; |
| 10198 | uint8_t *buf_ptr; |
| 10199 | uint32_t len, ie_len_aligned; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10200 | QDF_STATUS ret; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10201 | |
| 10202 | |
| 10203 | ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t)); |
| 10204 | /* Allocate memory for the WMI command */ |
| 10205 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + ie_len_aligned; |
| 10206 | |
| 10207 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10208 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10209 | WMI_LOGE(FL("wmi_buf_alloc failed")); |
| 10210 | return QDF_STATUS_E_NOMEM; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10211 | } |
| 10212 | |
| 10213 | buf_ptr = wmi_buf_data(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10214 | qdf_mem_zero(buf_ptr, len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10215 | |
| 10216 | /* Populate the WMI command */ |
| 10217 | cmd = (wmi_vdev_set_ie_cmd_fixed_param *)buf_ptr; |
| 10218 | |
| 10219 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10220 | WMITLV_TAG_STRUC_wmi_vdev_set_ie_cmd_fixed_param, |
| 10221 | WMITLV_GET_STRUCT_TLVLEN( |
| 10222 | wmi_vdev_set_ie_cmd_fixed_param)); |
| 10223 | cmd->vdev_id = ie_info->vdev_id; |
| 10224 | cmd->ie_id = ie_info->ie_id; |
| 10225 | cmd->ie_len = ie_info->length; |
Naveen Rawat | 61be23a | 2016-08-03 16:41:33 -0700 | [diff] [blame] | 10226 | cmd->band = ie_info->band; |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10227 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10228 | 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] | 10229 | ie_info->length, ie_info->vdev_id); |
| 10230 | |
| 10231 | buf_ptr += sizeof(*cmd); |
| 10232 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, ie_len_aligned); |
| 10233 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10234 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10235 | qdf_mem_copy(buf_ptr, ie_info->data, cmd->ie_len); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10236 | |
| 10237 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10238 | WMI_VDEV_SET_IE_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 10239 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 10240 | WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret); |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 10241 | wmi_buf_free(buf); |
| 10242 | } |
| 10243 | |
| 10244 | return ret; |
| 10245 | } |
| 10246 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10247 | /** |
| 10248 | * send_smart_ant_enable_cmd_tlv() - WMI smart ant enable function |
| 10249 | * |
| 10250 | * @param wmi_handle : handle to WMI. |
| 10251 | * @param param : pointer to antenna param |
| 10252 | * |
| 10253 | * This function sends smart antenna enable command to FW |
| 10254 | * |
| 10255 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10256 | */ |
| 10257 | static QDF_STATUS send_smart_ant_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 10258 | struct smart_ant_enable_params *param) |
| 10259 | { |
| 10260 | /* Send WMI COMMAND to Enable */ |
| 10261 | wmi_pdev_smart_ant_enable_cmd_fixed_param *cmd; |
| 10262 | wmi_pdev_smart_ant_gpio_handle *gpio_param; |
| 10263 | wmi_buf_t buf; |
| 10264 | uint8_t *buf_ptr; |
| 10265 | int len = 0; |
| 10266 | QDF_STATUS ret; |
| 10267 | int loop = 0; |
| 10268 | |
| 10269 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10270 | len += WMI_HAL_MAX_SANTENNA * sizeof(wmi_pdev_smart_ant_gpio_handle); |
| 10271 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10272 | |
| 10273 | if (!buf) { |
| 10274 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10275 | return QDF_STATUS_E_NOMEM; |
| 10276 | } |
| 10277 | |
| 10278 | buf_ptr = wmi_buf_data(buf); |
| 10279 | qdf_mem_zero(buf_ptr, len); |
| 10280 | cmd = (wmi_pdev_smart_ant_enable_cmd_fixed_param *)buf_ptr; |
| 10281 | |
| 10282 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10283 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_enable_cmd_fixed_param, |
| 10284 | WMITLV_GET_STRUCT_TLVLEN( |
| 10285 | wmi_pdev_smart_ant_enable_cmd_fixed_param)); |
| 10286 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10287 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10288 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10289 | cmd->enable = param->enable; |
| 10290 | cmd->mode = param->mode; |
| 10291 | cmd->rx_antenna = param->rx_antenna; |
| 10292 | cmd->tx_default_antenna = param->rx_antenna; |
| 10293 | |
| 10294 | /* TLV indicating array of structures to follow */ |
| 10295 | buf_ptr += sizeof(wmi_pdev_smart_ant_enable_cmd_fixed_param); |
| 10296 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10297 | WMI_HAL_MAX_SANTENNA * |
| 10298 | sizeof(wmi_pdev_smart_ant_gpio_handle)); |
| 10299 | |
| 10300 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10301 | gpio_param = (wmi_pdev_smart_ant_gpio_handle *)buf_ptr; |
| 10302 | |
| 10303 | for (loop = 0; loop < WMI_HAL_MAX_SANTENNA; loop++) { |
| 10304 | WMITLV_SET_HDR(&gpio_param->tlv_header, |
| 10305 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_gpio_handle, |
| 10306 | WMITLV_GET_STRUCT_TLVLEN( |
| 10307 | wmi_pdev_smart_ant_gpio_handle)); |
| 10308 | if (param->mode == SMART_ANT_MODE_SERIAL) { |
| 10309 | if (loop < WMI_HOST_MAX_SERIAL_ANTENNA) { |
| 10310 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 10311 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 10312 | } else { |
| 10313 | gpio_param->gpio_pin = 0; |
| 10314 | gpio_param->gpio_func = 0; |
| 10315 | } |
| 10316 | } else if (param->mode == SMART_ANT_MODE_PARALLEL) { |
| 10317 | gpio_param->gpio_pin = param->gpio_pin[loop]; |
| 10318 | gpio_param->gpio_func = param->gpio_func[loop]; |
| 10319 | } |
| 10320 | /* Setting it to 0 for now */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10321 | gpio_param->pdev_id = |
| 10322 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10323 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10324 | gpio_param++; |
| 10325 | } |
| 10326 | |
| 10327 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10328 | buf, |
| 10329 | len, |
| 10330 | WMI_PDEV_SMART_ANT_ENABLE_CMDID); |
| 10331 | |
| 10332 | if (ret != 0) { |
| 10333 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 10334 | WMI_LOGE("enable:%d mode:%d rx_antenna: 0x%08x PINS: [%d %d %d %d] Func[%d %d %d %d] cmdstatus=%d\n", |
| 10335 | cmd->enable, |
| 10336 | cmd->mode, |
| 10337 | cmd->rx_antenna, |
| 10338 | param->gpio_pin[0], param->gpio_pin[1], |
| 10339 | param->gpio_pin[2], param->gpio_pin[3], |
| 10340 | param->gpio_func[0], param->gpio_func[1], |
| 10341 | param->gpio_func[2], param->gpio_func[3], |
| 10342 | ret); |
| 10343 | wmi_buf_free(buf); |
| 10344 | } |
| 10345 | |
| 10346 | return ret; |
| 10347 | } |
| 10348 | |
| 10349 | /** |
| 10350 | * send_smart_ant_set_rx_ant_cmd_tlv() - WMI set rx antenna function |
| 10351 | * |
| 10352 | * @param wmi_handle : handle to WMI. |
| 10353 | * @param param : pointer to rx antenna param |
| 10354 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10355 | */ |
| 10356 | static QDF_STATUS send_smart_ant_set_rx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 10357 | struct smart_ant_rx_ant_params *param) |
| 10358 | { |
| 10359 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *cmd; |
| 10360 | wmi_buf_t buf; |
| 10361 | uint8_t *buf_ptr; |
| 10362 | uint32_t len; |
| 10363 | QDF_STATUS ret; |
| 10364 | |
| 10365 | len = sizeof(*cmd); |
| 10366 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10367 | WMI_LOGD("%s:\n", __func__); |
| 10368 | if (!buf) { |
| 10369 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10370 | return QDF_STATUS_E_NOMEM; |
| 10371 | } |
| 10372 | |
| 10373 | buf_ptr = wmi_buf_data(buf); |
| 10374 | cmd = (wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *)buf_ptr; |
| 10375 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10376 | WMITLV_TAG_STRUC_wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param, |
| 10377 | WMITLV_GET_STRUCT_TLVLEN( |
| 10378 | wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param)); |
| 10379 | cmd->rx_antenna = param->antenna; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10380 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10381 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10382 | |
| 10383 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10384 | buf, |
| 10385 | len, |
| 10386 | WMI_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID); |
| 10387 | |
| 10388 | if (ret != 0) { |
| 10389 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 10390 | WMI_LOGE("%s: rx_antenna: 0x%08x cmdstatus=%d\n", |
| 10391 | __func__, |
| 10392 | cmd->rx_antenna, |
| 10393 | ret); |
| 10394 | wmi_buf_free(buf); |
| 10395 | } |
| 10396 | |
| 10397 | return ret; |
| 10398 | } |
| 10399 | |
| 10400 | /** |
| 10401 | * send_set_ctl_table_cmd_tlv() - send ctl table cmd to fw |
| 10402 | * @wmi_handle: wmi handle |
| 10403 | * @param: pointer to hold ctl table param |
| 10404 | * |
| 10405 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10406 | */ |
| 10407 | static QDF_STATUS |
| 10408 | send_set_ctl_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 10409 | struct ctl_table_params *param) |
| 10410 | { |
| 10411 | uint16_t len, ctl_tlv_len; |
| 10412 | uint8_t *buf_ptr; |
| 10413 | wmi_buf_t buf; |
| 10414 | wmi_pdev_set_ctl_table_cmd_fixed_param *cmd; |
| 10415 | uint32_t *ctl_array; |
| 10416 | |
| 10417 | if (!param->ctl_array) |
| 10418 | return QDF_STATUS_E_FAILURE; |
| 10419 | |
| 10420 | if (param->ctl_cmd_len != |
| 10421 | WMI_HOST_NUM_CTLS_2G * WMI_HOST_NUM_BAND_EDGES_2G * 2 + |
| 10422 | WMI_HOST_NUM_CTLS_5G * WMI_HOST_NUM_BAND_EDGES_5G * 2) { |
| 10423 | qdf_print("CTL array len not correct\n"); |
| 10424 | return QDF_STATUS_E_FAILURE; |
| 10425 | } |
| 10426 | |
| 10427 | ctl_tlv_len = WMI_TLV_HDR_SIZE + |
| 10428 | roundup(param->ctl_cmd_len, sizeof(A_UINT32)); |
| 10429 | len = sizeof(*cmd) + ctl_tlv_len; |
| 10430 | |
| 10431 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10432 | if (!buf) { |
| 10433 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10434 | return QDF_STATUS_E_FAILURE; |
| 10435 | } |
| 10436 | |
| 10437 | buf_ptr = wmi_buf_data(buf); |
| 10438 | qdf_mem_zero(buf_ptr, len); |
| 10439 | |
| 10440 | cmd = (wmi_pdev_set_ctl_table_cmd_fixed_param *)buf_ptr; |
| 10441 | |
| 10442 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10443 | WMITLV_TAG_STRUC_wmi_pdev_set_ctl_table_cmd_fixed_param, |
| 10444 | WMITLV_GET_STRUCT_TLVLEN( |
| 10445 | wmi_pdev_set_ctl_table_cmd_fixed_param)); |
| 10446 | cmd->ctl_len = param->ctl_cmd_len; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10447 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10448 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10449 | |
| 10450 | buf_ptr += sizeof(*cmd); |
| 10451 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10452 | (cmd->ctl_len)); |
| 10453 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10454 | ctl_array = (uint32_t *)buf_ptr; |
| 10455 | |
| 10456 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[0], ¶m->ctl_band, |
| 10457 | sizeof(param->ctl_band)); |
| 10458 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[1], param->ctl_array, |
| 10459 | param->ctl_cmd_len - |
| 10460 | sizeof(param->ctl_band)); |
| 10461 | |
| 10462 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10463 | WMI_PDEV_SET_CTL_TABLE_CMDID)) { |
| 10464 | WMI_LOGE("%s:Failed to send command\n", __func__); |
| 10465 | wmi_buf_free(buf); |
| 10466 | return QDF_STATUS_E_FAILURE; |
| 10467 | } |
| 10468 | |
| 10469 | return QDF_STATUS_SUCCESS; |
| 10470 | } |
| 10471 | |
| 10472 | /** |
| 10473 | * send_set_mimogain_table_cmd_tlv() - send mimogain table cmd to fw |
| 10474 | * @wmi_handle: wmi handle |
| 10475 | * @param: pointer to hold mimogain table param |
| 10476 | * |
| 10477 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10478 | */ |
| 10479 | static QDF_STATUS |
| 10480 | send_set_mimogain_table_cmd_tlv(wmi_unified_t wmi_handle, |
| 10481 | struct mimogain_table_params *param) |
| 10482 | { |
| 10483 | uint16_t len, table_tlv_len; |
| 10484 | wmi_buf_t buf; |
| 10485 | uint8_t *buf_ptr; |
| 10486 | wmi_pdev_set_mimogain_table_cmd_fixed_param *cmd; |
| 10487 | uint32_t *gain_table; |
| 10488 | |
| 10489 | if (!param->array_gain) |
| 10490 | return QDF_STATUS_E_FAILURE; |
| 10491 | |
| 10492 | /* len must be multiple of a single array gain table */ |
| 10493 | if (param->tbl_len % |
| 10494 | ((WMI_HOST_TX_NUM_CHAIN-1) * WMI_HOST_TPC_REGINDEX_MAX * |
| 10495 | WMI_HOST_ARRAY_GAIN_NUM_STREAMS) != 0) { |
| 10496 | WMI_LOGE("Array gain table len not correct\n"); |
| 10497 | return QDF_STATUS_E_FAILURE; |
| 10498 | } |
| 10499 | |
| 10500 | table_tlv_len = WMI_TLV_HDR_SIZE + |
| 10501 | roundup(param->tbl_len, sizeof(uint32_t)); |
| 10502 | len = sizeof(*cmd) + table_tlv_len; |
| 10503 | |
| 10504 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10505 | if (!buf) { |
| 10506 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10507 | return QDF_STATUS_E_FAILURE; |
| 10508 | } |
| 10509 | |
| 10510 | buf_ptr = wmi_buf_data(buf); |
| 10511 | qdf_mem_zero(buf_ptr, len); |
| 10512 | |
| 10513 | cmd = (wmi_pdev_set_mimogain_table_cmd_fixed_param *)buf_ptr; |
| 10514 | |
| 10515 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10516 | WMITLV_TAG_STRUC_wmi_pdev_set_mimogain_table_cmd_fixed_param, |
| 10517 | WMITLV_GET_STRUCT_TLVLEN( |
| 10518 | wmi_pdev_set_mimogain_table_cmd_fixed_param)); |
| 10519 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10520 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10521 | param->pdev_id); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10522 | WMI_MIMOGAIN_ARRAY_GAIN_LEN_SET(cmd->mimogain_info, param->tbl_len); |
| 10523 | WMI_MIMOGAIN_MULTI_CHAIN_BYPASS_SET(cmd->mimogain_info, |
| 10524 | param->multichain_gain_bypass); |
| 10525 | |
| 10526 | buf_ptr += sizeof(*cmd); |
| 10527 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 10528 | (param->tbl_len)); |
| 10529 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10530 | gain_table = (uint32_t *)buf_ptr; |
| 10531 | |
| 10532 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(gain_table, |
| 10533 | param->array_gain, |
| 10534 | param->tbl_len); |
| 10535 | |
| 10536 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10537 | WMI_PDEV_SET_MIMOGAIN_TABLE_CMDID)) { |
| 10538 | return QDF_STATUS_E_FAILURE; |
| 10539 | } |
| 10540 | |
| 10541 | return QDF_STATUS_SUCCESS; |
| 10542 | } |
| 10543 | |
| 10544 | /** |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 10545 | * enum packet_power_tlv_flags: target defined |
| 10546 | * packet power rate flags for TLV |
| 10547 | * @WMI_TLV_FLAG_ONE_CHAIN: one chain |
| 10548 | * @WMI_TLV_FLAG_TWO_CHAIN: two chain |
| 10549 | * @WMI_TLV_FLAG_THREE_CHAIN: three chain |
| 10550 | * @WMI_TLV_FLAG_FOUR_CHAIN: four chain |
| 10551 | * @WMI_TLV_FLAG_FIVE_CHAIN: five chain |
| 10552 | * @WMI_TLV_FLAG_SIX_CHAIN: six chain |
| 10553 | * @WMI_TLV_FLAG_SEVEN_CHAIN: seven chain |
| 10554 | * @WMI_TLV_FLAG_EIGHT_CHAIN:eight chain |
| 10555 | * @WMI_TLV_FLAG_STBC: STBC is set |
| 10556 | * @WMI_TLV_FLAG_40MHZ: 40MHz chan width |
| 10557 | * @WMI_TLV_FLAG_80MHZ: 80MHz chan width |
| 10558 | * @WMI_TLV_FLAG_160MHZ: 160MHz chan width |
| 10559 | * @WMI_TLV_FLAG_TXBF: Tx Bf enabled |
| 10560 | * @WMI_TLV_FLAG_RTSENA: RTS enabled |
| 10561 | * @WMI_TLV_FLAG_CTSENA: CTS enabled |
| 10562 | * @WMI_TLV_FLAG_LDPC: LDPC is set |
| 10563 | * @WMI_TLV_FLAG_SGI: Short gaurd interval |
| 10564 | * @WMI_TLV_FLAG_SU: SU Data |
| 10565 | * @WMI_TLV_FLAG_DL_MU_MIMO_AC: DL AC MU data |
| 10566 | * @WMI_TLV_FLAG_DL_MU_MIMO_AX: DL AX MU data |
| 10567 | * @WMI_TLV_FLAG_DL_OFDMA: DL OFDMA data |
| 10568 | * @WMI_TLV_FLAG_UL_OFDMA: UL OFDMA data |
| 10569 | * @WMI_TLV_FLAG_UL_MU_MIMO: UL MU data |
| 10570 | * |
| 10571 | * @WMI_TLV_FLAG_BW_MASK: bandwidth mask |
| 10572 | * @WMI_TLV_FLAG_BW_SHIFT: bandwidth shift |
| 10573 | * @WMI_TLV_FLAG_SU_MU_OFDMA_MASK: su/mu/ofdma mask |
| 10574 | * @WMI_TLV_FLAG_SU_MU_OFDMA_shift: su/mu/ofdma shift |
| 10575 | */ |
| 10576 | enum packet_power_tlv_flags { |
| 10577 | WMI_TLV_FLAG_ONE_CHAIN = 0x00000001, |
| 10578 | WMI_TLV_FLAG_TWO_CHAIN = 0x00000003, |
| 10579 | WMI_TLV_FLAG_THREE_CHAIN = 0x00000007, |
| 10580 | WMI_TLV_FLAG_FOUR_CHAIN = 0x0000000F, |
| 10581 | WMI_TLV_FLAG_FIVE_CHAIN = 0x0000001F, |
| 10582 | WMI_TLV_FLAG_SIX_CHAIN = 0x0000003F, |
| 10583 | WMI_TLV_FLAG_SEVEN_CHAIN = 0x0000007F, |
| 10584 | WMI_TLV_FLAG_EIGHT_CHAIN = 0x0000008F, |
| 10585 | WMI_TLV_FLAG_STBC = 0x00000100, |
| 10586 | WMI_TLV_FLAG_40MHZ = 0x00000200, |
| 10587 | WMI_TLV_FLAG_80MHZ = 0x00000300, |
| 10588 | WMI_TLV_FLAG_160MHZ = 0x00000400, |
| 10589 | WMI_TLV_FLAG_TXBF = 0x00000800, |
| 10590 | WMI_TLV_FLAG_RTSENA = 0x00001000, |
| 10591 | WMI_TLV_FLAG_CTSENA = 0x00002000, |
| 10592 | WMI_TLV_FLAG_LDPC = 0x00004000, |
| 10593 | WMI_TLV_FLAG_SGI = 0x00008000, |
| 10594 | WMI_TLV_FLAG_SU = 0x00100000, |
| 10595 | WMI_TLV_FLAG_DL_MU_MIMO_AC = 0x00200000, |
| 10596 | WMI_TLV_FLAG_DL_MU_MIMO_AX = 0x00300000, |
| 10597 | WMI_TLV_FLAG_DL_OFDMA = 0x00400000, |
| 10598 | WMI_TLV_FLAG_UL_OFDMA = 0x00500000, |
| 10599 | WMI_TLV_FLAG_UL_MU_MIMO = 0x00600000, |
| 10600 | |
| 10601 | WMI_TLV_FLAG_CHAIN_MASK = 0xff, |
| 10602 | WMI_TLV_FLAG_BW_MASK = 0x3, |
| 10603 | WMI_TLV_FLAG_BW_SHIFT = 9, |
| 10604 | WMI_TLV_FLAG_SU_MU_OFDMA_MASK = 0x7, |
| 10605 | WMI_TLV_FLAG_SU_MU_OFDMA_SHIFT = 20, |
| 10606 | }; |
| 10607 | |
| 10608 | /** |
| 10609 | * convert_to_power_info_rate_flags() - convert packet_power_info_params |
| 10610 | * to FW understandable format |
| 10611 | * @param: pointer to hold packet power info param |
| 10612 | * |
| 10613 | * @return FW understandable 32 bit rate flags |
| 10614 | */ |
| 10615 | static uint32_t |
| 10616 | convert_to_power_info_rate_flags(struct packet_power_info_params *param) |
| 10617 | { |
| 10618 | uint32_t rateflags = 0; |
| 10619 | |
| 10620 | if (param->chainmask) |
| 10621 | rateflags |= |
| 10622 | (param->chainmask & WMI_TLV_FLAG_CHAIN_MASK); |
| 10623 | if (param->chan_width) |
| 10624 | rateflags |= |
| 10625 | ((param->chan_width & WMI_TLV_FLAG_BW_MASK) |
| 10626 | << WMI_TLV_FLAG_BW_SHIFT); |
| 10627 | if (param->su_mu_ofdma) |
| 10628 | rateflags |= |
| 10629 | ((param->su_mu_ofdma & WMI_TLV_FLAG_SU_MU_OFDMA_MASK) |
| 10630 | << WMI_TLV_FLAG_SU_MU_OFDMA_SHIFT); |
| 10631 | if (param->rate_flags & WMI_HOST_FLAG_STBC) |
| 10632 | rateflags |= WMI_TLV_FLAG_STBC; |
| 10633 | if (param->rate_flags & WMI_HOST_FLAG_LDPC) |
| 10634 | rateflags |= WMI_TLV_FLAG_LDPC; |
| 10635 | if (param->rate_flags & WMI_HOST_FLAG_TXBF) |
| 10636 | rateflags |= WMI_TLV_FLAG_TXBF; |
| 10637 | if (param->rate_flags & WMI_HOST_FLAG_RTSENA) |
| 10638 | rateflags |= WMI_TLV_FLAG_RTSENA; |
| 10639 | if (param->rate_flags & WMI_HOST_FLAG_CTSENA) |
| 10640 | rateflags |= WMI_TLV_FLAG_CTSENA; |
| 10641 | if (param->rate_flags & WMI_HOST_FLAG_SGI) |
| 10642 | rateflags |= WMI_TLV_FLAG_SGI; |
| 10643 | |
| 10644 | return rateflags; |
| 10645 | } |
| 10646 | |
| 10647 | /** |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10648 | * send_packet_power_info_get_cmd_tlv() - send request to get packet power |
| 10649 | * info to fw |
| 10650 | * @wmi_handle: wmi handle |
| 10651 | * @param: pointer to hold packet power info param |
| 10652 | * |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 10653 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10654 | */ |
| 10655 | static QDF_STATUS |
| 10656 | send_packet_power_info_get_cmd_tlv(wmi_unified_t wmi_handle, |
| 10657 | struct packet_power_info_params *param) |
| 10658 | { |
| 10659 | wmi_pdev_get_tpc_cmd_fixed_param *cmd; |
| 10660 | wmi_buf_t wmibuf; |
| 10661 | uint8_t *buf_ptr; |
| 10662 | u_int32_t len = sizeof(wmi_pdev_get_tpc_cmd_fixed_param); |
| 10663 | |
| 10664 | wmibuf = wmi_buf_alloc(wmi_handle, len); |
| 10665 | if (wmibuf == NULL) |
| 10666 | return QDF_STATUS_E_NOMEM; |
| 10667 | |
| 10668 | buf_ptr = (uint8_t *)wmi_buf_data(wmibuf); |
| 10669 | |
| 10670 | cmd = (wmi_pdev_get_tpc_cmd_fixed_param *)buf_ptr; |
| 10671 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10672 | WMITLV_TAG_STRUC_wmi_pdev_get_tpc_cmd_fixed_param, |
| 10673 | WMITLV_GET_STRUCT_TLVLEN( |
| 10674 | wmi_pdev_get_tpc_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10675 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 10676 | param->pdev_id); |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 10677 | cmd->rate_flags = convert_to_power_info_rate_flags(param); |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10678 | cmd->nss = param->nss; |
| 10679 | cmd->preamble = param->preamble; |
| 10680 | cmd->hw_rate = param->hw_rate; |
Om Prakash Tripathi | 53ed74b | 2017-09-06 15:22:04 +0530 | [diff] [blame] | 10681 | |
| 10682 | WMI_LOGI("%s[%d] commandID %d, wmi_pdev_get_tpc_cmd=0x%x," |
| 10683 | "rate_flags: 0x%x, nss: %d, preamble: %d, hw_rate: %d\n", |
| 10684 | __func__, __LINE__, WMI_PDEV_GET_TPC_CMDID, *((u_int32_t *)cmd), |
| 10685 | cmd->rate_flags, cmd->nss, cmd->preamble, cmd->hw_rate); |
| 10686 | |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 10687 | if (wmi_unified_cmd_send(wmi_handle, wmibuf, len, |
| 10688 | WMI_PDEV_GET_TPC_CMDID)) { |
| 10689 | WMI_LOGE(FL("Failed to get tpc command\n")); |
| 10690 | wmi_buf_free(wmibuf); |
| 10691 | return QDF_STATUS_E_FAILURE; |
| 10692 | } |
| 10693 | |
| 10694 | return QDF_STATUS_SUCCESS; |
| 10695 | } |
| 10696 | |
| 10697 | /** |
| 10698 | * send_vdev_config_ratemask_cmd_tlv() - config ratemask param in fw |
| 10699 | * @wmi_handle: wmi handle |
| 10700 | * @param: pointer to hold config ratemask params |
| 10701 | * |
| 10702 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10703 | */ |
| 10704 | static QDF_STATUS send_vdev_config_ratemask_cmd_tlv(wmi_unified_t wmi_handle, |
| 10705 | struct config_ratemask_params *param) |
| 10706 | { |
| 10707 | wmi_vdev_config_ratemask_cmd_fixed_param *cmd; |
| 10708 | wmi_buf_t buf; |
| 10709 | int32_t len = sizeof(*cmd); |
| 10710 | |
| 10711 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10712 | if (!buf) { |
| 10713 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10714 | return QDF_STATUS_E_FAILURE; |
| 10715 | } |
| 10716 | cmd = (wmi_vdev_config_ratemask_cmd_fixed_param *)wmi_buf_data(buf); |
| 10717 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10718 | WMITLV_TAG_STRUC_wmi_vdev_config_ratemask_fixed_param, |
| 10719 | WMITLV_GET_STRUCT_TLVLEN( |
| 10720 | wmi_vdev_config_ratemask_cmd_fixed_param)); |
| 10721 | cmd->vdev_id = param->vdev_id; |
| 10722 | cmd->type = param->type; |
| 10723 | cmd->mask_lower32 = param->lower32; |
| 10724 | cmd->mask_higher32 = param->higher32; |
| 10725 | WMI_LOGI("Setting vdev ratemask vdev id = 0x%X, type = 0x%X, mask_l32 = 0x%X mask_h32 = 0x%X\n", |
| 10726 | param->vdev_id, param->type, param->lower32, param->higher32); |
| 10727 | |
| 10728 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10729 | WMI_VDEV_RATEMASK_CMDID)) { |
| 10730 | WMI_LOGE("Seting vdev ratemask failed\n"); |
| 10731 | wmi_buf_free(buf); |
| 10732 | return QDF_STATUS_E_FAILURE; |
| 10733 | } |
| 10734 | |
| 10735 | return QDF_STATUS_SUCCESS; |
| 10736 | } |
| 10737 | |
| 10738 | /** |
| 10739 | * send_set_vap_dscp_tid_map_cmd_tlv() - send vap dscp tid map cmd to fw |
| 10740 | * @wmi_handle: wmi handle |
| 10741 | * @param: pointer to hold vap dscp tid map param |
| 10742 | * |
| 10743 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10744 | */ |
| 10745 | static QDF_STATUS |
| 10746 | send_set_vap_dscp_tid_map_cmd_tlv(wmi_unified_t wmi_handle, |
| 10747 | struct vap_dscp_tid_map_params *param) |
| 10748 | { |
| 10749 | wmi_buf_t buf; |
| 10750 | wmi_vdev_set_dscp_tid_map_cmd_fixed_param *cmd; |
| 10751 | int32_t len = sizeof(*cmd); |
| 10752 | |
| 10753 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10754 | if (!buf) { |
| 10755 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10756 | return QDF_STATUS_E_FAILURE; |
| 10757 | } |
| 10758 | |
| 10759 | cmd = (wmi_vdev_set_dscp_tid_map_cmd_fixed_param *)wmi_buf_data(buf); |
| 10760 | qdf_mem_copy(cmd->dscp_to_tid_map, param->dscp_to_tid_map, |
| 10761 | sizeof(A_UINT32) * WMI_DSCP_MAP_MAX); |
| 10762 | |
| 10763 | cmd->vdev_id = param->vdev_id; |
| 10764 | cmd->enable_override = 0; |
| 10765 | |
| 10766 | WMI_LOGI("Setting dscp for vap id: %d\n", cmd->vdev_id); |
| 10767 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10768 | WMI_VDEV_SET_DSCP_TID_MAP_CMDID)) { |
| 10769 | WMI_LOGE("Failed to set dscp cmd\n"); |
| 10770 | wmi_buf_free(buf); |
| 10771 | return QDF_STATUS_E_FAILURE; |
| 10772 | } |
| 10773 | |
| 10774 | return QDF_STATUS_SUCCESS; |
| 10775 | } |
| 10776 | |
| 10777 | /** |
| 10778 | * send_vdev_set_neighbour_rx_cmd_tlv() - set neighbour rx param in fw |
| 10779 | * @wmi_handle: wmi handle |
| 10780 | * @macaddr: vdev mac address |
| 10781 | * @param: pointer to hold neigbour rx param |
| 10782 | * |
| 10783 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10784 | */ |
| 10785 | static QDF_STATUS send_vdev_set_neighbour_rx_cmd_tlv(wmi_unified_t wmi_handle, |
| 10786 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10787 | struct set_neighbour_rx_params *param) |
| 10788 | { |
| 10789 | wmi_vdev_filter_nrp_config_cmd_fixed_param *cmd; |
| 10790 | wmi_buf_t buf; |
| 10791 | int32_t len = sizeof(*cmd); |
| 10792 | |
| 10793 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10794 | if (!buf) { |
| 10795 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10796 | return QDF_STATUS_E_FAILURE; |
| 10797 | } |
| 10798 | cmd = (wmi_vdev_filter_nrp_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 10799 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10800 | WMITLV_TAG_STRUC_wmi_vdev_filter_nrp_config_cmd_fixed_param, |
| 10801 | WMITLV_GET_STRUCT_TLVLEN( |
| 10802 | wmi_vdev_filter_nrp_config_cmd_fixed_param)); |
| 10803 | cmd->vdev_id = param->vdev_id; |
| 10804 | cmd->bssid_idx = param->idx; |
| 10805 | cmd->action = param->action; |
| 10806 | cmd->type = param->type; |
| 10807 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->addr); |
| 10808 | cmd->flag = 0; |
| 10809 | |
| 10810 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10811 | WMI_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID)) { |
| 10812 | WMI_LOGE("Failed to set neighbour rx param\n"); |
| 10813 | wmi_buf_free(buf); |
| 10814 | return QDF_STATUS_E_FAILURE; |
| 10815 | } |
| 10816 | |
| 10817 | return QDF_STATUS_SUCCESS; |
| 10818 | } |
| 10819 | |
| 10820 | /** |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 10821 | * 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] | 10822 | * @param wmi_handle : handle to WMI. |
| 10823 | * @param macaddr : vdev mac address |
| 10824 | * @param param : pointer to tx antenna param |
| 10825 | * |
| 10826 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10827 | */ |
| 10828 | static QDF_STATUS send_smart_ant_set_tx_ant_cmd_tlv(wmi_unified_t wmi_handle, |
| 10829 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10830 | struct smart_ant_tx_ant_params *param) |
| 10831 | { |
| 10832 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *cmd; |
| 10833 | wmi_peer_smart_ant_set_tx_antenna_series *ant_tx_series; |
| 10834 | wmi_buf_t buf; |
| 10835 | int32_t len = 0; |
| 10836 | int i; |
| 10837 | uint8_t *buf_ptr; |
| 10838 | QDF_STATUS ret; |
| 10839 | |
| 10840 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10841 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 10842 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series); |
| 10843 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10844 | |
| 10845 | if (!buf) { |
| 10846 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10847 | return QDF_STATUS_E_NOMEM; |
| 10848 | } |
| 10849 | |
| 10850 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10851 | qdf_mem_zero(buf_ptr, len); |
| 10852 | cmd = (wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *)buf_ptr; |
| 10853 | |
| 10854 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10855 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param, |
| 10856 | WMITLV_GET_STRUCT_TLVLEN( |
| 10857 | wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param)); |
| 10858 | |
| 10859 | cmd->vdev_id = param->vdev_id; |
| 10860 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10861 | |
| 10862 | buf_ptr += sizeof(wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param); |
| 10863 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10864 | sizeof(wmi_peer_smart_ant_set_tx_antenna_series)); |
| 10865 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10866 | ant_tx_series = (wmi_peer_smart_ant_set_tx_antenna_series *)buf_ptr; |
| 10867 | |
| 10868 | for (i = 0; i < WMI_SMART_ANT_MAX_RATE_SERIES; i++) { |
| 10869 | WMITLV_SET_HDR(&ant_tx_series->tlv_header, |
| 10870 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_series, |
| 10871 | WMITLV_GET_STRUCT_TLVLEN( |
| 10872 | wmi_peer_smart_ant_set_tx_antenna_series)); |
| 10873 | ant_tx_series->antenna_series = param->antenna_array[i]; |
| 10874 | ant_tx_series++; |
| 10875 | } |
| 10876 | |
| 10877 | ret = wmi_unified_cmd_send(wmi_handle, |
| 10878 | buf, |
| 10879 | len, |
| 10880 | WMI_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID); |
| 10881 | |
| 10882 | if (ret != 0) { |
| 10883 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 10884 | wmi_buf_free(buf); |
| 10885 | } |
| 10886 | |
| 10887 | return ret; |
| 10888 | } |
| 10889 | |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 10890 | /** |
| 10891 | * send_set_ant_switch_tbl_cmd_tlv() - send ant switch tbl cmd to fw |
| 10892 | * @wmi_handle: wmi handle |
| 10893 | * @param: pointer to hold ant switch tbl param |
| 10894 | * |
| 10895 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10896 | */ |
| 10897 | static QDF_STATUS |
| 10898 | send_set_ant_switch_tbl_cmd_tlv(wmi_unified_t wmi_handle, |
| 10899 | struct ant_switch_tbl_params *param) |
| 10900 | { |
| 10901 | uint8_t len; |
| 10902 | wmi_buf_t buf; |
| 10903 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *cmd; |
| 10904 | wmi_pdev_set_ant_ctrl_chain *ctrl_chain; |
| 10905 | uint8_t *buf_ptr; |
| 10906 | |
| 10907 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10908 | len += sizeof(wmi_pdev_set_ant_ctrl_chain); |
| 10909 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10910 | |
| 10911 | if (!buf) { |
| 10912 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10913 | return QDF_STATUS_E_NOMEM; |
| 10914 | } |
| 10915 | |
| 10916 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10917 | qdf_mem_zero(buf_ptr, len); |
| 10918 | cmd = (wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *)buf_ptr; |
| 10919 | |
| 10920 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10921 | WMITLV_TAG_STRUC_wmi_pdev_set_ant_switch_tbl_cmd_fixed_param, |
| 10922 | WMITLV_GET_STRUCT_TLVLEN( |
| 10923 | wmi_pdev_set_ant_switch_tbl_cmd_fixed_param)); |
| 10924 | |
| 10925 | cmd->antCtrlCommon1 = param->ant_ctrl_common1; |
| 10926 | cmd->antCtrlCommon2 = param->ant_ctrl_common2; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10927 | cmd->mac_id = |
| 10928 | wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 10929 | |
| 10930 | /* TLV indicating array of structures to follow */ |
| 10931 | buf_ptr += sizeof(wmi_pdev_set_ant_switch_tbl_cmd_fixed_param); |
| 10932 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10933 | sizeof(wmi_pdev_set_ant_ctrl_chain)); |
| 10934 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 10935 | ctrl_chain = (wmi_pdev_set_ant_ctrl_chain *)buf_ptr; |
| 10936 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 10937 | ctrl_chain->pdev_id = |
| 10938 | wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 10939 | ctrl_chain->antCtrlChain = param->antCtrlChain; |
| 10940 | |
| 10941 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 10942 | WMI_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID)) { |
| 10943 | wmi_buf_free(buf); |
| 10944 | return QDF_STATUS_E_FAILURE; |
| 10945 | } |
| 10946 | |
| 10947 | return QDF_STATUS_SUCCESS; |
| 10948 | } |
| 10949 | |
| 10950 | /** |
| 10951 | * send_smart_ant_set_training_info_cmd_tlv() - WMI set smart antenna |
| 10952 | * training information function |
| 10953 | * @param wmi_handle : handle to WMI. |
| 10954 | * @macaddr : vdev mac address |
| 10955 | * @param param : pointer to tx antenna param |
| 10956 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 10957 | */ |
| 10958 | static QDF_STATUS send_smart_ant_set_training_info_cmd_tlv( |
| 10959 | wmi_unified_t wmi_handle, |
| 10960 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 10961 | struct smart_ant_training_info_params *param) |
| 10962 | { |
| 10963 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *cmd; |
| 10964 | wmi_peer_smart_ant_set_train_antenna_param *train_param; |
| 10965 | wmi_buf_t buf; |
| 10966 | uint8_t *buf_ptr; |
| 10967 | int32_t len = 0; |
| 10968 | QDF_STATUS ret; |
| 10969 | int loop; |
| 10970 | |
| 10971 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 10972 | len += (WMI_SMART_ANT_MAX_RATE_SERIES) * |
| 10973 | sizeof(wmi_peer_smart_ant_set_train_antenna_param); |
| 10974 | buf = wmi_buf_alloc(wmi_handle, len); |
| 10975 | |
| 10976 | if (!buf) { |
| 10977 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 10978 | return QDF_STATUS_E_NOMEM; |
| 10979 | } |
| 10980 | |
| 10981 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 10982 | qdf_mem_zero(buf_ptr, len); |
| 10983 | cmd = (wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *)buf_ptr; |
| 10984 | |
| 10985 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 10986 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param, |
| 10987 | WMITLV_GET_STRUCT_TLVLEN( |
| 10988 | wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param)); |
| 10989 | |
| 10990 | cmd->vdev_id = param->vdev_id; |
| 10991 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 10992 | cmd->num_pkts = param->numpkts; |
| 10993 | |
| 10994 | buf_ptr += sizeof(wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param); |
| 10995 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 10996 | sizeof(wmi_peer_smart_ant_set_train_antenna_param) * |
| 10997 | WMI_SMART_ANT_MAX_RATE_SERIES); |
| 10998 | |
| 10999 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11000 | train_param = (wmi_peer_smart_ant_set_train_antenna_param *)buf_ptr; |
| 11001 | |
| 11002 | for (loop = 0; loop < WMI_SMART_ANT_MAX_RATE_SERIES; loop++) { |
| 11003 | WMITLV_SET_HDR(&train_param->tlv_header, |
| 11004 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_param, |
| 11005 | WMITLV_GET_STRUCT_TLVLEN( |
| 11006 | wmi_peer_smart_ant_set_train_antenna_param)); |
| 11007 | train_param->train_rate_series = param->rate_array[loop]; |
| 11008 | train_param->train_antenna_series = param->antenna_array[loop]; |
| 11009 | train_param->rc_flags = 0; |
| 11010 | WMI_LOGI(FL("Series number:%d\n"), loop); |
| 11011 | WMI_LOGI(FL("Rate [0x%02x] Tx_Antenna [0x%08x]\n"), |
| 11012 | train_param->train_rate_series, |
| 11013 | train_param->train_antenna_series); |
| 11014 | train_param++; |
| 11015 | } |
| 11016 | |
| 11017 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11018 | buf, |
| 11019 | len, |
| 11020 | WMI_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID); |
| 11021 | |
| 11022 | if (ret != 0) { |
| 11023 | WMI_LOGE(" %s :WMI Failed\n", __func__); |
| 11024 | wmi_buf_free(buf); |
| 11025 | return QDF_STATUS_E_FAILURE; |
| 11026 | } |
| 11027 | |
| 11028 | return ret; |
| 11029 | } |
| 11030 | |
| 11031 | /** |
| 11032 | * send_smart_ant_set_node_config_cmd_tlv() - WMI set node |
| 11033 | * configuration function |
| 11034 | * @param wmi_handle : handle to WMI. |
| 11035 | * @macaddr : vdev mad address |
| 11036 | * @param param : pointer to tx antenna param |
| 11037 | * |
| 11038 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11039 | */ |
| 11040 | static QDF_STATUS send_smart_ant_set_node_config_cmd_tlv( |
| 11041 | wmi_unified_t wmi_handle, |
| 11042 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 11043 | struct smart_ant_node_config_params *param) |
| 11044 | { |
| 11045 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *cmd; |
| 11046 | wmi_buf_t buf; |
| 11047 | uint8_t *buf_ptr; |
| 11048 | int32_t len = 0, args_tlv_len; |
| 11049 | int ret; |
| 11050 | int i = 0; |
| 11051 | A_UINT32 *node_config_args; |
| 11052 | |
| 11053 | args_tlv_len = WMI_TLV_HDR_SIZE + param->args_count * sizeof(A_UINT32); |
| 11054 | len = sizeof(*cmd) + args_tlv_len; |
| 11055 | |
| 11056 | if ((param->args_count == 0)) { |
| 11057 | WMI_LOGE("%s: Can't send a command with %d arguments\n", |
| 11058 | __func__, param->args_count); |
| 11059 | return QDF_STATUS_E_FAILURE; |
| 11060 | } |
| 11061 | |
| 11062 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11063 | if (!buf) { |
| 11064 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11065 | return QDF_STATUS_E_NOMEM; |
| 11066 | } |
| 11067 | |
| 11068 | cmd = (wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *) |
| 11069 | wmi_buf_data(buf); |
| 11070 | buf_ptr = (uint8_t *)cmd; |
| 11071 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11072 | WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param, |
| 11073 | WMITLV_GET_STRUCT_TLVLEN( |
| 11074 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param)); |
| 11075 | cmd->vdev_id = param->vdev_id; |
| 11076 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 11077 | cmd->cmd_id = param->cmd_id; |
| 11078 | cmd->args_count = param->args_count; |
| 11079 | buf_ptr += sizeof( |
| 11080 | wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param); |
| 11081 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 11082 | (cmd->args_count * sizeof(A_UINT32))); |
| 11083 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11084 | node_config_args = (A_UINT32 *)buf_ptr; |
| 11085 | |
| 11086 | for (i = 0; i < param->args_count; i++) { |
| 11087 | node_config_args[i] = param->args_arr[i]; |
| 11088 | WMI_LOGI("%d", param->args_arr[i]); |
| 11089 | } |
| 11090 | |
| 11091 | ret = wmi_unified_cmd_send(wmi_handle, |
| 11092 | buf, |
| 11093 | len, |
| 11094 | WMI_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID); |
| 11095 | |
| 11096 | if (ret != 0) { |
| 11097 | WMI_LOGE("%s: WMI FAILED:Sent cmd_id: 0x%x\n Node: %02x:%02x:%02x:%02x:%02x:%02x cmdstatus=%d\n", |
| 11098 | __func__, param->cmd_id, macaddr[0], |
| 11099 | macaddr[1], macaddr[2], macaddr[3], |
| 11100 | macaddr[4], macaddr[5], ret); |
| 11101 | wmi_buf_free(buf); |
| 11102 | } |
| 11103 | |
| 11104 | return ret; |
| 11105 | } |
| 11106 | |
| 11107 | /** |
| 11108 | * send_set_atf_cmd_tlv() - send set atf command to fw |
| 11109 | * @wmi_handle: wmi handle |
| 11110 | * @param: pointer to set atf param |
| 11111 | * |
| 11112 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11113 | */ |
| 11114 | static QDF_STATUS |
| 11115 | send_set_atf_cmd_tlv(wmi_unified_t wmi_handle, |
| 11116 | struct set_atf_params *param) |
| 11117 | { |
| 11118 | wmi_atf_peer_info *peer_info; |
| 11119 | wmi_peer_atf_request_fixed_param *cmd; |
| 11120 | wmi_buf_t buf; |
| 11121 | uint8_t *buf_ptr; |
| 11122 | int i; |
| 11123 | int32_t len = 0; |
| 11124 | QDF_STATUS retval; |
| 11125 | |
| 11126 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11127 | len += param->num_peers * sizeof(wmi_atf_peer_info); |
| 11128 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11129 | if (!buf) { |
| 11130 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11131 | return QDF_STATUS_E_FAILURE; |
| 11132 | } |
| 11133 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11134 | cmd = (wmi_peer_atf_request_fixed_param *)buf_ptr; |
| 11135 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11136 | WMITLV_TAG_STRUC_wmi_peer_atf_request_fixed_param, |
| 11137 | WMITLV_GET_STRUCT_TLVLEN( |
| 11138 | wmi_peer_atf_request_fixed_param)); |
| 11139 | cmd->num_peers = param->num_peers; |
| 11140 | |
| 11141 | buf_ptr += sizeof(*cmd); |
| 11142 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11143 | sizeof(wmi_atf_peer_info) * |
| 11144 | cmd->num_peers); |
| 11145 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11146 | peer_info = (wmi_atf_peer_info *)buf_ptr; |
| 11147 | |
| 11148 | for (i = 0; i < cmd->num_peers; i++) { |
| 11149 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 11150 | WMITLV_TAG_STRUC_wmi_atf_peer_info, |
| 11151 | WMITLV_GET_STRUCT_TLVLEN( |
| 11152 | wmi_atf_peer_info)); |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11153 | qdf_mem_copy(&(peer_info->peer_macaddr), |
| 11154 | &(param->peer_info[i].peer_macaddr), |
| 11155 | sizeof(wmi_mac_addr)); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11156 | peer_info->atf_units = param->peer_info[i].percentage_peer; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11157 | peer_info->vdev_id = param->peer_info[i].vdev_id; |
| 11158 | peer_info->pdev_id = |
| 11159 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11160 | param->peer_info[i].pdev_id); |
Sathish Kumar | 02c3b54 | 2017-02-22 17:24:45 +0530 | [diff] [blame] | 11161 | /* |
| 11162 | * TLV definition for peer atf request fixed param combines |
| 11163 | * extension stats. Legacy FW for WIN (Non-TLV) has peer atf |
| 11164 | * stats and atf extension stats as two different |
| 11165 | * implementations. |
| 11166 | * Need to discuss with FW on this. |
| 11167 | * |
| 11168 | * peer_info->atf_groupid = param->peer_ext_info[i].group_index; |
| 11169 | * peer_info->atf_units_reserved = |
| 11170 | * param->peer_ext_info[i].atf_index_reserved; |
| 11171 | */ |
| 11172 | peer_info++; |
| 11173 | } |
| 11174 | |
| 11175 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11176 | WMI_PEER_ATF_REQUEST_CMDID); |
| 11177 | |
| 11178 | if (retval != QDF_STATUS_SUCCESS) { |
| 11179 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 11180 | wmi_buf_free(buf); |
| 11181 | } |
| 11182 | |
| 11183 | return retval; |
| 11184 | } |
| 11185 | |
| 11186 | /** |
| 11187 | * send_vdev_set_fwtest_param_cmd_tlv() - send fwtest param in fw |
| 11188 | * @wmi_handle: wmi handle |
| 11189 | * @param: pointer to hold fwtest param |
| 11190 | * |
| 11191 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11192 | */ |
| 11193 | static QDF_STATUS send_vdev_set_fwtest_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 11194 | struct set_fwtest_params *param) |
| 11195 | { |
| 11196 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 11197 | wmi_buf_t buf; |
| 11198 | int32_t len = sizeof(*cmd); |
| 11199 | |
| 11200 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11201 | |
| 11202 | if (!buf) { |
| 11203 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11204 | return QDF_STATUS_E_FAILURE; |
| 11205 | } |
| 11206 | |
| 11207 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 11208 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11209 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 11210 | WMITLV_GET_STRUCT_TLVLEN( |
| 11211 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 11212 | cmd->param_id = param->arg; |
| 11213 | cmd->param_value = param->value; |
| 11214 | |
| 11215 | if (wmi_unified_cmd_send(wmi_handle, buf, len, WMI_FWTEST_CMDID)) { |
| 11216 | WMI_LOGE("Setting FW test param failed\n"); |
| 11217 | wmi_buf_free(buf); |
| 11218 | return QDF_STATUS_E_FAILURE; |
| 11219 | } |
| 11220 | |
| 11221 | return QDF_STATUS_SUCCESS; |
| 11222 | } |
| 11223 | |
| 11224 | /** |
| 11225 | * send_set_qboost_param_cmd_tlv() - send set qboost command to fw |
| 11226 | * @wmi_handle: wmi handle |
| 11227 | * @param: pointer to qboost params |
| 11228 | * @macaddr: vdev mac address |
| 11229 | * |
| 11230 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11231 | */ |
| 11232 | static QDF_STATUS |
| 11233 | send_set_qboost_param_cmd_tlv(wmi_unified_t wmi_handle, |
| 11234 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 11235 | struct set_qboost_params *param) |
| 11236 | { |
| 11237 | WMI_QBOOST_CFG_CMD_fixed_param *cmd; |
| 11238 | wmi_buf_t buf; |
| 11239 | int32_t len; |
| 11240 | QDF_STATUS ret; |
| 11241 | |
| 11242 | len = sizeof(*cmd); |
| 11243 | |
| 11244 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11245 | if (!buf) { |
| 11246 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11247 | return QDF_STATUS_E_FAILURE; |
| 11248 | } |
| 11249 | |
| 11250 | cmd = (WMI_QBOOST_CFG_CMD_fixed_param *)wmi_buf_data(buf); |
| 11251 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11252 | WMITLV_TAG_STRUC_WMI_QBOOST_CFG_CMD_fixed_param, |
| 11253 | WMITLV_GET_STRUCT_TLVLEN( |
| 11254 | WMI_QBOOST_CFG_CMD_fixed_param)); |
| 11255 | cmd->vdev_id = param->vdev_id; |
| 11256 | WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); |
| 11257 | cmd->qb_enable = param->value; |
| 11258 | |
| 11259 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11260 | WMI_QBOOST_CFG_CMDID); |
| 11261 | |
| 11262 | if (ret != 0) { |
| 11263 | WMI_LOGE("Setting qboost cmd failed\n"); |
| 11264 | wmi_buf_free(buf); |
| 11265 | } |
| 11266 | |
| 11267 | return ret; |
| 11268 | } |
| 11269 | |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 11270 | /** |
| 11271 | * send_gpio_config_cmd_tlv() - send gpio config to fw |
| 11272 | * @wmi_handle: wmi handle |
| 11273 | * @param: pointer to hold gpio config param |
| 11274 | * |
| 11275 | * Return: 0 for success or error code |
| 11276 | */ |
| 11277 | static QDF_STATUS |
| 11278 | send_gpio_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 11279 | struct gpio_config_params *param) |
| 11280 | { |
| 11281 | wmi_gpio_config_cmd_fixed_param *cmd; |
| 11282 | wmi_buf_t buf; |
| 11283 | int32_t len; |
| 11284 | QDF_STATUS ret; |
| 11285 | |
| 11286 | len = sizeof(*cmd); |
| 11287 | |
| 11288 | /* Sanity Checks */ |
| 11289 | if (param->pull_type > WMI_GPIO_PULL_DOWN || |
| 11290 | param->intr_mode > WMI_GPIO_INTTYPE_LEVEL_HIGH) { |
| 11291 | return QDF_STATUS_E_FAILURE; |
| 11292 | } |
| 11293 | |
| 11294 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11295 | if (!buf) { |
| 11296 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11297 | return QDF_STATUS_E_FAILURE; |
| 11298 | } |
| 11299 | |
| 11300 | cmd = (wmi_gpio_config_cmd_fixed_param *)wmi_buf_data(buf); |
| 11301 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11302 | WMITLV_TAG_STRUC_wmi_gpio_config_cmd_fixed_param, |
| 11303 | WMITLV_GET_STRUCT_TLVLEN( |
| 11304 | wmi_gpio_config_cmd_fixed_param)); |
| 11305 | cmd->gpio_num = param->gpio_num; |
| 11306 | cmd->input = param->input; |
| 11307 | cmd->pull_type = param->pull_type; |
| 11308 | cmd->intr_mode = param->intr_mode; |
| 11309 | |
| 11310 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11311 | WMI_GPIO_CONFIG_CMDID); |
| 11312 | |
| 11313 | if (ret != 0) { |
| 11314 | WMI_LOGE("Sending GPIO config cmd failed\n"); |
| 11315 | wmi_buf_free(buf); |
| 11316 | } |
| 11317 | |
| 11318 | return ret; |
| 11319 | } |
| 11320 | |
| 11321 | /** |
| 11322 | * send_gpio_output_cmd_tlv() - send gpio output to fw |
| 11323 | * @wmi_handle: wmi handle |
| 11324 | * @param: pointer to hold gpio output param |
| 11325 | * |
| 11326 | * Return: 0 for success or error code |
| 11327 | */ |
| 11328 | static QDF_STATUS |
| 11329 | send_gpio_output_cmd_tlv(wmi_unified_t wmi_handle, |
| 11330 | struct gpio_output_params *param) |
| 11331 | { |
| 11332 | wmi_gpio_output_cmd_fixed_param *cmd; |
| 11333 | wmi_buf_t buf; |
| 11334 | int32_t len; |
| 11335 | QDF_STATUS ret; |
| 11336 | |
| 11337 | len = sizeof(*cmd); |
| 11338 | |
| 11339 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11340 | if (!buf) { |
| 11341 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11342 | return QDF_STATUS_E_FAILURE; |
| 11343 | } |
| 11344 | |
| 11345 | cmd = (wmi_gpio_output_cmd_fixed_param *)wmi_buf_data(buf); |
| 11346 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11347 | WMITLV_TAG_STRUC_wmi_gpio_output_cmd_fixed_param, |
| 11348 | WMITLV_GET_STRUCT_TLVLEN( |
| 11349 | wmi_gpio_output_cmd_fixed_param)); |
| 11350 | cmd->gpio_num = param->gpio_num; |
| 11351 | cmd->set = param->set; |
| 11352 | |
| 11353 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11354 | WMI_GPIO_OUTPUT_CMDID); |
| 11355 | |
| 11356 | if (ret != 0) { |
| 11357 | WMI_LOGE("Sending GPIO output cmd failed\n"); |
| 11358 | wmi_buf_free(buf); |
| 11359 | } |
| 11360 | |
| 11361 | return ret; |
| 11362 | |
| 11363 | } |
| 11364 | |
| 11365 | /** |
| 11366 | * send_phyerr_disable_cmd_tlv() - WMI phyerr disable function |
| 11367 | * |
| 11368 | * @param wmi_handle : handle to WMI. |
| 11369 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11370 | */ |
| 11371 | static QDF_STATUS send_phyerr_disable_cmd_tlv(wmi_unified_t wmi_handle) |
| 11372 | { |
| 11373 | wmi_pdev_dfs_disable_cmd_fixed_param *cmd; |
| 11374 | wmi_buf_t buf; |
| 11375 | QDF_STATUS ret; |
| 11376 | int32_t len; |
| 11377 | |
| 11378 | len = sizeof(*cmd); |
| 11379 | |
| 11380 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11381 | if (!buf) { |
| 11382 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11383 | return QDF_STATUS_E_FAILURE; |
| 11384 | } |
| 11385 | |
| 11386 | cmd = (wmi_pdev_dfs_disable_cmd_fixed_param *)wmi_buf_data(buf); |
| 11387 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11388 | WMITLV_TAG_STRUC_wmi_pdev_dfs_disable_cmd_fixed_param, |
| 11389 | WMITLV_GET_STRUCT_TLVLEN( |
| 11390 | wmi_pdev_dfs_disable_cmd_fixed_param)); |
| 11391 | /* Filling it with WMI_PDEV_ID_SOC for now */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11392 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11393 | WMI_HOST_PDEV_ID_SOC); |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 11394 | |
| 11395 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11396 | WMI_PDEV_DFS_DISABLE_CMDID); |
| 11397 | |
| 11398 | if (ret != 0) { |
| 11399 | WMI_LOGE("Sending PDEV DFS disable cmd failed\n"); |
| 11400 | wmi_buf_free(buf); |
| 11401 | } |
| 11402 | |
| 11403 | return ret; |
| 11404 | } |
| 11405 | |
| 11406 | /** |
| 11407 | * send_phyerr_enable_cmd_tlv() - WMI phyerr disable function |
| 11408 | * |
| 11409 | * @param wmi_handle : handle to WMI. |
| 11410 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11411 | */ |
| 11412 | static QDF_STATUS send_phyerr_enable_cmd_tlv(wmi_unified_t wmi_handle) |
| 11413 | { |
| 11414 | wmi_pdev_dfs_enable_cmd_fixed_param *cmd; |
| 11415 | wmi_buf_t buf; |
| 11416 | QDF_STATUS ret; |
| 11417 | int32_t len; |
| 11418 | |
| 11419 | len = sizeof(*cmd); |
| 11420 | |
| 11421 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11422 | if (!buf) { |
| 11423 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11424 | return QDF_STATUS_E_FAILURE; |
| 11425 | } |
| 11426 | |
| 11427 | cmd = (wmi_pdev_dfs_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 11428 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11429 | WMITLV_TAG_STRUC_wmi_pdev_dfs_enable_cmd_fixed_param, |
| 11430 | WMITLV_GET_STRUCT_TLVLEN( |
| 11431 | wmi_pdev_dfs_enable_cmd_fixed_param)); |
| 11432 | /* Reserved for future use */ |
| 11433 | cmd->reserved0 = 0; |
| 11434 | |
| 11435 | ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 11436 | WMI_PDEV_DFS_ENABLE_CMDID); |
| 11437 | |
| 11438 | if (ret != 0) { |
| 11439 | WMI_LOGE("Sending PDEV DFS enable cmd failed\n"); |
| 11440 | wmi_buf_free(buf); |
| 11441 | } |
| 11442 | |
| 11443 | return ret; |
| 11444 | } |
| 11445 | |
| 11446 | /** |
| 11447 | * send_nf_dbr_dbm_info_get_cmd_tlv() - send request to get nf to fw |
| 11448 | * @wmi_handle: wmi handle |
| 11449 | * |
| 11450 | * Return: 0 for success or error code |
| 11451 | */ |
| 11452 | static QDF_STATUS |
| 11453 | send_nf_dbr_dbm_info_get_cmd_tlv(wmi_unified_t wmi_handle) |
| 11454 | { |
| 11455 | wmi_buf_t buf; |
| 11456 | QDF_STATUS ret; |
| 11457 | |
| 11458 | buf = wmi_buf_alloc(wmi_handle, 0); |
| 11459 | if (buf == NULL) |
| 11460 | return QDF_STATUS_E_NOMEM; |
| 11461 | |
| 11462 | ret = wmi_unified_cmd_send(wmi_handle, buf, 0, |
| 11463 | WMI_PDEV_GET_NFCAL_POWER_CMDID); |
| 11464 | if (ret != 0) { |
| 11465 | WMI_LOGE("Sending get nfcal power cmd failed\n"); |
| 11466 | wmi_buf_free(buf); |
| 11467 | } |
| 11468 | |
| 11469 | return ret; |
| 11470 | } |
| 11471 | |
| 11472 | /** |
| 11473 | * send_set_ht_ie_cmd_tlv() - send ht ie command to fw |
| 11474 | * @wmi_handle: wmi handle |
| 11475 | * @param: pointer to ht ie param |
| 11476 | * |
| 11477 | * Return: 0 for success or error code |
| 11478 | */ |
| 11479 | static QDF_STATUS |
| 11480 | send_set_ht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 11481 | struct ht_ie_params *param) |
| 11482 | { |
| 11483 | wmi_pdev_set_ht_ie_cmd_fixed_param *cmd; |
| 11484 | wmi_buf_t buf; |
| 11485 | QDF_STATUS ret; |
| 11486 | int32_t len; |
| 11487 | uint8_t *buf_ptr; |
| 11488 | |
| 11489 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 11490 | roundup(param->ie_len, sizeof(uint32_t)); |
| 11491 | |
| 11492 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11493 | if (!buf) { |
| 11494 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11495 | return QDF_STATUS_E_FAILURE; |
| 11496 | } |
| 11497 | |
| 11498 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11499 | cmd = (wmi_pdev_set_ht_ie_cmd_fixed_param *)buf_ptr; |
| 11500 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11501 | WMITLV_TAG_STRUC_wmi_pdev_set_ht_ie_cmd_fixed_param, |
| 11502 | WMITLV_GET_STRUCT_TLVLEN( |
| 11503 | wmi_pdev_set_ht_ie_cmd_fixed_param)); |
| 11504 | cmd->reserved0 = 0; |
| 11505 | cmd->ie_len = param->ie_len; |
| 11506 | cmd->tx_streams = param->tx_streams; |
| 11507 | cmd->rx_streams = param->rx_streams; |
| 11508 | |
| 11509 | buf_ptr += sizeof(*cmd); |
| 11510 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 11511 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11512 | if (param->ie_len) |
| 11513 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 11514 | cmd->ie_len); |
| 11515 | |
| 11516 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11517 | WMI_PDEV_SET_HT_CAP_IE_CMDID); |
| 11518 | |
| 11519 | if (ret != 0) { |
| 11520 | WMI_LOGE("Sending set ht ie cmd failed\n"); |
| 11521 | wmi_buf_free(buf); |
| 11522 | } |
| 11523 | |
| 11524 | return ret; |
| 11525 | } |
| 11526 | |
| 11527 | /** |
| 11528 | * send_set_vht_ie_cmd_tlv() - send vht ie command to fw |
| 11529 | * @wmi_handle: wmi handle |
| 11530 | * @param: pointer to vht ie param |
| 11531 | * |
| 11532 | * Return: 0 for success or error code |
| 11533 | */ |
| 11534 | static QDF_STATUS |
| 11535 | send_set_vht_ie_cmd_tlv(wmi_unified_t wmi_handle, |
| 11536 | struct vht_ie_params *param) |
| 11537 | { |
| 11538 | wmi_pdev_set_vht_ie_cmd_fixed_param *cmd; |
| 11539 | wmi_buf_t buf; |
| 11540 | QDF_STATUS ret; |
| 11541 | int32_t len; |
| 11542 | uint8_t *buf_ptr; |
| 11543 | |
| 11544 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 11545 | roundup(param->ie_len, sizeof(uint32_t)); |
| 11546 | |
| 11547 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11548 | if (!buf) { |
| 11549 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11550 | return QDF_STATUS_E_FAILURE; |
| 11551 | } |
| 11552 | |
| 11553 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11554 | cmd = (wmi_pdev_set_vht_ie_cmd_fixed_param *)buf_ptr; |
| 11555 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11556 | WMITLV_TAG_STRUC_wmi_pdev_set_vht_ie_cmd_fixed_param, |
| 11557 | WMITLV_GET_STRUCT_TLVLEN( |
| 11558 | wmi_pdev_set_vht_ie_cmd_fixed_param)); |
| 11559 | cmd->reserved0 = 0; |
| 11560 | cmd->ie_len = param->ie_len; |
| 11561 | cmd->tx_streams = param->tx_streams; |
| 11562 | cmd->rx_streams = param->rx_streams; |
| 11563 | |
| 11564 | buf_ptr += sizeof(*cmd); |
| 11565 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len); |
| 11566 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11567 | if (param->ie_len) |
| 11568 | WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data, |
| 11569 | cmd->ie_len); |
| 11570 | |
| 11571 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11572 | WMI_PDEV_SET_VHT_CAP_IE_CMDID); |
| 11573 | |
| 11574 | if (ret != 0) { |
| 11575 | WMI_LOGE("Sending set vht ie cmd failed\n"); |
| 11576 | wmi_buf_free(buf); |
| 11577 | } |
| 11578 | |
| 11579 | return ret; |
| 11580 | } |
| 11581 | |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11582 | /** |
| 11583 | * send_set_quiet_mode_cmd_tlv() - send set quiet mode command to fw |
| 11584 | * @wmi_handle: wmi handle |
| 11585 | * @param: pointer to quiet mode params |
| 11586 | * |
| 11587 | * Return: 0 for success or error code |
| 11588 | */ |
| 11589 | static QDF_STATUS |
| 11590 | send_set_quiet_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 11591 | struct set_quiet_mode_params *param) |
| 11592 | { |
| 11593 | wmi_pdev_set_quiet_cmd_fixed_param *quiet_cmd; |
| 11594 | wmi_buf_t buf; |
| 11595 | QDF_STATUS ret; |
| 11596 | int32_t len; |
| 11597 | |
| 11598 | len = sizeof(*quiet_cmd); |
| 11599 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11600 | if (!buf) { |
| 11601 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11602 | return QDF_STATUS_E_FAILURE; |
| 11603 | } |
| 11604 | |
| 11605 | quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf); |
| 11606 | WMITLV_SET_HDR(&quiet_cmd->tlv_header, |
| 11607 | WMITLV_TAG_STRUC_wmi_pdev_set_quiet_cmd_fixed_param, |
| 11608 | WMITLV_GET_STRUCT_TLVLEN( |
| 11609 | wmi_pdev_set_quiet_cmd_fixed_param)); |
| 11610 | quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf); |
| 11611 | quiet_cmd->enabled = param->enabled; |
| 11612 | quiet_cmd->period = (param->period)*(param->intval); |
| 11613 | quiet_cmd->duration = param->duration; |
| 11614 | quiet_cmd->next_start = param->offset; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11615 | quiet_cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11616 | WMI_HOST_PDEV_ID_SOC); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11617 | |
| 11618 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11619 | WMI_PDEV_SET_QUIET_MODE_CMDID); |
| 11620 | |
| 11621 | if (ret != 0) { |
| 11622 | WMI_LOGE("Sending set quiet cmd failed\n"); |
| 11623 | wmi_buf_free(buf); |
| 11624 | } |
| 11625 | |
| 11626 | return ret; |
| 11627 | } |
| 11628 | |
| 11629 | /** |
| 11630 | * send_set_bwf_cmd_tlv() - send set bwf command to fw |
| 11631 | * @wmi_handle: wmi handle |
| 11632 | * @param: pointer to set bwf param |
| 11633 | * |
| 11634 | * Return: 0 for success or error code |
| 11635 | */ |
| 11636 | static QDF_STATUS |
| 11637 | send_set_bwf_cmd_tlv(wmi_unified_t wmi_handle, |
| 11638 | struct set_bwf_params *param) |
| 11639 | { |
| 11640 | wmi_bwf_peer_info *peer_info; |
| 11641 | wmi_peer_bwf_request_fixed_param *cmd; |
| 11642 | wmi_buf_t buf; |
| 11643 | QDF_STATUS retval; |
| 11644 | int32_t len; |
| 11645 | uint8_t *buf_ptr; |
| 11646 | int i; |
| 11647 | |
| 11648 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 11649 | len += param->num_peers * sizeof(wmi_bwf_peer_info); |
| 11650 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11651 | if (!buf) { |
| 11652 | WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); |
| 11653 | return QDF_STATUS_E_FAILURE; |
| 11654 | } |
| 11655 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 11656 | cmd = (wmi_peer_bwf_request_fixed_param *)buf_ptr; |
| 11657 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11658 | WMITLV_TAG_STRUC_wmi_peer_bwf_request_fixed_param, |
| 11659 | WMITLV_GET_STRUCT_TLVLEN( |
| 11660 | wmi_peer_bwf_request_fixed_param)); |
| 11661 | cmd->num_peers = param->num_peers; |
| 11662 | |
| 11663 | buf_ptr += sizeof(*cmd); |
| 11664 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 11665 | sizeof(wmi_bwf_peer_info) * |
| 11666 | cmd->num_peers); |
| 11667 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 11668 | peer_info = (wmi_bwf_peer_info *)buf_ptr; |
| 11669 | |
| 11670 | for (i = 0; i < cmd->num_peers; i++) { |
| 11671 | WMITLV_SET_HDR(&peer_info->tlv_header, |
| 11672 | WMITLV_TAG_STRUC_wmi_bwf_peer_info, |
| 11673 | WMITLV_GET_STRUCT_TLVLEN(wmi_bwf_peer_info)); |
| 11674 | peer_info->bwf_guaranteed_bandwidth = |
| 11675 | param->peer_info[i].throughput; |
| 11676 | peer_info->bwf_max_airtime = |
| 11677 | param->peer_info[i].max_airtime; |
| 11678 | peer_info->bwf_peer_priority = |
| 11679 | param->peer_info[i].priority; |
| 11680 | qdf_mem_copy(&peer_info->peer_macaddr, |
| 11681 | ¶m->peer_info[i].peer_macaddr, |
| 11682 | sizeof(param->peer_info[i].peer_macaddr)); |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 11683 | peer_info->vdev_id = |
| 11684 | param->peer_info[i].vdev_id; |
| 11685 | peer_info->pdev_id = |
| 11686 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11687 | param->peer_info[i].pdev_id); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11688 | peer_info++; |
| 11689 | } |
| 11690 | |
| 11691 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11692 | WMI_PEER_BWF_REQUEST_CMDID); |
| 11693 | |
| 11694 | if (retval != QDF_STATUS_SUCCESS) { |
| 11695 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 11696 | wmi_buf_free(buf); |
| 11697 | } |
| 11698 | |
| 11699 | return retval; |
| 11700 | } |
| 11701 | |
| 11702 | /** |
| 11703 | * send_mcast_group_update_cmd_tlv() - send mcast group update cmd to fw |
| 11704 | * @wmi_handle: wmi handle |
| 11705 | * @param: pointer to hold mcast update param |
| 11706 | * |
| 11707 | * Return: 0 for success or error code |
| 11708 | */ |
| 11709 | static QDF_STATUS |
| 11710 | send_mcast_group_update_cmd_tlv(wmi_unified_t wmi_handle, |
| 11711 | struct mcast_group_update_params *param) |
| 11712 | { |
| 11713 | wmi_peer_mcast_group_cmd_fixed_param *cmd; |
| 11714 | wmi_buf_t buf; |
| 11715 | QDF_STATUS ret; |
| 11716 | int32_t len; |
| 11717 | int offset = 0; |
| 11718 | static char dummymask[4] = { 0xFF, 0xFF, 0xFF, 0xFF}; |
| 11719 | |
| 11720 | len = sizeof(*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 | cmd = (wmi_peer_mcast_group_cmd_fixed_param *)wmi_buf_data(buf); |
| 11727 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11728 | WMITLV_TAG_STRUC_wmi_peer_mcast_group_cmd_fixed_param, |
| 11729 | WMITLV_GET_STRUCT_TLVLEN( |
| 11730 | wmi_peer_mcast_group_cmd_fixed_param)); |
| 11731 | /* confirm the buffer is 4-byte aligned */ |
| 11732 | QDF_ASSERT((((size_t) cmd) & 0x3) == 0); |
| 11733 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 11734 | |
| 11735 | cmd->vdev_id = param->vap_id; |
| 11736 | /* construct the message assuming our endianness matches the target */ |
| 11737 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_ACTION_M & |
| 11738 | (param->action << WMI_PEER_MCAST_GROUP_FLAG_ACTION_S); |
| 11739 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_M & |
| 11740 | (param->wildcard << WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_S); |
| 11741 | if (param->is_action_delete) |
| 11742 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_DELETEALL_M; |
| 11743 | |
| 11744 | if (param->is_mcast_addr_len) |
| 11745 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_IPV6_M; |
| 11746 | |
| 11747 | if (param->is_filter_mode_snoop) |
| 11748 | cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_SRC_FILTER_EXCLUDE_M; |
| 11749 | |
| 11750 | /* unicast address spec only applies for non-wildcard cases */ |
| 11751 | if (!param->wildcard && param->ucast_mac_addr) { |
| 11752 | WMI_CHAR_ARRAY_TO_MAC_ADDR(param->ucast_mac_addr, |
| 11753 | &cmd->ucast_mac_addr); |
| 11754 | } |
| 11755 | if (param->mcast_ip_addr) { |
| 11756 | QDF_ASSERT(param->mcast_ip_addr_bytes <= |
| 11757 | sizeof(cmd->mcast_ip_addr)); |
| 11758 | offset = sizeof(cmd->mcast_ip_addr) - |
| 11759 | param->mcast_ip_addr_bytes; |
| 11760 | qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_addr) + offset, |
| 11761 | param->mcast_ip_addr, |
| 11762 | param->mcast_ip_addr_bytes); |
| 11763 | } |
| 11764 | if (!param->mask) |
| 11765 | param->mask = &dummymask[0]; |
| 11766 | |
| 11767 | qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_mask) + offset, |
| 11768 | param->mask, |
| 11769 | param->mcast_ip_addr_bytes); |
| 11770 | |
| 11771 | if (param->srcs && param->nsrcs) { |
| 11772 | cmd->num_filter_addr = param->nsrcs; |
| 11773 | QDF_ASSERT((param->nsrcs * param->mcast_ip_addr_bytes) <= |
| 11774 | sizeof(cmd->filter_addr)); |
| 11775 | |
| 11776 | qdf_mem_copy(((uint8_t *) &cmd->filter_addr), param->srcs, |
| 11777 | param->nsrcs * param->mcast_ip_addr_bytes); |
| 11778 | } |
| 11779 | |
| 11780 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11781 | WMI_PEER_MCAST_GROUP_CMDID); |
| 11782 | |
| 11783 | if (ret != QDF_STATUS_SUCCESS) { |
| 11784 | WMI_LOGE("%s : WMI Failed\n", __func__); |
| 11785 | wmi_buf_free(buf); |
| 11786 | } |
| 11787 | |
| 11788 | return ret; |
| 11789 | } |
| 11790 | |
| 11791 | /** |
| 11792 | * send_vdev_spectral_configure_cmd_tlv() - send VDEV spectral configure |
| 11793 | * command to fw |
| 11794 | * @wmi_handle: wmi handle |
| 11795 | * @param: pointer to hold spectral config parameter |
| 11796 | * |
| 11797 | * Return: 0 for success or error code |
| 11798 | */ |
| 11799 | static QDF_STATUS send_vdev_spectral_configure_cmd_tlv(wmi_unified_t wmi_handle, |
| 11800 | struct vdev_spectral_configure_params *param) |
| 11801 | { |
| 11802 | wmi_vdev_spectral_configure_cmd_fixed_param *cmd; |
| 11803 | wmi_buf_t buf; |
| 11804 | QDF_STATUS ret; |
| 11805 | int32_t len; |
| 11806 | |
| 11807 | len = sizeof(*cmd); |
| 11808 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11809 | if (!buf) { |
| 11810 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11811 | return QDF_STATUS_E_FAILURE; |
| 11812 | } |
| 11813 | |
| 11814 | cmd = (wmi_vdev_spectral_configure_cmd_fixed_param *)wmi_buf_data(buf); |
| 11815 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11816 | WMITLV_TAG_STRUC_wmi_vdev_spectral_configure_cmd_fixed_param, |
| 11817 | WMITLV_GET_STRUCT_TLVLEN( |
Edayilliam Jayadev | dca2054 | 2017-07-21 12:24:04 +0530 | [diff] [blame] | 11818 | wmi_vdev_spectral_configure_cmd_fixed_param)); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11819 | |
| 11820 | cmd->vdev_id = param->vdev_id; |
| 11821 | cmd->spectral_scan_count = param->count; |
| 11822 | cmd->spectral_scan_period = param->period; |
| 11823 | cmd->spectral_scan_priority = param->spectral_pri; |
| 11824 | cmd->spectral_scan_fft_size = param->fft_size; |
| 11825 | cmd->spectral_scan_gc_ena = param->gc_enable; |
| 11826 | cmd->spectral_scan_restart_ena = param->restart_enable; |
| 11827 | cmd->spectral_scan_noise_floor_ref = param->noise_floor_ref; |
| 11828 | cmd->spectral_scan_init_delay = param->init_delay; |
| 11829 | cmd->spectral_scan_nb_tone_thr = param->nb_tone_thr; |
| 11830 | cmd->spectral_scan_str_bin_thr = param->str_bin_thr; |
| 11831 | cmd->spectral_scan_wb_rpt_mode = param->wb_rpt_mode; |
| 11832 | cmd->spectral_scan_rssi_rpt_mode = param->rssi_rpt_mode; |
| 11833 | cmd->spectral_scan_rssi_thr = param->rssi_thr; |
| 11834 | cmd->spectral_scan_pwr_format = param->pwr_format; |
| 11835 | cmd->spectral_scan_rpt_mode = param->rpt_mode; |
| 11836 | cmd->spectral_scan_bin_scale = param->bin_scale; |
| 11837 | cmd->spectral_scan_dBm_adj = param->dBm_adj; |
| 11838 | cmd->spectral_scan_chn_mask = param->chn_mask; |
| 11839 | |
| 11840 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11841 | WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID); |
| 11842 | |
| 11843 | if (ret != 0) { |
| 11844 | WMI_LOGE("Sending set quiet cmd failed\n"); |
| 11845 | wmi_buf_free(buf); |
| 11846 | } |
| 11847 | |
| 11848 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID\n", |
| 11849 | __func__); |
| 11850 | |
| 11851 | WMI_LOGI("vdev_id = %u\n" |
| 11852 | "spectral_scan_count = %u\n" |
| 11853 | "spectral_scan_period = %u\n" |
| 11854 | "spectral_scan_priority = %u\n" |
| 11855 | "spectral_scan_fft_size = %u\n" |
| 11856 | "spectral_scan_gc_ena = %u\n" |
| 11857 | "spectral_scan_restart_ena = %u\n" |
| 11858 | "spectral_scan_noise_floor_ref = %u\n" |
| 11859 | "spectral_scan_init_delay = %u\n" |
| 11860 | "spectral_scan_nb_tone_thr = %u\n" |
| 11861 | "spectral_scan_str_bin_thr = %u\n" |
| 11862 | "spectral_scan_wb_rpt_mode = %u\n" |
| 11863 | "spectral_scan_rssi_rpt_mode = %u\n" |
| 11864 | "spectral_scan_rssi_thr = %u\n" |
| 11865 | "spectral_scan_pwr_format = %u\n" |
| 11866 | "spectral_scan_rpt_mode = %u\n" |
| 11867 | "spectral_scan_bin_scale = %u\n" |
| 11868 | "spectral_scan_dBm_adj = %u\n" |
| 11869 | "spectral_scan_chn_mask = %u\n", |
| 11870 | param->vdev_id, |
| 11871 | param->count, |
| 11872 | param->period, |
| 11873 | param->spectral_pri, |
| 11874 | param->fft_size, |
| 11875 | param->gc_enable, |
| 11876 | param->restart_enable, |
| 11877 | param->noise_floor_ref, |
| 11878 | param->init_delay, |
| 11879 | param->nb_tone_thr, |
| 11880 | param->str_bin_thr, |
| 11881 | param->wb_rpt_mode, |
| 11882 | param->rssi_rpt_mode, |
| 11883 | param->rssi_thr, |
| 11884 | param->pwr_format, |
| 11885 | param->rpt_mode, |
| 11886 | param->bin_scale, |
| 11887 | param->dBm_adj, |
| 11888 | param->chn_mask); |
| 11889 | WMI_LOGI("%s: Status: %d\n\n", __func__, ret); |
| 11890 | |
| 11891 | return ret; |
| 11892 | } |
| 11893 | |
| 11894 | /** |
| 11895 | * send_vdev_spectral_enable_cmd_tlv() - send VDEV spectral configure |
| 11896 | * command to fw |
| 11897 | * @wmi_handle: wmi handle |
| 11898 | * @param: pointer to hold spectral enable parameter |
| 11899 | * |
| 11900 | * Return: 0 for success or error code |
| 11901 | */ |
| 11902 | static QDF_STATUS send_vdev_spectral_enable_cmd_tlv(wmi_unified_t wmi_handle, |
| 11903 | struct vdev_spectral_enable_params *param) |
| 11904 | { |
| 11905 | wmi_vdev_spectral_enable_cmd_fixed_param *cmd; |
| 11906 | wmi_buf_t buf; |
| 11907 | QDF_STATUS ret; |
| 11908 | int32_t len; |
| 11909 | |
| 11910 | len = sizeof(*cmd); |
| 11911 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11912 | if (!buf) { |
| 11913 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 11914 | return QDF_STATUS_E_FAILURE; |
| 11915 | } |
| 11916 | |
| 11917 | cmd = (wmi_vdev_spectral_enable_cmd_fixed_param *)wmi_buf_data(buf); |
| 11918 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 11919 | WMITLV_TAG_STRUC_wmi_vdev_spectral_enable_cmd_fixed_param, |
| 11920 | WMITLV_GET_STRUCT_TLVLEN( |
Edayilliam Jayadev | dca2054 | 2017-07-21 12:24:04 +0530 | [diff] [blame] | 11921 | wmi_vdev_spectral_enable_cmd_fixed_param)); |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 11922 | |
| 11923 | cmd->vdev_id = param->vdev_id; |
| 11924 | |
| 11925 | if (param->active_valid) { |
| 11926 | cmd->trigger_cmd = param->active ? 1 : 2; |
| 11927 | /* 1: Trigger, 2: Clear Trigger */ |
| 11928 | } else { |
| 11929 | cmd->trigger_cmd = 0; /* 0: Ignore */ |
| 11930 | } |
| 11931 | |
| 11932 | if (param->enabled_valid) { |
| 11933 | cmd->enable_cmd = param->enabled ? 1 : 2; |
| 11934 | /* 1: Enable 2: Disable */ |
| 11935 | } else { |
| 11936 | cmd->enable_cmd = 0; /* 0: Ignore */ |
| 11937 | } |
| 11938 | |
| 11939 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 11940 | WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID); |
| 11941 | |
| 11942 | if (ret != 0) { |
| 11943 | WMI_LOGE("Sending scan enable CMD failed\n"); |
| 11944 | wmi_buf_free(buf); |
| 11945 | } |
| 11946 | |
| 11947 | WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID\n", __func__); |
| 11948 | |
| 11949 | WMI_LOGI("vdev_id = %u\n" |
| 11950 | "trigger_cmd = %u\n" |
| 11951 | "enable_cmd = %u\n", |
| 11952 | cmd->vdev_id, |
| 11953 | cmd->trigger_cmd, |
| 11954 | cmd->enable_cmd); |
| 11955 | |
| 11956 | WMI_LOGI("%s: Status: %d\n\n", __func__, ret); |
| 11957 | |
| 11958 | return ret; |
| 11959 | } |
| 11960 | |
| 11961 | /** |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 11962 | * send_thermal_mitigation_param_cmd_tlv() - configure thermal mitigation params |
| 11963 | * @param wmi_handle : handle to WMI. |
| 11964 | * @param param : pointer to hold thermal mitigation param |
| 11965 | * |
| 11966 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 11967 | */ |
| 11968 | static QDF_STATUS send_thermal_mitigation_param_cmd_tlv( |
| 11969 | wmi_unified_t wmi_handle, |
| 11970 | struct thermal_mitigation_params *param) |
| 11971 | { |
| 11972 | wmi_therm_throt_config_request_fixed_param *tt_conf = NULL; |
| 11973 | wmi_therm_throt_level_config_info *lvl_conf = NULL; |
| 11974 | wmi_buf_t buf = NULL; |
| 11975 | uint8_t *buf_ptr = NULL; |
| 11976 | int error; |
| 11977 | int32_t len; |
| 11978 | int i; |
| 11979 | |
| 11980 | len = sizeof(*tt_conf) + WMI_TLV_HDR_SIZE + |
| 11981 | THERMAL_LEVELS * sizeof(wmi_therm_throt_level_config_info); |
| 11982 | |
| 11983 | buf = wmi_buf_alloc(wmi_handle, len); |
| 11984 | if (!buf) { |
| 11985 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 11986 | return QDF_STATUS_E_NOMEM; |
| 11987 | } |
| 11988 | tt_conf = (wmi_therm_throt_config_request_fixed_param *) wmi_buf_data(buf); |
| 11989 | |
| 11990 | /* init fixed params */ |
| 11991 | WMITLV_SET_HDR(tt_conf, |
| 11992 | WMITLV_TAG_STRUC_wmi_therm_throt_config_request_fixed_param, |
| 11993 | (WMITLV_GET_STRUCT_TLVLEN(wmi_therm_throt_config_request_fixed_param))); |
| 11994 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 11995 | tt_conf->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 11996 | param->pdev_id); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 11997 | tt_conf->enable = param->enable; |
| 11998 | tt_conf->dc = param->dc; |
| 11999 | tt_conf->dc_per_event = param->dc_per_event; |
| 12000 | tt_conf->therm_throt_levels = THERMAL_LEVELS; |
| 12001 | |
| 12002 | buf_ptr = (uint8_t *) ++tt_conf; |
| 12003 | /* init TLV params */ |
| 12004 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 12005 | (THERMAL_LEVELS * sizeof(wmi_therm_throt_level_config_info))); |
| 12006 | |
| 12007 | lvl_conf = (wmi_therm_throt_level_config_info *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 12008 | for (i = 0; i < THERMAL_LEVELS; i++) { |
| 12009 | WMITLV_SET_HDR(&lvl_conf->tlv_header, |
| 12010 | WMITLV_TAG_STRUC_wmi_therm_throt_level_config_info, |
| 12011 | WMITLV_GET_STRUCT_TLVLEN(wmi_therm_throt_level_config_info)); |
| 12012 | lvl_conf->temp_lwm = param->levelconf[i].tmplwm; |
| 12013 | lvl_conf->temp_hwm = param->levelconf[i].tmphwm; |
| 12014 | lvl_conf->dc_off_percent = param->levelconf[i].dcoffpercent; |
| 12015 | lvl_conf->prio = param->levelconf[i].priority; |
| 12016 | lvl_conf++; |
| 12017 | } |
| 12018 | |
| 12019 | error = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12020 | WMI_THERM_THROT_SET_CONF_CMDID); |
| 12021 | if (QDF_IS_STATUS_ERROR(error)) { |
| 12022 | wmi_buf_free(buf); |
| 12023 | WMI_LOGE("Failed to send WMI_THERM_THROT_SET_CONF_CMDID command"); |
| 12024 | } |
| 12025 | |
| 12026 | return error; |
| 12027 | } |
| 12028 | |
| 12029 | /** |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12030 | * send_pdev_qvit_cmd_tlv() - send qvit command to fw |
| 12031 | * @wmi_handle: wmi handle |
| 12032 | * @param: pointer to pdev_qvit_params |
| 12033 | * |
| 12034 | * Return: 0 for success or error code |
| 12035 | */ |
| 12036 | static QDF_STATUS |
| 12037 | send_pdev_qvit_cmd_tlv(wmi_unified_t wmi_handle, |
| 12038 | struct pdev_qvit_params *param) |
| 12039 | { |
| 12040 | wmi_buf_t buf; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12041 | QDF_STATUS ret = QDF_STATUS_E_INVAL; |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12042 | uint8_t *cmd; |
| 12043 | static uint8_t msgref = 1; |
| 12044 | uint8_t segnumber = 0, seginfo, numsegments; |
| 12045 | uint16_t chunk_len, total_bytes; |
| 12046 | uint8_t *bufpos; |
| 12047 | QVIT_SEG_HDR_INFO_STRUCT seghdrinfo; |
| 12048 | |
| 12049 | bufpos = param->utf_payload; |
| 12050 | total_bytes = param->len; |
| 12051 | ASSERT(total_bytes / MAX_WMI_QVIT_LEN == |
| 12052 | (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN)); |
| 12053 | numsegments = (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN); |
| 12054 | |
| 12055 | if (param->len - (numsegments * MAX_WMI_QVIT_LEN)) |
| 12056 | numsegments++; |
| 12057 | |
| 12058 | while (param->len) { |
| 12059 | if (param->len > MAX_WMI_QVIT_LEN) |
| 12060 | chunk_len = MAX_WMI_QVIT_LEN; /* MAX messsage */ |
| 12061 | else |
| 12062 | chunk_len = param->len; |
| 12063 | |
| 12064 | buf = wmi_buf_alloc(wmi_handle, |
| 12065 | (chunk_len + sizeof(seghdrinfo) + |
| 12066 | WMI_TLV_HDR_SIZE)); |
| 12067 | if (!buf) { |
| 12068 | WMI_LOGE("%s:wmi_buf_alloc failed", __func__); |
| 12069 | return QDF_STATUS_E_NOMEM; |
| 12070 | } |
| 12071 | |
| 12072 | cmd = (uint8_t *) wmi_buf_data(buf); |
| 12073 | |
| 12074 | seghdrinfo.len = total_bytes; |
| 12075 | seghdrinfo.msgref = msgref; |
| 12076 | seginfo = ((numsegments << 4) & 0xF0) | (segnumber & 0xF); |
| 12077 | seghdrinfo.segmentInfo = seginfo; |
| 12078 | |
| 12079 | segnumber++; |
| 12080 | |
| 12081 | WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE, |
| 12082 | (chunk_len + sizeof(seghdrinfo))); |
| 12083 | cmd += WMI_TLV_HDR_SIZE; |
| 12084 | qdf_mem_copy(cmd, &seghdrinfo, sizeof(seghdrinfo)); |
| 12085 | qdf_mem_copy(&cmd[sizeof(seghdrinfo)], bufpos, chunk_len); |
| 12086 | |
| 12087 | ret = wmi_unified_cmd_send(wmi_handle, buf, |
| 12088 | (chunk_len + sizeof(seghdrinfo) + |
| 12089 | WMI_TLV_HDR_SIZE), |
| 12090 | WMI_PDEV_QVIT_CMDID); |
| 12091 | |
| 12092 | if (ret != 0) { |
| 12093 | WMI_LOGE("Failed to send WMI_PDEV_QVIT_CMDID command"); |
| 12094 | wmi_buf_free(buf); |
| 12095 | break; |
| 12096 | } |
| 12097 | |
| 12098 | param->len -= chunk_len; |
| 12099 | bufpos += chunk_len; |
| 12100 | } |
| 12101 | msgref++; |
| 12102 | |
| 12103 | return ret; |
| 12104 | } |
| 12105 | |
| 12106 | /** |
| 12107 | * send_wmm_update_cmd_tlv() - send wmm update command to fw |
| 12108 | * @wmi_handle: wmi handle |
| 12109 | * @param: pointer to wmm update param |
| 12110 | * |
| 12111 | * Return: 0 for success or error code |
| 12112 | */ |
| 12113 | static QDF_STATUS |
| 12114 | send_wmm_update_cmd_tlv(wmi_unified_t wmi_handle, |
| 12115 | struct wmm_update_params *param) |
| 12116 | { |
| 12117 | wmi_pdev_set_wmm_params_cmd_fixed_param *cmd; |
| 12118 | wmi_wmm_params *wmm_param; |
| 12119 | wmi_buf_t buf; |
| 12120 | QDF_STATUS ret; |
| 12121 | int32_t len; |
| 12122 | int ac = 0; |
| 12123 | struct wmi_host_wmeParams *wmep; |
| 12124 | uint8_t *buf_ptr; |
| 12125 | |
| 12126 | len = sizeof(*cmd) + (WME_NUM_AC * sizeof(*wmm_param)); |
| 12127 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12128 | if (!buf) { |
| 12129 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12130 | return QDF_STATUS_E_FAILURE; |
| 12131 | } |
| 12132 | |
| 12133 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12134 | cmd = (wmi_pdev_set_wmm_params_cmd_fixed_param *) buf_ptr; |
| 12135 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12136 | WMITLV_TAG_STRUC_wmi_pdev_set_wmm_params_cmd_fixed_param, |
| 12137 | WMITLV_GET_STRUCT_TLVLEN |
| 12138 | (wmi_pdev_set_wmm_params_cmd_fixed_param)); |
| 12139 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12140 | cmd->reserved0 = WMI_HOST_PDEV_ID_SOC; |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 12141 | |
| 12142 | buf_ptr += sizeof(wmi_pdev_set_wmm_params_cmd_fixed_param); |
| 12143 | |
| 12144 | for (ac = 0; ac < WME_NUM_AC; ac++) { |
| 12145 | wmep = ¶m->wmep_array[ac]; |
| 12146 | wmm_param = (wmi_wmm_params *)buf_ptr; |
| 12147 | WMITLV_SET_HDR(&wmm_param->tlv_header, |
| 12148 | WMITLV_TAG_STRUC_wmi_wmm_params, |
| 12149 | WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_params)); |
| 12150 | wmm_param->aifs = wmep->wmep_aifsn; |
| 12151 | wmm_param->cwmin = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmin); |
| 12152 | wmm_param->cwmax = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmax); |
| 12153 | wmm_param->txoplimit = ATH_TXOP_TO_US(wmep->wmep_txopLimit); |
| 12154 | wmm_param->acm = wmep->wmep_acm; |
| 12155 | wmm_param->no_ack = wmep->wmep_noackPolicy; |
| 12156 | buf_ptr += sizeof(wmi_wmm_params); |
| 12157 | } |
| 12158 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12159 | WMI_PDEV_SET_WMM_PARAMS_CMDID); |
| 12160 | |
| 12161 | if (ret != 0) { |
| 12162 | WMI_LOGE("Sending WMM update CMD failed\n"); |
| 12163 | wmi_buf_free(buf); |
| 12164 | } |
| 12165 | |
| 12166 | return ret; |
| 12167 | } |
| 12168 | |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 12169 | /** |
| 12170 | * send_coex_config_cmd_tlv() - send coex config command to fw |
| 12171 | * @wmi_handle: wmi handle |
| 12172 | * @param: pointer to coex config param |
| 12173 | * |
| 12174 | * Return: 0 for success or error code |
| 12175 | */ |
| 12176 | static QDF_STATUS |
| 12177 | send_coex_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 12178 | struct coex_config_params *param) |
| 12179 | { |
| 12180 | WMI_COEX_CONFIG_CMD_fixed_param *cmd; |
| 12181 | wmi_buf_t buf; |
| 12182 | QDF_STATUS ret; |
| 12183 | int32_t len; |
| 12184 | |
| 12185 | len = sizeof(*cmd); |
| 12186 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12187 | if (!buf) { |
| 12188 | WMI_LOGE("%s: wmi_buf_alloc failed\n", __func__); |
| 12189 | return QDF_STATUS_E_FAILURE; |
| 12190 | } |
| 12191 | |
| 12192 | cmd = (WMI_COEX_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 12193 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12194 | WMITLV_TAG_STRUC_WMI_COEX_CONFIG_CMD_fixed_param, |
| 12195 | WMITLV_GET_STRUCT_TLVLEN( |
Sathish Kumar | 8458a05 | 2017-05-12 15:52:00 +0530 | [diff] [blame] | 12196 | WMI_COEX_CONFIG_CMD_fixed_param)); |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 12197 | |
| 12198 | cmd->vdev_id = param->vdev_id; |
| 12199 | cmd->config_type = param->config_type; |
| 12200 | cmd->config_arg1 = param->config_arg1; |
| 12201 | cmd->config_arg2 = param->config_arg2; |
| 12202 | cmd->config_arg3 = param->config_arg3; |
| 12203 | cmd->config_arg4 = param->config_arg4; |
| 12204 | cmd->config_arg5 = param->config_arg5; |
| 12205 | cmd->config_arg6 = param->config_arg6; |
| 12206 | |
| 12207 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12208 | WMI_COEX_CONFIG_CMDID); |
| 12209 | |
| 12210 | if (ret != 0) { |
| 12211 | WMI_LOGE("Sending COEX CONFIG CMD failed\n"); |
| 12212 | wmi_buf_free(buf); |
| 12213 | } |
| 12214 | |
| 12215 | return ret; |
| 12216 | } |
| 12217 | |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 12218 | static |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12219 | void wmi_copy_resource_config(wmi_resource_config *resource_cfg, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12220 | target_resource_config *tgt_res_cfg) |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12221 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12222 | resource_cfg->num_vdevs = tgt_res_cfg->num_vdevs; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12223 | resource_cfg->num_peers = tgt_res_cfg->num_peers; |
| 12224 | resource_cfg->num_offload_peers = tgt_res_cfg->num_offload_peers; |
| 12225 | resource_cfg->num_offload_reorder_buffs = |
| 12226 | tgt_res_cfg->num_offload_reorder_buffs; |
| 12227 | resource_cfg->num_peer_keys = tgt_res_cfg->num_peer_keys; |
| 12228 | resource_cfg->num_tids = tgt_res_cfg->num_tids; |
| 12229 | resource_cfg->ast_skid_limit = tgt_res_cfg->ast_skid_limit; |
| 12230 | resource_cfg->tx_chain_mask = tgt_res_cfg->tx_chain_mask; |
| 12231 | resource_cfg->rx_chain_mask = tgt_res_cfg->rx_chain_mask; |
| 12232 | resource_cfg->rx_timeout_pri[0] = tgt_res_cfg->rx_timeout_pri[0]; |
| 12233 | resource_cfg->rx_timeout_pri[1] = tgt_res_cfg->rx_timeout_pri[1]; |
| 12234 | resource_cfg->rx_timeout_pri[2] = tgt_res_cfg->rx_timeout_pri[2]; |
| 12235 | resource_cfg->rx_timeout_pri[3] = tgt_res_cfg->rx_timeout_pri[3]; |
| 12236 | resource_cfg->rx_decap_mode = tgt_res_cfg->rx_decap_mode; |
| 12237 | resource_cfg->scan_max_pending_req = |
| 12238 | tgt_res_cfg->scan_max_pending_req; |
| 12239 | resource_cfg->bmiss_offload_max_vdev = |
| 12240 | tgt_res_cfg->bmiss_offload_max_vdev; |
| 12241 | resource_cfg->roam_offload_max_vdev = |
| 12242 | tgt_res_cfg->roam_offload_max_vdev; |
| 12243 | resource_cfg->roam_offload_max_ap_profiles = |
| 12244 | tgt_res_cfg->roam_offload_max_ap_profiles; |
| 12245 | resource_cfg->num_mcast_groups = tgt_res_cfg->num_mcast_groups; |
| 12246 | resource_cfg->num_mcast_table_elems = |
| 12247 | tgt_res_cfg->num_mcast_table_elems; |
| 12248 | resource_cfg->mcast2ucast_mode = tgt_res_cfg->mcast2ucast_mode; |
| 12249 | resource_cfg->tx_dbg_log_size = tgt_res_cfg->tx_dbg_log_size; |
| 12250 | resource_cfg->num_wds_entries = tgt_res_cfg->num_wds_entries; |
| 12251 | resource_cfg->dma_burst_size = tgt_res_cfg->dma_burst_size; |
| 12252 | resource_cfg->mac_aggr_delim = tgt_res_cfg->mac_aggr_delim; |
| 12253 | resource_cfg->rx_skip_defrag_timeout_dup_detection_check = |
| 12254 | tgt_res_cfg->rx_skip_defrag_timeout_dup_detection_check; |
| 12255 | resource_cfg->vow_config = tgt_res_cfg->vow_config; |
| 12256 | resource_cfg->gtk_offload_max_vdev = tgt_res_cfg->gtk_offload_max_vdev; |
| 12257 | resource_cfg->num_msdu_desc = tgt_res_cfg->num_msdu_desc; |
| 12258 | resource_cfg->max_frag_entries = tgt_res_cfg->max_frag_entries; |
| 12259 | resource_cfg->num_tdls_vdevs = tgt_res_cfg->num_tdls_vdevs; |
| 12260 | resource_cfg->num_tdls_conn_table_entries = |
| 12261 | tgt_res_cfg->num_tdls_conn_table_entries; |
| 12262 | resource_cfg->beacon_tx_offload_max_vdev = |
| 12263 | tgt_res_cfg->beacon_tx_offload_max_vdev; |
| 12264 | resource_cfg->num_multicast_filter_entries = |
| 12265 | tgt_res_cfg->num_multicast_filter_entries; |
| 12266 | resource_cfg->num_wow_filters = |
| 12267 | tgt_res_cfg->num_wow_filters; |
| 12268 | resource_cfg->num_keep_alive_pattern = |
| 12269 | tgt_res_cfg->num_keep_alive_pattern; |
| 12270 | resource_cfg->keep_alive_pattern_size = |
| 12271 | tgt_res_cfg->keep_alive_pattern_size; |
| 12272 | resource_cfg->max_tdls_concurrent_sleep_sta = |
| 12273 | tgt_res_cfg->max_tdls_concurrent_sleep_sta; |
| 12274 | resource_cfg->max_tdls_concurrent_buffer_sta = |
| 12275 | tgt_res_cfg->max_tdls_concurrent_buffer_sta; |
| 12276 | resource_cfg->wmi_send_separate = |
| 12277 | tgt_res_cfg->wmi_send_separate; |
| 12278 | resource_cfg->num_ocb_vdevs = |
| 12279 | tgt_res_cfg->num_ocb_vdevs; |
| 12280 | resource_cfg->num_ocb_channels = |
| 12281 | tgt_res_cfg->num_ocb_channels; |
| 12282 | resource_cfg->num_ocb_schedules = |
| 12283 | tgt_res_cfg->num_ocb_schedules; |
Kiran Venkatappa | 8e146df | 2017-02-08 14:51:13 +0530 | [diff] [blame] | 12284 | resource_cfg->bpf_instruction_size = tgt_res_cfg->bpf_instruction_size; |
| 12285 | resource_cfg->max_bssid_rx_filters = tgt_res_cfg->max_bssid_rx_filters; |
| 12286 | resource_cfg->use_pdev_id = tgt_res_cfg->use_pdev_id; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 12287 | |
| 12288 | WMI_RSRC_CFG_FLAG_ATF_CONFIG_ENABLE_SET(resource_cfg->flag1, |
| 12289 | tgt_res_cfg->atf_config); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12290 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 12291 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12292 | /** |
| 12293 | * send_init_cmd_tlv() - wmi init command |
| 12294 | * @wmi_handle: pointer to wmi handle |
| 12295 | * @res_cfg: resource config |
| 12296 | * @num_mem_chunks: no of mem chunck |
| 12297 | * @mem_chunk: pointer to mem chunck structure |
| 12298 | * |
| 12299 | * This function sends IE information to firmware |
| 12300 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12301 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12302 | * |
| 12303 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12304 | static QDF_STATUS send_init_cmd_tlv(wmi_unified_t wmi_handle, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12305 | wmi_resource_config *tgt_res_cfg, |
| 12306 | uint8_t num_mem_chunks, struct wmi_host_mem_chunk *mem_chunks, |
| 12307 | bool action) |
| 12308 | { |
| 12309 | wmi_buf_t buf; |
| 12310 | wmi_init_cmd_fixed_param *cmd; |
| 12311 | wmi_abi_version my_vers; |
| 12312 | int num_whitelist; |
| 12313 | uint8_t *buf_ptr; |
| 12314 | wmi_resource_config *resource_cfg; |
| 12315 | wlan_host_memory_chunk *host_mem_chunks; |
| 12316 | uint32_t mem_chunk_len = 0; |
| 12317 | uint16_t idx; |
| 12318 | int len; |
| 12319 | int ret; |
| 12320 | |
| 12321 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + WMI_TLV_HDR_SIZE; |
| 12322 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
| 12323 | buf = wmi_buf_alloc(wmi_handle, len + mem_chunk_len); |
| 12324 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12325 | WMI_LOGD("%s: wmi_buf_alloc failed\n", __func__); |
| 12326 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12327 | } |
| 12328 | |
| 12329 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 12330 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 12331 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 12332 | |
| 12333 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 12334 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 12335 | + WMI_TLV_HDR_SIZE); |
| 12336 | |
| 12337 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12338 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 12339 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 12340 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12341 | qdf_mem_copy(resource_cfg, tgt_res_cfg, sizeof(wmi_resource_config)); |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12342 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 12343 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 12344 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 12345 | |
| 12346 | for (idx = 0; idx < num_mem_chunks; ++idx) { |
| 12347 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 12348 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 12349 | WMITLV_GET_STRUCT_TLVLEN |
| 12350 | (wlan_host_memory_chunk)); |
| 12351 | host_mem_chunks[idx].ptr = mem_chunks[idx].paddr; |
| 12352 | host_mem_chunks[idx].size = mem_chunks[idx].len; |
| 12353 | host_mem_chunks[idx].req_id = mem_chunks[idx].req_id; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12354 | WMI_LOGD("chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12355 | idx, host_mem_chunks[idx].size, |
| 12356 | host_mem_chunks[idx].ptr); |
| 12357 | } |
| 12358 | cmd->num_host_mem_chunks = num_mem_chunks; |
| 12359 | len += (num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 12360 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 12361 | WMITLV_TAG_ARRAY_STRUC, |
| 12362 | (sizeof(wlan_host_memory_chunk) * |
| 12363 | num_mem_chunks)); |
| 12364 | |
| 12365 | num_whitelist = sizeof(version_whitelist) / |
| 12366 | sizeof(wmi_whitelist_version_info); |
| 12367 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 12368 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 12369 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 12370 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 12371 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 12372 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12373 | #ifdef CONFIG_MCL |
| 12374 | /* This needs to be enabled for WIN Lithium after removing dependency |
| 12375 | * on wmi_unified.h from priv.h for using wmi_abi_version type */ |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12376 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 12377 | &my_vers, |
| 12378 | &wmi_handle->fw_abi_version, |
| 12379 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12380 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12381 | WMI_LOGD("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12382 | __func__, WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 12383 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 12384 | cmd->host_abi_vers.abi_version_ns_0, |
| 12385 | cmd->host_abi_vers.abi_version_ns_1, |
| 12386 | cmd->host_abi_vers.abi_version_ns_2, |
| 12387 | cmd->host_abi_vers.abi_version_ns_3); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12388 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12389 | /* Save version sent from host - |
| 12390 | * Will be used to check ready event |
| 12391 | */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12392 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12393 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12394 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12395 | if (action) { |
| 12396 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12397 | WMI_INIT_CMDID); |
| 12398 | if (ret) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12399 | 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] | 12400 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12401 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12402 | } |
| 12403 | } else { |
| 12404 | wmi_handle->saved_wmi_init_cmd.buf = buf; |
| 12405 | wmi_handle->saved_wmi_init_cmd.buf_len = len; |
| 12406 | } |
| 12407 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12408 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12409 | |
| 12410 | } |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 12411 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12412 | /** |
| 12413 | * send_saved_init_cmd_tlv() - wmi init command |
| 12414 | * @wmi_handle: pointer to wmi handle |
| 12415 | * |
| 12416 | * This function sends IE information to firmware |
| 12417 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12418 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12419 | * |
| 12420 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12421 | 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] | 12422 | { |
| 12423 | int status; |
| 12424 | |
| 12425 | if (!wmi_handle->saved_wmi_init_cmd.buf || |
| 12426 | !wmi_handle->saved_wmi_init_cmd.buf_len) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12427 | WMI_LOGP("Service ready ext event w/o WMI_SERVICE_EXT_MSG!"); |
| 12428 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12429 | } |
| 12430 | status = wmi_unified_cmd_send(wmi_handle, |
| 12431 | wmi_handle->saved_wmi_init_cmd.buf, |
| 12432 | wmi_handle->saved_wmi_init_cmd.buf_len, |
| 12433 | WMI_INIT_CMDID); |
| 12434 | if (status) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12435 | 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] | 12436 | wmi_buf_free(wmi_handle->saved_wmi_init_cmd.buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12437 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12438 | } |
| 12439 | wmi_handle->saved_wmi_init_cmd.buf = NULL; |
| 12440 | wmi_handle->saved_wmi_init_cmd.buf_len = 0; |
| 12441 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12442 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12443 | } |
| 12444 | |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12445 | 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] | 12446 | { |
| 12447 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 12448 | wmi_service_ready_event_fixed_param *ev; |
| 12449 | |
| 12450 | |
| 12451 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 12452 | |
| 12453 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 12454 | if (!ev) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12455 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12456 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12457 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12458 | /*Save fw version from service ready message */ |
| 12459 | /*This will be used while sending INIT message */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12460 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12461 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12462 | #endif |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12463 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12464 | } |
| 12465 | |
| 12466 | /** |
| 12467 | * wmi_unified_save_fw_version_cmd() - save fw version |
| 12468 | * @wmi_handle: pointer to wmi handle |
| 12469 | * @res_cfg: resource config |
| 12470 | * @num_mem_chunks: no of mem chunck |
| 12471 | * @mem_chunk: pointer to mem chunck structure |
| 12472 | * |
| 12473 | * This function sends IE information to firmware |
| 12474 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12475 | * Return: QDF_STATUS_SUCCESS for success otherwise failure |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12476 | * |
| 12477 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12478 | 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] | 12479 | void *evt_buf) |
| 12480 | { |
| 12481 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 12482 | wmi_ready_event_fixed_param *ev = NULL; |
| 12483 | |
| 12484 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 12485 | ev = param_buf->fixed_param; |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12486 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12487 | if (!wmi_versions_are_compatible(&wmi_handle->final_abi_vers, |
| 12488 | &ev->fw_abi_vers)) { |
| 12489 | /* |
| 12490 | * Error: Our host version and the given firmware version |
| 12491 | * are incompatible. |
| 12492 | **/ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12493 | WMI_LOGD("%s: Error: Incompatible WMI version." |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12494 | "Host: %d,%d,0x%x 0x%x 0x%x 0x%x, FW: %d,%d,0x%x 0x%x 0x%x 0x%x\n", |
| 12495 | __func__, |
| 12496 | WMI_VER_GET_MAJOR(wmi_handle->final_abi_vers. |
| 12497 | abi_version_0), |
| 12498 | WMI_VER_GET_MINOR(wmi_handle->final_abi_vers. |
| 12499 | abi_version_0), |
| 12500 | wmi_handle->final_abi_vers.abi_version_ns_0, |
| 12501 | wmi_handle->final_abi_vers.abi_version_ns_1, |
| 12502 | wmi_handle->final_abi_vers.abi_version_ns_2, |
| 12503 | wmi_handle->final_abi_vers.abi_version_ns_3, |
| 12504 | WMI_VER_GET_MAJOR(ev->fw_abi_vers.abi_version_0), |
| 12505 | WMI_VER_GET_MINOR(ev->fw_abi_vers.abi_version_0), |
| 12506 | ev->fw_abi_vers.abi_version_ns_0, |
| 12507 | ev->fw_abi_vers.abi_version_ns_1, |
| 12508 | ev->fw_abi_vers.abi_version_ns_2, |
| 12509 | ev->fw_abi_vers.abi_version_ns_3); |
| 12510 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12511 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12512 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12513 | qdf_mem_copy(&wmi_handle->final_abi_vers, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12514 | sizeof(wmi_abi_version)); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12515 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12516 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 12517 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12518 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12519 | return QDF_STATUS_SUCCESS; |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 12520 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12521 | |
| 12522 | /** |
| 12523 | * send_set_base_macaddr_indicate_cmd_tlv() - set base mac address in fw |
| 12524 | * @wmi_handle: wmi handle |
| 12525 | * @custom_addr: base mac address |
| 12526 | * |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 12527 | * Return: QDF_STATUS_SUCCESS for success or error code |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12528 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12529 | 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] | 12530 | uint8_t *custom_addr) |
| 12531 | { |
| 12532 | wmi_pdev_set_base_macaddr_cmd_fixed_param *cmd; |
| 12533 | wmi_buf_t buf; |
| 12534 | int err; |
| 12535 | |
| 12536 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 12537 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12538 | WMI_LOGE("Failed to allocate buffer to send base macaddr cmd"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12539 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12540 | } |
| 12541 | |
| 12542 | 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] | 12543 | qdf_mem_zero(cmd, sizeof(*cmd)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12544 | |
| 12545 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12546 | WMITLV_TAG_STRUC_wmi_pdev_set_base_macaddr_cmd_fixed_param, |
| 12547 | WMITLV_GET_STRUCT_TLVLEN |
| 12548 | (wmi_pdev_set_base_macaddr_cmd_fixed_param)); |
| 12549 | WMI_CHAR_ARRAY_TO_MAC_ADDR(custom_addr, &cmd->base_macaddr); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12550 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12551 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12552 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 12553 | sizeof(*cmd), |
| 12554 | WMI_PDEV_SET_BASE_MACADDR_CMDID); |
| 12555 | if (err) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12556 | WMI_LOGE("Failed to send set_base_macaddr cmd"); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12557 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12558 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12559 | } |
| 12560 | |
| 12561 | return 0; |
| 12562 | } |
| 12563 | |
| 12564 | /** |
| 12565 | * send_log_supported_evt_cmd_tlv() - Enable/Disable FW diag/log events |
| 12566 | * @handle: wmi handle |
| 12567 | * @event: Event received from FW |
| 12568 | * @len: Length of the event |
| 12569 | * |
| 12570 | * Enables the low frequency events and disables the high frequency |
| 12571 | * events. Bit 17 indicates if the event if low/high frequency. |
| 12572 | * 1 - high frequency, 0 - low frequency |
| 12573 | * |
| 12574 | * Return: 0 on successfully enabling/disabling the events |
| 12575 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12576 | 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] | 12577 | uint8_t *event, |
| 12578 | uint32_t len) |
| 12579 | { |
| 12580 | uint32_t num_of_diag_events_logs; |
| 12581 | wmi_diag_event_log_config_fixed_param *cmd; |
| 12582 | wmi_buf_t buf; |
| 12583 | uint8_t *buf_ptr; |
| 12584 | uint32_t *cmd_args, *evt_args; |
| 12585 | uint32_t buf_len, i; |
| 12586 | |
| 12587 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *param_buf; |
| 12588 | wmi_diag_event_log_supported_event_fixed_params *wmi_event; |
| 12589 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12590 | WMI_LOGI("Received WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12591 | |
| 12592 | param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event; |
| 12593 | if (!param_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12594 | WMI_LOGE("Invalid log supported event buffer"); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12595 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12596 | } |
| 12597 | wmi_event = param_buf->fixed_param; |
| 12598 | num_of_diag_events_logs = wmi_event->num_of_diag_events_logs; |
| 12599 | evt_args = param_buf->diag_events_logs_list; |
| 12600 | if (!evt_args) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12601 | 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] | 12602 | __func__, num_of_diag_events_logs); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12603 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12604 | } |
| 12605 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12606 | WMI_LOGD("%s: num_of_diag_events_logs=%d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12607 | __func__, num_of_diag_events_logs); |
| 12608 | |
| 12609 | /* Free any previous allocation */ |
| 12610 | if (wmi_handle->events_logs_list) |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12611 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12612 | |
Varun Reddy Yeturu | c799752 | 2017-08-20 13:41:02 -0700 | [diff] [blame] | 12613 | if (num_of_diag_events_logs > |
| 12614 | (WMI_SVC_MSG_MAX_SIZE / sizeof(uint32_t))) { |
| 12615 | WMI_LOGE("%s: excess num of logs:%d", __func__, |
| 12616 | num_of_diag_events_logs); |
| 12617 | QDF_ASSERT(0); |
| 12618 | return QDF_STATUS_E_INVAL; |
| 12619 | } |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12620 | /* Store the event list for run time enable/disable */ |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12621 | 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] | 12622 | sizeof(uint32_t)); |
| 12623 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12624 | WMI_LOGE("%s: event log list memory allocation failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12625 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12626 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12627 | } |
| 12628 | wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs; |
| 12629 | |
| 12630 | /* Prepare the send buffer */ |
| 12631 | buf_len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 12632 | (num_of_diag_events_logs * sizeof(uint32_t)); |
| 12633 | |
| 12634 | buf = wmi_buf_alloc(wmi_handle, buf_len); |
| 12635 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12636 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12637 | qdf_mem_free(wmi_handle->events_logs_list); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12638 | wmi_handle->events_logs_list = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12639 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12640 | } |
| 12641 | |
| 12642 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 12643 | buf_ptr = (uint8_t *) cmd; |
| 12644 | |
| 12645 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12646 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 12647 | WMITLV_GET_STRUCT_TLVLEN( |
| 12648 | wmi_diag_event_log_config_fixed_param)); |
| 12649 | |
| 12650 | cmd->num_of_diag_events_logs = num_of_diag_events_logs; |
| 12651 | |
| 12652 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 12653 | |
| 12654 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 12655 | (num_of_diag_events_logs * sizeof(uint32_t))); |
| 12656 | |
| 12657 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 12658 | |
| 12659 | /* Populate the events */ |
| 12660 | for (i = 0; i < num_of_diag_events_logs; i++) { |
| 12661 | /* Low freq (0) - Enable (1) the event |
| 12662 | * High freq (1) - Disable (0) the event |
| 12663 | */ |
| 12664 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[i], |
| 12665 | !(WMI_DIAG_FREQUENCY_GET(evt_args[i]))); |
| 12666 | /* Set the event ID */ |
| 12667 | WMI_DIAG_ID_SET(cmd_args[i], |
| 12668 | WMI_DIAG_ID_GET(evt_args[i])); |
| 12669 | /* Set the type */ |
| 12670 | WMI_DIAG_TYPE_SET(cmd_args[i], |
| 12671 | WMI_DIAG_TYPE_GET(evt_args[i])); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12672 | /* Storing the event/log list in WMI */ |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12673 | wmi_handle->events_logs_list[i] = evt_args[i]; |
| 12674 | } |
| 12675 | |
| 12676 | if (wmi_unified_cmd_send(wmi_handle, buf, buf_len, |
| 12677 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12678 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12679 | __func__); |
| 12680 | wmi_buf_free(buf); |
| 12681 | /* Not clearing events_logs_list, though wmi cmd failed. |
| 12682 | * Host can still have this list |
| 12683 | */ |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12684 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12685 | } |
| 12686 | |
| 12687 | return 0; |
| 12688 | } |
| 12689 | |
| 12690 | /** |
| 12691 | * send_enable_specific_fw_logs_cmd_tlv() - Start/Stop logging of diag log id |
| 12692 | * @wmi_handle: wmi handle |
| 12693 | * @start_log: Start logging related parameters |
| 12694 | * |
| 12695 | * Send the command to the FW based on which specific logging of diag |
| 12696 | * event/log id can be started/stopped |
| 12697 | * |
| 12698 | * Return: None |
| 12699 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12700 | 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] | 12701 | struct wmi_wifi_start_log *start_log) |
| 12702 | { |
| 12703 | wmi_diag_event_log_config_fixed_param *cmd; |
| 12704 | wmi_buf_t buf; |
| 12705 | uint8_t *buf_ptr; |
| 12706 | uint32_t len, count, log_level, i; |
| 12707 | uint32_t *cmd_args; |
| 12708 | uint32_t total_len; |
| 12709 | count = 0; |
| 12710 | |
| 12711 | if (!wmi_handle->events_logs_list) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12712 | WMI_LOGE("%s: Not received event/log list from FW, yet", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12713 | __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12714 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12715 | } |
| 12716 | /* total_len stores the number of events where BITS 17 and 18 are set. |
| 12717 | * i.e., events of high frequency (17) and for extended debugging (18) |
| 12718 | */ |
| 12719 | total_len = 0; |
| 12720 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 12721 | if ((WMI_DIAG_FREQUENCY_GET(wmi_handle->events_logs_list[i])) && |
| 12722 | (WMI_DIAG_EXT_FEATURE_GET(wmi_handle->events_logs_list[i]))) |
| 12723 | total_len++; |
| 12724 | } |
| 12725 | |
| 12726 | len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 12727 | (total_len * sizeof(uint32_t)); |
| 12728 | |
| 12729 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12730 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12731 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12732 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12733 | } |
| 12734 | cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf); |
| 12735 | buf_ptr = (uint8_t *) cmd; |
| 12736 | |
| 12737 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12738 | WMITLV_TAG_STRUC_wmi_diag_event_log_config_fixed_param, |
| 12739 | WMITLV_GET_STRUCT_TLVLEN( |
| 12740 | wmi_diag_event_log_config_fixed_param)); |
| 12741 | |
| 12742 | cmd->num_of_diag_events_logs = total_len; |
| 12743 | |
| 12744 | buf_ptr += sizeof(wmi_diag_event_log_config_fixed_param); |
| 12745 | |
| 12746 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 12747 | (total_len * sizeof(uint32_t))); |
| 12748 | |
| 12749 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 12750 | |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 12751 | if (start_log->verbose_level >= WMI_LOG_LEVEL_ACTIVE) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12752 | log_level = 1; |
| 12753 | else |
| 12754 | log_level = 0; |
| 12755 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12756 | 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] | 12757 | for (i = 0; i < wmi_handle->num_of_diag_events_logs; i++) { |
| 12758 | uint32_t val = wmi_handle->events_logs_list[i]; |
| 12759 | if ((WMI_DIAG_FREQUENCY_GET(val)) && |
| 12760 | (WMI_DIAG_EXT_FEATURE_GET(val))) { |
| 12761 | |
| 12762 | WMI_DIAG_ID_SET(cmd_args[count], |
| 12763 | WMI_DIAG_ID_GET(val)); |
| 12764 | WMI_DIAG_TYPE_SET(cmd_args[count], |
| 12765 | WMI_DIAG_TYPE_GET(val)); |
| 12766 | WMI_DIAG_ID_ENABLED_DISABLED_SET(cmd_args[count], |
| 12767 | log_level); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12768 | WMI_LOGD("%s: Idx:%d, val:%x", __func__, i, val); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12769 | count++; |
| 12770 | } |
| 12771 | } |
| 12772 | |
| 12773 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 12774 | WMI_DIAG_EVENT_LOG_CONFIG_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12775 | WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12776 | __func__); |
| 12777 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12778 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12779 | } |
| 12780 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12781 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12782 | } |
| 12783 | |
| 12784 | /** |
| 12785 | * send_flush_logs_to_fw_cmd_tlv() - Send log flush command to FW |
| 12786 | * @wmi_handle: WMI handle |
| 12787 | * |
| 12788 | * This function is used to send the flush command to the FW, |
| 12789 | * that will flush the fw logs that are residue in the FW |
| 12790 | * |
| 12791 | * Return: None |
| 12792 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12793 | 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] | 12794 | { |
| 12795 | wmi_debug_mesg_flush_fixed_param *cmd; |
| 12796 | wmi_buf_t buf; |
| 12797 | int len = sizeof(*cmd); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12798 | QDF_STATUS ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12799 | |
| 12800 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12801 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12802 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12803 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12804 | } |
| 12805 | |
| 12806 | cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf); |
| 12807 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 12808 | WMITLV_TAG_STRUC_wmi_debug_mesg_flush_fixed_param, |
| 12809 | WMITLV_GET_STRUCT_TLVLEN( |
| 12810 | wmi_debug_mesg_flush_fixed_param)); |
| 12811 | cmd->reserved0 = 0; |
| 12812 | |
| 12813 | ret = wmi_unified_cmd_send(wmi_handle, |
| 12814 | buf, |
| 12815 | len, |
| 12816 | WMI_DEBUG_MESG_FLUSH_CMDID); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12817 | if (QDF_IS_STATUS_ERROR(ret)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12818 | WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12819 | wmi_buf_free(buf); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12820 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12821 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12822 | WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12823 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 12824 | return ret; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12825 | } |
| 12826 | |
| 12827 | /** |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12828 | * 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] | 12829 | * @wmi_handle: wmi handle |
| 12830 | * @msg: PCL structure containing the PCL and the number of channels |
| 12831 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12832 | * 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] | 12833 | * firmware. The DBS Manager is the consumer of this information in the WLAN |
| 12834 | * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs |
| 12835 | * to migrate to a new channel without host driver involvement. An example of |
| 12836 | * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will |
| 12837 | * manage the channel selection without firmware involvement. |
| 12838 | * |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12839 | * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual |
| 12840 | * channel list. The weights corresponds to the channels sent in |
| 12841 | * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher |
| 12842 | * weightage compared to the non PCL channels. |
| 12843 | * |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12844 | * Return: Success if the cmd is sent successfully to the firmware |
| 12845 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12846 | 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] | 12847 | struct wmi_pcl_chan_weights *msg) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12848 | { |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12849 | wmi_pdev_set_pcl_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12850 | wmi_buf_t buf; |
| 12851 | uint8_t *buf_ptr; |
| 12852 | uint32_t *cmd_args, i, len; |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12853 | uint32_t chan_len; |
| 12854 | |
| 12855 | chan_len = msg->saved_num_chan; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12856 | |
| 12857 | len = sizeof(*cmd) + |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12858 | WMI_TLV_HDR_SIZE + (chan_len * sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12859 | |
| 12860 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12861 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12862 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12863 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12864 | } |
| 12865 | |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12866 | cmd = (wmi_pdev_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12867 | buf_ptr = (uint8_t *) cmd; |
| 12868 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12869 | WMITLV_TAG_STRUC_wmi_pdev_set_pcl_cmd_fixed_param, |
| 12870 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_pcl_cmd_fixed_param)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12871 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12872 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12873 | WMI_HOST_PDEV_ID_SOC); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12874 | cmd->num_chan = chan_len; |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 12875 | WMI_LOGD("%s: Total chan (PCL) len:%d", __func__, cmd->num_chan); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12876 | |
| 12877 | buf_ptr += sizeof(wmi_pdev_set_pcl_cmd_fixed_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12878 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12879 | (chan_len * sizeof(uint32_t))); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12880 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12881 | for (i = 0; i < chan_len ; i++) { |
| 12882 | cmd_args[i] = msg->weighed_valid_list[i]; |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 12883 | WMI_LOGD("%s: chan:%d weight:%d", __func__, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12884 | msg->saved_chan_list[i], cmd_args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12885 | } |
| 12886 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 8650851 | 2016-04-21 19:16:32 +0530 | [diff] [blame] | 12887 | WMI_PDEV_SET_PCL_CMDID)) { |
| 12888 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_PCL_CMDID", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12889 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12890 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12891 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12892 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12893 | } |
| 12894 | |
| 12895 | /** |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12896 | * 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] | 12897 | * @wmi_handle: wmi handle |
| 12898 | * @msg: Structure containing the following parameters |
| 12899 | * |
| 12900 | * - hw_mode_index: The HW_Mode field is a enumerated type that is selected |
| 12901 | * from the HW_Mode table, which is returned in the WMI_SERVICE_READY_EVENTID. |
| 12902 | * |
| 12903 | * Provides notification to the WLAN firmware that host driver is requesting a |
| 12904 | * HardWare (HW) Mode change. This command is needed to support iHelium in the |
| 12905 | * configurations that include the Dual Band Simultaneous (DBS) feature. |
| 12906 | * |
| 12907 | * Return: Success if the cmd is sent successfully to the firmware |
| 12908 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 12909 | 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] | 12910 | uint32_t hw_mode_index) |
| 12911 | { |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12912 | wmi_pdev_set_hw_mode_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12913 | wmi_buf_t buf; |
| 12914 | uint32_t len; |
| 12915 | |
| 12916 | len = sizeof(*cmd); |
| 12917 | |
| 12918 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12919 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12920 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12921 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12922 | } |
| 12923 | |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12924 | 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] | 12925 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12926 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 12927 | WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_hw_mode_cmd_fixed_param)); |
| 12928 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12929 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12930 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12931 | cmd->hw_mode_index = hw_mode_index; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12932 | WMI_LOGI("%s: HW mode index:%d", __func__, cmd->hw_mode_index); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12933 | |
| 12934 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 12935 | WMI_PDEV_SET_HW_MODE_CMDID)) { |
| 12936 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_HW_MODE_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12937 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12938 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12939 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12940 | } |
| 12941 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12942 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12943 | } |
| 12944 | |
| 12945 | /** |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12946 | * 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] | 12947 | * @wmi_handle: wmi handle |
| 12948 | * @msg: Dual MAC config parameters |
| 12949 | * |
| 12950 | * Configures WLAN firmware with the dual MAC features |
| 12951 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12952 | * Return: QDF_STATUS. 0 on success. |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12953 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 12954 | static |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12955 | 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] | 12956 | struct wmi_dual_mac_config *msg) |
| 12957 | { |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12958 | wmi_pdev_set_mac_config_cmd_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12959 | wmi_buf_t buf; |
| 12960 | uint32_t len; |
| 12961 | |
| 12962 | len = sizeof(*cmd); |
| 12963 | |
| 12964 | buf = wmi_buf_alloc(wmi_handle, len); |
| 12965 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12966 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 12967 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12968 | } |
| 12969 | |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12970 | 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] | 12971 | WMITLV_SET_HDR(&cmd->tlv_header, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12972 | WMITLV_TAG_STRUC_wmi_pdev_set_mac_config_cmd_fixed_param, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12973 | WMITLV_GET_STRUCT_TLVLEN( |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12974 | wmi_pdev_set_mac_config_cmd_fixed_param)); |
| 12975 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 12976 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 12977 | WMI_HOST_PDEV_ID_SOC); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12978 | cmd->concurrent_scan_config_bits = msg->scan_config; |
| 12979 | cmd->fw_mode_config_bits = msg->fw_mode_config; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12980 | WMI_LOGI("%s: scan_config:%x fw_mode_config:%x", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12981 | __func__, msg->scan_config, msg->fw_mode_config); |
| 12982 | |
| 12983 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
Manishekar Chandrasekaran | 157a4de | 2016-04-27 12:52:51 +0530 | [diff] [blame] | 12984 | WMI_PDEV_SET_MAC_CONFIG_CMDID)) { |
| 12985 | WMI_LOGE("%s: Failed to send WMI_PDEV_SET_MAC_CONFIG_CMDID", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12986 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 12987 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12988 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 12989 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 12990 | } |
| 12991 | |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 12992 | #ifdef BIG_ENDIAN_HOST |
| 12993 | /** |
| 12994 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 12995 | * @param data_len - data length |
| 12996 | * @param data - pointer to data |
| 12997 | * |
| 12998 | * Return: QDF_STATUS - success or error status |
| 12999 | */ |
| 13000 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 13001 | struct fips_params *param) |
| 13002 | { |
| 13003 | unsigned char *key_unaligned, *data_unaligned; |
| 13004 | int c; |
| 13005 | u_int8_t *key_aligned = NULL; |
| 13006 | u_int8_t *data_aligned = NULL; |
| 13007 | |
| 13008 | /* Assigning unaligned space to copy the key */ |
| 13009 | key_unaligned = qdf_mem_malloc( |
| 13010 | sizeof(u_int8_t)*param->key_len + FIPS_ALIGN); |
| 13011 | data_unaligned = qdf_mem_malloc( |
| 13012 | sizeof(u_int8_t)*param->data_len + FIPS_ALIGN); |
| 13013 | |
| 13014 | /* Checking if kmalloc is succesful to allocate space */ |
| 13015 | if (key_unaligned == NULL) |
| 13016 | return QDF_STATUS_SUCCESS; |
| 13017 | /* Checking if space is aligned */ |
| 13018 | if (!FIPS_IS_ALIGNED(key_unaligned, FIPS_ALIGN)) { |
| 13019 | /* align to 4 */ |
| 13020 | key_aligned = |
| 13021 | (u_int8_t *)FIPS_ALIGNTO(key_unaligned, |
| 13022 | FIPS_ALIGN); |
| 13023 | } else { |
| 13024 | key_aligned = (u_int8_t *)key_unaligned; |
| 13025 | } |
| 13026 | |
| 13027 | /* memset and copy content from key to key aligned */ |
| 13028 | OS_MEMSET(key_aligned, 0, param->key_len); |
| 13029 | OS_MEMCPY(key_aligned, param->key, param->key_len); |
| 13030 | |
| 13031 | /* print a hexdump for host debug */ |
| 13032 | print_hex_dump(KERN_DEBUG, |
| 13033 | "\t Aligned and Copied Key:@@@@ ", |
| 13034 | DUMP_PREFIX_NONE, |
| 13035 | 16, 1, key_aligned, param->key_len, true); |
| 13036 | |
| 13037 | /* Checking if kmalloc is succesful to allocate space */ |
| 13038 | if (data_unaligned == NULL) |
| 13039 | return QDF_STATUS_SUCCESS; |
| 13040 | /* Checking of space is aligned */ |
| 13041 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 13042 | /* align to 4 */ |
| 13043 | data_aligned = |
| 13044 | (u_int8_t *)FIPS_ALIGNTO(data_unaligned, |
| 13045 | FIPS_ALIGN); |
| 13046 | } else { |
| 13047 | data_aligned = (u_int8_t *)data_unaligned; |
| 13048 | } |
| 13049 | |
| 13050 | /* memset and copy content from data to data aligned */ |
| 13051 | OS_MEMSET(data_aligned, 0, param->data_len); |
| 13052 | OS_MEMCPY(data_aligned, param->data, param->data_len); |
| 13053 | |
| 13054 | /* print a hexdump for host debug */ |
| 13055 | print_hex_dump(KERN_DEBUG, |
| 13056 | "\t Properly Aligned and Copied Data:@@@@ ", |
| 13057 | DUMP_PREFIX_NONE, |
| 13058 | 16, 1, data_aligned, param->data_len, true); |
| 13059 | |
| 13060 | /* converting to little Endian both key_aligned and |
| 13061 | * data_aligned*/ |
| 13062 | for (c = 0; c < param->key_len/4; c++) { |
| 13063 | *((u_int32_t *)key_aligned+c) = |
| 13064 | qdf_cpu_to_le32(*((u_int32_t *)key_aligned+c)); |
| 13065 | } |
| 13066 | for (c = 0; c < param->data_len/4; c++) { |
| 13067 | *((u_int32_t *)data_aligned+c) = |
| 13068 | qdf_cpu_to_le32(*((u_int32_t *)data_aligned+c)); |
| 13069 | } |
| 13070 | |
| 13071 | /* update endian data to key and data vectors */ |
| 13072 | OS_MEMCPY(param->key, key_aligned, param->key_len); |
| 13073 | OS_MEMCPY(param->data, data_aligned, param->data_len); |
| 13074 | |
| 13075 | /* clean up allocated spaces */ |
| 13076 | qdf_mem_free(key_unaligned); |
| 13077 | key_unaligned = NULL; |
| 13078 | key_aligned = NULL; |
| 13079 | |
| 13080 | qdf_mem_free(data_unaligned); |
| 13081 | data_unaligned = NULL; |
| 13082 | data_aligned = NULL; |
| 13083 | |
| 13084 | return QDF_STATUS_SUCCESS; |
| 13085 | } |
| 13086 | #else |
| 13087 | /** |
| 13088 | * fips_align_data_be() - DUMMY for LE platform |
| 13089 | * |
| 13090 | * Return: QDF_STATUS - success |
| 13091 | */ |
| 13092 | static QDF_STATUS fips_align_data_be(wmi_unified_t wmi_handle, |
| 13093 | struct fips_params *param) |
| 13094 | { |
| 13095 | return QDF_STATUS_SUCCESS; |
| 13096 | } |
| 13097 | #endif |
| 13098 | |
| 13099 | |
| 13100 | /** |
| 13101 | * send_pdev_fips_cmd_tlv() - send pdev fips cmd to fw |
| 13102 | * @wmi_handle: wmi handle |
| 13103 | * @param: pointer to hold pdev fips param |
| 13104 | * |
| 13105 | * Return: 0 for success or error code |
| 13106 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13107 | static QDF_STATUS |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 13108 | send_pdev_fips_cmd_tlv(wmi_unified_t wmi_handle, |
| 13109 | struct fips_params *param) |
| 13110 | { |
| 13111 | wmi_pdev_fips_cmd_fixed_param *cmd; |
| 13112 | wmi_buf_t buf; |
| 13113 | uint8_t *buf_ptr; |
| 13114 | uint32_t len = sizeof(wmi_pdev_fips_cmd_fixed_param); |
| 13115 | QDF_STATUS retval = QDF_STATUS_SUCCESS; |
| 13116 | |
| 13117 | /* Length TLV placeholder for array of bytes */ |
| 13118 | len += WMI_TLV_HDR_SIZE; |
| 13119 | if (param->data_len) |
| 13120 | len += (param->data_len*sizeof(uint8_t)); |
| 13121 | |
| 13122 | /* |
| 13123 | * Data length must be multiples of 16 bytes - checked against 0xF - |
| 13124 | * and must be less than WMI_SVC_MSG_SIZE - static size of |
| 13125 | * wmi_pdev_fips_cmd structure |
| 13126 | */ |
| 13127 | |
| 13128 | /* do sanity on the input */ |
| 13129 | if (!(((param->data_len & 0xF) == 0) && |
| 13130 | ((param->data_len > 0) && |
| 13131 | (param->data_len < (WMI_HOST_MAX_BUFFER_SIZE - |
| 13132 | sizeof(wmi_pdev_fips_cmd_fixed_param)))))) { |
| 13133 | return QDF_STATUS_E_INVAL; |
| 13134 | } |
| 13135 | |
| 13136 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13137 | if (!buf) { |
| 13138 | qdf_print("%s:wmi_buf_alloc failed\n", __func__); |
| 13139 | return QDF_STATUS_E_FAILURE; |
| 13140 | } |
| 13141 | |
| 13142 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 13143 | cmd = (wmi_pdev_fips_cmd_fixed_param *)buf_ptr; |
| 13144 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13145 | WMITLV_TAG_STRUC_wmi_pdev_fips_cmd_fixed_param, |
| 13146 | WMITLV_GET_STRUCT_TLVLEN |
| 13147 | (wmi_pdev_fips_cmd_fixed_param)); |
| 13148 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 13149 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 13150 | param->pdev_id); |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 13151 | if (param->key != NULL && param->data != NULL) { |
| 13152 | cmd->key_len = param->key_len; |
| 13153 | cmd->data_len = param->data_len; |
| 13154 | cmd->fips_cmd = !!(param->op); |
| 13155 | |
| 13156 | if (fips_align_data_be(wmi_handle, param) != QDF_STATUS_SUCCESS) |
| 13157 | return QDF_STATUS_E_FAILURE; |
| 13158 | |
| 13159 | qdf_mem_copy(cmd->key, param->key, param->key_len); |
| 13160 | |
| 13161 | if (param->mode == FIPS_ENGINE_AES_CTR || |
| 13162 | param->mode == FIPS_ENGINE_AES_MIC) { |
| 13163 | cmd->mode = param->mode; |
| 13164 | } else { |
| 13165 | cmd->mode = FIPS_ENGINE_AES_CTR; |
| 13166 | } |
| 13167 | qdf_print(KERN_ERR "Key len = %d, Data len = %d\n", |
| 13168 | cmd->key_len, cmd->data_len); |
| 13169 | |
| 13170 | print_hex_dump(KERN_DEBUG, "Key: ", DUMP_PREFIX_NONE, 16, 1, |
| 13171 | cmd->key, cmd->key_len, true); |
| 13172 | buf_ptr += sizeof(*cmd); |
| 13173 | |
| 13174 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, param->data_len); |
| 13175 | |
| 13176 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13177 | if (param->data_len) |
| 13178 | qdf_mem_copy(buf_ptr, |
| 13179 | (uint8_t *) param->data, param->data_len); |
| 13180 | |
| 13181 | print_hex_dump(KERN_DEBUG, "Plain text: ", DUMP_PREFIX_NONE, |
| 13182 | 16, 1, buf_ptr, cmd->data_len, true); |
| 13183 | |
| 13184 | buf_ptr += param->data_len; |
| 13185 | |
| 13186 | retval = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13187 | WMI_PDEV_FIPS_CMDID); |
| 13188 | qdf_print("%s return value %d\n", __func__, retval); |
| 13189 | } else { |
| 13190 | qdf_print("\n%s:%d Key or Data is NULL\n", __func__, __LINE__); |
| 13191 | wmi_buf_free(buf); |
| 13192 | retval = -QDF_STATUS_E_BADMSG; |
| 13193 | } |
| 13194 | |
| 13195 | return retval; |
| 13196 | } |
| 13197 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13198 | #ifdef WLAN_PMO_ENABLE |
| 13199 | /** |
| 13200 | * send_add_wow_wakeup_event_cmd_tlv() - Configures wow wakeup events. |
| 13201 | * @wmi_handle: wmi handle |
| 13202 | * @vdev_id: vdev id |
| 13203 | * @bitmap: Event bitmap |
| 13204 | * @enable: enable/disable |
| 13205 | * |
| 13206 | * Return: CDF status |
| 13207 | */ |
| 13208 | static QDF_STATUS send_add_wow_wakeup_event_cmd_tlv(wmi_unified_t wmi_handle, |
| 13209 | uint32_t vdev_id, |
Ravi Kumar Bokka | ce4ac39 | 2017-03-23 17:20:31 +0530 | [diff] [blame] | 13210 | uint32_t *bitmap, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13211 | bool enable) |
| 13212 | { |
| 13213 | WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *cmd; |
| 13214 | uint16_t len; |
| 13215 | wmi_buf_t buf; |
| 13216 | int ret; |
| 13217 | |
| 13218 | len = sizeof(WMI_WOW_ADD_DEL_EVT_CMD_fixed_param); |
| 13219 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13220 | if (!buf) { |
| 13221 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 13222 | return QDF_STATUS_E_NOMEM; |
| 13223 | } |
| 13224 | cmd = (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param *) wmi_buf_data(buf); |
| 13225 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13226 | WMITLV_TAG_STRUC_WMI_WOW_ADD_DEL_EVT_CMD_fixed_param, |
| 13227 | WMITLV_GET_STRUCT_TLVLEN |
| 13228 | (WMI_WOW_ADD_DEL_EVT_CMD_fixed_param)); |
| 13229 | cmd->vdev_id = vdev_id; |
| 13230 | cmd->is_add = enable; |
Ravi Kumar Bokka | ce4ac39 | 2017-03-23 17:20:31 +0530 | [diff] [blame] | 13231 | qdf_mem_copy(&(cmd->event_bitmaps[0]), bitmap, sizeof(uint32_t) * |
| 13232 | WMI_WOW_MAX_EVENT_BM_LEN); |
| 13233 | |
| 13234 | WMI_LOGD("Wakeup pattern 0x%x%x%x%x %s in fw", cmd->event_bitmaps[0], |
| 13235 | cmd->event_bitmaps[1], cmd->event_bitmaps[2], |
| 13236 | cmd->event_bitmaps[3], enable ? "enabled" : "disabled"); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13237 | |
| 13238 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13239 | WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); |
| 13240 | if (ret) { |
| 13241 | WMI_LOGE("Failed to config wow wakeup event"); |
| 13242 | wmi_buf_free(buf); |
| 13243 | return QDF_STATUS_E_FAILURE; |
| 13244 | } |
| 13245 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13246 | return QDF_STATUS_SUCCESS; |
| 13247 | } |
| 13248 | |
| 13249 | /** |
| 13250 | * send_wow_patterns_to_fw_cmd_tlv() - Sends WOW patterns to FW. |
| 13251 | * @wmi_handle: wmi handle |
| 13252 | * @vdev_id: vdev id |
| 13253 | * @ptrn_id: pattern id |
| 13254 | * @ptrn: pattern |
| 13255 | * @ptrn_len: pattern length |
| 13256 | * @ptrn_offset: pattern offset |
| 13257 | * @mask: mask |
| 13258 | * @mask_len: mask length |
| 13259 | * @user: true for user configured pattern and false for default pattern |
| 13260 | * @default_patterns: default patterns |
| 13261 | * |
| 13262 | * Return: CDF status |
| 13263 | */ |
| 13264 | static QDF_STATUS send_wow_patterns_to_fw_cmd_tlv(wmi_unified_t wmi_handle, |
| 13265 | uint8_t vdev_id, uint8_t ptrn_id, |
| 13266 | const uint8_t *ptrn, uint8_t ptrn_len, |
| 13267 | uint8_t ptrn_offset, const uint8_t *mask, |
| 13268 | uint8_t mask_len, bool user, |
| 13269 | uint8_t default_patterns) |
| 13270 | { |
| 13271 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 13272 | WOW_BITMAP_PATTERN_T *bitmap_pattern; |
| 13273 | wmi_buf_t buf; |
| 13274 | uint8_t *buf_ptr; |
| 13275 | int32_t len; |
| 13276 | int ret; |
| 13277 | |
| 13278 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 13279 | WMI_TLV_HDR_SIZE + |
| 13280 | 1 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 13281 | WMI_TLV_HDR_SIZE + |
| 13282 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 13283 | WMI_TLV_HDR_SIZE + |
| 13284 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 13285 | WMI_TLV_HDR_SIZE + |
| 13286 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 13287 | WMI_TLV_HDR_SIZE + |
| 13288 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 13289 | |
| 13290 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13291 | if (!buf) { |
| 13292 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 13293 | return QDF_STATUS_E_NOMEM; |
| 13294 | } |
| 13295 | |
| 13296 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 13297 | buf_ptr = (uint8_t *) cmd; |
| 13298 | |
| 13299 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13300 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 13301 | WMITLV_GET_STRUCT_TLVLEN |
| 13302 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 13303 | cmd->vdev_id = vdev_id; |
| 13304 | cmd->pattern_id = ptrn_id; |
| 13305 | |
| 13306 | cmd->pattern_type = WOW_BITMAP_PATTERN; |
| 13307 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 13308 | |
| 13309 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13310 | sizeof(WOW_BITMAP_PATTERN_T)); |
| 13311 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13312 | bitmap_pattern = (WOW_BITMAP_PATTERN_T *) buf_ptr; |
| 13313 | |
| 13314 | WMITLV_SET_HDR(&bitmap_pattern->tlv_header, |
| 13315 | WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T, |
| 13316 | WMITLV_GET_STRUCT_TLVLEN(WOW_BITMAP_PATTERN_T)); |
| 13317 | |
| 13318 | qdf_mem_copy(&bitmap_pattern->patternbuf[0], ptrn, ptrn_len); |
| 13319 | qdf_mem_copy(&bitmap_pattern->bitmaskbuf[0], mask, mask_len); |
| 13320 | |
| 13321 | bitmap_pattern->pattern_offset = ptrn_offset; |
| 13322 | bitmap_pattern->pattern_len = ptrn_len; |
| 13323 | |
| 13324 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMAP_PATTERN_SIZE) |
| 13325 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMAP_PATTERN_SIZE; |
| 13326 | |
| 13327 | if (bitmap_pattern->pattern_len > WOW_DEFAULT_BITMASK_SIZE) |
| 13328 | bitmap_pattern->pattern_len = WOW_DEFAULT_BITMASK_SIZE; |
| 13329 | |
| 13330 | bitmap_pattern->bitmask_len = bitmap_pattern->pattern_len; |
| 13331 | bitmap_pattern->pattern_id = ptrn_id; |
| 13332 | |
| 13333 | WMI_LOGI("vdev: %d, ptrn id: %d, ptrn len: %d, ptrn offset: %d user %d", |
| 13334 | cmd->vdev_id, cmd->pattern_id, bitmap_pattern->pattern_len, |
| 13335 | bitmap_pattern->pattern_offset, user); |
| 13336 | WMI_LOGI("Pattern : "); |
| 13337 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 13338 | &bitmap_pattern->patternbuf[0], bitmap_pattern->pattern_len); |
| 13339 | |
| 13340 | WMI_LOGI("Mask : "); |
| 13341 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO, |
| 13342 | &bitmap_pattern->bitmaskbuf[0], bitmap_pattern->pattern_len); |
| 13343 | |
| 13344 | buf_ptr += sizeof(WOW_BITMAP_PATTERN_T); |
| 13345 | |
| 13346 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 13347 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13348 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13349 | |
| 13350 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 13351 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13352 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13353 | |
| 13354 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 13355 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13356 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13357 | |
| 13358 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 13359 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 13360 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13361 | |
| 13362 | /* Fill TLV for ratelimit_interval with dummy data as this fix elem */ |
| 13363 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 1 * sizeof(A_UINT32)); |
| 13364 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13365 | *(A_UINT32 *) buf_ptr = 0; |
| 13366 | |
| 13367 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13368 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 13369 | if (ret) { |
| 13370 | WMI_LOGE("%s: Failed to send wow ptrn to fw", __func__); |
| 13371 | wmi_buf_free(buf); |
| 13372 | return QDF_STATUS_E_FAILURE; |
| 13373 | } |
| 13374 | |
| 13375 | return QDF_STATUS_SUCCESS; |
| 13376 | } |
| 13377 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13378 | /** |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13379 | * fill_arp_offload_params_tlv() - Fill ARP offload data |
| 13380 | * @wmi_handle: wmi handle |
| 13381 | * @offload_req: offload request |
| 13382 | * @buf_ptr: buffer pointer |
| 13383 | * |
| 13384 | * To fill ARP offload data to firmware |
| 13385 | * when target goes to wow mode. |
| 13386 | * |
| 13387 | * Return: None |
| 13388 | */ |
| 13389 | static void fill_arp_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13390 | struct pmo_arp_offload_params *offload_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13391 | { |
| 13392 | |
| 13393 | int i; |
| 13394 | WMI_ARP_OFFLOAD_TUPLE *arp_tuple; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13395 | bool enable_or_disable = offload_req->enable; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13396 | |
| 13397 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13398 | (WMI_MAX_ARP_OFFLOADS*sizeof(WMI_ARP_OFFLOAD_TUPLE))); |
| 13399 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 13400 | for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { |
| 13401 | arp_tuple = (WMI_ARP_OFFLOAD_TUPLE *)*buf_ptr; |
| 13402 | WMITLV_SET_HDR(&arp_tuple->tlv_header, |
| 13403 | WMITLV_TAG_STRUC_WMI_ARP_OFFLOAD_TUPLE, |
| 13404 | WMITLV_GET_STRUCT_TLVLEN(WMI_ARP_OFFLOAD_TUPLE)); |
| 13405 | |
| 13406 | /* Fill data for ARP and NS in the first tupple for LA */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13407 | if ((enable_or_disable & PMO_OFFLOAD_ENABLE) && (i == 0)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13408 | /* Copy the target ip addr and flags */ |
| 13409 | arp_tuple->flags = WMI_ARPOFF_FLAGS_VALID; |
| 13410 | qdf_mem_copy(&arp_tuple->target_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13411 | offload_req->host_ipv4_addr, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13412 | WMI_IPV4_ADDR_LEN); |
| 13413 | WMI_LOGD("ARPOffload IP4 address: %pI4", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13414 | offload_req->host_ipv4_addr); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13415 | } |
| 13416 | *buf_ptr += sizeof(WMI_ARP_OFFLOAD_TUPLE); |
| 13417 | } |
| 13418 | } |
| 13419 | |
| 13420 | #ifdef WLAN_NS_OFFLOAD |
| 13421 | /** |
| 13422 | * fill_ns_offload_params_tlv() - Fill NS offload data |
| 13423 | * @wmi|_handle: wmi handle |
| 13424 | * @offload_req: offload request |
| 13425 | * @buf_ptr: buffer pointer |
| 13426 | * |
| 13427 | * To fill NS offload data to firmware |
| 13428 | * when target goes to wow mode. |
| 13429 | * |
| 13430 | * Return: None |
| 13431 | */ |
| 13432 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13433 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13434 | { |
| 13435 | |
| 13436 | int i; |
| 13437 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13438 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13439 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13440 | (WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 13441 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 13442 | for (i = 0; i < WMI_MAX_NS_OFFLOADS; i++) { |
| 13443 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 13444 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 13445 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 13446 | (sizeof(WMI_NS_OFFLOAD_TUPLE) - WMI_TLV_HDR_SIZE)); |
| 13447 | |
| 13448 | /* |
| 13449 | * Fill data only for NS offload in the first ARP tuple for LA |
| 13450 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13451 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13452 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 13453 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13454 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13455 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13456 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13457 | sizeof(WMI_IPV6_ADDR)); |
| 13458 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13459 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13460 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13461 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13462 | ns_tuple->flags |= |
| 13463 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 13464 | } |
| 13465 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13466 | i, &ns_req->self_ipv6_addr[i], |
| 13467 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13468 | |
| 13469 | /* target MAC is optional, check if it is valid, |
| 13470 | * if this is not valid, the target will use the known |
| 13471 | * local MAC address rather than the tuple |
| 13472 | */ |
| 13473 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13474 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13475 | &ns_tuple->target_mac); |
| 13476 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 13477 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 13478 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 13479 | } |
| 13480 | } |
| 13481 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 13482 | } |
| 13483 | } |
| 13484 | |
| 13485 | |
| 13486 | /** |
| 13487 | * fill_nsoffload_ext_tlv() - Fill NS offload ext data |
| 13488 | * @wmi: wmi handle |
| 13489 | * @offload_req: offload request |
| 13490 | * @buf_ptr: buffer pointer |
| 13491 | * |
| 13492 | * To fill extended NS offload extended data to firmware |
| 13493 | * when target goes to wow mode. |
| 13494 | * |
| 13495 | * Return: None |
| 13496 | */ |
| 13497 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13498 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13499 | { |
| 13500 | int i; |
| 13501 | WMI_NS_OFFLOAD_TUPLE *ns_tuple; |
| 13502 | uint32_t count, num_ns_ext_tuples; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13503 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13504 | count = ns_req->num_ns_offload_count; |
| 13505 | num_ns_ext_tuples = ns_req->num_ns_offload_count - |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13506 | WMI_MAX_NS_OFFLOADS; |
| 13507 | |
| 13508 | /* Populate extended NS offload tuples */ |
| 13509 | WMITLV_SET_HDR(*buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 13510 | (num_ns_ext_tuples * sizeof(WMI_NS_OFFLOAD_TUPLE))); |
| 13511 | *buf_ptr += WMI_TLV_HDR_SIZE; |
| 13512 | for (i = WMI_MAX_NS_OFFLOADS; i < count; i++) { |
| 13513 | ns_tuple = (WMI_NS_OFFLOAD_TUPLE *)*buf_ptr; |
| 13514 | WMITLV_SET_HDR(&ns_tuple->tlv_header, |
| 13515 | WMITLV_TAG_STRUC_WMI_NS_OFFLOAD_TUPLE, |
| 13516 | (sizeof(WMI_NS_OFFLOAD_TUPLE)-WMI_TLV_HDR_SIZE)); |
| 13517 | |
| 13518 | /* |
| 13519 | * Fill data only for NS offload in the first ARP tuple for LA |
| 13520 | */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13521 | if ((ns_req->enable & PMO_OFFLOAD_ENABLE)) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13522 | ns_tuple->flags |= WMI_NSOFF_FLAGS_VALID; |
| 13523 | /* Copy the target/solicitation/remote ip addr */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13524 | if (ns_req->target_ipv6_addr_valid[i]) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13525 | qdf_mem_copy(&ns_tuple->target_ipaddr[0], |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13526 | &ns_req->target_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13527 | sizeof(WMI_IPV6_ADDR)); |
| 13528 | qdf_mem_copy(&ns_tuple->solicitation_ipaddr, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13529 | &ns_req->self_ipv6_addr[i], |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13530 | sizeof(WMI_IPV6_ADDR)); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13531 | if (ns_req->target_ipv6_addr_ac_type[i]) { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13532 | ns_tuple->flags |= |
| 13533 | WMI_NSOFF_FLAGS_IS_IPV6_ANYCAST; |
| 13534 | } |
| 13535 | WMI_LOGD("Index %d NS solicitedIp %pI6, targetIp %pI6", |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13536 | i, &ns_req->self_ipv6_addr[i], |
| 13537 | &ns_req->target_ipv6_addr[i]); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13538 | |
| 13539 | /* target MAC is optional, check if it is valid, |
| 13540 | * if this is not valid, the target will use the |
| 13541 | * known local MAC address rather than the tuple |
| 13542 | */ |
| 13543 | WMI_CHAR_ARRAY_TO_MAC_ADDR( |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13544 | ns_req->self_macaddr.bytes, |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13545 | &ns_tuple->target_mac); |
| 13546 | if ((ns_tuple->target_mac.mac_addr31to0 != 0) || |
| 13547 | (ns_tuple->target_mac.mac_addr47to32 != 0)) { |
| 13548 | ns_tuple->flags |= WMI_NSOFF_FLAGS_MAC_VALID; |
| 13549 | } |
| 13550 | } |
| 13551 | *buf_ptr += sizeof(WMI_NS_OFFLOAD_TUPLE); |
| 13552 | } |
| 13553 | } |
| 13554 | #else |
| 13555 | static void fill_ns_offload_params_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13556 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13557 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13558 | } |
| 13559 | |
| 13560 | static void fill_nsoffload_ext_tlv(wmi_unified_t wmi_handle, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13561 | struct pmo_ns_offload_params *ns_req, uint8_t **buf_ptr) |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13562 | { |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13563 | } |
| 13564 | #endif |
| 13565 | |
| 13566 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13567 | * send_enable_arp_ns_offload_cmd_tlv() - enable ARP NS offload |
| 13568 | * @wma: wmi handle |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13569 | * @arp_offload_req: arp offload request |
| 13570 | * @ns_offload_req: ns offload request |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13571 | * @arp_only: flag |
| 13572 | * |
| 13573 | * To configure ARP NS off load data to firmware |
| 13574 | * when target goes to wow mode. |
| 13575 | * |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13576 | * Return: QDF Status |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13577 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 13578 | 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] | 13579 | struct pmo_arp_offload_params *arp_offload_req, |
| 13580 | struct pmo_ns_offload_params *ns_offload_req, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13581 | uint8_t vdev_id) |
| 13582 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13583 | int32_t res; |
| 13584 | WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *cmd; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13585 | A_UINT8 *buf_ptr; |
| 13586 | wmi_buf_t buf; |
| 13587 | int32_t len; |
| 13588 | uint32_t count = 0, num_ns_ext_tuples = 0; |
| 13589 | |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13590 | count = ns_offload_req->num_ns_offload_count; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13591 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13592 | /* |
| 13593 | * TLV place holder size for array of NS tuples |
| 13594 | * TLV place holder size for array of ARP tuples |
| 13595 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13596 | len = sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param) + |
| 13597 | WMI_TLV_HDR_SIZE + |
| 13598 | WMI_MAX_NS_OFFLOADS * sizeof(WMI_NS_OFFLOAD_TUPLE) + |
| 13599 | WMI_TLV_HDR_SIZE + |
| 13600 | WMI_MAX_ARP_OFFLOADS * sizeof(WMI_ARP_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13601 | |
| 13602 | /* |
| 13603 | * If there are more than WMI_MAX_NS_OFFLOADS addresses then allocate |
| 13604 | * extra length for extended NS offload tuples which follows ARP offload |
| 13605 | * tuples. Host needs to fill this structure in following format: |
| 13606 | * 2 NS ofload tuples |
| 13607 | * 2 ARP offload tuples |
| 13608 | * N numbers of extended NS offload tuples if HDD has given more than |
| 13609 | * 2 NS offload addresses |
| 13610 | */ |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13611 | if (count > WMI_MAX_NS_OFFLOADS) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13612 | num_ns_ext_tuples = count - WMI_MAX_NS_OFFLOADS; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13613 | len += WMI_TLV_HDR_SIZE + num_ns_ext_tuples |
| 13614 | * sizeof(WMI_NS_OFFLOAD_TUPLE); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13615 | } |
| 13616 | |
| 13617 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13618 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13619 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13620 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13621 | } |
| 13622 | |
| 13623 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 13624 | cmd = (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param *) buf_ptr; |
| 13625 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13626 | WMITLV_TAG_STRUC_WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param, |
| 13627 | WMITLV_GET_STRUCT_TLVLEN |
| 13628 | (WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param)); |
| 13629 | cmd->flags = 0; |
| 13630 | cmd->vdev_id = vdev_id; |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13631 | cmd->num_ns_ext_tuples = num_ns_ext_tuples; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13632 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13633 | WMI_LOGD("ARP NS Offload vdev_id: %d", cmd->vdev_id); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13634 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13635 | buf_ptr += sizeof(WMI_SET_ARP_NS_OFFLOAD_CMD_fixed_param); |
Mukul Sharma | 3a5eedb | 2016-09-07 20:31:47 +0530 | [diff] [blame] | 13636 | fill_ns_offload_params_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
| 13637 | fill_arp_offload_params_tlv(wmi_handle, arp_offload_req, &buf_ptr); |
| 13638 | if (num_ns_ext_tuples) |
| 13639 | fill_nsoffload_ext_tlv(wmi_handle, ns_offload_req, &buf_ptr); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13640 | |
| 13641 | res = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13642 | WMI_SET_ARP_NS_OFFLOAD_CMDID); |
| 13643 | if (res) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13644 | WMI_LOGE("Failed to enable ARP NDP/NSffload"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13645 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13646 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13647 | } |
| 13648 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 13649 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 13650 | } |
| 13651 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13652 | /** |
| 13653 | * send_enable_enhance_multicast_offload_tlv() - send enhance multicast offload |
| 13654 | * @wmi_handle: wmi handle |
| 13655 | * @vdev_id: vdev id |
| 13656 | * @action: true for enable else false |
| 13657 | * |
| 13658 | * To enable enhance multicast offload to firmware |
| 13659 | * when target goes to wow mode. |
| 13660 | * |
| 13661 | * Return: QDF Status |
| 13662 | */ |
| 13663 | |
| 13664 | static |
| 13665 | QDF_STATUS send_enable_enhance_multicast_offload_tlv( |
| 13666 | wmi_unified_t wmi_handle, |
| 13667 | uint8_t vdev_id, bool action) |
| 13668 | { |
| 13669 | QDF_STATUS status; |
| 13670 | wmi_buf_t buf; |
| 13671 | wmi_config_enhanced_mcast_filter_cmd_fixed_param *cmd; |
| 13672 | |
| 13673 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 13674 | if (!buf) { |
| 13675 | WMI_LOGE("Failed to allocate buffer to send set key cmd"); |
| 13676 | return QDF_STATUS_E_NOMEM; |
| 13677 | } |
| 13678 | |
| 13679 | cmd = (wmi_config_enhanced_mcast_filter_cmd_fixed_param *) |
| 13680 | wmi_buf_data(buf); |
| 13681 | |
| 13682 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13683 | WMITLV_TAG_STRUC_wmi_config_enhanced_mcast_filter_fixed_param, |
| 13684 | WMITLV_GET_STRUCT_TLVLEN( |
| 13685 | wmi_config_enhanced_mcast_filter_cmd_fixed_param)); |
| 13686 | |
| 13687 | cmd->vdev_id = vdev_id; |
| 13688 | cmd->enable = ((action == 0) ? ENHANCED_MCAST_FILTER_DISABLED : |
| 13689 | ENHANCED_MCAST_FILTER_ENABLED); |
| 13690 | WMI_LOGD("%s: config enhance multicast offload action %d for vdev %d", |
| 13691 | __func__, action, vdev_id); |
| 13692 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 13693 | sizeof(*cmd), WMI_CONFIG_ENHANCED_MCAST_FILTER_CMDID); |
| 13694 | if (status != QDF_STATUS_SUCCESS) { |
| 13695 | qdf_nbuf_free(buf); |
| 13696 | WMI_LOGE("%s:Failed to send ENHANCED_MCAST_FILTER_CMDID", |
| 13697 | __func__); |
| 13698 | } |
| 13699 | |
| 13700 | return status; |
| 13701 | } |
| 13702 | |
| 13703 | /** |
| 13704 | * extract_gtk_rsp_event_tlv() - extract gtk rsp params from event |
| 13705 | * @wmi_handle: wmi handle |
| 13706 | * @param evt_buf: pointer to event buffer |
| 13707 | * @param hdr: Pointer to hold header |
| 13708 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 13709 | * |
| 13710 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13711 | */ |
| 13712 | static QDF_STATUS extract_gtk_rsp_event_tlv(wmi_unified_t wmi_handle, |
| 13713 | void *evt_buf, struct pmo_gtk_rsp_params *gtk_rsp_param, uint32_t len) |
| 13714 | { |
| 13715 | WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *fixed_param; |
| 13716 | WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *param_buf; |
| 13717 | |
| 13718 | param_buf = (WMI_GTK_OFFLOAD_STATUS_EVENTID_param_tlvs *)evt_buf; |
| 13719 | if (!param_buf) { |
| 13720 | WMI_LOGE("gtk param_buf is NULL"); |
| 13721 | return QDF_STATUS_E_INVAL; |
| 13722 | } |
| 13723 | |
| 13724 | if (len < sizeof(WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param)) { |
| 13725 | WMI_LOGE("Invalid length for GTK status"); |
| 13726 | return QDF_STATUS_E_INVAL; |
| 13727 | } |
| 13728 | |
| 13729 | fixed_param = (WMI_GTK_OFFLOAD_STATUS_EVENT_fixed_param *) |
| 13730 | param_buf->fixed_param; |
| 13731 | gtk_rsp_param->vdev_id = fixed_param->vdev_id; |
| 13732 | gtk_rsp_param->status_flag = QDF_STATUS_SUCCESS; |
| 13733 | gtk_rsp_param->refresh_cnt = fixed_param->refresh_cnt; |
| 13734 | qdf_mem_copy(>k_rsp_param->replay_counter, |
| 13735 | &fixed_param->replay_counter, |
| 13736 | GTK_REPLAY_COUNTER_BYTES); |
| 13737 | |
| 13738 | return QDF_STATUS_SUCCESS; |
| 13739 | |
| 13740 | } |
| 13741 | |
| 13742 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 13743 | /** |
| 13744 | * send_wow_sta_ra_filter_cmd_tlv() - set RA filter pattern in fw |
| 13745 | * @wmi_handle: wmi handle |
| 13746 | * @vdev_id: vdev id |
| 13747 | * |
| 13748 | * Return: CDF status |
| 13749 | */ |
| 13750 | static QDF_STATUS send_wow_sta_ra_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 13751 | uint8_t vdev_id, uint8_t default_pattern, |
| 13752 | uint16_t rate_limit_interval) |
| 13753 | { |
| 13754 | |
| 13755 | WMI_WOW_ADD_PATTERN_CMD_fixed_param *cmd; |
| 13756 | wmi_buf_t buf; |
| 13757 | uint8_t *buf_ptr; |
| 13758 | int32_t len; |
| 13759 | int ret; |
| 13760 | |
| 13761 | len = sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param) + |
| 13762 | WMI_TLV_HDR_SIZE + |
| 13763 | 0 * sizeof(WOW_BITMAP_PATTERN_T) + |
| 13764 | WMI_TLV_HDR_SIZE + |
| 13765 | 0 * sizeof(WOW_IPV4_SYNC_PATTERN_T) + |
| 13766 | WMI_TLV_HDR_SIZE + |
| 13767 | 0 * sizeof(WOW_IPV6_SYNC_PATTERN_T) + |
| 13768 | WMI_TLV_HDR_SIZE + |
| 13769 | 0 * sizeof(WOW_MAGIC_PATTERN_CMD) + |
| 13770 | WMI_TLV_HDR_SIZE + |
| 13771 | 0 * sizeof(A_UINT32) + WMI_TLV_HDR_SIZE + 1 * sizeof(A_UINT32); |
| 13772 | |
| 13773 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13774 | if (!buf) { |
| 13775 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 13776 | return QDF_STATUS_E_NOMEM; |
| 13777 | } |
| 13778 | |
| 13779 | cmd = (WMI_WOW_ADD_PATTERN_CMD_fixed_param *) wmi_buf_data(buf); |
| 13780 | buf_ptr = (uint8_t *) cmd; |
| 13781 | |
| 13782 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13783 | WMITLV_TAG_STRUC_WMI_WOW_ADD_PATTERN_CMD_fixed_param, |
| 13784 | WMITLV_GET_STRUCT_TLVLEN |
| 13785 | (WMI_WOW_ADD_PATTERN_CMD_fixed_param)); |
| 13786 | cmd->vdev_id = vdev_id; |
| 13787 | cmd->pattern_id = default_pattern, |
| 13788 | cmd->pattern_type = WOW_IPV6_RA_PATTERN; |
| 13789 | buf_ptr += sizeof(WMI_WOW_ADD_PATTERN_CMD_fixed_param); |
| 13790 | |
| 13791 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_BITMAP_PATTERN_T but no data. */ |
| 13792 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13793 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13794 | |
| 13795 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV4_SYNC_PATTERN_T but no data. */ |
| 13796 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13797 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13798 | |
| 13799 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_IPV6_SYNC_PATTERN_T but no data. */ |
| 13800 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13801 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13802 | |
| 13803 | /* Fill TLV for WMITLV_TAG_STRUC_WOW_MAGIC_PATTERN_CMD but no data. */ |
| 13804 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); |
| 13805 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13806 | |
| 13807 | /* Fill TLV for pattern_info_timeout but no data. */ |
| 13808 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, 0); |
| 13809 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13810 | |
| 13811 | /* Fill TLV for ra_ratelimit_interval. */ |
| 13812 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, sizeof(A_UINT32)); |
| 13813 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 13814 | |
| 13815 | *((A_UINT32 *) buf_ptr) = rate_limit_interval; |
| 13816 | |
| 13817 | WMI_LOGD("%s: send RA rate limit [%d] to fw vdev = %d", __func__, |
| 13818 | rate_limit_interval, vdev_id); |
| 13819 | |
| 13820 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 13821 | WMI_WOW_ADD_WAKE_PATTERN_CMDID); |
| 13822 | if (ret) { |
| 13823 | WMI_LOGE("%s: Failed to send RA rate limit to fw", __func__); |
| 13824 | wmi_buf_free(buf); |
| 13825 | return QDF_STATUS_E_FAILURE; |
| 13826 | } |
| 13827 | |
| 13828 | return QDF_STATUS_SUCCESS; |
| 13829 | |
| 13830 | } |
| 13831 | #endif /* FEATURE_WLAN_RA_FILTERING */ |
| 13832 | |
| 13833 | /** |
| 13834 | * send_add_clear_mcbc_filter_cmd_tlv() - set mcast filter command to fw |
| 13835 | * @wmi_handle: wmi handle |
| 13836 | * @vdev_id: vdev id |
| 13837 | * @multicastAddr: mcast address |
| 13838 | * @clearList: clear list flag |
| 13839 | * |
| 13840 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13841 | */ |
| 13842 | static QDF_STATUS send_add_clear_mcbc_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 13843 | uint8_t vdev_id, |
| 13844 | struct qdf_mac_addr multicast_addr, |
| 13845 | bool clearList) |
| 13846 | { |
| 13847 | WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *cmd; |
| 13848 | wmi_buf_t buf; |
| 13849 | int err; |
| 13850 | |
| 13851 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 13852 | if (!buf) { |
| 13853 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
| 13854 | return QDF_STATUS_E_NOMEM; |
| 13855 | } |
| 13856 | |
| 13857 | cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf); |
| 13858 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 13859 | |
| 13860 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13861 | WMITLV_TAG_STRUC_WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param, |
| 13862 | WMITLV_GET_STRUCT_TLVLEN |
| 13863 | (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param)); |
| 13864 | cmd->action = |
| 13865 | (clearList ? WMI_MCAST_FILTER_DELETE : WMI_MCAST_FILTER_SET); |
| 13866 | cmd->vdev_id = vdev_id; |
| 13867 | WMI_CHAR_ARRAY_TO_MAC_ADDR(multicast_addr.bytes, &cmd->mcastbdcastaddr); |
| 13868 | |
| 13869 | WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d; MCBC MAC Addr: %pM", |
| 13870 | cmd->action, vdev_id, clearList, multicast_addr.bytes); |
| 13871 | |
| 13872 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 13873 | sizeof(*cmd), |
| 13874 | WMI_SET_MCASTBCAST_FILTER_CMDID); |
| 13875 | if (err) { |
| 13876 | WMI_LOGE("Failed to send set_param cmd"); |
| 13877 | wmi_buf_free(buf); |
| 13878 | return QDF_STATUS_E_FAILURE; |
| 13879 | } |
| 13880 | |
| 13881 | return QDF_STATUS_SUCCESS; |
| 13882 | } |
| 13883 | |
| 13884 | /** |
Poddar, Siddarth | 79ba820 | 2017-09-28 17:14:01 +0530 | [diff] [blame] | 13885 | * send_multiple_add_clear_mcbc_filter_cmd_tlv() - send multiple mcast filter |
| 13886 | * command to fw |
| 13887 | * @wmi_handle: wmi handle |
| 13888 | * @vdev_id: vdev id |
| 13889 | * @mcast_filter_params: mcast filter params |
| 13890 | * |
| 13891 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 13892 | */ |
| 13893 | static QDF_STATUS send_multiple_add_clear_mcbc_filter_cmd_tlv( |
| 13894 | wmi_unified_t wmi_handle, |
| 13895 | uint8_t vdev_id, |
| 13896 | struct pmo_mcast_filter_params *filter_param) |
| 13897 | |
| 13898 | { |
| 13899 | WMI_SET_MULTIPLE_MCAST_FILTER_CMD_fixed_param *cmd; |
| 13900 | uint8_t *buf_ptr; |
| 13901 | wmi_buf_t buf; |
| 13902 | int err; |
| 13903 | int i; |
| 13904 | uint8_t *mac_addr_src_ptr = NULL; |
| 13905 | wmi_mac_addr *mac_addr_dst_ptr; |
| 13906 | uint32_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + |
| 13907 | sizeof(wmi_mac_addr) * filter_param->multicast_addr_cnt; |
| 13908 | |
| 13909 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13910 | if (!buf) { |
| 13911 | WMI_LOGE("Failed to allocate memory"); |
| 13912 | return QDF_STATUS_E_NOMEM; |
| 13913 | } |
| 13914 | |
| 13915 | buf_ptr = (A_UINT8 *) wmi_buf_data(buf); |
| 13916 | cmd = (WMI_SET_MULTIPLE_MCAST_FILTER_CMD_fixed_param *) |
| 13917 | wmi_buf_data(buf); |
| 13918 | qdf_mem_zero(cmd, sizeof(*cmd)); |
| 13919 | |
| 13920 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13921 | WMITLV_TAG_STRUC_wmi_set_multiple_mcast_filter_cmd_fixed_param, |
| 13922 | WMITLV_GET_STRUCT_TLVLEN |
| 13923 | (WMI_SET_MULTIPLE_MCAST_FILTER_CMD_fixed_param)); |
| 13924 | cmd->operation = |
| 13925 | ((filter_param->action == 0) ? WMI_MULTIPLE_MCAST_FILTER_DELETE |
| 13926 | : WMI_MULTIPLE_MCAST_FILTER_ADD); |
| 13927 | cmd->vdev_id = vdev_id; |
| 13928 | cmd->num_mcastaddrs = filter_param->multicast_addr_cnt; |
| 13929 | |
| 13930 | buf_ptr += sizeof(*cmd); |
| 13931 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 13932 | sizeof(wmi_mac_addr) * |
| 13933 | filter_param->multicast_addr_cnt); |
| 13934 | |
| 13935 | if (filter_param->multicast_addr_cnt == 0) |
| 13936 | goto send_cmd; |
| 13937 | |
| 13938 | mac_addr_src_ptr = (uint8_t *)&filter_param->multicast_addr; |
| 13939 | mac_addr_dst_ptr = (wmi_mac_addr *) |
| 13940 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 13941 | |
| 13942 | for (i = 0; i < filter_param->multicast_addr_cnt; i++) { |
| 13943 | WMI_CHAR_ARRAY_TO_MAC_ADDR(mac_addr_src_ptr, mac_addr_dst_ptr); |
| 13944 | mac_addr_src_ptr += ATH_MAC_LEN; |
| 13945 | mac_addr_dst_ptr++; |
| 13946 | } |
| 13947 | |
| 13948 | send_cmd: |
| 13949 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 13950 | len, |
| 13951 | WMI_SET_MULTIPLE_MCAST_FILTER_CMDID); |
| 13952 | if (err) { |
| 13953 | WMI_LOGE("Failed to send set_param cmd"); |
| 13954 | wmi_buf_free(buf); |
| 13955 | return QDF_STATUS_E_FAILURE; |
| 13956 | } |
| 13957 | |
| 13958 | return QDF_STATUS_SUCCESS; |
| 13959 | } |
| 13960 | |
| 13961 | |
| 13962 | /** |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 13963 | * send_gtk_offload_cmd_tlv() - send GTK offload command to fw |
| 13964 | * @wmi_handle: wmi handle |
| 13965 | * @vdev_id: vdev id |
| 13966 | * @params: GTK offload parameters |
| 13967 | * |
| 13968 | * Return: CDF status |
| 13969 | */ |
| 13970 | static |
| 13971 | QDF_STATUS send_gtk_offload_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id, |
| 13972 | struct pmo_gtk_req *params, |
| 13973 | bool enable_offload, |
| 13974 | uint32_t gtk_offload_opcode) |
| 13975 | { |
| 13976 | int len; |
| 13977 | wmi_buf_t buf; |
| 13978 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
| 13979 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13980 | |
| 13981 | WMI_LOGD("%s Enter", __func__); |
| 13982 | |
| 13983 | len = sizeof(*cmd); |
| 13984 | |
| 13985 | /* alloc wmi buffer */ |
| 13986 | buf = wmi_buf_alloc(wmi_handle, len); |
| 13987 | if (!buf) { |
| 13988 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 13989 | status = QDF_STATUS_E_NOMEM; |
| 13990 | goto out; |
| 13991 | } |
| 13992 | |
| 13993 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 13994 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 13995 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 13996 | WMITLV_GET_STRUCT_TLVLEN |
| 13997 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 13998 | |
| 13999 | cmd->vdev_id = vdev_id; |
| 14000 | |
| 14001 | /* Request target to enable GTK offload */ |
| 14002 | if (enable_offload == PMO_GTK_OFFLOAD_ENABLE) { |
| 14003 | cmd->flags = gtk_offload_opcode; |
| 14004 | |
| 14005 | /* Copy the keys and replay counter */ |
| 14006 | qdf_mem_copy(cmd->KCK, params->kck, PMO_KCK_LEN); |
| 14007 | qdf_mem_copy(cmd->KEK, params->kek, PMO_KEK_LEN); |
| 14008 | qdf_mem_copy(cmd->replay_counter, ¶ms->replay_counter, |
| 14009 | GTK_REPLAY_COUNTER_BYTES); |
| 14010 | } else { |
| 14011 | cmd->flags = gtk_offload_opcode; |
| 14012 | } |
| 14013 | |
| 14014 | WMI_LOGD("VDEVID: %d, GTK_FLAGS: x%x", vdev_id, cmd->flags); |
| 14015 | |
| 14016 | /* send the wmi command */ |
| 14017 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14018 | WMI_GTK_OFFLOAD_CMDID)) { |
| 14019 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID"); |
| 14020 | wmi_buf_free(buf); |
| 14021 | status = QDF_STATUS_E_FAILURE; |
| 14022 | } |
| 14023 | |
| 14024 | out: |
| 14025 | WMI_LOGD("%s Exit", __func__); |
| 14026 | return status; |
| 14027 | } |
| 14028 | |
| 14029 | /** |
| 14030 | * send_process_gtk_offload_getinfo_cmd_tlv() - send GTK offload cmd to fw |
| 14031 | * @wmi_handle: wmi handle |
| 14032 | * @params: GTK offload params |
| 14033 | * |
| 14034 | * Return: CDF status |
| 14035 | */ |
| 14036 | static QDF_STATUS send_process_gtk_offload_getinfo_cmd_tlv( |
| 14037 | wmi_unified_t wmi_handle, |
| 14038 | uint8_t vdev_id, |
| 14039 | uint64_t offload_req_opcode) |
| 14040 | { |
| 14041 | int len; |
| 14042 | wmi_buf_t buf; |
| 14043 | WMI_GTK_OFFLOAD_CMD_fixed_param *cmd; |
| 14044 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 14045 | |
| 14046 | len = sizeof(*cmd); |
| 14047 | |
| 14048 | /* alloc wmi buffer */ |
| 14049 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14050 | if (!buf) { |
| 14051 | WMI_LOGE("wmi_buf_alloc failed for WMI_GTK_OFFLOAD_CMD"); |
| 14052 | status = QDF_STATUS_E_NOMEM; |
| 14053 | goto out; |
| 14054 | } |
| 14055 | |
| 14056 | cmd = (WMI_GTK_OFFLOAD_CMD_fixed_param *) wmi_buf_data(buf); |
| 14057 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14058 | WMITLV_TAG_STRUC_WMI_GTK_OFFLOAD_CMD_fixed_param, |
| 14059 | WMITLV_GET_STRUCT_TLVLEN |
| 14060 | (WMI_GTK_OFFLOAD_CMD_fixed_param)); |
| 14061 | |
| 14062 | /* Request for GTK offload status */ |
| 14063 | cmd->flags = offload_req_opcode; |
| 14064 | cmd->vdev_id = vdev_id; |
| 14065 | |
| 14066 | /* send the wmi command */ |
| 14067 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14068 | WMI_GTK_OFFLOAD_CMDID)) { |
| 14069 | WMI_LOGE("Failed to send WMI_GTK_OFFLOAD_CMDID for req info"); |
| 14070 | wmi_buf_free(buf); |
| 14071 | status = QDF_STATUS_E_FAILURE; |
| 14072 | } |
| 14073 | |
| 14074 | out: |
| 14075 | return status; |
| 14076 | } |
| 14077 | |
| 14078 | /** |
| 14079 | * send_action_frame_patterns_cmd_tlv() - send wmi cmd of action filter params |
| 14080 | * @wmi_handle: wmi handler |
| 14081 | * @action_params: pointer to action_params |
| 14082 | * |
| 14083 | * Return: 0 for success, otherwise appropriate error code |
| 14084 | */ |
| 14085 | static QDF_STATUS send_action_frame_patterns_cmd_tlv(wmi_unified_t wmi_handle, |
| 14086 | struct pmo_action_wakeup_set_params *action_params) |
| 14087 | { |
| 14088 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param *cmd; |
| 14089 | wmi_buf_t buf; |
| 14090 | int i; |
| 14091 | int32_t err; |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14092 | uint32_t len = 0, *cmd_args; |
| 14093 | uint8_t *buf_ptr; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14094 | |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14095 | len = (PMO_SUPPORTED_ACTION_CATE * sizeof(A_UINT32)) |
| 14096 | + WMI_TLV_HDR_SIZE + sizeof(*cmd); |
| 14097 | buf = wmi_buf_alloc(wmi_handle, len); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14098 | if (!buf) { |
| 14099 | WMI_LOGE("Failed to allocate buffer to send action filter cmd"); |
| 14100 | return QDF_STATUS_E_NOMEM; |
| 14101 | } |
| 14102 | 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] | 14103 | buf_ptr = (uint8_t *)cmd; |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14104 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14105 | WMITLV_TAG_STRUC_wmi_wow_set_action_wake_up_cmd_fixed_param, |
| 14106 | WMITLV_GET_STRUCT_TLVLEN( |
| 14107 | WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param)); |
| 14108 | |
| 14109 | cmd->vdev_id = action_params->vdev_id; |
| 14110 | cmd->operation = action_params->operation; |
| 14111 | |
| 14112 | for (i = 0; i < MAX_SUPPORTED_ACTION_CATEGORY_ELE_LIST; i++) |
| 14113 | cmd->action_category_map[i] = |
| 14114 | action_params->action_category_map[i]; |
| 14115 | |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14116 | buf_ptr += sizeof(WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param); |
| 14117 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 14118 | (PMO_SUPPORTED_ACTION_CATE * sizeof(A_UINT32))); |
| 14119 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14120 | cmd_args = (uint32_t *) buf_ptr; |
| 14121 | for (i = 0; i < PMO_SUPPORTED_ACTION_CATE; i++) |
| 14122 | cmd_args[i] = action_params->action_per_category[i]; |
| 14123 | |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14124 | err = wmi_unified_cmd_send(wmi_handle, buf, |
Sridhar Selvaraj | 2c51f4f | 2017-08-04 12:04:55 +0530 | [diff] [blame] | 14125 | len, WMI_WOW_SET_ACTION_WAKE_UP_CMDID); |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14126 | if (err) { |
| 14127 | WMI_LOGE("Failed to send ap_ps_egap cmd"); |
| 14128 | wmi_buf_free(buf); |
| 14129 | return QDF_STATUS_E_FAILURE; |
| 14130 | } |
| 14131 | |
| 14132 | return QDF_STATUS_SUCCESS; |
| 14133 | } |
| 14134 | |
| 14135 | #ifdef FEATURE_WLAN_LPHB |
| 14136 | |
| 14137 | /** |
| 14138 | * send_lphb_config_hbenable_cmd_tlv() - enable command of LPHB configuration |
| 14139 | * @wmi_handle: wmi handle |
| 14140 | * @lphb_conf_req: configuration info |
| 14141 | * |
| 14142 | * Return: CDF status |
| 14143 | */ |
| 14144 | static QDF_STATUS send_lphb_config_hbenable_cmd_tlv(wmi_unified_t wmi_handle, |
| 14145 | wmi_hb_set_enable_cmd_fixed_param *params) |
| 14146 | { |
| 14147 | QDF_STATUS status; |
| 14148 | wmi_buf_t buf = NULL; |
| 14149 | uint8_t *buf_ptr; |
| 14150 | wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp; |
| 14151 | int len = sizeof(wmi_hb_set_enable_cmd_fixed_param); |
| 14152 | |
| 14153 | |
| 14154 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14155 | if (!buf) { |
| 14156 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14157 | return QDF_STATUS_E_NOMEM; |
| 14158 | } |
| 14159 | |
| 14160 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14161 | hb_enable_fp = (wmi_hb_set_enable_cmd_fixed_param *) buf_ptr; |
| 14162 | WMITLV_SET_HDR(&hb_enable_fp->tlv_header, |
| 14163 | WMITLV_TAG_STRUC_wmi_hb_set_enable_cmd_fixed_param, |
| 14164 | WMITLV_GET_STRUCT_TLVLEN |
| 14165 | (wmi_hb_set_enable_cmd_fixed_param)); |
| 14166 | |
| 14167 | /* fill in values */ |
| 14168 | hb_enable_fp->vdev_id = params->session; |
| 14169 | hb_enable_fp->enable = params->enable; |
| 14170 | hb_enable_fp->item = params->item; |
| 14171 | hb_enable_fp->session = params->session; |
| 14172 | |
| 14173 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14174 | len, WMI_HB_SET_ENABLE_CMDID); |
| 14175 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14176 | WMI_LOGE("cmd_send WMI_HB_SET_ENABLE returned Error %d", |
| 14177 | status); |
| 14178 | wmi_buf_free(buf); |
| 14179 | } |
| 14180 | |
| 14181 | return status; |
| 14182 | } |
| 14183 | |
| 14184 | /** |
| 14185 | * send_lphb_config_tcp_params_cmd_tlv() - set tcp params of LPHB configuration |
| 14186 | * @wmi_handle: wmi handle |
| 14187 | * @lphb_conf_req: lphb config request |
| 14188 | * |
| 14189 | * Return: CDF status |
| 14190 | */ |
| 14191 | static QDF_STATUS send_lphb_config_tcp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 14192 | wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req) |
| 14193 | { |
| 14194 | QDF_STATUS status; |
| 14195 | wmi_buf_t buf = NULL; |
| 14196 | uint8_t *buf_ptr; |
| 14197 | wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp; |
| 14198 | int len = sizeof(wmi_hb_set_tcp_params_cmd_fixed_param); |
| 14199 | |
| 14200 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14201 | if (!buf) { |
| 14202 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14203 | return QDF_STATUS_E_NOMEM; |
| 14204 | } |
| 14205 | |
| 14206 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14207 | hb_tcp_params_fp = (wmi_hb_set_tcp_params_cmd_fixed_param *) buf_ptr; |
| 14208 | WMITLV_SET_HDR(&hb_tcp_params_fp->tlv_header, |
| 14209 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_params_cmd_fixed_param, |
| 14210 | WMITLV_GET_STRUCT_TLVLEN |
| 14211 | (wmi_hb_set_tcp_params_cmd_fixed_param)); |
| 14212 | |
| 14213 | /* fill in values */ |
| 14214 | hb_tcp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 14215 | hb_tcp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 14216 | hb_tcp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 14217 | hb_tcp_params_fp->seq = lphb_conf_req->seq; |
| 14218 | hb_tcp_params_fp->src_port = lphb_conf_req->src_port; |
| 14219 | hb_tcp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 14220 | hb_tcp_params_fp->interval = lphb_conf_req->interval; |
| 14221 | hb_tcp_params_fp->timeout = lphb_conf_req->timeout; |
| 14222 | hb_tcp_params_fp->session = lphb_conf_req->session; |
| 14223 | qdf_mem_copy(&hb_tcp_params_fp->gateway_mac, |
| 14224 | &lphb_conf_req->gateway_mac, |
| 14225 | sizeof(hb_tcp_params_fp->gateway_mac)); |
| 14226 | |
| 14227 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14228 | len, WMI_HB_SET_TCP_PARAMS_CMDID); |
| 14229 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14230 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PARAMS returned Error %d", |
| 14231 | status); |
| 14232 | wmi_buf_free(buf); |
| 14233 | } |
| 14234 | |
| 14235 | return status; |
| 14236 | } |
| 14237 | |
| 14238 | /** |
| 14239 | * send_lphb_config_tcp_pkt_filter_cmd_tlv() - configure tcp packet filter cmd |
| 14240 | * @wmi_handle: wmi handle |
| 14241 | * @lphb_conf_req: lphb config request |
| 14242 | * |
| 14243 | * Return: CDF status |
| 14244 | */ |
| 14245 | static |
| 14246 | QDF_STATUS send_lphb_config_tcp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 14247 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp) |
| 14248 | { |
| 14249 | QDF_STATUS status; |
| 14250 | wmi_buf_t buf = NULL; |
| 14251 | uint8_t *buf_ptr; |
| 14252 | wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp; |
| 14253 | int len = sizeof(wmi_hb_set_tcp_pkt_filter_cmd_fixed_param); |
| 14254 | |
| 14255 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14256 | if (!buf) { |
| 14257 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14258 | return QDF_STATUS_E_NOMEM; |
| 14259 | } |
| 14260 | |
| 14261 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14262 | hb_tcp_filter_fp = |
| 14263 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 14264 | WMITLV_SET_HDR(&hb_tcp_filter_fp->tlv_header, |
| 14265 | WMITLV_TAG_STRUC_wmi_hb_set_tcp_pkt_filter_cmd_fixed_param, |
| 14266 | WMITLV_GET_STRUCT_TLVLEN |
| 14267 | (wmi_hb_set_tcp_pkt_filter_cmd_fixed_param)); |
| 14268 | |
| 14269 | /* fill in values */ |
| 14270 | hb_tcp_filter_fp->vdev_id = g_hb_tcp_filter_fp->vdev_id; |
| 14271 | hb_tcp_filter_fp->length = g_hb_tcp_filter_fp->length; |
| 14272 | hb_tcp_filter_fp->offset = g_hb_tcp_filter_fp->offset; |
| 14273 | hb_tcp_filter_fp->session = g_hb_tcp_filter_fp->session; |
| 14274 | memcpy((void *)&hb_tcp_filter_fp->filter, |
| 14275 | (void *)&g_hb_tcp_filter_fp->filter, |
| 14276 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 14277 | |
| 14278 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14279 | len, WMI_HB_SET_TCP_PKT_FILTER_CMDID); |
| 14280 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14281 | WMI_LOGE("cmd_send WMI_HB_SET_TCP_PKT_FILTER returned Error %d", |
| 14282 | status); |
| 14283 | wmi_buf_free(buf); |
| 14284 | } |
| 14285 | |
| 14286 | return status; |
| 14287 | } |
| 14288 | |
| 14289 | /** |
| 14290 | * send_lphb_config_udp_params_cmd_tlv() - configure udp param command of LPHB |
| 14291 | * @wmi_handle: wmi handle |
| 14292 | * @lphb_conf_req: lphb config request |
| 14293 | * |
| 14294 | * Return: CDF status |
| 14295 | */ |
| 14296 | static QDF_STATUS send_lphb_config_udp_params_cmd_tlv(wmi_unified_t wmi_handle, |
| 14297 | wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req) |
| 14298 | { |
| 14299 | QDF_STATUS status; |
| 14300 | wmi_buf_t buf = NULL; |
| 14301 | uint8_t *buf_ptr; |
| 14302 | wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp; |
| 14303 | int len = sizeof(wmi_hb_set_udp_params_cmd_fixed_param); |
| 14304 | |
| 14305 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14306 | if (!buf) { |
| 14307 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14308 | return QDF_STATUS_E_NOMEM; |
| 14309 | } |
| 14310 | |
| 14311 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14312 | hb_udp_params_fp = (wmi_hb_set_udp_params_cmd_fixed_param *) buf_ptr; |
| 14313 | WMITLV_SET_HDR(&hb_udp_params_fp->tlv_header, |
| 14314 | WMITLV_TAG_STRUC_wmi_hb_set_udp_params_cmd_fixed_param, |
| 14315 | WMITLV_GET_STRUCT_TLVLEN |
| 14316 | (wmi_hb_set_udp_params_cmd_fixed_param)); |
| 14317 | |
| 14318 | /* fill in values */ |
| 14319 | hb_udp_params_fp->vdev_id = lphb_conf_req->vdev_id; |
| 14320 | hb_udp_params_fp->srv_ip = lphb_conf_req->srv_ip; |
| 14321 | hb_udp_params_fp->dev_ip = lphb_conf_req->dev_ip; |
| 14322 | hb_udp_params_fp->src_port = lphb_conf_req->src_port; |
| 14323 | hb_udp_params_fp->dst_port = lphb_conf_req->dst_port; |
| 14324 | hb_udp_params_fp->interval = lphb_conf_req->interval; |
| 14325 | hb_udp_params_fp->timeout = lphb_conf_req->timeout; |
| 14326 | hb_udp_params_fp->session = lphb_conf_req->session; |
| 14327 | qdf_mem_copy(&hb_udp_params_fp->gateway_mac, |
| 14328 | &lphb_conf_req->gateway_mac, |
| 14329 | sizeof(lphb_conf_req->gateway_mac)); |
| 14330 | |
| 14331 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14332 | len, WMI_HB_SET_UDP_PARAMS_CMDID); |
| 14333 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14334 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PARAMS returned Error %d", |
| 14335 | status); |
| 14336 | wmi_buf_free(buf); |
| 14337 | } |
| 14338 | |
| 14339 | return status; |
| 14340 | } |
| 14341 | |
| 14342 | /** |
| 14343 | * send_lphb_config_udp_pkt_filter_cmd_tlv() - configure udp pkt filter command |
| 14344 | * @wmi_handle: wmi handle |
| 14345 | * @lphb_conf_req: lphb config request |
| 14346 | * |
| 14347 | * Return: CDF status |
| 14348 | */ |
| 14349 | static |
| 14350 | QDF_STATUS send_lphb_config_udp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 14351 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req) |
| 14352 | { |
| 14353 | QDF_STATUS status; |
| 14354 | wmi_buf_t buf = NULL; |
| 14355 | uint8_t *buf_ptr; |
| 14356 | wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp; |
| 14357 | int len = sizeof(wmi_hb_set_udp_pkt_filter_cmd_fixed_param); |
| 14358 | |
| 14359 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14360 | if (!buf) { |
| 14361 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14362 | return QDF_STATUS_E_NOMEM; |
| 14363 | } |
| 14364 | |
| 14365 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14366 | hb_udp_filter_fp = |
| 14367 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param *) buf_ptr; |
| 14368 | WMITLV_SET_HDR(&hb_udp_filter_fp->tlv_header, |
| 14369 | WMITLV_TAG_STRUC_wmi_hb_set_udp_pkt_filter_cmd_fixed_param, |
| 14370 | WMITLV_GET_STRUCT_TLVLEN |
| 14371 | (wmi_hb_set_udp_pkt_filter_cmd_fixed_param)); |
| 14372 | |
| 14373 | /* fill in values */ |
| 14374 | hb_udp_filter_fp->vdev_id = lphb_conf_req->vdev_id; |
| 14375 | hb_udp_filter_fp->length = lphb_conf_req->length; |
| 14376 | hb_udp_filter_fp->offset = lphb_conf_req->offset; |
| 14377 | hb_udp_filter_fp->session = lphb_conf_req->session; |
| 14378 | memcpy((void *)&hb_udp_filter_fp->filter, |
| 14379 | (void *)&lphb_conf_req->filter, |
| 14380 | WMI_WLAN_HB_MAX_FILTER_SIZE); |
| 14381 | |
| 14382 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14383 | len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); |
| 14384 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14385 | WMI_LOGE("cmd_send WMI_HB_SET_UDP_PKT_FILTER returned Error %d", |
| 14386 | status); |
| 14387 | wmi_buf_free(buf); |
| 14388 | } |
| 14389 | |
| 14390 | return status; |
| 14391 | } |
| 14392 | #endif /* FEATURE_WLAN_LPHB */ |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 14393 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14394 | static QDF_STATUS send_conf_hw_filter_cmd_tlv(wmi_unified_t wmi, |
| 14395 | struct pmo_hw_filter_params *req) |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14396 | { |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14397 | QDF_STATUS status; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14398 | wmi_hw_data_filter_cmd_fixed_param *cmd; |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14399 | wmi_buf_t wmi_buf; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14400 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14401 | if (!req) { |
| 14402 | WMI_LOGE("req is null"); |
| 14403 | return QDF_STATUS_E_INVAL; |
| 14404 | } |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14405 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14406 | wmi_buf = wmi_buf_alloc(wmi, sizeof(*cmd)); |
| 14407 | if (!wmi_buf) { |
| 14408 | WMI_LOGE(FL("Out of memory")); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14409 | return QDF_STATUS_E_NOMEM; |
| 14410 | } |
| 14411 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14412 | 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] | 14413 | WMITLV_SET_HDR(&cmd->tlv_header, |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14414 | WMITLV_TAG_STRUC_wmi_hw_data_filter_cmd_fixed_param, |
| 14415 | WMITLV_GET_STRUCT_TLVLEN(wmi_hw_data_filter_cmd_fixed_param)); |
| 14416 | cmd->vdev_id = req->vdev_id; |
| 14417 | cmd->enable = req->mode != PMO_HW_FILTER_DISABLED; |
| 14418 | cmd->hw_filter_bitmap = req->mode; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14419 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14420 | WMI_LOGD("configure hw filter (vdev_id: %d, mode: %d)", |
| 14421 | req->vdev_id, req->mode); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14422 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14423 | status = wmi_unified_cmd_send(wmi, wmi_buf, sizeof(*cmd), |
| 14424 | WMI_HW_DATA_FILTER_CMDID); |
| 14425 | if (QDF_IS_STATUS_ERROR(status)) { |
| 14426 | WMI_LOGE("Failed to configure hw filter"); |
| 14427 | wmi_buf_free(wmi_buf); |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14428 | } |
| 14429 | |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 14430 | return status; |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14431 | } |
Ravi Kumar Bokka | 0f3f04d | 2017-04-20 17:14:33 +0530 | [diff] [blame] | 14432 | |
| 14433 | /** |
| 14434 | * send_enable_disable_packet_filter_cmd_tlv() - enable/disable packet filter |
| 14435 | * @wmi_handle: wmi handle |
| 14436 | * @vdev_id: vdev id |
| 14437 | * @enable: Flag to enable/disable packet filter |
| 14438 | * |
| 14439 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14440 | */ |
| 14441 | static QDF_STATUS send_enable_disable_packet_filter_cmd_tlv( |
| 14442 | wmi_unified_t wmi_handle, uint8_t vdev_id, bool enable) |
| 14443 | { |
| 14444 | int32_t len; |
| 14445 | int ret = 0; |
| 14446 | wmi_buf_t buf; |
| 14447 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *cmd; |
| 14448 | |
| 14449 | len = sizeof(WMI_PACKET_FILTER_ENABLE_CMD_fixed_param); |
| 14450 | |
| 14451 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14452 | if (!buf) { |
| 14453 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 14454 | return QDF_STATUS_E_NOMEM; |
| 14455 | } |
| 14456 | |
| 14457 | cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf); |
| 14458 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14459 | WMITLV_TAG_STRUC_wmi_packet_filter_enable_fixed_param, |
| 14460 | WMITLV_GET_STRUCT_TLVLEN( |
| 14461 | WMI_PACKET_FILTER_ENABLE_CMD_fixed_param)); |
| 14462 | |
| 14463 | cmd->vdev_id = vdev_id; |
| 14464 | if (enable) |
| 14465 | cmd->enable = PACKET_FILTER_SET_ENABLE; |
| 14466 | else |
| 14467 | cmd->enable = PACKET_FILTER_SET_DISABLE; |
| 14468 | |
| 14469 | WMI_LOGE("%s: Packet filter enable %d for vdev_id %d", |
| 14470 | __func__, cmd->enable, vdev_id); |
| 14471 | |
| 14472 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14473 | WMI_PACKET_FILTER_ENABLE_CMDID); |
| 14474 | if (ret) { |
| 14475 | WMI_LOGE("Failed to send packet filter wmi cmd to fw"); |
| 14476 | wmi_buf_free(buf); |
| 14477 | } |
| 14478 | |
| 14479 | return ret; |
| 14480 | } |
| 14481 | |
| 14482 | /** |
| 14483 | * send_config_packet_filter_cmd_tlv() - configure packet filter in target |
| 14484 | * @wmi_handle: wmi handle |
| 14485 | * @vdev_id: vdev id |
| 14486 | * @rcv_filter_param: Packet filter parameters |
| 14487 | * @filter_id: Filter id |
| 14488 | * @enable: Flag to add/delete packet filter configuration |
| 14489 | * |
| 14490 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 14491 | */ |
| 14492 | static QDF_STATUS send_config_packet_filter_cmd_tlv(wmi_unified_t wmi_handle, |
| 14493 | uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param, |
| 14494 | uint8_t filter_id, bool enable) |
| 14495 | { |
| 14496 | int len, i; |
| 14497 | int err = 0; |
| 14498 | wmi_buf_t buf; |
| 14499 | WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *cmd; |
| 14500 | |
| 14501 | |
| 14502 | /* allocate the memory */ |
| 14503 | len = sizeof(*cmd); |
| 14504 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14505 | if (!buf) { |
| 14506 | WMI_LOGE("Failed to allocate buffer to send set_param cmd"); |
| 14507 | return QDF_STATUS_E_NOMEM; |
| 14508 | } |
| 14509 | |
| 14510 | cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf); |
| 14511 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14512 | WMITLV_TAG_STRUC_wmi_packet_filter_config_fixed_param, |
| 14513 | WMITLV_GET_STRUCT_TLVLEN |
| 14514 | (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param)); |
| 14515 | |
| 14516 | cmd->vdev_id = vdev_id; |
| 14517 | cmd->filter_id = filter_id; |
| 14518 | if (enable) |
| 14519 | cmd->filter_action = PACKET_FILTER_SET_ACTIVE; |
| 14520 | else |
| 14521 | cmd->filter_action = PACKET_FILTER_SET_INACTIVE; |
| 14522 | |
| 14523 | if (enable) { |
| 14524 | cmd->num_params = QDF_MIN( |
| 14525 | WMI_PACKET_FILTER_MAX_CMP_PER_PACKET_FILTER, |
| 14526 | rcv_filter_param->num_params); |
| 14527 | cmd->filter_type = rcv_filter_param->filter_type; |
| 14528 | cmd->coalesce_time = rcv_filter_param->coalesce_time; |
| 14529 | |
| 14530 | for (i = 0; i < cmd->num_params; i++) { |
| 14531 | cmd->paramsData[i].proto_type = |
| 14532 | rcv_filter_param->params_data[i].protocol_layer; |
| 14533 | cmd->paramsData[i].cmp_type = |
| 14534 | rcv_filter_param->params_data[i].compare_flag; |
| 14535 | cmd->paramsData[i].data_length = |
| 14536 | rcv_filter_param->params_data[i].data_length; |
| 14537 | cmd->paramsData[i].data_offset = |
| 14538 | rcv_filter_param->params_data[i].data_offset; |
| 14539 | memcpy(&cmd->paramsData[i].compareData, |
| 14540 | rcv_filter_param->params_data[i].compare_data, |
| 14541 | sizeof(cmd->paramsData[i].compareData)); |
| 14542 | memcpy(&cmd->paramsData[i].dataMask, |
| 14543 | rcv_filter_param->params_data[i].data_mask, |
| 14544 | sizeof(cmd->paramsData[i].dataMask)); |
| 14545 | } |
| 14546 | } |
| 14547 | |
| 14548 | WMI_LOGE("Packet filter action %d filter with id: %d, num_params=%d", |
| 14549 | cmd->filter_action, cmd->filter_id, cmd->num_params); |
| 14550 | /* send the command along with data */ |
| 14551 | err = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 14552 | WMI_PACKET_FILTER_CONFIG_CMDID); |
| 14553 | if (err) { |
| 14554 | WMI_LOGE("Failed to send pkt_filter cmd"); |
| 14555 | wmi_buf_free(buf); |
| 14556 | return QDF_STATUS_E_FAILURE; |
| 14557 | } |
| 14558 | |
| 14559 | return QDF_STATUS_SUCCESS; |
| 14560 | } |
Ravi Kumar Bokka | 8f2c92f | 2017-03-23 15:22:51 +0530 | [diff] [blame] | 14561 | #endif /* End of WLAN_PMO_ENABLE */ |
Hanumanth Reddy Pothula | 3e3e7a6 | 2017-01-19 18:47:43 +0530 | [diff] [blame] | 14562 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14563 | /** |
| 14564 | * send_set_ssid_hotlist_cmd_tlv() - Handle an SSID hotlist set request |
| 14565 | * @wmi_handle: wmi handle |
| 14566 | * @request: SSID hotlist set request |
| 14567 | * |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14568 | * Return: QDF_STATUS enumeration |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14569 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14570 | static QDF_STATUS |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14571 | send_set_ssid_hotlist_cmd_tlv(wmi_unified_t wmi_handle, |
| 14572 | struct ssid_hotlist_request_params *request) |
| 14573 | { |
| 14574 | wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *cmd; |
| 14575 | wmi_buf_t wmi_buf; |
| 14576 | uint32_t len; |
| 14577 | uint32_t array_size; |
| 14578 | uint8_t *buf_ptr; |
| 14579 | |
| 14580 | /* length of fixed portion */ |
| 14581 | len = sizeof(*cmd); |
| 14582 | |
| 14583 | /* length of variable portion */ |
| 14584 | array_size = |
| 14585 | request->ssid_count * sizeof(wmi_extscan_hotlist_ssid_entry); |
| 14586 | len += WMI_TLV_HDR_SIZE + array_size; |
| 14587 | |
| 14588 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14589 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14590 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 14591 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14592 | } |
| 14593 | |
| 14594 | buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); |
| 14595 | cmd = (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param *) |
| 14596 | buf_ptr; |
| 14597 | WMITLV_SET_HDR |
| 14598 | (&cmd->tlv_header, |
| 14599 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param, |
| 14600 | WMITLV_GET_STRUCT_TLVLEN |
| 14601 | (wmi_extscan_configure_hotlist_ssid_monitor_cmd_fixed_param)); |
| 14602 | |
| 14603 | cmd->request_id = request->request_id; |
| 14604 | cmd->requestor_id = 0; |
| 14605 | cmd->vdev_id = request->session_id; |
| 14606 | cmd->table_id = 0; |
| 14607 | cmd->lost_ap_scan_count = request->lost_ssid_sample_size; |
| 14608 | cmd->total_entries = request->ssid_count; |
| 14609 | cmd->num_entries_in_page = request->ssid_count; |
| 14610 | cmd->first_entry_index = 0; |
| 14611 | |
| 14612 | buf_ptr += sizeof(*cmd); |
| 14613 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, array_size); |
| 14614 | |
| 14615 | if (request->ssid_count) { |
| 14616 | wmi_extscan_hotlist_ssid_entry *entry; |
| 14617 | int i; |
| 14618 | |
| 14619 | buf_ptr += WMI_TLV_HDR_SIZE; |
| 14620 | entry = (wmi_extscan_hotlist_ssid_entry *)buf_ptr; |
| 14621 | for (i = 0; i < request->ssid_count; i++) { |
| 14622 | WMITLV_SET_HDR |
| 14623 | (entry, |
| 14624 | WMITLV_TAG_ARRAY_STRUC, |
| 14625 | WMITLV_GET_STRUCT_TLVLEN |
| 14626 | (wmi_extscan_hotlist_ssid_entry)); |
| 14627 | entry->ssid.ssid_len = request->ssids[i].ssid.length; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14628 | qdf_mem_copy(entry->ssid.ssid, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14629 | request->ssids[i].ssid.mac_ssid, |
| 14630 | request->ssids[i].ssid.length); |
| 14631 | entry->band = request->ssids[i].band; |
| 14632 | entry->min_rssi = request->ssids[i].rssi_low; |
| 14633 | entry->max_rssi = request->ssids[i].rssi_high; |
| 14634 | entry++; |
| 14635 | } |
| 14636 | cmd->mode = WMI_EXTSCAN_MODE_START; |
| 14637 | } else { |
| 14638 | cmd->mode = WMI_EXTSCAN_MODE_STOP; |
| 14639 | } |
| 14640 | |
| 14641 | if (wmi_unified_cmd_send |
| 14642 | (wmi_handle, wmi_buf, len, |
| 14643 | WMI_EXTSCAN_CONFIGURE_HOTLIST_SSID_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14644 | WMI_LOGE("%s: failed to send command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14645 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14646 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14647 | } |
| 14648 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14649 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14650 | } |
| 14651 | |
| 14652 | /** |
| 14653 | * send_process_roam_synch_complete_cmd_tlv() - roam synch complete command to fw. |
| 14654 | * @wmi_handle: wmi handle |
| 14655 | * @vdev_id: vdev id |
| 14656 | * |
| 14657 | * This function sends roam synch complete event to fw. |
| 14658 | * |
| 14659 | * Return: CDF STATUS |
| 14660 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14661 | 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] | 14662 | uint8_t vdev_id) |
| 14663 | { |
| 14664 | wmi_roam_synch_complete_fixed_param *cmd; |
| 14665 | wmi_buf_t wmi_buf; |
| 14666 | uint8_t *buf_ptr; |
| 14667 | uint16_t len; |
| 14668 | len = sizeof(wmi_roam_synch_complete_fixed_param); |
| 14669 | |
| 14670 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14671 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14672 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 14673 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14674 | } |
| 14675 | cmd = (wmi_roam_synch_complete_fixed_param *) wmi_buf_data(wmi_buf); |
| 14676 | buf_ptr = (uint8_t *) cmd; |
| 14677 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14678 | WMITLV_TAG_STRUC_wmi_roam_synch_complete_fixed_param, |
| 14679 | WMITLV_GET_STRUCT_TLVLEN |
| 14680 | (wmi_roam_synch_complete_fixed_param)); |
| 14681 | cmd->vdev_id = vdev_id; |
| 14682 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 14683 | WMI_ROAM_SYNCH_COMPLETE)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14684 | WMI_LOGP("%s: failed to send roam synch confirmation", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14685 | __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14686 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14687 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14688 | } |
| 14689 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14690 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14691 | } |
| 14692 | |
| 14693 | /** |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 14694 | * send_fw_test_cmd_tlv() - send fw test command to fw. |
| 14695 | * @wmi_handle: wmi handle |
| 14696 | * @wmi_fwtest: fw test command |
| 14697 | * |
| 14698 | * This function sends fw test command to fw. |
| 14699 | * |
| 14700 | * Return: CDF STATUS |
| 14701 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 14702 | static |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 14703 | QDF_STATUS send_fw_test_cmd_tlv(wmi_unified_t wmi_handle, |
| 14704 | struct set_fwtest_params *wmi_fwtest) |
| 14705 | { |
| 14706 | wmi_fwtest_set_param_cmd_fixed_param *cmd; |
| 14707 | wmi_buf_t wmi_buf; |
| 14708 | uint16_t len; |
| 14709 | |
| 14710 | len = sizeof(*cmd); |
| 14711 | |
| 14712 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14713 | if (!wmi_buf) { |
| 14714 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 14715 | return QDF_STATUS_E_NOMEM; |
| 14716 | } |
| 14717 | |
| 14718 | cmd = (wmi_fwtest_set_param_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 14719 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14720 | WMITLV_TAG_STRUC_wmi_fwtest_set_param_cmd_fixed_param, |
| 14721 | WMITLV_GET_STRUCT_TLVLEN( |
| 14722 | wmi_fwtest_set_param_cmd_fixed_param)); |
| 14723 | cmd->param_id = wmi_fwtest->arg; |
| 14724 | cmd->param_value = wmi_fwtest->value; |
| 14725 | |
| 14726 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 14727 | WMI_FWTEST_CMDID)) { |
| 14728 | WMI_LOGP("%s: failed to send fw test command", __func__); |
| 14729 | qdf_nbuf_free(wmi_buf); |
| 14730 | return QDF_STATUS_E_FAILURE; |
| 14731 | } |
| 14732 | |
| 14733 | return QDF_STATUS_SUCCESS; |
| 14734 | } |
| 14735 | |
| 14736 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14737 | * send_unit_test_cmd_tlv() - send unit test command to fw. |
| 14738 | * @wmi_handle: wmi handle |
| 14739 | * @wmi_utest: unit test command |
| 14740 | * |
| 14741 | * This function send unit test command to fw. |
| 14742 | * |
| 14743 | * Return: CDF STATUS |
| 14744 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14745 | 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] | 14746 | struct wmi_unit_test_cmd *wmi_utest) |
| 14747 | { |
| 14748 | wmi_unit_test_cmd_fixed_param *cmd; |
| 14749 | wmi_buf_t wmi_buf; |
| 14750 | uint8_t *buf_ptr; |
| 14751 | int i; |
| 14752 | uint16_t len, args_tlv_len; |
| 14753 | A_UINT32 *unit_test_cmd_args; |
| 14754 | |
| 14755 | args_tlv_len = |
| 14756 | WMI_TLV_HDR_SIZE + wmi_utest->num_args * sizeof(A_UINT32); |
| 14757 | len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; |
| 14758 | |
| 14759 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14760 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14761 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 14762 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14763 | } |
| 14764 | |
| 14765 | cmd = (wmi_unit_test_cmd_fixed_param *) wmi_buf_data(wmi_buf); |
| 14766 | buf_ptr = (uint8_t *) cmd; |
| 14767 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14768 | WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, |
| 14769 | WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); |
| 14770 | cmd->vdev_id = wmi_utest->vdev_id; |
| 14771 | cmd->module_id = wmi_utest->module_id; |
| 14772 | cmd->num_args = wmi_utest->num_args; |
| 14773 | buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); |
| 14774 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 14775 | (wmi_utest->num_args * sizeof(uint32_t))); |
| 14776 | unit_test_cmd_args = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14777 | WMI_LOGI("%s: %d num of args = ", __func__, wmi_utest->num_args); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14778 | for (i = 0; (i < wmi_utest->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 14779 | unit_test_cmd_args[i] = wmi_utest->args[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14780 | WMI_LOGI("%d,", wmi_utest->args[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14781 | } |
| 14782 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 14783 | WMI_UNIT_TEST_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14784 | WMI_LOGP("%s: failed to send unit test command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 14785 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14786 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14787 | } |
| 14788 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14789 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14790 | } |
| 14791 | |
| 14792 | /** |
| 14793 | * send_roam_invoke_cmd_tlv() - send roam invoke command to fw. |
| 14794 | * @wmi_handle: wma handle |
| 14795 | * @roaminvoke: roam invoke command |
| 14796 | * |
| 14797 | * Send roam invoke command to fw for fastreassoc. |
| 14798 | * |
| 14799 | * Return: CDF STATUS |
| 14800 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14801 | 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] | 14802 | struct wmi_roam_invoke_cmd *roaminvoke, |
| 14803 | uint32_t ch_hz) |
| 14804 | { |
| 14805 | wmi_roam_invoke_cmd_fixed_param *cmd; |
| 14806 | wmi_buf_t wmi_buf; |
| 14807 | u_int8_t *buf_ptr; |
| 14808 | u_int16_t len, args_tlv_len; |
| 14809 | A_UINT32 *channel_list; |
| 14810 | wmi_mac_addr *bssid_list; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14811 | wmi_tlv_buf_len_param *buf_len_tlv; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14812 | |
| 14813 | /* Host sends only one channel and one bssid */ |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14814 | args_tlv_len = (4 * WMI_TLV_HDR_SIZE) + sizeof(A_UINT32) + |
| 14815 | sizeof(wmi_mac_addr) + sizeof(wmi_tlv_buf_len_param) + |
| 14816 | roundup(roaminvoke->frame_len, sizeof(uint32_t)); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14817 | len = sizeof(wmi_roam_invoke_cmd_fixed_param) + args_tlv_len; |
| 14818 | wmi_buf = wmi_buf_alloc(wmi_handle, len); |
| 14819 | if (!wmi_buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14820 | WMI_LOGE("%s: wmai_buf_alloc failed", __func__); |
| 14821 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14822 | } |
| 14823 | |
| 14824 | cmd = (wmi_roam_invoke_cmd_fixed_param *)wmi_buf_data(wmi_buf); |
| 14825 | buf_ptr = (u_int8_t *) cmd; |
| 14826 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 14827 | WMITLV_TAG_STRUC_wmi_roam_invoke_cmd_fixed_param, |
| 14828 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_invoke_cmd_fixed_param)); |
| 14829 | cmd->vdev_id = roaminvoke->vdev_id; |
Arif Hussain | 7698b6d | 2016-12-15 20:05:36 -0800 | [diff] [blame] | 14830 | cmd->flags |= (1 << WMI_ROAM_INVOKE_FLAG_REPORT_FAILURE); |
Krunal Soni | 7544a40 | 2017-07-25 11:23:44 -0700 | [diff] [blame] | 14831 | if (roaminvoke->is_same_bssid) |
| 14832 | cmd->flags |= (1 << WMI_ROAM_INVOKE_FLAG_NO_NULL_FRAME_TO_AP); |
| 14833 | WMI_LOGD(FL("is_same_bssid flag: %d"), roaminvoke->is_same_bssid); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14834 | |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 14835 | if (roaminvoke->frame_len) { |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14836 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_SKIP; |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 14837 | /* packing 1 beacon/probe_rsp frame with WMI cmd */ |
| 14838 | cmd->num_buf = 1; |
| 14839 | } else { |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14840 | cmd->roam_scan_mode = WMI_ROAM_INVOKE_SCAN_MODE_FIXED_CH; |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 14841 | cmd->num_buf = 0; |
| 14842 | } |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14843 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14844 | cmd->roam_ap_sel_mode = 0; |
| 14845 | cmd->roam_delay = 0; |
| 14846 | cmd->num_chan = 1; |
| 14847 | cmd->num_bssid = 1; |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14848 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14849 | buf_ptr += sizeof(wmi_roam_invoke_cmd_fixed_param); |
| 14850 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 14851 | (sizeof(u_int32_t))); |
| 14852 | channel_list = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 14853 | *channel_list = ch_hz; |
| 14854 | buf_ptr += sizeof(A_UINT32) + WMI_TLV_HDR_SIZE; |
| 14855 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 14856 | (sizeof(wmi_mac_addr))); |
| 14857 | bssid_list = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 14858 | WMI_CHAR_ARRAY_TO_MAC_ADDR(roaminvoke->bssid, bssid_list); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14859 | |
| 14860 | /* move to next tlv i.e. bcn_prb_buf_list */ |
| 14861 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_mac_addr); |
| 14862 | |
| 14863 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_FIXED_STRUC, |
| 14864 | sizeof(wmi_tlv_buf_len_param)); |
| 14865 | |
| 14866 | buf_len_tlv = (wmi_tlv_buf_len_param *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 14867 | buf_len_tlv->buf_len = roaminvoke->frame_len; |
| 14868 | |
| 14869 | /* move to next tlv i.e. bcn_prb_frm */ |
| 14870 | buf_ptr += WMI_TLV_HDR_SIZE + sizeof(wmi_tlv_buf_len_param); |
| 14871 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, |
| 14872 | roundup(roaminvoke->frame_len, sizeof(uint32_t))); |
| 14873 | |
| 14874 | /* copy frame after the header */ |
| 14875 | qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE, |
| 14876 | roaminvoke->frame_buf, |
| 14877 | roaminvoke->frame_len); |
| 14878 | |
| 14879 | WMI_LOGD(FL("bcn/prb_rsp frame, length: %d"), roaminvoke->frame_len); |
| 14880 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, |
| 14881 | buf_ptr + WMI_TLV_HDR_SIZE, |
| 14882 | roaminvoke->frame_len); |
Varun Reddy Yeturu | 2892dce | 2017-07-14 16:47:48 -0700 | [diff] [blame] | 14883 | WMI_LOGD(FL("flag:%d, MODE scn:%d, ap:%d, dly:%d, n_ch:%d, n_bssid:%d"), |
| 14884 | cmd->flags, cmd->roam_scan_mode, |
| 14885 | cmd->roam_ap_sel_mode, cmd->roam_delay, |
| 14886 | cmd->num_chan, cmd->num_bssid); |
| 14887 | WMI_LOGD(FL("BSSID: %pM, channel: %d"), roaminvoke->bssid, ch_hz); |
Naveen Rawat | 7779792 | 2017-01-20 17:00:07 -0800 | [diff] [blame] | 14888 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14889 | if (wmi_unified_cmd_send(wmi_handle, wmi_buf, len, |
| 14890 | WMI_ROAM_INVOKE_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14891 | WMI_LOGP("%s: failed to send roam invoke command", __func__); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14892 | wmi_buf_free(wmi_buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14893 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14894 | } |
| 14895 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14896 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14897 | } |
| 14898 | |
| 14899 | /** |
| 14900 | * send_roam_scan_offload_cmd_tlv() - set roam offload command |
| 14901 | * @wmi_handle: wmi handle |
| 14902 | * @command: command |
| 14903 | * @vdev_id: vdev id |
| 14904 | * |
| 14905 | * This function set roam offload command to fw. |
| 14906 | * |
| 14907 | * Return: CDF status |
| 14908 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14909 | 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] | 14910 | uint32_t command, uint32_t vdev_id) |
| 14911 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14912 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14913 | wmi_roam_scan_cmd_fixed_param *cmd_fp; |
| 14914 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14915 | int len; |
| 14916 | uint8_t *buf_ptr; |
| 14917 | |
| 14918 | len = sizeof(wmi_roam_scan_cmd_fixed_param); |
| 14919 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14920 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14921 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14922 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14923 | } |
| 14924 | |
| 14925 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14926 | |
| 14927 | cmd_fp = (wmi_roam_scan_cmd_fixed_param *) buf_ptr; |
| 14928 | WMITLV_SET_HDR(&cmd_fp->tlv_header, |
| 14929 | WMITLV_TAG_STRUC_wmi_roam_scan_cmd_fixed_param, |
| 14930 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_scan_cmd_fixed_param)); |
| 14931 | cmd_fp->vdev_id = vdev_id; |
| 14932 | cmd_fp->command_arg = command; |
| 14933 | |
| 14934 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 14935 | len, WMI_ROAM_SCAN_CMD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14936 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14937 | 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] | 14938 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14939 | goto error; |
| 14940 | } |
| 14941 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14942 | WMI_LOGI("%s: WMI --> WMI_ROAM_SCAN_CMD", __func__); |
| 14943 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14944 | |
| 14945 | error: |
| 14946 | wmi_buf_free(buf); |
| 14947 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14948 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14949 | } |
| 14950 | |
| 14951 | /** |
| 14952 | * send_roam_scan_offload_ap_profile_cmd_tlv() - set roam ap profile in fw |
| 14953 | * @wmi_handle: wmi handle |
| 14954 | * @ap_profile_p: ap profile |
| 14955 | * @vdev_id: vdev id |
| 14956 | * |
| 14957 | * Send WMI_ROAM_AP_PROFILE to firmware |
| 14958 | * |
| 14959 | * Return: CDF status |
| 14960 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 14961 | 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] | 14962 | struct ap_profile_params *ap_profile) |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14963 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14964 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 14965 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14966 | int len; |
| 14967 | uint8_t *buf_ptr; |
| 14968 | wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp; |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 14969 | wmi_roam_cnd_scoring_param *score_param; |
| 14970 | wmi_ap_profile *profile; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14971 | |
| 14972 | len = sizeof(wmi_roam_ap_profile_fixed_param) + sizeof(wmi_ap_profile); |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 14973 | len += sizeof(*score_param); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14974 | buf = wmi_buf_alloc(wmi_handle, len); |
| 14975 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 14976 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 14977 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14978 | } |
| 14979 | |
| 14980 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 14981 | roam_ap_profile_fp = (wmi_roam_ap_profile_fixed_param *) buf_ptr; |
| 14982 | WMITLV_SET_HDR(&roam_ap_profile_fp->tlv_header, |
| 14983 | WMITLV_TAG_STRUC_wmi_roam_ap_profile_fixed_param, |
| 14984 | WMITLV_GET_STRUCT_TLVLEN |
| 14985 | (wmi_roam_ap_profile_fixed_param)); |
| 14986 | /* fill in threshold values */ |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 14987 | roam_ap_profile_fp->vdev_id = ap_profile->vdev_id; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14988 | roam_ap_profile_fp->id = 0; |
| 14989 | buf_ptr += sizeof(wmi_roam_ap_profile_fixed_param); |
| 14990 | |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 14991 | profile = (wmi_ap_profile *)buf_ptr; |
| 14992 | WMITLV_SET_HDR(&profile->tlv_header, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 14993 | WMITLV_TAG_STRUC_wmi_ap_profile, |
| 14994 | WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile)); |
Himanshu Agarwal | eaf7d73 | 2017-09-28 11:51:35 +0530 | [diff] [blame] | 14995 | profile->flags = ap_profile->profile.flags; |
| 14996 | profile->rssi_threshold = ap_profile->profile.rssi_threshold; |
| 14997 | profile->ssid.ssid_len = ap_profile->profile.ssid.length; |
| 14998 | qdf_mem_copy(profile->ssid.ssid, ap_profile->profile.ssid.mac_ssid, |
| 14999 | profile->ssid.ssid_len); |
| 15000 | profile->rsn_authmode = ap_profile->profile.rsn_authmode; |
| 15001 | profile->rsn_ucastcipherset = ap_profile->profile.rsn_ucastcipherset; |
| 15002 | profile->rsn_mcastcipherset = ap_profile->profile.rsn_mcastcipherset; |
| 15003 | profile->rsn_mcastmgmtcipherset = |
| 15004 | ap_profile->profile.rsn_mcastmgmtcipherset; |
| 15005 | profile->rssi_abs_thresh = ap_profile->profile.rssi_abs_thresh; |
| 15006 | |
| 15007 | 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", |
| 15008 | profile->flags, profile->rssi_threshold, |
| 15009 | profile->ssid.ssid_len, ap_profile->profile.ssid.mac_ssid, |
| 15010 | profile->rsn_authmode, profile->rsn_ucastcipherset, |
| 15011 | profile->rsn_mcastcipherset, profile->rsn_mcastmgmtcipherset, |
| 15012 | profile->rssi_abs_thresh); |
| 15013 | |
| 15014 | buf_ptr += sizeof(wmi_ap_profile); |
| 15015 | |
| 15016 | score_param = (wmi_roam_cnd_scoring_param *)buf_ptr; |
| 15017 | WMITLV_SET_HDR(&score_param->tlv_header, |
| 15018 | WMITLV_TAG_STRUC_wmi_roam_cnd_scoring_param, |
| 15019 | WMITLV_GET_STRUCT_TLVLEN(wmi_roam_cnd_scoring_param)); |
| 15020 | score_param->disable_bitmap = ap_profile->param.disable_bitmap; |
| 15021 | score_param->rssi_weightage_pcnt = |
| 15022 | ap_profile->param.rssi_weightage; |
| 15023 | score_param->ht_weightage_pcnt = ap_profile->param.ht_weightage; |
| 15024 | score_param->vht_weightage_pcnt = ap_profile->param.vht_weightage; |
| 15025 | score_param->he_weightage_pcnt = ap_profile->param.he_weightage; |
| 15026 | score_param->bw_weightage_pcnt = ap_profile->param.bw_weightage; |
| 15027 | score_param->band_weightage_pcnt = ap_profile->param.band_weightage; |
| 15028 | score_param->nss_weightage_pcnt = ap_profile->param.nss_weightage; |
| 15029 | score_param->esp_qbss_weightage_pcnt = |
| 15030 | ap_profile->param.esp_qbss_weightage; |
| 15031 | score_param->beamforming_weightage_pcnt = |
| 15032 | ap_profile->param.beamforming_weightage; |
| 15033 | score_param->pcl_weightage_pcnt = ap_profile->param.pcl_weightage; |
| 15034 | score_param->oce_wan_weightage_pcnt = |
| 15035 | ap_profile->param.oce_wan_weightage; |
| 15036 | |
| 15037 | 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", |
| 15038 | score_param->disable_bitmap, score_param->rssi_weightage_pcnt, |
| 15039 | score_param->ht_weightage_pcnt, |
| 15040 | score_param->vht_weightage_pcnt, |
| 15041 | score_param->he_weightage_pcnt, score_param->bw_weightage_pcnt, |
| 15042 | score_param->band_weightage_pcnt, |
| 15043 | score_param->nss_weightage_pcnt, |
| 15044 | score_param->esp_qbss_weightage_pcnt, |
| 15045 | score_param->beamforming_weightage_pcnt, |
| 15046 | score_param->pcl_weightage_pcnt, |
| 15047 | score_param->oce_wan_weightage_pcnt); |
| 15048 | |
| 15049 | score_param->bw_scoring.score_pcnt = ap_profile->param.bw_index_score; |
| 15050 | score_param->band_scoring.score_pcnt = |
| 15051 | ap_profile->param.band_index_score; |
| 15052 | score_param->nss_scoring.score_pcnt = |
| 15053 | ap_profile->param.nss_index_score; |
| 15054 | |
| 15055 | WMI_LOGD("Params index score bitmask: bw_index_score %x band_index_score %x nss_index_score %x", |
| 15056 | score_param->bw_scoring.score_pcnt, |
| 15057 | score_param->band_scoring.score_pcnt, |
| 15058 | score_param->nss_scoring.score_pcnt); |
| 15059 | |
| 15060 | score_param->rssi_scoring.best_rssi_threshold = |
| 15061 | (-1) * ap_profile->param.rssi_scoring.best_rssi_threshold; |
| 15062 | score_param->rssi_scoring.good_rssi_threshold = |
| 15063 | (-1) * ap_profile->param.rssi_scoring.good_rssi_threshold; |
| 15064 | score_param->rssi_scoring.bad_rssi_threshold = |
| 15065 | (-1) * ap_profile->param.rssi_scoring.bad_rssi_threshold; |
| 15066 | score_param->rssi_scoring.good_rssi_pcnt = |
| 15067 | ap_profile->param.rssi_scoring.good_rssi_pcnt; |
| 15068 | score_param->rssi_scoring.bad_rssi_pcnt = |
| 15069 | ap_profile->param.rssi_scoring.bad_rssi_pcnt; |
| 15070 | score_param->rssi_scoring.good_bucket_size = |
| 15071 | ap_profile->param.rssi_scoring.good_bucket_size; |
| 15072 | score_param->rssi_scoring.bad_bucket_size = |
| 15073 | ap_profile->param.rssi_scoring.bad_bucket_size; |
| 15074 | score_param->rssi_scoring.rssi_pref_5g_rssi_thresh = |
| 15075 | (-1) * ap_profile->param.rssi_scoring.rssi_pref_5g_rssi_thresh; |
| 15076 | |
| 15077 | WMI_LOGD("Rssi scoring threshold: best RSSI %d good RSSI %d bad RSSI %d prefer 5g threshold %d", |
| 15078 | score_param->rssi_scoring.best_rssi_threshold, |
| 15079 | score_param->rssi_scoring.good_rssi_threshold, |
| 15080 | score_param->rssi_scoring.bad_rssi_threshold, |
| 15081 | score_param->rssi_scoring.rssi_pref_5g_rssi_thresh); |
| 15082 | WMI_LOGD("Good RSSI score for each slot %d bad RSSI score for each slot %d good bucket %d bad bucket %d", |
| 15083 | score_param->rssi_scoring.good_rssi_pcnt, |
| 15084 | score_param->rssi_scoring.bad_rssi_pcnt, |
| 15085 | score_param->rssi_scoring.good_bucket_size, |
| 15086 | score_param->rssi_scoring.bad_bucket_size); |
| 15087 | |
| 15088 | score_param->esp_qbss_scoring.num_slot = |
| 15089 | ap_profile->param.esp_qbss_scoring.num_slot; |
| 15090 | score_param->esp_qbss_scoring.score_pcnt3_to_0 = |
| 15091 | ap_profile->param.esp_qbss_scoring.score_pcnt3_to_0; |
| 15092 | score_param->esp_qbss_scoring.score_pcnt7_to_4 = |
| 15093 | ap_profile->param.esp_qbss_scoring.score_pcnt7_to_4; |
| 15094 | score_param->esp_qbss_scoring.score_pcnt11_to_8 = |
| 15095 | ap_profile->param.esp_qbss_scoring.score_pcnt11_to_8; |
| 15096 | score_param->esp_qbss_scoring.score_pcnt15_to_12 = |
| 15097 | ap_profile->param.esp_qbss_scoring.score_pcnt15_to_12; |
| 15098 | |
| 15099 | WMI_LOGD("ESP QBSS index weight: slots %d weight 0to3 %x weight 4to7 %x weight 8to11 %x weight 12to15 %x", |
| 15100 | score_param->esp_qbss_scoring.num_slot, |
| 15101 | score_param->esp_qbss_scoring.score_pcnt3_to_0, |
| 15102 | score_param->esp_qbss_scoring.score_pcnt7_to_4, |
| 15103 | score_param->esp_qbss_scoring.score_pcnt11_to_8, |
| 15104 | score_param->esp_qbss_scoring.score_pcnt15_to_12); |
| 15105 | |
| 15106 | score_param->oce_wan_scoring.num_slot = |
| 15107 | ap_profile->param.oce_wan_scoring.num_slot; |
| 15108 | score_param->oce_wan_scoring.score_pcnt3_to_0 = |
| 15109 | ap_profile->param.oce_wan_scoring.score_pcnt3_to_0; |
| 15110 | score_param->oce_wan_scoring.score_pcnt7_to_4 = |
| 15111 | ap_profile->param.oce_wan_scoring.score_pcnt7_to_4; |
| 15112 | score_param->oce_wan_scoring.score_pcnt11_to_8 = |
| 15113 | ap_profile->param.oce_wan_scoring.score_pcnt11_to_8; |
| 15114 | score_param->oce_wan_scoring.score_pcnt15_to_12 = |
| 15115 | ap_profile->param.oce_wan_scoring.score_pcnt15_to_12; |
| 15116 | |
| 15117 | WMI_LOGD("OCE WAN index weight: slots %d weight 0to3 %x weight 4to7 %x weight 8to11 %x weight 12to15 %x", |
| 15118 | score_param->oce_wan_scoring.num_slot, |
| 15119 | score_param->oce_wan_scoring.score_pcnt3_to_0, |
| 15120 | score_param->oce_wan_scoring.score_pcnt7_to_4, |
| 15121 | score_param->oce_wan_scoring.score_pcnt11_to_8, |
| 15122 | score_param->oce_wan_scoring.score_pcnt15_to_12); |
| 15123 | |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15124 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15125 | len, WMI_ROAM_AP_PROFILE); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15126 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15127 | 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] | 15128 | status); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15129 | wmi_buf_free(buf); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15130 | } |
| 15131 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15132 | WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters"); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15133 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15134 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15135 | } |
| 15136 | |
| 15137 | /** |
| 15138 | * send_roam_scan_offload_scan_period_cmd_tlv() - set roam offload scan period |
| 15139 | * @wmi_handle: wmi handle |
| 15140 | * @scan_period: scan period |
| 15141 | * @scan_age: scan age |
| 15142 | * @vdev_id: vdev id |
| 15143 | * |
| 15144 | * Send WMI_ROAM_SCAN_PERIOD parameters to fw. |
| 15145 | * |
| 15146 | * Return: CDF status |
| 15147 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15148 | 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] | 15149 | uint32_t scan_period, |
| 15150 | uint32_t scan_age, |
| 15151 | uint32_t vdev_id) |
| 15152 | { |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15153 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15154 | wmi_buf_t buf = NULL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15155 | int len; |
| 15156 | uint8_t *buf_ptr; |
| 15157 | wmi_roam_scan_period_fixed_param *scan_period_fp; |
| 15158 | |
| 15159 | /* Send scan period values */ |
| 15160 | len = sizeof(wmi_roam_scan_period_fixed_param); |
| 15161 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15162 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15163 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15164 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15165 | } |
| 15166 | |
| 15167 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15168 | scan_period_fp = (wmi_roam_scan_period_fixed_param *) buf_ptr; |
| 15169 | WMITLV_SET_HDR(&scan_period_fp->tlv_header, |
| 15170 | WMITLV_TAG_STRUC_wmi_roam_scan_period_fixed_param, |
| 15171 | WMITLV_GET_STRUCT_TLVLEN |
| 15172 | (wmi_roam_scan_period_fixed_param)); |
| 15173 | /* fill in scan period values */ |
| 15174 | scan_period_fp->vdev_id = vdev_id; |
| 15175 | scan_period_fp->roam_scan_period = scan_period; /* 20 seconds */ |
| 15176 | scan_period_fp->roam_scan_age = scan_age; |
| 15177 | |
| 15178 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15179 | len, WMI_ROAM_SCAN_PERIOD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15180 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15181 | 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] | 15182 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15183 | goto error; |
| 15184 | } |
| 15185 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15186 | 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] | 15187 | __func__, scan_period, scan_age); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15188 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15189 | error: |
| 15190 | wmi_buf_free(buf); |
| 15191 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15192 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15193 | } |
| 15194 | |
| 15195 | /** |
| 15196 | * send_roam_scan_offload_chan_list_cmd_tlv() - set roam offload channel list |
| 15197 | * @wmi_handle: wmi handle |
| 15198 | * @chan_count: channel count |
| 15199 | * @chan_list: channel list |
| 15200 | * @list_type: list type |
| 15201 | * @vdev_id: vdev id |
| 15202 | * |
| 15203 | * Set roam offload channel list. |
| 15204 | * |
| 15205 | * Return: CDF status |
| 15206 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15207 | 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] | 15208 | uint8_t chan_count, |
Varun Reddy Yeturu | 5a552cf | 2016-07-07 17:42:49 -0700 | [diff] [blame] | 15209 | uint32_t *chan_list, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15210 | uint8_t list_type, uint32_t vdev_id) |
| 15211 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15212 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15213 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15214 | int len, list_tlv_len; |
| 15215 | int i; |
| 15216 | uint8_t *buf_ptr; |
| 15217 | wmi_roam_chan_list_fixed_param *chan_list_fp; |
| 15218 | A_UINT32 *roam_chan_list_array; |
| 15219 | |
| 15220 | if (chan_count == 0) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15221 | WMI_LOGD("%s : invalid number of channels %d", __func__, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15222 | chan_count); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15223 | return QDF_STATUS_E_EMPTY; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15224 | } |
| 15225 | /* Channel list is a table of 2 TLV's */ |
| 15226 | list_tlv_len = WMI_TLV_HDR_SIZE + chan_count * sizeof(A_UINT32); |
| 15227 | len = sizeof(wmi_roam_chan_list_fixed_param) + list_tlv_len; |
| 15228 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15229 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15230 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15231 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15232 | } |
| 15233 | |
| 15234 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15235 | chan_list_fp = (wmi_roam_chan_list_fixed_param *) buf_ptr; |
| 15236 | WMITLV_SET_HDR(&chan_list_fp->tlv_header, |
| 15237 | WMITLV_TAG_STRUC_wmi_roam_chan_list_fixed_param, |
| 15238 | WMITLV_GET_STRUCT_TLVLEN |
| 15239 | (wmi_roam_chan_list_fixed_param)); |
| 15240 | chan_list_fp->vdev_id = vdev_id; |
| 15241 | chan_list_fp->num_chan = chan_count; |
Govind Singh | 224a731 | 2016-06-21 14:33:26 +0530 | [diff] [blame] | 15242 | if (chan_count > 0 && list_type == WMI_CHANNEL_LIST_STATIC) { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15243 | /* external app is controlling channel list */ |
| 15244 | chan_list_fp->chan_list_type = |
| 15245 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_STATIC; |
| 15246 | } else { |
| 15247 | /* umac supplied occupied channel list in LFR */ |
| 15248 | chan_list_fp->chan_list_type = |
| 15249 | WMI_ROAM_SCAN_CHAN_LIST_TYPE_DYNAMIC; |
| 15250 | } |
| 15251 | |
| 15252 | buf_ptr += sizeof(wmi_roam_chan_list_fixed_param); |
| 15253 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 15254 | (chan_list_fp->num_chan * sizeof(uint32_t))); |
| 15255 | roam_chan_list_array = (A_UINT32 *) (buf_ptr + WMI_TLV_HDR_SIZE); |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 15256 | WMI_LOGD("%s: %d channels = ", __func__, chan_list_fp->num_chan); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15257 | for (i = 0; ((i < chan_list_fp->num_chan) && |
| 15258 | (i < WMI_ROAM_MAX_CHANNELS)); i++) { |
| 15259 | roam_chan_list_array[i] = chan_list[i]; |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15260 | WMI_LOGI("%d,", roam_chan_list_array[i]); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15261 | } |
| 15262 | |
| 15263 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15264 | len, WMI_ROAM_CHAN_LIST); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15265 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15266 | 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] | 15267 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15268 | goto error; |
| 15269 | } |
| 15270 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 15271 | WMI_LOGD("%s: WMI --> WMI_ROAM_SCAN_CHAN_LIST", __func__); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15272 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15273 | error: |
| 15274 | wmi_buf_free(buf); |
| 15275 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15276 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15277 | } |
| 15278 | |
| 15279 | /** |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 15280 | * send_per_roam_config_cmd_tlv() - set per roaming config to FW |
| 15281 | * @wmi_handle: wmi handle |
| 15282 | * @req_buf: per roam config buffer |
| 15283 | * |
| 15284 | * Return: QDF status |
| 15285 | */ |
| 15286 | static QDF_STATUS send_per_roam_config_cmd_tlv(wmi_unified_t wmi_handle, |
| 15287 | struct wmi_per_roam_config_req *req_buf) |
| 15288 | { |
| 15289 | wmi_buf_t buf = NULL; |
| 15290 | QDF_STATUS status; |
| 15291 | int len; |
| 15292 | uint8_t *buf_ptr; |
| 15293 | wmi_roam_per_config_fixed_param *wmi_per_config; |
| 15294 | |
| 15295 | len = sizeof(wmi_roam_per_config_fixed_param); |
| 15296 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15297 | if (!buf) { |
| 15298 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15299 | return QDF_STATUS_E_NOMEM; |
| 15300 | } |
| 15301 | |
| 15302 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15303 | wmi_per_config = |
| 15304 | (wmi_roam_per_config_fixed_param *) buf_ptr; |
| 15305 | WMITLV_SET_HDR(&wmi_per_config->tlv_header, |
| 15306 | WMITLV_TAG_STRUC_wmi_roam_per_config_fixed_param, |
| 15307 | WMITLV_GET_STRUCT_TLVLEN |
| 15308 | (wmi_roam_per_config_fixed_param)); |
| 15309 | |
| 15310 | /* fill in per roam config values */ |
| 15311 | wmi_per_config->vdev_id = req_buf->vdev_id; |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 15312 | |
| 15313 | wmi_per_config->enable = req_buf->per_config.enable; |
| 15314 | wmi_per_config->high_rate_thresh = |
| 15315 | (req_buf->per_config.tx_high_rate_thresh << 16) | |
| 15316 | (req_buf->per_config.rx_high_rate_thresh & 0x0000ffff); |
| 15317 | wmi_per_config->low_rate_thresh = |
| 15318 | (req_buf->per_config.tx_low_rate_thresh << 16) | |
| 15319 | (req_buf->per_config.rx_low_rate_thresh & 0x0000ffff); |
| 15320 | wmi_per_config->pkt_err_rate_thresh_pct = |
| 15321 | (req_buf->per_config.tx_rate_thresh_percnt << 16) | |
| 15322 | (req_buf->per_config.rx_rate_thresh_percnt & 0x0000ffff); |
| 15323 | 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] | 15324 | wmi_per_config->pkt_err_rate_mon_time = |
| 15325 | (req_buf->per_config.tx_per_mon_time << 16) | |
| 15326 | (req_buf->per_config.rx_per_mon_time & 0x0000ffff); |
Selvaraj, Sridhar | ba7e361 | 2017-05-17 16:05:15 +0530 | [diff] [blame] | 15327 | wmi_per_config->min_candidate_rssi = |
| 15328 | req_buf->per_config.min_candidate_rssi; |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 15329 | |
| 15330 | /* Send per roam config parameters */ |
| 15331 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15332 | len, WMI_ROAM_PER_CONFIG_CMDID); |
| 15333 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15334 | WMI_LOGE("WMI_ROAM_PER_CONFIG_CMDID failed, Error %d", |
| 15335 | status); |
| 15336 | wmi_buf_free(buf); |
| 15337 | return status; |
| 15338 | } |
| 15339 | |
| 15340 | WMI_LOGI(FL("per roam enable=%d, vdev=%d"), |
| 15341 | req_buf->per_config.enable, req_buf->vdev_id); |
| 15342 | return QDF_STATUS_SUCCESS; |
| 15343 | } |
| 15344 | |
| 15345 | /** |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15346 | * send_roam_scan_offload_rssi_change_cmd_tlv() - set roam offload RSSI th |
| 15347 | * @wmi_handle: wmi handle |
| 15348 | * @rssi_change_thresh: RSSI Change threshold |
| 15349 | * @bcn_rssi_weight: beacon RSSI weight |
| 15350 | * @vdev_id: vdev id |
| 15351 | * |
| 15352 | * Send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD parameters to fw. |
| 15353 | * |
| 15354 | * Return: CDF status |
| 15355 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15356 | 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] | 15357 | uint32_t vdev_id, |
| 15358 | int32_t rssi_change_thresh, |
| 15359 | uint32_t bcn_rssi_weight, |
| 15360 | uint32_t hirssi_delay_btw_scans) |
| 15361 | { |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15362 | wmi_buf_t buf = NULL; |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15363 | QDF_STATUS status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15364 | int len; |
| 15365 | uint8_t *buf_ptr; |
| 15366 | wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp; |
| 15367 | |
| 15368 | /* Send rssi change parameters */ |
| 15369 | len = sizeof(wmi_roam_scan_rssi_change_threshold_fixed_param); |
| 15370 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15371 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15372 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15373 | return QDF_STATUS_E_NOMEM; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15374 | } |
| 15375 | |
| 15376 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15377 | rssi_change_fp = |
| 15378 | (wmi_roam_scan_rssi_change_threshold_fixed_param *) buf_ptr; |
| 15379 | WMITLV_SET_HDR(&rssi_change_fp->tlv_header, |
| 15380 | WMITLV_TAG_STRUC_wmi_roam_scan_rssi_change_threshold_fixed_param, |
| 15381 | WMITLV_GET_STRUCT_TLVLEN |
| 15382 | (wmi_roam_scan_rssi_change_threshold_fixed_param)); |
| 15383 | /* fill in rssi change threshold (hysteresis) values */ |
| 15384 | rssi_change_fp->vdev_id = vdev_id; |
| 15385 | rssi_change_fp->roam_scan_rssi_change_thresh = rssi_change_thresh; |
| 15386 | rssi_change_fp->bcn_rssi_weight = bcn_rssi_weight; |
| 15387 | rssi_change_fp->hirssi_delay_btw_scans = hirssi_delay_btw_scans; |
| 15388 | |
| 15389 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15390 | len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD); |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15391 | if (QDF_IS_STATUS_ERROR(status)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15392 | 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] | 15393 | status); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15394 | goto error; |
| 15395 | } |
| 15396 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15397 | 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] | 15398 | rssi_change_thresh, bcn_rssi_weight); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15399 | WMI_LOGI(FL("hirssi_delay_btw_scans=%d"), hirssi_delay_btw_scans); |
| 15400 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15401 | error: |
| 15402 | wmi_buf_free(buf); |
| 15403 | |
Govind Singh | 67922e8 | 2016-04-01 16:48:57 +0530 | [diff] [blame] | 15404 | return status; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15405 | } |
| 15406 | |
| 15407 | /** wmi_get_hotlist_entries_per_page() - hotlist entries per page |
| 15408 | * @wmi_handle: wmi handle. |
| 15409 | * @cmd: size of command structure. |
| 15410 | * @per_entry_size: per entry size. |
| 15411 | * |
| 15412 | * This utility function calculates how many hotlist entries can |
| 15413 | * fit in one page. |
| 15414 | * |
| 15415 | * Return: number of entries |
| 15416 | */ |
| 15417 | static inline int wmi_get_hotlist_entries_per_page(wmi_unified_t wmi_handle, |
| 15418 | size_t cmd_size, |
| 15419 | size_t per_entry_size) |
| 15420 | { |
| 15421 | uint32_t avail_space = 0; |
| 15422 | int num_entries = 0; |
| 15423 | uint16_t max_msg_len = wmi_get_max_msg_len(wmi_handle); |
| 15424 | |
| 15425 | /* Calculate number of hotlist entries that can |
| 15426 | * be passed in wma message request. |
| 15427 | */ |
| 15428 | avail_space = max_msg_len - cmd_size; |
| 15429 | num_entries = avail_space / per_entry_size; |
| 15430 | return num_entries; |
| 15431 | } |
| 15432 | |
| 15433 | /** |
| 15434 | * send_get_buf_extscan_hotlist_cmd_tlv() - prepare hotlist command |
| 15435 | * @wmi_handle: wmi handle |
| 15436 | * @photlist: hotlist command params |
| 15437 | * @buf_len: buffer length |
| 15438 | * |
| 15439 | * This function fills individual elements for hotlist request and |
| 15440 | * TLV for bssid entries |
| 15441 | * |
| 15442 | * Return: CDF Status. |
| 15443 | */ |
Sathish Kumar | fd34737 | 2017-02-13 12:29:09 +0530 | [diff] [blame] | 15444 | 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] | 15445 | struct ext_scan_setbssi_hotlist_params * |
| 15446 | photlist, int *buf_len) |
| 15447 | { |
| 15448 | wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *cmd = NULL; |
| 15449 | wmi_extscan_hotlist_entry *dest_hotlist; |
| 15450 | struct ap_threshold_params *src_ap = photlist->ap; |
| 15451 | wmi_buf_t buf; |
| 15452 | uint8_t *buf_ptr; |
| 15453 | |
| 15454 | int j, index = 0; |
| 15455 | int cmd_len = 0; |
| 15456 | int num_entries; |
| 15457 | int min_entries = 0; |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 15458 | uint32_t numap = photlist->numAp; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15459 | int len = sizeof(*cmd); |
| 15460 | |
| 15461 | len += WMI_TLV_HDR_SIZE; |
| 15462 | cmd_len = len; |
| 15463 | |
| 15464 | num_entries = wmi_get_hotlist_entries_per_page(wmi_handle, |
| 15465 | cmd_len, |
| 15466 | sizeof(*dest_hotlist)); |
| 15467 | /* setbssid hotlist expects the bssid list |
| 15468 | * to be non zero value |
| 15469 | */ |
Srinivas Girigowda | 4c777b4 | 2016-12-07 14:45:34 -0800 | [diff] [blame] | 15470 | if (!numap || (numap > WMI_WLAN_EXTSCAN_MAX_HOTLIST_APS)) { |
Srinivas Girigowda | bf1a9ef | 2016-12-07 14:32:24 -0800 | [diff] [blame] | 15471 | WMI_LOGE("Invalid number of APs: %d", numap); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15472 | return QDF_STATUS_E_INVAL; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15473 | } |
| 15474 | |
| 15475 | /* Split the hot list entry pages and send multiple command |
| 15476 | * requests if the buffer reaches the maximum request size |
| 15477 | */ |
| 15478 | while (index < numap) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15479 | min_entries = QDF_MIN(num_entries, numap); |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15480 | len += min_entries * sizeof(wmi_extscan_hotlist_entry); |
| 15481 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15482 | if (!buf) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15483 | WMI_LOGP("%s: wmi_buf_alloc failed", __func__); |
| 15484 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15485 | } |
| 15486 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15487 | cmd = (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param *) |
| 15488 | buf_ptr; |
| 15489 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15490 | WMITLV_TAG_STRUC_wmi_extscan_configure_hotlist_monitor_cmd_fixed_param, |
| 15491 | WMITLV_GET_STRUCT_TLVLEN |
| 15492 | (wmi_extscan_configure_hotlist_monitor_cmd_fixed_param)); |
| 15493 | |
| 15494 | /* Multiple requests are sent until the num_entries_in_page |
| 15495 | * matches the total_entries |
| 15496 | */ |
| 15497 | cmd->request_id = photlist->requestId; |
| 15498 | cmd->vdev_id = photlist->sessionId; |
| 15499 | cmd->total_entries = numap; |
| 15500 | cmd->mode = 1; |
| 15501 | cmd->num_entries_in_page = min_entries; |
| 15502 | cmd->lost_ap_scan_count = photlist->lost_ap_sample_size; |
| 15503 | cmd->first_entry_index = index; |
| 15504 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15505 | 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] | 15506 | __func__, cmd->vdev_id, cmd->total_entries, |
| 15507 | cmd->num_entries_in_page, |
| 15508 | cmd->lost_ap_scan_count); |
| 15509 | |
| 15510 | buf_ptr += sizeof(*cmd); |
| 15511 | WMITLV_SET_HDR(buf_ptr, |
| 15512 | WMITLV_TAG_ARRAY_STRUC, |
| 15513 | min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 15514 | dest_hotlist = (wmi_extscan_hotlist_entry *) |
| 15515 | (buf_ptr + WMI_TLV_HDR_SIZE); |
| 15516 | |
| 15517 | /* Populate bssid, channel info and rssi |
| 15518 | * for the bssid's that are sent as hotlists. |
| 15519 | */ |
| 15520 | for (j = 0; j < min_entries; j++) { |
| 15521 | WMITLV_SET_HDR(dest_hotlist, |
| 15522 | WMITLV_TAG_STRUC_wmi_extscan_bucket_cmd_fixed_param, |
| 15523 | WMITLV_GET_STRUCT_TLVLEN |
| 15524 | (wmi_extscan_hotlist_entry)); |
| 15525 | |
| 15526 | dest_hotlist->min_rssi = src_ap->low; |
| 15527 | WMI_CHAR_ARRAY_TO_MAC_ADDR(src_ap->bssid.bytes, |
| 15528 | &dest_hotlist->bssid); |
| 15529 | |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15530 | WMI_LOGD("%s:channel:%d min_rssi %d", |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15531 | __func__, dest_hotlist->channel, |
| 15532 | dest_hotlist->min_rssi); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15533 | WMI_LOGD |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15534 | ("%s: bssid mac_addr31to0: 0x%x, mac_addr47to32: 0x%x", |
| 15535 | __func__, dest_hotlist->bssid.mac_addr31to0, |
| 15536 | dest_hotlist->bssid.mac_addr47to32); |
| 15537 | dest_hotlist++; |
| 15538 | src_ap++; |
| 15539 | } |
| 15540 | buf_ptr += WMI_TLV_HDR_SIZE + |
| 15541 | (min_entries * sizeof(wmi_extscan_hotlist_entry)); |
| 15542 | |
| 15543 | if (wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15544 | WMI_EXTSCAN_CONFIGURE_HOTLIST_MONITOR_CMDID)) { |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15545 | WMI_LOGE("%s: failed to send command", __func__); |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 15546 | wmi_buf_free(buf); |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15547 | return QDF_STATUS_E_FAILURE; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15548 | } |
| 15549 | index = index + min_entries; |
| 15550 | num_entries = numap - min_entries; |
| 15551 | len = cmd_len; |
| 15552 | } |
Govind Singh | b53420c | 2016-03-09 14:32:57 +0530 | [diff] [blame] | 15553 | return QDF_STATUS_SUCCESS; |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 15554 | } |
| 15555 | |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 15556 | /** |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 15557 | * send_set_active_bpf_mode_cmd_tlv() - configure active BPF mode in FW |
| 15558 | * @wmi_handle: the WMI handle |
| 15559 | * @vdev_id: the Id of the vdev to apply the configuration to |
| 15560 | * @ucast_mode: the active BPF mode to configure for unicast packets |
| 15561 | * @mcast_bcast_mode: the active BPF mode to configure for multicast/broadcast |
| 15562 | * packets |
| 15563 | * |
| 15564 | * Return: QDF status |
| 15565 | */ |
| 15566 | static QDF_STATUS send_set_active_bpf_mode_cmd_tlv(wmi_unified_t wmi_handle, |
| 15567 | uint8_t vdev_id, |
| 15568 | enum wmi_host_active_bpf_mode ucast_mode, |
| 15569 | enum wmi_host_active_bpf_mode mcast_bcast_mode) |
| 15570 | { |
| 15571 | const WMITLV_TAG_ID tag_id = |
| 15572 | WMITLV_TAG_STRUC_wmi_bpf_set_vdev_active_mode_cmd_fixed_param; |
| 15573 | const uint32_t tlv_len = WMITLV_GET_STRUCT_TLVLEN( |
| 15574 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param); |
| 15575 | QDF_STATUS status; |
| 15576 | wmi_bpf_set_vdev_active_mode_cmd_fixed_param *cmd; |
| 15577 | wmi_buf_t buf; |
| 15578 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 15579 | 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] | 15580 | vdev_id, ucast_mode, mcast_bcast_mode); |
| 15581 | |
| 15582 | /* allocate command buffer */ |
| 15583 | buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); |
| 15584 | if (!buf) { |
| 15585 | WMI_LOGE("%s: wmi_buf_alloc failed", __func__); |
| 15586 | return QDF_STATUS_E_NOMEM; |
| 15587 | } |
| 15588 | |
| 15589 | /* set TLV header */ |
| 15590 | cmd = (wmi_bpf_set_vdev_active_mode_cmd_fixed_param *)wmi_buf_data(buf); |
| 15591 | WMITLV_SET_HDR(&cmd->tlv_header, tag_id, tlv_len); |
| 15592 | |
| 15593 | /* populate data */ |
| 15594 | cmd->vdev_id = vdev_id; |
| 15595 | cmd->uc_mode = ucast_mode; |
| 15596 | cmd->mcbc_mode = mcast_bcast_mode; |
| 15597 | |
| 15598 | /* send to FW */ |
| 15599 | status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd), |
| 15600 | WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID); |
| 15601 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15602 | WMI_LOGE("Failed to send WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID:%d", |
| 15603 | status); |
| 15604 | wmi_buf_free(buf); |
| 15605 | return status; |
| 15606 | } |
| 15607 | |
Srinivas Girigowda | 245fa9e | 2017-03-10 16:00:56 -0800 | [diff] [blame] | 15608 | WMI_LOGD("Sent WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID successfully"); |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 15609 | |
| 15610 | return QDF_STATUS_SUCCESS; |
| 15611 | } |
| 15612 | |
| 15613 | /** |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 15614 | * send_power_dbg_cmd_tlv() - send power debug commands |
| 15615 | * @wmi_handle: wmi handle |
| 15616 | * @param: wmi power debug parameter |
| 15617 | * |
| 15618 | * Send WMI_POWER_DEBUG_CMDID parameters to fw. |
| 15619 | * |
| 15620 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 15621 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 15622 | static QDF_STATUS send_power_dbg_cmd_tlv(wmi_unified_t wmi_handle, |
| 15623 | struct wmi_power_dbg_params *param) |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 15624 | { |
| 15625 | wmi_buf_t buf = NULL; |
| 15626 | QDF_STATUS status; |
| 15627 | int len, args_tlv_len; |
| 15628 | uint8_t *buf_ptr; |
| 15629 | uint8_t i; |
| 15630 | wmi_pdev_wal_power_debug_cmd_fixed_param *cmd; |
| 15631 | uint32_t *cmd_args; |
| 15632 | |
| 15633 | /* Prepare and send power debug cmd parameters */ |
| 15634 | args_tlv_len = WMI_TLV_HDR_SIZE + param->num_args * sizeof(uint32_t); |
| 15635 | len = sizeof(*cmd) + args_tlv_len; |
| 15636 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15637 | if (!buf) { |
| 15638 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15639 | return QDF_STATUS_E_NOMEM; |
| 15640 | } |
| 15641 | |
| 15642 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15643 | cmd = (wmi_pdev_wal_power_debug_cmd_fixed_param *) buf_ptr; |
| 15644 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15645 | WMITLV_TAG_STRUC_wmi_pdev_wal_power_debug_cmd_fixed_param, |
| 15646 | WMITLV_GET_STRUCT_TLVLEN |
| 15647 | (wmi_pdev_wal_power_debug_cmd_fixed_param)); |
| 15648 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15649 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 15650 | param->pdev_id); |
Govind Singh | bca3b1b | 2016-05-02 17:59:24 +0530 | [diff] [blame] | 15651 | cmd->module_id = param->module_id; |
| 15652 | cmd->num_args = param->num_args; |
| 15653 | buf_ptr += sizeof(*cmd); |
| 15654 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, |
| 15655 | (param->num_args * sizeof(uint32_t))); |
| 15656 | cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); |
| 15657 | WMI_LOGI("%s: %d num of args = ", __func__, param->num_args); |
| 15658 | for (i = 0; (i < param->num_args && i < WMI_MAX_NUM_ARGS); i++) { |
| 15659 | cmd_args[i] = param->args[i]; |
| 15660 | WMI_LOGI("%d,", param->args[i]); |
| 15661 | } |
| 15662 | |
| 15663 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 15664 | len, WMI_PDEV_WAL_POWER_DEBUG_CMDID); |
| 15665 | if (QDF_IS_STATUS_ERROR(status)) { |
| 15666 | WMI_LOGE("wmi_unified_cmd_send WMI_PDEV_WAL_POWER_DEBUG_CMDID returned Error %d", |
| 15667 | status); |
| 15668 | goto error; |
| 15669 | } |
| 15670 | |
| 15671 | return QDF_STATUS_SUCCESS; |
| 15672 | error: |
| 15673 | wmi_buf_free(buf); |
| 15674 | |
| 15675 | return status; |
| 15676 | } |
| 15677 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15678 | /* copy_hw_mode_id_in_init_cmd() - Helper routine to copy hw_mode in init cmd |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15679 | * @wmi_handle: pointer to wmi handle |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15680 | * @buf_ptr: pointer to current position in init command buffer |
| 15681 | * @len: pointer to length. This will be updated with current lenght of cmd |
| 15682 | * @param: point host parameters for init command |
| 15683 | * |
| 15684 | * Return: Updated pointer of buf_ptr. |
| 15685 | */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15686 | static inline uint8_t *copy_hw_mode_in_init_cmd(struct wmi_unified *wmi_handle, |
| 15687 | uint8_t *buf_ptr, int *len, struct wmi_init_cmd_param *param) |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15688 | { |
| 15689 | uint16_t idx; |
| 15690 | |
| 15691 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) { |
| 15692 | wmi_pdev_set_hw_mode_cmd_fixed_param *hw_mode; |
| 15693 | wmi_pdev_band_to_mac *band_to_mac; |
| 15694 | |
| 15695 | hw_mode = (wmi_pdev_set_hw_mode_cmd_fixed_param *) |
| 15696 | (buf_ptr + sizeof(wmi_init_cmd_fixed_param) + |
| 15697 | sizeof(wmi_resource_config) + |
| 15698 | WMI_TLV_HDR_SIZE + (param->num_mem_chunks * |
| 15699 | sizeof(wlan_host_memory_chunk))); |
| 15700 | |
| 15701 | WMITLV_SET_HDR(&hw_mode->tlv_header, |
| 15702 | WMITLV_TAG_STRUC_wmi_pdev_set_hw_mode_cmd_fixed_param, |
| 15703 | (WMITLV_GET_STRUCT_TLVLEN |
| 15704 | (wmi_pdev_set_hw_mode_cmd_fixed_param))); |
| 15705 | |
| 15706 | hw_mode->hw_mode_index = param->hw_mode_id; |
| 15707 | hw_mode->num_band_to_mac = param->num_band_to_mac; |
| 15708 | |
| 15709 | buf_ptr = (uint8_t *) (hw_mode + 1); |
| 15710 | band_to_mac = (wmi_pdev_band_to_mac *) (buf_ptr + |
| 15711 | WMI_TLV_HDR_SIZE); |
| 15712 | for (idx = 0; idx < param->num_band_to_mac; idx++) { |
| 15713 | WMITLV_SET_HDR(&band_to_mac[idx].tlv_header, |
| 15714 | WMITLV_TAG_STRUC_wmi_pdev_band_to_mac, |
| 15715 | WMITLV_GET_STRUCT_TLVLEN |
| 15716 | (wmi_pdev_band_to_mac)); |
| 15717 | band_to_mac[idx].pdev_id = |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15718 | wmi_handle->ops->convert_pdev_id_host_to_target( |
| 15719 | param->band_to_mac[idx].pdev_id); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15720 | band_to_mac[idx].start_freq = |
| 15721 | param->band_to_mac[idx].start_freq; |
| 15722 | band_to_mac[idx].end_freq = |
| 15723 | param->band_to_mac[idx].end_freq; |
| 15724 | } |
| 15725 | *len += sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 15726 | (param->num_band_to_mac * |
| 15727 | sizeof(wmi_pdev_band_to_mac)) + |
| 15728 | WMI_TLV_HDR_SIZE; |
| 15729 | |
| 15730 | WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, |
| 15731 | (param->num_band_to_mac * |
| 15732 | sizeof(wmi_pdev_band_to_mac))); |
| 15733 | } |
| 15734 | |
| 15735 | return buf_ptr; |
| 15736 | } |
| 15737 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15738 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 15739 | * send_multiple_vdev_restart_req_cmd_tlv() - send multiple vdev restart req |
| 15740 | * @wmi_handle: wmi handle |
| 15741 | * @param: wmi multiple vdev restart req param |
| 15742 | * |
| 15743 | * Send WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID parameters to fw. |
| 15744 | * |
| 15745 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 15746 | */ |
| 15747 | static QDF_STATUS send_multiple_vdev_restart_req_cmd_tlv( |
| 15748 | wmi_unified_t wmi_handle, |
| 15749 | struct multiple_vdev_restart_params *param) |
| 15750 | { |
| 15751 | wmi_buf_t buf; |
| 15752 | QDF_STATUS qdf_status; |
| 15753 | wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *cmd; |
| 15754 | int i; |
| 15755 | uint8_t *buf_ptr; |
| 15756 | uint32_t *vdev_ids; |
| 15757 | wmi_channel *chan_info; |
| 15758 | struct channel_param *tchan_info; |
| 15759 | uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; |
| 15760 | |
| 15761 | len += sizeof(wmi_channel); |
| 15762 | if (param->num_vdevs) |
| 15763 | len += sizeof(uint32_t) * param->num_vdevs; |
| 15764 | |
| 15765 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15766 | if (!buf) { |
| 15767 | WMI_LOGE("Failed to allocate memory\n"); |
| 15768 | qdf_status = QDF_STATUS_E_NOMEM; |
| 15769 | goto end; |
| 15770 | } |
| 15771 | |
| 15772 | buf_ptr = (uint8_t *)wmi_buf_data(buf); |
| 15773 | cmd = (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *) |
| 15774 | buf_ptr; |
| 15775 | |
| 15776 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15777 | WMITLV_TAG_STRUC_wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param, |
| 15778 | WMITLV_GET_STRUCT_TLVLEN |
| 15779 | (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param)); |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15780 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( |
| 15781 | param->pdev_id); |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 15782 | cmd->requestor_id = param->requestor_id; |
| 15783 | cmd->disable_hw_ack = param->disable_hw_ack; |
| 15784 | cmd->cac_duration_ms = param->cac_duration_ms; |
| 15785 | cmd->num_vdevs = param->num_vdevs; |
| 15786 | |
| 15787 | buf_ptr += sizeof(*cmd); |
| 15788 | |
| 15789 | WMITLV_SET_HDR(buf_ptr, |
| 15790 | WMITLV_TAG_ARRAY_UINT32, |
| 15791 | sizeof(A_UINT32) * param->num_vdevs); |
| 15792 | vdev_ids = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE); |
| 15793 | for (i = 0; i < param->num_vdevs; i++) { |
| 15794 | vdev_ids[i] = param->vdev_ids[i]; |
| 15795 | } |
| 15796 | |
| 15797 | buf_ptr += (sizeof(A_UINT32) * param->num_vdevs) + WMI_TLV_HDR_SIZE; |
| 15798 | |
| 15799 | WMITLV_SET_HDR(buf_ptr, |
| 15800 | WMITLV_TAG_STRUC_wmi_channel, |
| 15801 | WMITLV_GET_STRUCT_TLVLEN(wmi_channel)); |
Sathish Kumar | 3e28e00 | 2017-03-07 15:53:04 +0530 | [diff] [blame] | 15802 | chan_info = (wmi_channel *)buf_ptr; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 15803 | tchan_info = &(param->ch_param); |
| 15804 | chan_info->mhz = tchan_info->mhz; |
| 15805 | chan_info->band_center_freq1 = tchan_info->cfreq1; |
| 15806 | chan_info->band_center_freq2 = tchan_info->cfreq2; |
| 15807 | if (tchan_info->is_chan_passive) |
| 15808 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 15809 | WMI_CHAN_FLAG_PASSIVE); |
| 15810 | if (tchan_info->allow_vht) |
| 15811 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 15812 | WMI_CHAN_FLAG_ALLOW_VHT); |
| 15813 | else if (tchan_info->allow_ht) |
| 15814 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 15815 | WMI_CHAN_FLAG_ALLOW_HT); |
| 15816 | WMI_SET_CHANNEL_MODE(chan_info, tchan_info->phy_mode); |
| 15817 | WMI_SET_CHANNEL_MIN_POWER(chan_info, tchan_info->minpower); |
| 15818 | WMI_SET_CHANNEL_MAX_POWER(chan_info, tchan_info->maxpower); |
| 15819 | WMI_SET_CHANNEL_REG_POWER(chan_info, tchan_info->maxregpower); |
| 15820 | WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, tchan_info->antennamax); |
| 15821 | WMI_SET_CHANNEL_REG_CLASSID(chan_info, tchan_info->reg_class_id); |
| 15822 | |
| 15823 | qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15824 | WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID); |
| 15825 | |
| 15826 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 15827 | WMI_LOGE("%s: Failed to send\n", __func__); |
| 15828 | wmi_buf_free(buf); |
| 15829 | } |
| 15830 | |
| 15831 | end: |
| 15832 | return qdf_status; |
| 15833 | } |
| 15834 | |
| 15835 | /** |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 15836 | * send_dfs_phyerr_offload_en_cmd_tlv() - send dfs phyerr offload enable cmd |
| 15837 | * @wmi_handle: wmi handle |
| 15838 | * @pdev_id: pdev id |
| 15839 | * |
| 15840 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID command to firmware. |
| 15841 | * |
| 15842 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 15843 | */ |
| 15844 | static QDF_STATUS send_dfs_phyerr_offload_en_cmd_tlv(wmi_unified_t wmi_handle, |
| 15845 | uint32_t pdev_id) |
| 15846 | { |
| 15847 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *cmd; |
| 15848 | wmi_buf_t buf; |
| 15849 | uint16_t len; |
| 15850 | QDF_STATUS ret; |
| 15851 | |
| 15852 | len = sizeof(*cmd); |
| 15853 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15854 | |
| 15855 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 15856 | |
| 15857 | if (!buf) { |
| 15858 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15859 | return QDF_STATUS_E_NOMEM; |
| 15860 | } |
| 15861 | |
| 15862 | cmd = (wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param *) |
| 15863 | wmi_buf_data(buf); |
| 15864 | |
| 15865 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15866 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param, |
| 15867 | WMITLV_GET_STRUCT_TLVLEN( |
| 15868 | wmi_pdev_dfs_phyerr_offload_enable_cmd_fixed_param)); |
| 15869 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15870 | 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] | 15871 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15872 | WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID); |
| 15873 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 15874 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 15875 | __func__, ret, pdev_id); |
| 15876 | wmi_buf_free(buf); |
| 15877 | return QDF_STATUS_E_FAILURE; |
| 15878 | } |
| 15879 | |
| 15880 | return QDF_STATUS_SUCCESS; |
| 15881 | } |
| 15882 | |
| 15883 | /** |
| 15884 | * send_dfs_phyerr_offload_dis_cmd_tlv() - send dfs phyerr offload disable cmd |
| 15885 | * @wmi_handle: wmi handle |
| 15886 | * @pdev_id: pdev id |
| 15887 | * |
| 15888 | * Send WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID command to firmware. |
| 15889 | * |
| 15890 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
| 15891 | */ |
| 15892 | static QDF_STATUS send_dfs_phyerr_offload_dis_cmd_tlv(wmi_unified_t wmi_handle, |
| 15893 | uint32_t pdev_id) |
| 15894 | { |
| 15895 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *cmd; |
| 15896 | wmi_buf_t buf; |
| 15897 | uint16_t len; |
| 15898 | QDF_STATUS ret; |
| 15899 | |
| 15900 | len = sizeof(*cmd); |
| 15901 | buf = wmi_buf_alloc(wmi_handle, len); |
| 15902 | |
| 15903 | WMI_LOGI("%s: pdev_id=%d", __func__, pdev_id); |
| 15904 | |
| 15905 | if (!buf) { |
| 15906 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 15907 | return QDF_STATUS_E_NOMEM; |
| 15908 | } |
| 15909 | |
| 15910 | cmd = (wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param *) |
| 15911 | wmi_buf_data(buf); |
| 15912 | |
| 15913 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15914 | WMITLV_TAG_STRUC_wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param, |
| 15915 | WMITLV_GET_STRUCT_TLVLEN( |
| 15916 | wmi_pdev_dfs_phyerr_offload_disable_cmd_fixed_param)); |
| 15917 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 15918 | 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] | 15919 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 15920 | WMI_PDEV_DFS_PHYERR_OFFLOAD_DISABLE_CMDID); |
| 15921 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 15922 | WMI_LOGE("%s: Failed to send cmd to fw, ret=%d, pdev_id=%d", |
| 15923 | __func__, ret, pdev_id); |
| 15924 | wmi_buf_free(buf); |
| 15925 | return QDF_STATUS_E_FAILURE; |
| 15926 | } |
| 15927 | |
| 15928 | return QDF_STATUS_SUCCESS; |
| 15929 | } |
| 15930 | |
| 15931 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15932 | * init_cmd_send_tlv() - send initialization cmd to fw |
| 15933 | * @wmi_handle: wmi handle |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15934 | * @param param: pointer to wmi init param |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15935 | * |
| 15936 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 15937 | */ |
| 15938 | static QDF_STATUS init_cmd_send_tlv(wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15939 | struct wmi_init_cmd_param *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15940 | { |
| 15941 | wmi_buf_t buf; |
| 15942 | wmi_init_cmd_fixed_param *cmd; |
| 15943 | wmi_abi_version my_vers; |
| 15944 | int num_whitelist; |
| 15945 | uint8_t *buf_ptr; |
| 15946 | wmi_resource_config *resource_cfg; |
| 15947 | wlan_host_memory_chunk *host_mem_chunks; |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15948 | uint32_t mem_chunk_len = 0, hw_mode_len = 0; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15949 | uint16_t idx; |
| 15950 | int len; |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 15951 | QDF_STATUS ret; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15952 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15953 | len = sizeof(*cmd) + sizeof(wmi_resource_config) + |
| 15954 | WMI_TLV_HDR_SIZE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15955 | mem_chunk_len = (sizeof(wlan_host_memory_chunk) * MAX_MEM_CHUNKS); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15956 | |
| 15957 | if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) |
| 15958 | hw_mode_len = sizeof(wmi_pdev_set_hw_mode_cmd_fixed_param) + |
| 15959 | WMI_TLV_HDR_SIZE + |
| 15960 | (param->num_band_to_mac * sizeof(wmi_pdev_band_to_mac)); |
| 15961 | |
| 15962 | 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] | 15963 | if (!buf) { |
| 15964 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 15965 | return QDF_STATUS_E_FAILURE; |
| 15966 | } |
| 15967 | |
| 15968 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 15969 | cmd = (wmi_init_cmd_fixed_param *) buf_ptr; |
| 15970 | resource_cfg = (wmi_resource_config *) (buf_ptr + sizeof(*cmd)); |
| 15971 | |
| 15972 | host_mem_chunks = (wlan_host_memory_chunk *) |
| 15973 | (buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config) |
| 15974 | + WMI_TLV_HDR_SIZE); |
| 15975 | |
| 15976 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 15977 | WMITLV_TAG_STRUC_wmi_init_cmd_fixed_param, |
| 15978 | WMITLV_GET_STRUCT_TLVLEN(wmi_init_cmd_fixed_param)); |
| 15979 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15980 | wmi_copy_resource_config(resource_cfg, param->res_cfg); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15981 | WMITLV_SET_HDR(&resource_cfg->tlv_header, |
| 15982 | WMITLV_TAG_STRUC_wmi_resource_config, |
| 15983 | WMITLV_GET_STRUCT_TLVLEN(wmi_resource_config)); |
| 15984 | |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15985 | for (idx = 0; idx < param->num_mem_chunks; ++idx) { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15986 | WMITLV_SET_HDR(&(host_mem_chunks[idx].tlv_header), |
| 15987 | WMITLV_TAG_STRUC_wlan_host_memory_chunk, |
| 15988 | WMITLV_GET_STRUCT_TLVLEN |
| 15989 | (wlan_host_memory_chunk)); |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15990 | host_mem_chunks[idx].ptr = param->mem_chunks[idx].paddr; |
| 15991 | host_mem_chunks[idx].size = param->mem_chunks[idx].len; |
| 15992 | host_mem_chunks[idx].req_id = param->mem_chunks[idx].req_id; |
Vivek | f85a42b | 2017-06-21 11:38:28 +0530 | [diff] [blame] | 15993 | QDF_TRACE(QDF_MODULE_ID_ANY, QDF_TRACE_LEVEL_DEBUG, |
| 15994 | "chunk %d len %d requested ,ptr 0x%x ", |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 15995 | idx, host_mem_chunks[idx].size, |
| 15996 | host_mem_chunks[idx].ptr); |
| 15997 | } |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 15998 | cmd->num_host_mem_chunks = param->num_mem_chunks; |
| 15999 | len += (param->num_mem_chunks * sizeof(wlan_host_memory_chunk)); |
| 16000 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16001 | WMITLV_SET_HDR((buf_ptr + sizeof(*cmd) + sizeof(wmi_resource_config)), |
| 16002 | WMITLV_TAG_ARRAY_STRUC, |
| 16003 | (sizeof(wlan_host_memory_chunk) * |
Kiran Venkatappa | 2611705 | 2016-12-23 19:58:54 +0530 | [diff] [blame] | 16004 | param->num_mem_chunks)); |
| 16005 | |
| 16006 | /* Fill hw mode id config */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16007 | 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] | 16008 | |
| 16009 | num_whitelist = sizeof(version_whitelist) / |
| 16010 | sizeof(wmi_whitelist_version_info); |
| 16011 | my_vers.abi_version_0 = WMI_ABI_VERSION_0; |
| 16012 | my_vers.abi_version_1 = WMI_ABI_VERSION_1; |
| 16013 | my_vers.abi_version_ns_0 = WMI_ABI_VERSION_NS_0; |
| 16014 | my_vers.abi_version_ns_1 = WMI_ABI_VERSION_NS_1; |
| 16015 | my_vers.abi_version_ns_2 = WMI_ABI_VERSION_NS_2; |
| 16016 | my_vers.abi_version_ns_3 = WMI_ABI_VERSION_NS_3; |
| 16017 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16018 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16019 | wmi_cmp_and_set_abi_version(num_whitelist, version_whitelist, |
| 16020 | &my_vers, |
| 16021 | (struct _wmi_abi_version *)&wmi_handle->fw_abi_version, |
| 16022 | &cmd->host_abi_vers); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16023 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16024 | qdf_print("%s: INIT_CMD version: %d, %d, 0x%x, 0x%x, 0x%x, 0x%x", |
| 16025 | __func__, |
| 16026 | WMI_VER_GET_MAJOR(cmd->host_abi_vers.abi_version_0), |
| 16027 | WMI_VER_GET_MINOR(cmd->host_abi_vers.abi_version_0), |
| 16028 | cmd->host_abi_vers.abi_version_ns_0, |
| 16029 | cmd->host_abi_vers.abi_version_ns_1, |
| 16030 | cmd->host_abi_vers.abi_version_ns_2, |
| 16031 | cmd->host_abi_vers.abi_version_ns_3); |
| 16032 | |
| 16033 | /* Save version sent from host - |
| 16034 | * Will be used to check ready event |
| 16035 | */ |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16036 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16037 | qdf_mem_copy(&wmi_handle->final_abi_vers, &cmd->host_abi_vers, |
| 16038 | sizeof(wmi_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16039 | #endif |
Abhishek Singh | 716c46c | 2016-05-04 16:24:07 +0530 | [diff] [blame] | 16040 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_INIT_CMDID); |
| 16041 | if (QDF_IS_STATUS_ERROR(ret)) { |
| 16042 | WMI_LOGE("wmi_unified_cmd_send WMI_INIT_CMDID returned Error %d", |
| 16043 | ret); |
| 16044 | wmi_buf_free(buf); |
| 16045 | } |
| 16046 | return ret; |
| 16047 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16048 | } |
| 16049 | |
| 16050 | /** |
| 16051 | * save_service_bitmap_tlv() - save service bitmap |
| 16052 | * @wmi_handle: wmi handle |
| 16053 | * @param evt_buf: pointer to event buffer |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 16054 | * @param bitmap_buf: bitmap buffer, for converged legacy support |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16055 | * |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16056 | * Return: QDF_STATUS |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16057 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 16058 | static |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16059 | 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] | 16060 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16061 | { |
| 16062 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16063 | struct wmi_soc *soc = wmi_handle->soc; |
| 16064 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16065 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16066 | |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16067 | /* If it is already allocated, use that buffer. This can happen |
| 16068 | * during target stop/start scenarios where host allocation is skipped. |
| 16069 | */ |
| 16070 | if (!soc->wmi_service_bitmap) { |
| 16071 | soc->wmi_service_bitmap = |
| 16072 | qdf_mem_malloc(WMI_SERVICE_BM_SIZE * sizeof(uint32_t)); |
| 16073 | if (!soc->wmi_service_bitmap) { |
| 16074 | WMI_LOGE("Failed memory allocation for service bitmap"); |
| 16075 | return QDF_STATUS_E_NOMEM; |
| 16076 | } |
| 16077 | } |
| 16078 | |
| 16079 | qdf_mem_copy(soc->wmi_service_bitmap, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16080 | param_buf->wmi_service_bitmap, |
| 16081 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 16082 | |
| 16083 | if (bitmap_buf) |
| 16084 | qdf_mem_copy(bitmap_buf, |
| 16085 | param_buf->wmi_service_bitmap, |
| 16086 | (WMI_SERVICE_BM_SIZE * sizeof(uint32_t))); |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16087 | |
| 16088 | return QDF_STATUS_SUCCESS; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16089 | } |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16090 | |
| 16091 | /** |
| 16092 | * save_ext_service_bitmap_tlv() - save extendend service bitmap |
| 16093 | * @wmi_handle: wmi handle |
| 16094 | * @param evt_buf: pointer to event buffer |
| 16095 | * @param bitmap_buf: bitmap buffer, for converged legacy support |
| 16096 | * |
| 16097 | * Return: QDF_STATUS |
| 16098 | */ |
Jeff Johnson | 9366d7a | 2016-10-07 13:03:02 -0700 | [diff] [blame] | 16099 | static |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16100 | 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] | 16101 | void *bitmap_buf) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16102 | { |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16103 | WMI_SERVICE_AVAILABLE_EVENTID_param_tlvs *param_buf; |
| 16104 | wmi_service_available_event_fixed_param *ev; |
| 16105 | struct wmi_soc *soc = wmi_handle->soc; |
| 16106 | |
| 16107 | param_buf = (WMI_SERVICE_AVAILABLE_EVENTID_param_tlvs *) evt_buf; |
| 16108 | |
| 16109 | ev = param_buf->fixed_param; |
| 16110 | |
| 16111 | /* If it is already allocated, use that buffer. This can happen |
| 16112 | * during target stop/start scenarios where host allocation is skipped. |
| 16113 | */ |
| 16114 | if (!soc->wmi_ext_service_bitmap) { |
| 16115 | soc->wmi_ext_service_bitmap = qdf_mem_malloc( |
| 16116 | WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(uint32_t)); |
| 16117 | if (!soc->wmi_ext_service_bitmap) { |
| 16118 | WMI_LOGE("Failed memory allocation for service bitmap"); |
| 16119 | return QDF_STATUS_E_NOMEM; |
| 16120 | } |
| 16121 | } |
| 16122 | |
| 16123 | qdf_mem_copy(soc->wmi_ext_service_bitmap, |
| 16124 | ev->wmi_service_segment_bitmap, |
| 16125 | (WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(uint32_t))); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16126 | |
Rajeev Kumar | 7790147 | 2017-02-12 02:12:17 -0800 | [diff] [blame] | 16127 | if (bitmap_buf) |
| 16128 | qdf_mem_copy(bitmap_buf, |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16129 | soc->wmi_ext_service_bitmap, |
| 16130 | (WMI_SERVICE_SEGMENT_BM_SIZE32 * sizeof(uint32_t))); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16131 | |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16132 | return QDF_STATUS_SUCCESS; |
| 16133 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16134 | /** |
| 16135 | * is_service_enabled_tlv() - Check if service enabled |
| 16136 | * @param wmi_handle: wmi handle |
| 16137 | * @param service_id: service identifier |
| 16138 | * |
| 16139 | * Return: 1 enabled, 0 disabled |
| 16140 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 16141 | #ifndef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16142 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 16143 | uint32_t service_id) |
| 16144 | { |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 16145 | struct wmi_soc *soc = wmi_handle->soc; |
| 16146 | |
| 16147 | if (!soc->wmi_service_bitmap) { |
| 16148 | WMI_LOGE("WMI service bit map is not saved yet\n"); |
| 16149 | return false; |
| 16150 | } |
| 16151 | |
| 16152 | /* if WMI_EXTENDED_SERVICE_AVAILABLE was received with extended bitmap, |
| 16153 | * use WMI_SERVICE_EXT_ENABLE to check the services. |
| 16154 | */ |
| 16155 | if (soc->wmi_ext_service_bitmap) |
| 16156 | return WMI_SERVICE_EXT_IS_ENABLED(soc->wmi_service_bitmap, |
| 16157 | soc->wmi_ext_service_bitmap, |
| 16158 | service_id); |
| 16159 | |
| 16160 | return WMI_SERVICE_IS_ENABLED(soc->wmi_service_bitmap, |
| 16161 | service_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16162 | } |
| 16163 | #else |
| 16164 | static bool is_service_enabled_tlv(wmi_unified_t wmi_handle, |
| 16165 | uint32_t service_id) |
| 16166 | { |
| 16167 | return false; |
| 16168 | } |
| 16169 | #endif |
| 16170 | |
Nandha Kishore Easwaran | a769b36 | 2017-06-15 10:29:29 +0530 | [diff] [blame] | 16171 | static inline void copy_ht_cap_info(uint32_t ev_target_cap, |
| 16172 | struct wlan_psoc_target_capability_info *cap) |
| 16173 | { |
| 16174 | /* except LDPC all flags are common betwen legacy and here |
| 16175 | * also IBFEER is not defined for TLV |
| 16176 | */ |
| 16177 | cap->ht_cap_info |= ev_target_cap & ( |
| 16178 | WMI_HT_CAP_ENABLED |
| 16179 | | WMI_HT_CAP_HT20_SGI |
| 16180 | | WMI_HT_CAP_DYNAMIC_SMPS |
| 16181 | | WMI_HT_CAP_TX_STBC |
| 16182 | | WMI_HT_CAP_TX_STBC_MASK_SHIFT |
| 16183 | | WMI_HT_CAP_RX_STBC |
| 16184 | | WMI_HT_CAP_RX_STBC_MASK_SHIFT |
| 16185 | | WMI_HT_CAP_LDPC |
| 16186 | | WMI_HT_CAP_L_SIG_TXOP_PROT |
| 16187 | | WMI_HT_CAP_MPDU_DENSITY |
| 16188 | | WMI_HT_CAP_MPDU_DENSITY_MASK_SHIFT |
| 16189 | | WMI_HT_CAP_HT40_SGI); |
| 16190 | if (ev_target_cap & WMI_HT_CAP_LDPC) |
| 16191 | cap->ht_cap_info |= WMI_HOST_HT_CAP_RX_LDPC | |
| 16192 | WMI_HOST_HT_CAP_TX_LDPC; |
| 16193 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16194 | /** |
| 16195 | * extract_service_ready_tlv() - extract service ready event |
| 16196 | * @wmi_handle: wmi handle |
| 16197 | * @param evt_buf: pointer to received event buffer |
| 16198 | * @param cap: pointer to hold target capability information extracted from even |
| 16199 | * |
| 16200 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16201 | */ |
| 16202 | static QDF_STATUS extract_service_ready_tlv(wmi_unified_t wmi_handle, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 16203 | void *evt_buf, struct wlan_psoc_target_capability_info *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16204 | { |
| 16205 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 16206 | wmi_service_ready_event_fixed_param *ev; |
| 16207 | |
| 16208 | |
| 16209 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16210 | |
| 16211 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 16212 | if (!ev) { |
| 16213 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 16214 | return QDF_STATUS_E_FAILURE; |
| 16215 | } |
| 16216 | |
| 16217 | cap->phy_capability = ev->phy_capability; |
| 16218 | cap->max_frag_entry = ev->max_frag_entry; |
| 16219 | cap->num_rf_chains = ev->num_rf_chains; |
Nandha Kishore Easwaran | a769b36 | 2017-06-15 10:29:29 +0530 | [diff] [blame] | 16220 | copy_ht_cap_info(ev->ht_cap_info, cap); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16221 | cap->vht_cap_info = ev->vht_cap_info; |
| 16222 | cap->vht_supp_mcs = ev->vht_supp_mcs; |
| 16223 | cap->hw_min_tx_power = ev->hw_min_tx_power; |
| 16224 | cap->hw_max_tx_power = ev->hw_max_tx_power; |
| 16225 | cap->sys_cap_info = ev->sys_cap_info; |
| 16226 | cap->min_pkt_size_enable = ev->min_pkt_size_enable; |
| 16227 | cap->max_bcn_ie_size = ev->max_bcn_ie_size; |
| 16228 | cap->max_num_scan_channels = ev->max_num_scan_channels; |
| 16229 | cap->max_supported_macs = ev->max_supported_macs; |
| 16230 | cap->wmi_fw_sub_feat_caps = ev->wmi_fw_sub_feat_caps; |
| 16231 | cap->txrx_chainmask = ev->txrx_chainmask; |
| 16232 | cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; |
| 16233 | cap->num_msdu_desc = ev->num_msdu_desc; |
| 16234 | |
| 16235 | return QDF_STATUS_SUCCESS; |
| 16236 | } |
| 16237 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 16238 | /* convert_wireless_modes_tlv() - Convert REGDMN_MODE values sent by target |
| 16239 | * to host internal WMI_HOST_REGDMN_MODE values. |
| 16240 | * REGULATORY TODO : REGDMN_MODE_11AC_VHT*_2G values are not used by the |
| 16241 | * host currently. Add this in the future if required. |
| 16242 | * 11AX (Phase II) : 11ax related values are not currently |
| 16243 | * advertised separately by FW. As part of phase II regulatory bring-up, |
| 16244 | * finalize the advertisement mechanism. |
| 16245 | * @target_wireless_mode: target wireless mode received in message |
| 16246 | * |
| 16247 | * Return: returns the host internal wireless mode. |
| 16248 | */ |
| 16249 | static inline uint32_t convert_wireless_modes_tlv(uint32_t target_wireless_mode) |
| 16250 | { |
| 16251 | |
| 16252 | uint32_t wireless_modes = 0; |
| 16253 | |
| 16254 | if (target_wireless_mode & REGDMN_MODE_11A) |
| 16255 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A; |
| 16256 | |
| 16257 | if (target_wireless_mode & REGDMN_MODE_TURBO) |
| 16258 | wireless_modes |= WMI_HOST_REGDMN_MODE_TURBO; |
| 16259 | |
| 16260 | if (target_wireless_mode & REGDMN_MODE_11B) |
| 16261 | wireless_modes |= WMI_HOST_REGDMN_MODE_11B; |
| 16262 | |
| 16263 | if (target_wireless_mode & REGDMN_MODE_PUREG) |
| 16264 | wireless_modes |= WMI_HOST_REGDMN_MODE_PUREG; |
| 16265 | |
| 16266 | if (target_wireless_mode & REGDMN_MODE_11G) |
| 16267 | wireless_modes |= WMI_HOST_REGDMN_MODE_11G; |
| 16268 | |
| 16269 | if (target_wireless_mode & REGDMN_MODE_108G) |
| 16270 | wireless_modes |= WMI_HOST_REGDMN_MODE_108G; |
| 16271 | |
| 16272 | if (target_wireless_mode & REGDMN_MODE_108A) |
| 16273 | wireless_modes |= WMI_HOST_REGDMN_MODE_108A; |
| 16274 | |
| 16275 | if (target_wireless_mode & REGDMN_MODE_XR) |
| 16276 | wireless_modes |= WMI_HOST_REGDMN_MODE_XR; |
| 16277 | |
| 16278 | if (target_wireless_mode & REGDMN_MODE_11A_HALF_RATE) |
| 16279 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_HALF_RATE; |
| 16280 | |
| 16281 | if (target_wireless_mode & REGDMN_MODE_11A_QUARTER_RATE) |
| 16282 | wireless_modes |= WMI_HOST_REGDMN_MODE_11A_QUARTER_RATE; |
| 16283 | |
| 16284 | if (target_wireless_mode & REGDMN_MODE_11NG_HT20) |
| 16285 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT20; |
| 16286 | |
| 16287 | if (target_wireless_mode & REGDMN_MODE_11NA_HT20) |
| 16288 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT20; |
| 16289 | |
| 16290 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40PLUS) |
| 16291 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40PLUS; |
| 16292 | |
| 16293 | if (target_wireless_mode & REGDMN_MODE_11NG_HT40MINUS) |
| 16294 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NG_HT40MINUS; |
| 16295 | |
| 16296 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40PLUS) |
| 16297 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40PLUS; |
| 16298 | |
| 16299 | if (target_wireless_mode & REGDMN_MODE_11NA_HT40MINUS) |
| 16300 | wireless_modes |= WMI_HOST_REGDMN_MODE_11NA_HT40MINUS; |
| 16301 | |
| 16302 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT20) |
| 16303 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT20; |
| 16304 | |
| 16305 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40PLUS) |
| 16306 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40PLUS; |
| 16307 | |
| 16308 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT40MINUS) |
| 16309 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT40MINUS; |
| 16310 | |
| 16311 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80) |
| 16312 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80; |
| 16313 | |
| 16314 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT160) |
| 16315 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT160; |
| 16316 | |
| 16317 | if (target_wireless_mode & REGDMN_MODE_11AC_VHT80_80) |
| 16318 | wireless_modes |= WMI_HOST_REGDMN_MODE_11AC_VHT80_80; |
| 16319 | |
| 16320 | return wireless_modes; |
| 16321 | } |
| 16322 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16323 | /** |
| 16324 | * extract_hal_reg_cap_tlv() - extract HAL registered capabilities |
| 16325 | * @wmi_handle: wmi handle |
| 16326 | * @param evt_buf: Pointer to event buffer |
| 16327 | * @param cap: pointer to hold HAL reg capabilities |
| 16328 | * |
| 16329 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16330 | */ |
| 16331 | 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] | 16332 | void *evt_buf, struct wlan_psoc_hal_reg_capability *cap) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16333 | { |
| 16334 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 16335 | |
| 16336 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16337 | |
| 16338 | qdf_mem_copy(cap, (((uint8_t *)param_buf->hal_reg_capabilities) + |
| 16339 | sizeof(uint32_t)), |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 16340 | sizeof(struct wlan_psoc_hal_reg_capability)); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16341 | |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 16342 | cap->wireless_modes = convert_wireless_modes_tlv( |
| 16343 | param_buf->hal_reg_capabilities->wireless_modes); |
Pratik Gandhi | 33bb714 | 2017-01-05 19:38:41 +0530 | [diff] [blame] | 16344 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16345 | return QDF_STATUS_SUCCESS; |
| 16346 | } |
| 16347 | |
| 16348 | /** |
| 16349 | * extract_host_mem_req_tlv() - Extract host memory request event |
| 16350 | * @wmi_handle: wmi handle |
| 16351 | * @param evt_buf: pointer to event buffer |
| 16352 | * @param num_entries: pointer to hold number of entries requested |
| 16353 | * |
| 16354 | * Return: Number of entries requested |
| 16355 | */ |
| 16356 | static host_mem_req *extract_host_mem_req_tlv(wmi_unified_t wmi_handle, |
| 16357 | void *evt_buf, uint8_t *num_entries) |
| 16358 | { |
| 16359 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 16360 | wmi_service_ready_event_fixed_param *ev; |
| 16361 | |
| 16362 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16363 | |
| 16364 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 16365 | if (!ev) { |
| 16366 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 16367 | return NULL; |
| 16368 | } |
| 16369 | |
| 16370 | *num_entries = ev->num_mem_reqs; |
| 16371 | |
| 16372 | return (host_mem_req *)param_buf->mem_reqs; |
| 16373 | } |
| 16374 | |
| 16375 | /** |
| 16376 | * save_fw_version_in_service_ready_tlv() - Save fw version in service |
| 16377 | * ready function |
| 16378 | * @wmi_handle: wmi handle |
| 16379 | * @param evt_buf: pointer to event buffer |
| 16380 | * |
| 16381 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16382 | */ |
| 16383 | static QDF_STATUS |
| 16384 | save_fw_version_in_service_ready_tlv(wmi_unified_t wmi_handle, void *evt_buf) |
| 16385 | { |
| 16386 | WMI_SERVICE_READY_EVENTID_param_tlvs *param_buf; |
| 16387 | wmi_service_ready_event_fixed_param *ev; |
| 16388 | |
| 16389 | |
| 16390 | param_buf = (WMI_SERVICE_READY_EVENTID_param_tlvs *) evt_buf; |
| 16391 | |
| 16392 | ev = (wmi_service_ready_event_fixed_param *) param_buf->fixed_param; |
| 16393 | if (!ev) { |
| 16394 | qdf_print("%s: wmi_buf_alloc failed\n", __func__); |
| 16395 | return QDF_STATUS_E_FAILURE; |
| 16396 | } |
| 16397 | |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16398 | #ifdef CONFIG_MCL |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16399 | /*Save fw version from service ready message */ |
| 16400 | /*This will be used while sending INIT message */ |
| 16401 | qdf_mem_copy(&wmi_handle->fw_abi_version, &ev->fw_abi_vers, |
| 16402 | sizeof(wmi_handle->fw_abi_version)); |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 16403 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16404 | return QDF_STATUS_SUCCESS; |
| 16405 | } |
| 16406 | |
| 16407 | /** |
| 16408 | * ready_extract_init_status_tlv() - Extract init status from ready event |
| 16409 | * @wmi_handle: wmi handle |
| 16410 | * @param evt_buf: Pointer to event buffer |
| 16411 | * |
| 16412 | * Return: ready status |
| 16413 | */ |
| 16414 | static uint32_t ready_extract_init_status_tlv(wmi_unified_t wmi_handle, |
| 16415 | void *evt_buf) |
| 16416 | { |
| 16417 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 16418 | wmi_ready_event_fixed_param *ev = NULL; |
| 16419 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16420 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 16421 | ev = param_buf->fixed_param; |
| 16422 | |
| 16423 | qdf_print("%s:%d\n", __func__, ev->status); |
| 16424 | |
| 16425 | return ev->status; |
| 16426 | } |
| 16427 | |
| 16428 | /** |
| 16429 | * ready_extract_mac_addr_tlv() - extract mac address from ready event |
| 16430 | * @wmi_handle: wmi handle |
| 16431 | * @param evt_buf: pointer to event buffer |
| 16432 | * @param macaddr: Pointer to hold MAC address |
| 16433 | * |
| 16434 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16435 | */ |
| 16436 | static QDF_STATUS ready_extract_mac_addr_tlv(wmi_unified_t wmi_hamdle, |
| 16437 | void *evt_buf, uint8_t *macaddr) |
| 16438 | { |
| 16439 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 16440 | wmi_ready_event_fixed_param *ev = NULL; |
| 16441 | |
| 16442 | |
| 16443 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 16444 | ev = param_buf->fixed_param; |
| 16445 | |
| 16446 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->mac_addr, macaddr); |
| 16447 | |
| 16448 | return QDF_STATUS_SUCCESS; |
| 16449 | } |
| 16450 | |
| 16451 | /** |
Manoj Ekbote | dd27390 | 2017-07-09 23:28:56 -0700 | [diff] [blame] | 16452 | * ready_extract_mac_addr_list_tlv() - extract MAC address list from ready event |
| 16453 | * @wmi_handle: wmi handle |
| 16454 | * @param evt_buf: pointer to event buffer |
| 16455 | * @param macaddr: Pointer to hold number of MAC addresses |
| 16456 | * |
| 16457 | * Return: Pointer to addr list |
| 16458 | */ |
| 16459 | static wmi_host_mac_addr *ready_extract_mac_addr_list_tlv(wmi_unified_t wmi_hamdle, |
| 16460 | void *evt_buf, uint8_t *num_mac) |
| 16461 | { |
| 16462 | WMI_READY_EVENTID_param_tlvs *param_buf = NULL; |
| 16463 | wmi_ready_event_fixed_param *ev = NULL; |
| 16464 | |
| 16465 | param_buf = (WMI_READY_EVENTID_param_tlvs *) evt_buf; |
| 16466 | ev = param_buf->fixed_param; |
| 16467 | |
| 16468 | *num_mac = ev->num_extra_mac_addr; |
| 16469 | |
| 16470 | return (wmi_host_mac_addr *) param_buf->mac_addr_list; |
| 16471 | } |
| 16472 | |
| 16473 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16474 | * extract_dbglog_data_len_tlv() - extract debuglog data length |
| 16475 | * @wmi_handle: wmi handle |
| 16476 | * @param evt_buf: pointer to event buffer |
| 16477 | * |
| 16478 | * Return: length |
| 16479 | */ |
| 16480 | 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] | 16481 | void *evt_buf, uint32_t *len) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16482 | { |
| 16483 | WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf; |
| 16484 | |
| 16485 | param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) evt_buf; |
| 16486 | |
| 16487 | *len = param_buf->num_bufp; |
| 16488 | |
| 16489 | return param_buf->bufp; |
| 16490 | } |
| 16491 | |
| 16492 | /** |
| 16493 | * extract_vdev_start_resp_tlv() - extract vdev start response |
| 16494 | * @wmi_handle: wmi handle |
| 16495 | * @param evt_buf: pointer to event buffer |
| 16496 | * @param vdev_rsp: Pointer to hold vdev response |
| 16497 | * |
| 16498 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16499 | */ |
| 16500 | static QDF_STATUS extract_vdev_start_resp_tlv(wmi_unified_t wmi_handle, |
| 16501 | void *evt_buf, wmi_host_vdev_start_resp *vdev_rsp) |
| 16502 | { |
| 16503 | WMI_VDEV_START_RESP_EVENTID_param_tlvs *param_buf; |
| 16504 | wmi_vdev_start_response_event_fixed_param *ev; |
| 16505 | |
| 16506 | param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) evt_buf; |
| 16507 | if (!param_buf) { |
| 16508 | qdf_print("Invalid start response event buffer\n"); |
| 16509 | return QDF_STATUS_E_INVAL; |
| 16510 | } |
| 16511 | |
| 16512 | ev = param_buf->fixed_param; |
| 16513 | if (!ev) { |
| 16514 | qdf_print("Invalid start response event buffer\n"); |
| 16515 | return QDF_STATUS_E_INVAL; |
| 16516 | } |
| 16517 | |
| 16518 | qdf_mem_zero(vdev_rsp, sizeof(*vdev_rsp)); |
| 16519 | |
| 16520 | vdev_rsp->vdev_id = ev->vdev_id; |
| 16521 | vdev_rsp->requestor_id = ev->requestor_id; |
Varun Reddy Yeturu | e3d7601 | 2017-07-13 12:20:53 -0700 | [diff] [blame] | 16522 | switch (ev->resp_type) { |
| 16523 | case WMI_VDEV_START_RESP_EVENT: |
| 16524 | vdev_rsp->resp_type = WMI_HOST_VDEV_START_RESP_EVENT; |
| 16525 | break; |
| 16526 | case WMI_VDEV_RESTART_RESP_EVENT: |
| 16527 | vdev_rsp->resp_type = WMI_HOST_VDEV_RESTART_RESP_EVENT; |
| 16528 | break; |
| 16529 | default: |
| 16530 | qdf_print("Invalid start response event buffer\n"); |
| 16531 | break; |
| 16532 | }; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16533 | vdev_rsp->status = ev->status; |
| 16534 | vdev_rsp->chain_mask = ev->chain_mask; |
| 16535 | vdev_rsp->smps_mode = ev->smps_mode; |
| 16536 | vdev_rsp->mac_id = ev->mac_id; |
| 16537 | vdev_rsp->cfgd_tx_streams = ev->cfgd_tx_streams; |
| 16538 | vdev_rsp->cfgd_rx_streams = ev->cfgd_rx_streams; |
| 16539 | |
| 16540 | return QDF_STATUS_SUCCESS; |
| 16541 | } |
| 16542 | |
| 16543 | /** |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16544 | * extract_tbttoffset_num_vdevs_tlv() - extract tbtt offset num vdev |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16545 | * @wmi_handle: wmi handle |
| 16546 | * @param evt_buf: pointer to event buffer |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16547 | * @param num_vdevs: Pointer to hold num vdev |
| 16548 | * |
| 16549 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16550 | */ |
| 16551 | static QDF_STATUS extract_tbttoffset_num_vdevs_tlv(void *wmi_hdl, |
| 16552 | void *evt_buf, uint32_t *num_vdevs) |
| 16553 | { |
| 16554 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 16555 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
| 16556 | uint32_t vdev_map; |
| 16557 | |
| 16558 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *)evt_buf; |
| 16559 | if (!param_buf) { |
| 16560 | qdf_print("Invalid tbtt update ext event buffer\n"); |
| 16561 | return QDF_STATUS_E_INVAL; |
| 16562 | } |
| 16563 | tbtt_offset_event = param_buf->fixed_param; |
| 16564 | vdev_map = tbtt_offset_event->vdev_map; |
| 16565 | *num_vdevs = wmi_vdev_map_to_num_vdevs(vdev_map); |
| 16566 | |
| 16567 | return QDF_STATUS_SUCCESS; |
| 16568 | } |
| 16569 | |
| 16570 | /** |
| 16571 | * extract_ext_tbttoffset_num_vdevs_tlv() - extract ext tbtt offset num vdev |
| 16572 | * @wmi_handle: wmi handle |
| 16573 | * @param evt_buf: pointer to event buffer |
| 16574 | * @param num_vdevs: Pointer to hold num vdev |
| 16575 | * |
| 16576 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16577 | */ |
| 16578 | static QDF_STATUS extract_ext_tbttoffset_num_vdevs_tlv(void *wmi_hdl, |
| 16579 | void *evt_buf, uint32_t *num_vdevs) |
| 16580 | { |
| 16581 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *param_buf; |
| 16582 | wmi_tbtt_offset_ext_event_fixed_param *tbtt_offset_ext_event; |
| 16583 | |
| 16584 | param_buf = (WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *)evt_buf; |
| 16585 | if (!param_buf) { |
| 16586 | qdf_print("Invalid tbtt update ext event buffer\n"); |
| 16587 | return QDF_STATUS_E_INVAL; |
| 16588 | } |
| 16589 | tbtt_offset_ext_event = param_buf->fixed_param; |
| 16590 | |
| 16591 | *num_vdevs = tbtt_offset_ext_event->num_vdevs; |
| 16592 | |
| 16593 | return QDF_STATUS_SUCCESS; |
| 16594 | } |
| 16595 | |
| 16596 | /** |
| 16597 | * extract_tbttoffset_update_params_tlv() - extract tbtt offset param |
| 16598 | * @wmi_handle: wmi handle |
| 16599 | * @param evt_buf: pointer to event buffer |
| 16600 | * @param idx: Index refering to a vdev |
| 16601 | * @param tbtt_param: Pointer to tbttoffset event param |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16602 | * |
| 16603 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16604 | */ |
| 16605 | static QDF_STATUS extract_tbttoffset_update_params_tlv(void *wmi_hdl, |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16606 | void *evt_buf, uint8_t idx, |
| 16607 | struct tbttoffset_params *tbtt_param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16608 | { |
| 16609 | WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; |
| 16610 | wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16611 | uint32_t vdev_map; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16612 | |
| 16613 | param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *) evt_buf; |
| 16614 | if (!param_buf) { |
| 16615 | qdf_print("Invalid tbtt update event buffer\n"); |
| 16616 | return QDF_STATUS_E_INVAL; |
| 16617 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16618 | |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 16619 | tbtt_offset_event = param_buf->fixed_param; |
| 16620 | vdev_map = tbtt_offset_event->vdev_map; |
| 16621 | tbtt_param->vdev_id = wmi_vdev_map_to_vdev_id(vdev_map, idx); |
| 16622 | if (tbtt_param->vdev_id == WLAN_INVALID_VDEV_ID) |
| 16623 | return QDF_STATUS_E_INVAL; |
| 16624 | tbtt_param->tbttoffset = |
| 16625 | param_buf->tbttoffset_list[tbtt_param->vdev_id]; |
| 16626 | |
| 16627 | return QDF_STATUS_SUCCESS; |
| 16628 | } |
| 16629 | |
| 16630 | /** |
| 16631 | * extract_ext_tbttoffset_update_params_tlv() - extract ext tbtt offset param |
| 16632 | * @wmi_handle: wmi handle |
| 16633 | * @param evt_buf: pointer to event buffer |
| 16634 | * @param idx: Index refering to a vdev |
| 16635 | * @param tbtt_param: Pointer to tbttoffset event param |
| 16636 | * |
| 16637 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16638 | */ |
| 16639 | static QDF_STATUS extract_ext_tbttoffset_update_params_tlv(void *wmi_hdl, |
| 16640 | void *evt_buf, uint8_t idx, |
| 16641 | struct tbttoffset_params *tbtt_param) |
| 16642 | { |
| 16643 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *param_buf; |
| 16644 | wmi_tbtt_offset_info *tbtt_offset_info; |
| 16645 | |
| 16646 | param_buf = (WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *)evt_buf; |
| 16647 | if (!param_buf) { |
| 16648 | qdf_print("Invalid tbtt update event buffer\n"); |
| 16649 | return QDF_STATUS_E_INVAL; |
| 16650 | } |
| 16651 | tbtt_offset_info = ¶m_buf->tbtt_offset_info[idx]; |
| 16652 | |
| 16653 | tbtt_param->vdev_id = tbtt_offset_info->vdev_id; |
| 16654 | tbtt_param->tbttoffset = tbtt_offset_info->tbttoffset; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16655 | |
| 16656 | return QDF_STATUS_SUCCESS; |
| 16657 | } |
| 16658 | |
| 16659 | /** |
| 16660 | * extract_mgmt_rx_params_tlv() - extract management rx params from event |
| 16661 | * @wmi_handle: wmi handle |
| 16662 | * @param evt_buf: pointer to event buffer |
| 16663 | * @param hdr: Pointer to hold header |
| 16664 | * @param bufp: Pointer to hold pointer to rx param buffer |
| 16665 | * |
| 16666 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16667 | */ |
| 16668 | 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] | 16669 | void *evt_buf, struct mgmt_rx_event_params *hdr, |
| 16670 | uint8_t **bufp) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16671 | { |
| 16672 | WMI_MGMT_RX_EVENTID_param_tlvs *param_tlvs = NULL; |
| 16673 | wmi_mgmt_rx_hdr *ev_hdr = NULL; |
| 16674 | |
| 16675 | param_tlvs = (WMI_MGMT_RX_EVENTID_param_tlvs *) evt_buf; |
| 16676 | if (!param_tlvs) { |
| 16677 | WMI_LOGE("Get NULL point message from FW"); |
| 16678 | return QDF_STATUS_E_INVAL; |
| 16679 | } |
| 16680 | |
| 16681 | ev_hdr = param_tlvs->hdr; |
| 16682 | if (!hdr) { |
| 16683 | WMI_LOGE("Rx event is NULL"); |
| 16684 | return QDF_STATUS_E_INVAL; |
| 16685 | } |
| 16686 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16687 | hdr->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 16688 | ev_hdr->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16689 | |
| 16690 | hdr->channel = ev_hdr->channel; |
| 16691 | hdr->snr = ev_hdr->snr; |
| 16692 | hdr->rate = ev_hdr->rate; |
| 16693 | hdr->phy_mode = ev_hdr->phy_mode; |
| 16694 | hdr->buf_len = ev_hdr->buf_len; |
| 16695 | hdr->status = ev_hdr->status; |
| 16696 | hdr->flags = ev_hdr->flags; |
| 16697 | hdr->rssi = ev_hdr->rssi; |
| 16698 | hdr->tsf_delta = ev_hdr->tsf_delta; |
| 16699 | qdf_mem_copy(hdr->rssi_ctl, ev_hdr->rssi_ctl, sizeof(hdr->rssi_ctl)); |
| 16700 | |
| 16701 | *bufp = param_tlvs->bufp; |
| 16702 | |
| 16703 | return QDF_STATUS_SUCCESS; |
| 16704 | } |
| 16705 | |
| 16706 | /** |
| 16707 | * extract_vdev_stopped_param_tlv() - extract vdev stop param from event |
| 16708 | * @wmi_handle: wmi handle |
| 16709 | * @param evt_buf: pointer to event buffer |
| 16710 | * @param vdev_id: Pointer to hold vdev identifier |
| 16711 | * |
| 16712 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16713 | */ |
| 16714 | static QDF_STATUS extract_vdev_stopped_param_tlv(wmi_unified_t wmi_handle, |
| 16715 | void *evt_buf, uint32_t *vdev_id) |
| 16716 | { |
| 16717 | WMI_VDEV_STOPPED_EVENTID_param_tlvs *param_buf; |
| 16718 | wmi_vdev_stopped_event_fixed_param *resp_event; |
| 16719 | |
| 16720 | param_buf = (WMI_VDEV_STOPPED_EVENTID_param_tlvs *) evt_buf; |
| 16721 | if (!param_buf) { |
| 16722 | WMI_LOGE("Invalid event buffer"); |
| 16723 | return QDF_STATUS_E_INVAL; |
| 16724 | } |
| 16725 | resp_event = param_buf->fixed_param; |
| 16726 | *vdev_id = resp_event->vdev_id; |
| 16727 | |
| 16728 | return QDF_STATUS_SUCCESS; |
| 16729 | } |
| 16730 | |
| 16731 | /** |
| 16732 | * extract_vdev_roam_param_tlv() - extract vdev roam param from event |
| 16733 | * @wmi_handle: wmi handle |
| 16734 | * @param evt_buf: pointer to event buffer |
| 16735 | * @param param: Pointer to hold roam param |
| 16736 | * |
| 16737 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16738 | */ |
| 16739 | static QDF_STATUS extract_vdev_roam_param_tlv(wmi_unified_t wmi_handle, |
| 16740 | void *evt_buf, wmi_host_roam_event *param) |
| 16741 | { |
| 16742 | WMI_ROAM_EVENTID_param_tlvs *param_buf; |
| 16743 | wmi_roam_event_fixed_param *evt; |
| 16744 | |
| 16745 | param_buf = (WMI_ROAM_EVENTID_param_tlvs *) evt_buf; |
| 16746 | if (!param_buf) { |
| 16747 | WMI_LOGE("Invalid roam event buffer"); |
| 16748 | return QDF_STATUS_E_INVAL; |
| 16749 | } |
| 16750 | |
| 16751 | evt = param_buf->fixed_param; |
| 16752 | qdf_mem_zero(param, sizeof(*param)); |
| 16753 | |
| 16754 | param->vdev_id = evt->vdev_id; |
| 16755 | param->reason = evt->reason; |
| 16756 | param->rssi = evt->rssi; |
| 16757 | |
| 16758 | return QDF_STATUS_SUCCESS; |
| 16759 | } |
| 16760 | |
| 16761 | /** |
| 16762 | * extract_vdev_scan_ev_param_tlv() - extract vdev scan param from event |
| 16763 | * @wmi_handle: wmi handle |
| 16764 | * @param evt_buf: pointer to event buffer |
| 16765 | * @param param: Pointer to hold vdev scan param |
| 16766 | * |
| 16767 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16768 | */ |
| 16769 | 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] | 16770 | void *evt_buf, struct scan_event *param) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16771 | { |
| 16772 | WMI_SCAN_EVENTID_param_tlvs *param_buf = NULL; |
| 16773 | wmi_scan_event_fixed_param *evt = NULL; |
| 16774 | |
| 16775 | param_buf = (WMI_SCAN_EVENTID_param_tlvs *) evt_buf; |
| 16776 | evt = param_buf->fixed_param; |
| 16777 | |
| 16778 | qdf_mem_zero(param, sizeof(*param)); |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 16779 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16780 | switch (evt->event) { |
| 16781 | case WMI_SCAN_EVENT_STARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16782 | param->type = SCAN_EVENT_TYPE_STARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16783 | break; |
| 16784 | case WMI_SCAN_EVENT_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16785 | param->type = SCAN_EVENT_TYPE_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16786 | break; |
| 16787 | case WMI_SCAN_EVENT_BSS_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16788 | param->type = SCAN_EVENT_TYPE_BSS_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16789 | break; |
| 16790 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16791 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16792 | break; |
| 16793 | case WMI_SCAN_EVENT_DEQUEUED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16794 | param->type = SCAN_EVENT_TYPE_DEQUEUED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16795 | break; |
| 16796 | case WMI_SCAN_EVENT_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16797 | param->type = SCAN_EVENT_TYPE_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16798 | break; |
| 16799 | case WMI_SCAN_EVENT_START_FAILED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16800 | param->type = SCAN_EVENT_TYPE_START_FAILED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16801 | break; |
| 16802 | case WMI_SCAN_EVENT_RESTARTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16803 | param->type = SCAN_EVENT_TYPE_RESTARTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16804 | break; |
Sreelakshmi Konamki | 76d62af | 2017-05-25 18:11:03 +0530 | [diff] [blame] | 16805 | case WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16806 | param->type = SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16807 | break; |
| 16808 | case WMI_SCAN_EVENT_MAX: |
| 16809 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16810 | param->type = SCAN_EVENT_TYPE_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16811 | break; |
| 16812 | }; |
| 16813 | |
| 16814 | switch (evt->reason) { |
| 16815 | case WMI_SCAN_REASON_NONE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16816 | param->reason = SCAN_REASON_NONE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16817 | break; |
| 16818 | case WMI_SCAN_REASON_COMPLETED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16819 | param->reason = SCAN_REASON_COMPLETED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16820 | break; |
| 16821 | case WMI_SCAN_REASON_CANCELLED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16822 | param->reason = SCAN_REASON_CANCELLED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16823 | break; |
| 16824 | case WMI_SCAN_REASON_PREEMPTED: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16825 | param->reason = SCAN_REASON_PREEMPTED; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16826 | break; |
| 16827 | case WMI_SCAN_REASON_TIMEDOUT: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16828 | param->reason = SCAN_REASON_TIMEDOUT; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16829 | break; |
| 16830 | case WMI_SCAN_REASON_INTERNAL_FAILURE: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16831 | param->reason = SCAN_REASON_INTERNAL_FAILURE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16832 | break; |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 16833 | case WMI_SCAN_REASON_SUSPENDED: |
| 16834 | param->reason = SCAN_REASON_SUSPENDED; |
| 16835 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16836 | case WMI_SCAN_REASON_MAX: |
Anish Nataraj | 78b8ccd | 2017-03-20 12:57:55 +0530 | [diff] [blame] | 16837 | param->reason = SCAN_REASON_MAX; |
| 16838 | break; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16839 | default: |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16840 | param->reason = SCAN_REASON_MAX; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16841 | break; |
| 16842 | }; |
| 16843 | |
Om Prakash Tripathi | 1d83e35 | 2017-02-25 15:53:30 +0530 | [diff] [blame] | 16844 | param->chan_freq = evt->channel_freq; |
| 16845 | param->requester = evt->requestor; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16846 | param->scan_id = evt->scan_id; |
| 16847 | param->vdev_id = evt->vdev_id; |
Sathish Kumar | b863315 | 2017-08-11 15:00:04 +0530 | [diff] [blame] | 16848 | param->timestamp = evt->tsf_timestamp; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16849 | |
| 16850 | return QDF_STATUS_SUCCESS; |
| 16851 | } |
| 16852 | |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 16853 | #ifdef CONVERGED_TDLS_ENABLE |
| 16854 | /** |
| 16855 | * extract_vdev_tdls_ev_param_tlv() - extract vdev tdls param from event |
| 16856 | * @wmi_handle: wmi handle |
| 16857 | * @param evt_buf: pointer to event buffer |
| 16858 | * @param param: Pointer to hold vdev tdls param |
| 16859 | * |
| 16860 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16861 | */ |
| 16862 | static QDF_STATUS extract_vdev_tdls_ev_param_tlv(wmi_unified_t wmi_handle, |
| 16863 | void *evt_buf, struct tdls_event_info *param) |
| 16864 | { |
| 16865 | WMI_TDLS_PEER_EVENTID_param_tlvs *param_buf; |
| 16866 | wmi_tdls_peer_event_fixed_param *evt; |
| 16867 | |
| 16868 | param_buf = (WMI_TDLS_PEER_EVENTID_param_tlvs *)evt_buf; |
| 16869 | if (!param_buf) { |
| 16870 | WMI_LOGE("%s: NULL param_buf", __func__); |
| 16871 | return QDF_STATUS_E_NULL_VALUE; |
| 16872 | } |
| 16873 | |
| 16874 | evt = param_buf->fixed_param; |
| 16875 | |
| 16876 | qdf_mem_zero(param, sizeof(*param)); |
| 16877 | |
| 16878 | param->vdev_id = evt->vdev_id; |
| 16879 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&evt->peer_macaddr, |
| 16880 | param->peermac.bytes); |
| 16881 | switch (evt->peer_status) { |
| 16882 | case WMI_TDLS_SHOULD_DISCOVER: |
| 16883 | param->message_type = TDLS_SHOULD_DISCOVER; |
| 16884 | break; |
| 16885 | case WMI_TDLS_SHOULD_TEARDOWN: |
| 16886 | param->message_type = TDLS_SHOULD_TEARDOWN; |
| 16887 | break; |
| 16888 | case WMI_TDLS_PEER_DISCONNECTED: |
| 16889 | param->message_type = TDLS_PEER_DISCONNECTED; |
| 16890 | break; |
| 16891 | case WMI_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
| 16892 | param->message_type = TDLS_CONNECTION_TRACKER_NOTIFY; |
| 16893 | break; |
| 16894 | default: |
| 16895 | WMI_LOGE("%s: Discarding unknown tdls event %d from target", |
| 16896 | __func__, evt->peer_status); |
| 16897 | return QDF_STATUS_E_INVAL; |
| 16898 | }; |
| 16899 | |
| 16900 | switch (evt->peer_reason) { |
| 16901 | case WMI_TDLS_TEARDOWN_REASON_TX: |
| 16902 | param->peer_reason = TDLS_TEARDOWN_TX; |
| 16903 | break; |
| 16904 | case WMI_TDLS_TEARDOWN_REASON_RSSI: |
| 16905 | param->peer_reason = TDLS_TEARDOWN_RSSI; |
| 16906 | break; |
| 16907 | case WMI_TDLS_TEARDOWN_REASON_SCAN: |
| 16908 | param->peer_reason = TDLS_TEARDOWN_SCAN; |
| 16909 | break; |
| 16910 | case WMI_TDLS_DISCONNECTED_REASON_PEER_DELETE: |
| 16911 | param->peer_reason = TDLS_DISCONNECTED_PEER_DELETE; |
| 16912 | break; |
| 16913 | case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT: |
| 16914 | param->peer_reason = TDLS_TEARDOWN_PTR_TIMEOUT; |
| 16915 | break; |
| 16916 | case WMI_TDLS_TEARDOWN_REASON_BAD_PTR: |
| 16917 | param->peer_reason = TDLS_TEARDOWN_BAD_PTR; |
| 16918 | break; |
| 16919 | case WMI_TDLS_TEARDOWN_REASON_NO_RESPONSE: |
| 16920 | param->peer_reason = TDLS_TEARDOWN_NO_RSP; |
| 16921 | break; |
| 16922 | case WMI_TDLS_ENTER_BUF_STA: |
| 16923 | param->peer_reason = TDLS_PEER_ENTER_BUF_STA; |
| 16924 | break; |
| 16925 | case WMI_TDLS_EXIT_BUF_STA: |
| 16926 | param->peer_reason = TDLS_PEER_EXIT_BUF_STA; |
| 16927 | break; |
| 16928 | case WMI_TDLS_ENTER_BT_BUSY_MODE: |
| 16929 | param->peer_reason = TDLS_ENTER_BT_BUSY; |
| 16930 | break; |
| 16931 | case WMI_TDLS_EXIT_BT_BUSY_MODE: |
| 16932 | param->peer_reason = TDLS_EXIT_BT_BUSY; |
| 16933 | break; |
| 16934 | case WMI_TDLS_SCAN_STARTED_EVENT: |
| 16935 | param->peer_reason = TDLS_SCAN_STARTED; |
| 16936 | break; |
| 16937 | case WMI_TDLS_SCAN_COMPLETED_EVENT: |
| 16938 | param->peer_reason = TDLS_SCAN_COMPLETED; |
| 16939 | break; |
| 16940 | |
| 16941 | default: |
| 16942 | WMI_LOGE("%s: unknown reason %d in tdls event %d from target", |
| 16943 | __func__, evt->peer_reason, evt->peer_status); |
| 16944 | return QDF_STATUS_E_INVAL; |
| 16945 | }; |
| 16946 | |
| 16947 | WMI_LOGD("%s: tdls event, peer: %pM, type: 0x%x, reason: %d, vdev: %d", |
| 16948 | __func__, param->peermac.bytes, param->message_type, |
| 16949 | param->peer_reason, param->vdev_id); |
| 16950 | |
| 16951 | return QDF_STATUS_SUCCESS; |
| 16952 | } |
| 16953 | #endif |
| 16954 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16955 | /** |
| 16956 | * extract_mgmt_tx_compl_param_tlv() - extract MGMT tx completion event params |
| 16957 | * @wmi_handle: wmi handle |
| 16958 | * @param evt_buf: pointer to event buffer |
| 16959 | * @param param: Pointer to hold MGMT TX completion params |
| 16960 | * |
| 16961 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16962 | */ |
| 16963 | static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle, |
| 16964 | void *evt_buf, wmi_host_mgmt_tx_compl_event *param) |
| 16965 | { |
| 16966 | WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 16967 | wmi_mgmt_tx_compl_event_fixed_param *cmpl_params; |
| 16968 | |
| 16969 | param_buf = (WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *) |
| 16970 | evt_buf; |
| 16971 | if (!param_buf) { |
| 16972 | WMI_LOGE("%s: Invalid mgmt Tx completion event", __func__); |
| 16973 | return QDF_STATUS_E_INVAL; |
| 16974 | } |
| 16975 | cmpl_params = param_buf->fixed_param; |
| 16976 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 16977 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 16978 | cmpl_params->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 16979 | param->desc_id = cmpl_params->desc_id; |
| 16980 | param->status = cmpl_params->status; |
| 16981 | |
| 16982 | return QDF_STATUS_SUCCESS; |
| 16983 | } |
| 16984 | |
| 16985 | /** |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 16986 | * extract_offchan_data_tx_compl_param_tlv() - |
| 16987 | * extract Offchan data tx completion event params |
| 16988 | * @wmi_handle: wmi handle |
| 16989 | * @param evt_buf: pointer to event buffer |
| 16990 | * @param param: Pointer to hold offchan data TX completion params |
| 16991 | * |
| 16992 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 16993 | */ |
| 16994 | static QDF_STATUS extract_offchan_data_tx_compl_param_tlv( |
| 16995 | wmi_unified_t wmi_handle, void *evt_buf, |
| 16996 | struct wmi_host_offchan_data_tx_compl_event *param) |
| 16997 | { |
| 16998 | WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *param_buf; |
| 16999 | wmi_offchan_data_tx_compl_event_fixed_param *cmpl_params; |
| 17000 | |
| 17001 | param_buf = (WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *) |
| 17002 | evt_buf; |
| 17003 | if (!param_buf) { |
| 17004 | WMI_LOGE("%s: Invalid offchan data Tx compl event", __func__); |
| 17005 | return QDF_STATUS_E_INVAL; |
| 17006 | } |
| 17007 | cmpl_params = param_buf->fixed_param; |
| 17008 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17009 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17010 | cmpl_params->pdev_id); |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 17011 | param->desc_id = cmpl_params->desc_id; |
| 17012 | param->status = cmpl_params->status; |
| 17013 | |
| 17014 | return QDF_STATUS_SUCCESS; |
| 17015 | } |
| 17016 | |
| 17017 | /** |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 17018 | * extract_pdev_csa_switch_count_status_tlv() - extract pdev csa switch count |
| 17019 | * status tlv |
| 17020 | * @wmi_handle: wmi handle |
| 17021 | * @param evt_buf: pointer to event buffer |
| 17022 | * @param param: Pointer to hold csa switch count status event param |
| 17023 | * |
| 17024 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17025 | */ |
| 17026 | static QDF_STATUS extract_pdev_csa_switch_count_status_tlv( |
| 17027 | wmi_unified_t wmi_handle, |
| 17028 | void *evt_buf, |
| 17029 | struct pdev_csa_switch_count_status *param) |
| 17030 | { |
| 17031 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *param_buf; |
| 17032 | wmi_pdev_csa_switch_count_status_event_fixed_param *csa_status; |
| 17033 | |
| 17034 | param_buf = (WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *) |
| 17035 | evt_buf; |
| 17036 | if (!param_buf) { |
| 17037 | WMI_LOGE("%s: Invalid CSA status event\n", __func__); |
| 17038 | return QDF_STATUS_E_INVAL; |
| 17039 | } |
| 17040 | |
| 17041 | csa_status = param_buf->fixed_param; |
| 17042 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17043 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17044 | csa_status->pdev_id); |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 17045 | param->current_switch_count = csa_status->current_switch_count; |
| 17046 | param->num_vdevs = csa_status->num_vdevs; |
| 17047 | param->vdev_ids = param_buf->vdev_ids; |
| 17048 | |
| 17049 | return QDF_STATUS_SUCCESS; |
| 17050 | } |
| 17051 | |
| 17052 | /** |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17053 | * extract_swba_num_vdevs_tlv() - extract swba num vdevs from event |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17054 | * @wmi_handle: wmi handle |
| 17055 | * @param evt_buf: pointer to event buffer |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17056 | * @param num_vdevs: Pointer to hold num vdevs |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17057 | * |
| 17058 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17059 | */ |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17060 | static QDF_STATUS extract_swba_num_vdevs_tlv(wmi_unified_t wmi_handle, |
| 17061 | void *evt_buf, uint32_t *num_vdevs) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17062 | { |
| 17063 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 17064 | wmi_host_swba_event_fixed_param *swba_event; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17065 | uint32_t vdev_map; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17066 | |
| 17067 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 17068 | if (!param_buf) { |
| 17069 | WMI_LOGE("Invalid swba event buffer"); |
| 17070 | return QDF_STATUS_E_INVAL; |
| 17071 | } |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17072 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17073 | swba_event = param_buf->fixed_param; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17074 | *num_vdevs = swba_event->num_vdevs; |
| 17075 | if (!(*num_vdevs)) { |
| 17076 | vdev_map = swba_event->vdev_map; |
| 17077 | *num_vdevs = wmi_vdev_map_to_num_vdevs(vdev_map); |
| 17078 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17079 | |
| 17080 | return QDF_STATUS_SUCCESS; |
| 17081 | } |
| 17082 | |
| 17083 | /** |
| 17084 | * extract_swba_tim_info_tlv() - extract swba tim info from event |
| 17085 | * @wmi_handle: wmi handle |
| 17086 | * @param evt_buf: pointer to event buffer |
| 17087 | * @param idx: Index to bcn info |
| 17088 | * @param tim_info: Pointer to hold tim info |
| 17089 | * |
| 17090 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17091 | */ |
| 17092 | static QDF_STATUS extract_swba_tim_info_tlv(wmi_unified_t wmi_handle, |
| 17093 | void *evt_buf, uint32_t idx, wmi_host_tim_info *tim_info) |
| 17094 | { |
| 17095 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 17096 | wmi_tim_info *tim_info_ev; |
| 17097 | |
| 17098 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 17099 | if (!param_buf) { |
| 17100 | WMI_LOGE("Invalid swba event buffer"); |
| 17101 | return QDF_STATUS_E_INVAL; |
| 17102 | } |
| 17103 | |
| 17104 | tim_info_ev = ¶m_buf->tim_info[idx]; |
| 17105 | |
| 17106 | tim_info->tim_len = tim_info_ev->tim_len; |
| 17107 | tim_info->tim_mcast = tim_info_ev->tim_mcast; |
| 17108 | qdf_mem_copy(tim_info->tim_bitmap, tim_info_ev->tim_bitmap, |
| 17109 | (sizeof(uint32_t) * WMI_TIM_BITMAP_ARRAY_SIZE)); |
| 17110 | tim_info->tim_changed = tim_info_ev->tim_changed; |
| 17111 | 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] | 17112 | tim_info->vdev_id = tim_info_ev->vdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17113 | |
| 17114 | return QDF_STATUS_SUCCESS; |
| 17115 | } |
| 17116 | |
| 17117 | /** |
| 17118 | * extract_swba_noa_info_tlv() - extract swba NoA information from event |
| 17119 | * @wmi_handle: wmi handle |
| 17120 | * @param evt_buf: pointer to event buffer |
| 17121 | * @param idx: Index to bcn info |
| 17122 | * @param p2p_desc: Pointer to hold p2p NoA info |
| 17123 | * |
| 17124 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17125 | */ |
| 17126 | static QDF_STATUS extract_swba_noa_info_tlv(wmi_unified_t wmi_handle, |
| 17127 | void *evt_buf, uint32_t idx, wmi_host_p2p_noa_info *p2p_desc) |
| 17128 | { |
| 17129 | WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf; |
| 17130 | wmi_p2p_noa_info *p2p_noa_info; |
| 17131 | uint8_t i = 0; |
| 17132 | |
| 17133 | param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf; |
| 17134 | if (!param_buf) { |
| 17135 | WMI_LOGE("Invalid swba event buffer"); |
| 17136 | return QDF_STATUS_E_INVAL; |
| 17137 | } |
| 17138 | |
| 17139 | p2p_noa_info = ¶m_buf->p2p_noa_info[idx]; |
| 17140 | |
| 17141 | p2p_desc->modified = false; |
| 17142 | p2p_desc->num_descriptors = 0; |
| 17143 | if (WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(p2p_noa_info)) { |
| 17144 | p2p_desc->modified = true; |
| 17145 | p2p_desc->index = |
| 17146 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(p2p_noa_info); |
| 17147 | p2p_desc->oppPS = |
| 17148 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(p2p_noa_info); |
| 17149 | p2p_desc->ctwindow = |
| 17150 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(p2p_noa_info); |
| 17151 | p2p_desc->num_descriptors = |
| 17152 | (uint8_t) WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET |
| 17153 | (p2p_noa_info); |
| 17154 | for (i = 0; i < p2p_desc->num_descriptors; i++) { |
| 17155 | p2p_desc->noa_descriptors[i].type_count = |
| 17156 | (uint8_t) p2p_noa_info->noa_descriptors[i]. |
| 17157 | type_count; |
| 17158 | p2p_desc->noa_descriptors[i].duration = |
| 17159 | p2p_noa_info->noa_descriptors[i].duration; |
| 17160 | p2p_desc->noa_descriptors[i].interval = |
| 17161 | p2p_noa_info->noa_descriptors[i].interval; |
| 17162 | p2p_desc->noa_descriptors[i].start_time = |
| 17163 | p2p_noa_info->noa_descriptors[i].start_time; |
| 17164 | } |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 17165 | p2p_desc->vdev_id = p2p_noa_info->vdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17166 | } |
| 17167 | |
| 17168 | return QDF_STATUS_SUCCESS; |
| 17169 | } |
| 17170 | |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 17171 | #ifdef CONVERGED_P2P_ENABLE |
| 17172 | /** |
| 17173 | * extract_p2p_noa_ev_param_tlv() - extract p2p noa information from event |
| 17174 | * @wmi_handle: wmi handle |
| 17175 | * @param evt_buf: pointer to event buffer |
| 17176 | * @param param: Pointer to hold p2p noa info |
| 17177 | * |
| 17178 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17179 | */ |
| 17180 | static QDF_STATUS extract_p2p_noa_ev_param_tlv( |
| 17181 | wmi_unified_t wmi_handle, void *evt_buf, |
| 17182 | struct p2p_noa_info *param) |
| 17183 | { |
| 17184 | WMI_P2P_NOA_EVENTID_param_tlvs *param_tlvs; |
| 17185 | wmi_p2p_noa_event_fixed_param *fixed_param; |
| 17186 | uint8_t i; |
| 17187 | wmi_p2p_noa_info *wmi_noa_info; |
| 17188 | uint8_t *buf_ptr; |
| 17189 | uint32_t descriptors; |
| 17190 | |
| 17191 | param_tlvs = (WMI_P2P_NOA_EVENTID_param_tlvs *) evt_buf; |
| 17192 | if (!param_tlvs) { |
| 17193 | WMI_LOGE("%s: Invalid P2P NoA event buffer", __func__); |
| 17194 | return QDF_STATUS_E_INVAL; |
| 17195 | } |
| 17196 | |
| 17197 | if (!param) { |
| 17198 | WMI_LOGE("noa information param is null"); |
| 17199 | return QDF_STATUS_E_INVAL; |
| 17200 | } |
| 17201 | |
| 17202 | fixed_param = param_tlvs->fixed_param; |
| 17203 | buf_ptr = (uint8_t *) fixed_param; |
| 17204 | buf_ptr += sizeof(wmi_p2p_noa_event_fixed_param); |
| 17205 | wmi_noa_info = (wmi_p2p_noa_info *) (buf_ptr); |
| 17206 | |
| 17207 | if (!WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(wmi_noa_info)) { |
| 17208 | WMI_LOGE("%s: noa attr is not modified", __func__); |
| 17209 | return QDF_STATUS_E_INVAL; |
| 17210 | } |
| 17211 | |
| 17212 | param->vdev_id = fixed_param->vdev_id; |
| 17213 | param->index = |
| 17214 | (uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(wmi_noa_info); |
| 17215 | param->opps_ps = |
| 17216 | (uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(wmi_noa_info); |
| 17217 | param->ct_window = |
| 17218 | (uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(wmi_noa_info); |
| 17219 | descriptors = WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET(wmi_noa_info); |
| 17220 | param->num_desc = (uint8_t) descriptors; |
| 17221 | |
| 17222 | WMI_LOGD("%s:index %u, opps_ps %u, ct_window %u, num_descriptors = %u", __func__, |
| 17223 | param->index, param->opps_ps, param->ct_window, |
| 17224 | param->num_desc); |
| 17225 | for (i = 0; i < param->num_desc; i++) { |
| 17226 | param->noa_desc[i].type_count = |
| 17227 | (uint8_t) wmi_noa_info->noa_descriptors[i]. |
| 17228 | type_count; |
| 17229 | param->noa_desc[i].duration = |
| 17230 | wmi_noa_info->noa_descriptors[i].duration; |
| 17231 | param->noa_desc[i].interval = |
| 17232 | wmi_noa_info->noa_descriptors[i].interval; |
| 17233 | param->noa_desc[i].start_time = |
| 17234 | wmi_noa_info->noa_descriptors[i].start_time; |
| 17235 | WMI_LOGD("%s:NoA descriptor[%d] type_count %u, duration %u, interval %u, start_time = %u", |
| 17236 | __func__, i, param->noa_desc[i].type_count, |
| 17237 | param->noa_desc[i].duration, |
| 17238 | param->noa_desc[i].interval, |
| 17239 | param->noa_desc[i].start_time); |
| 17240 | } |
| 17241 | |
| 17242 | return QDF_STATUS_SUCCESS; |
| 17243 | } |
| 17244 | |
| 17245 | /** |
| 17246 | * extract_p2p_lo_stop_ev_param_tlv() - extract p2p lo stop |
| 17247 | * information from event |
| 17248 | * @wmi_handle: wmi handle |
| 17249 | * @param evt_buf: pointer to event buffer |
| 17250 | * @param param: Pointer to hold p2p lo stop event information |
| 17251 | * |
| 17252 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17253 | */ |
| 17254 | static QDF_STATUS extract_p2p_lo_stop_ev_param_tlv( |
| 17255 | wmi_unified_t wmi_handle, void *evt_buf, |
| 17256 | struct p2p_lo_event *param) |
| 17257 | { |
| 17258 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *param_tlvs; |
| 17259 | wmi_p2p_lo_stopped_event_fixed_param *lo_param; |
| 17260 | |
| 17261 | param_tlvs = (WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *) |
| 17262 | evt_buf; |
| 17263 | if (!param_tlvs) { |
| 17264 | WMI_LOGE("%s: Invalid P2P lo stop event buffer", __func__); |
| 17265 | return QDF_STATUS_E_INVAL; |
| 17266 | } |
| 17267 | |
| 17268 | if (!param) { |
| 17269 | WMI_LOGE("lo stop event param is null"); |
| 17270 | return QDF_STATUS_E_INVAL; |
| 17271 | } |
| 17272 | |
| 17273 | lo_param = param_tlvs->fixed_param; |
| 17274 | param->vdev_id = lo_param->vdev_id; |
| 17275 | param->reason_code = lo_param->reason; |
| 17276 | WMI_LOGD("%s: vdev_id:%d, reason:%d", __func__, |
| 17277 | param->vdev_id, param->reason_code); |
| 17278 | |
| 17279 | return QDF_STATUS_SUCCESS; |
| 17280 | } |
| 17281 | #endif /* End of CONVERGED_P2P_ENABLE */ |
| 17282 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17283 | /** |
| 17284 | * extract_peer_sta_kickout_ev_tlv() - extract peer sta kickout event |
| 17285 | * @wmi_handle: wmi handle |
| 17286 | * @param evt_buf: pointer to event buffer |
| 17287 | * @param ev: Pointer to hold peer param |
| 17288 | * |
| 17289 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17290 | */ |
| 17291 | static QDF_STATUS extract_peer_sta_kickout_ev_tlv(wmi_unified_t wmi_handle, |
| 17292 | void *evt_buf, wmi_host_peer_sta_kickout_event *ev) |
| 17293 | { |
| 17294 | WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *param_buf = NULL; |
| 17295 | wmi_peer_sta_kickout_event_fixed_param *kickout_event = NULL; |
| 17296 | |
| 17297 | param_buf = (WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *) evt_buf; |
| 17298 | kickout_event = param_buf->fixed_param; |
| 17299 | |
| 17300 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&kickout_event->peer_macaddr, |
| 17301 | ev->peer_macaddr); |
| 17302 | |
| 17303 | ev->reason = kickout_event->reason; |
| 17304 | ev->rssi = kickout_event->rssi; |
| 17305 | |
| 17306 | return QDF_STATUS_SUCCESS; |
| 17307 | } |
| 17308 | |
| 17309 | /** |
| 17310 | * extract_all_stats_counts_tlv() - extract all stats count from event |
| 17311 | * @wmi_handle: wmi handle |
| 17312 | * @param evt_buf: pointer to event buffer |
| 17313 | * @param stats_param: Pointer to hold stats count |
| 17314 | * |
| 17315 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17316 | */ |
| 17317 | static QDF_STATUS extract_all_stats_counts_tlv(wmi_unified_t wmi_handle, |
| 17318 | void *evt_buf, wmi_host_stats_event *stats_param) |
| 17319 | { |
| 17320 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17321 | wmi_stats_event_fixed_param *ev; |
| 17322 | |
| 17323 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17324 | |
| 17325 | ev = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17326 | if (!ev) { |
| 17327 | WMI_LOGE("%s: Failed to alloc memory\n", __func__); |
| 17328 | return QDF_STATUS_E_FAILURE; |
| 17329 | } |
| 17330 | |
| 17331 | switch (ev->stats_id) { |
| 17332 | case WMI_REQUEST_PEER_STAT: |
| 17333 | stats_param->stats_id = WMI_HOST_REQUEST_PEER_STAT; |
| 17334 | break; |
| 17335 | |
| 17336 | case WMI_REQUEST_AP_STAT: |
| 17337 | stats_param->stats_id = WMI_HOST_REQUEST_AP_STAT; |
| 17338 | break; |
| 17339 | |
| 17340 | case WMI_REQUEST_PDEV_STAT: |
| 17341 | stats_param->stats_id = WMI_HOST_REQUEST_PDEV_STAT; |
| 17342 | break; |
| 17343 | |
| 17344 | case WMI_REQUEST_VDEV_STAT: |
| 17345 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_STAT; |
| 17346 | break; |
| 17347 | |
| 17348 | case WMI_REQUEST_BCNFLT_STAT: |
| 17349 | stats_param->stats_id = WMI_HOST_REQUEST_BCNFLT_STAT; |
| 17350 | break; |
| 17351 | |
| 17352 | case WMI_REQUEST_VDEV_RATE_STAT: |
| 17353 | stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT; |
| 17354 | break; |
| 17355 | |
| 17356 | default: |
| 17357 | stats_param->stats_id = 0; |
| 17358 | break; |
| 17359 | |
| 17360 | } |
| 17361 | |
| 17362 | stats_param->num_pdev_stats = ev->num_pdev_stats; |
| 17363 | stats_param->num_pdev_ext_stats = 0; |
| 17364 | stats_param->num_vdev_stats = ev->num_vdev_stats; |
| 17365 | stats_param->num_peer_stats = ev->num_peer_stats; |
| 17366 | stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; |
| 17367 | stats_param->num_chan_stats = ev->num_chan_stats; |
Gurumoorthi Gnanasambandhan | 305aeae | 2017-08-10 22:12:36 +0530 | [diff] [blame] | 17368 | stats_param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 17369 | ev->pdev_id); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17370 | |
| 17371 | return QDF_STATUS_SUCCESS; |
| 17372 | } |
| 17373 | |
| 17374 | /** |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 17375 | * extract_pdev_tx_stats() - extract pdev tx stats from event |
| 17376 | */ |
| 17377 | static void extract_pdev_tx_stats(wmi_host_dbg_tx_stats *tx, struct wlan_dbg_tx_stats *tx_stats) |
| 17378 | { |
| 17379 | /* Tx Stats */ |
| 17380 | tx->comp_queued = tx_stats->comp_queued; |
| 17381 | tx->comp_delivered = tx_stats->comp_delivered; |
| 17382 | tx->msdu_enqued = tx_stats->msdu_enqued; |
| 17383 | tx->mpdu_enqued = tx_stats->mpdu_enqued; |
| 17384 | tx->wmm_drop = tx_stats->wmm_drop; |
| 17385 | tx->local_enqued = tx_stats->local_enqued; |
| 17386 | tx->local_freed = tx_stats->local_freed; |
| 17387 | tx->hw_queued = tx_stats->hw_queued; |
| 17388 | tx->hw_reaped = tx_stats->hw_reaped; |
| 17389 | tx->underrun = tx_stats->underrun; |
| 17390 | tx->tx_abort = tx_stats->tx_abort; |
| 17391 | tx->mpdus_requed = tx_stats->mpdus_requed; |
| 17392 | tx->data_rc = tx_stats->data_rc; |
| 17393 | tx->self_triggers = tx_stats->self_triggers; |
| 17394 | tx->sw_retry_failure = tx_stats->sw_retry_failure; |
| 17395 | tx->illgl_rate_phy_err = tx_stats->illgl_rate_phy_err; |
| 17396 | tx->pdev_cont_xretry = tx_stats->pdev_cont_xretry; |
| 17397 | tx->pdev_tx_timeout = tx_stats->pdev_tx_timeout; |
| 17398 | tx->pdev_resets = tx_stats->pdev_resets; |
| 17399 | tx->stateless_tid_alloc_failure = tx_stats->stateless_tid_alloc_failure; |
| 17400 | tx->phy_underrun = tx_stats->phy_underrun; |
| 17401 | tx->txop_ovf = tx_stats->txop_ovf; |
| 17402 | |
| 17403 | return; |
| 17404 | } |
| 17405 | |
| 17406 | |
| 17407 | /** |
| 17408 | * extract_pdev_rx_stats() - extract pdev rx stats from event |
| 17409 | */ |
| 17410 | static void extract_pdev_rx_stats(wmi_host_dbg_rx_stats *rx, struct wlan_dbg_rx_stats *rx_stats) |
| 17411 | { |
| 17412 | /* Rx Stats */ |
| 17413 | rx->mid_ppdu_route_change = rx_stats->mid_ppdu_route_change; |
| 17414 | rx->status_rcvd = rx_stats->status_rcvd; |
| 17415 | rx->r0_frags = rx_stats->r0_frags; |
| 17416 | rx->r1_frags = rx_stats->r1_frags; |
| 17417 | rx->r2_frags = rx_stats->r2_frags; |
| 17418 | /* Only TLV */ |
| 17419 | rx->r3_frags = 0; |
| 17420 | rx->htt_msdus = rx_stats->htt_msdus; |
| 17421 | rx->htt_mpdus = rx_stats->htt_mpdus; |
| 17422 | rx->loc_msdus = rx_stats->loc_msdus; |
| 17423 | rx->loc_mpdus = rx_stats->loc_mpdus; |
| 17424 | rx->oversize_amsdu = rx_stats->oversize_amsdu; |
| 17425 | rx->phy_errs = rx_stats->phy_errs; |
| 17426 | rx->phy_err_drop = rx_stats->phy_err_drop; |
| 17427 | rx->mpdu_errs = rx_stats->mpdu_errs; |
| 17428 | |
| 17429 | return; |
| 17430 | } |
| 17431 | |
| 17432 | /** |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17433 | * extract_pdev_stats_tlv() - extract pdev stats from event |
| 17434 | * @wmi_handle: wmi handle |
| 17435 | * @param evt_buf: pointer to event buffer |
| 17436 | * @param index: Index into pdev stats |
| 17437 | * @param pdev_stats: Pointer to hold pdev stats |
| 17438 | * |
| 17439 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17440 | */ |
| 17441 | static QDF_STATUS extract_pdev_stats_tlv(wmi_unified_t wmi_handle, |
| 17442 | void *evt_buf, uint32_t index, wmi_host_pdev_stats *pdev_stats) |
| 17443 | { |
Gurumoorthi Gnanasambandhan | 871fd6e | 2017-05-24 17:41:46 +0530 | [diff] [blame] | 17444 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17445 | wmi_stats_event_fixed_param *ev_param; |
| 17446 | uint8_t *data; |
| 17447 | |
| 17448 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17449 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17450 | |
| 17451 | data = param_buf->data; |
| 17452 | |
| 17453 | if (index < ev_param->num_pdev_stats) { |
| 17454 | wmi_pdev_stats *ev = (wmi_pdev_stats *) ((data) + |
| 17455 | (index * sizeof(wmi_pdev_stats))); |
| 17456 | |
| 17457 | pdev_stats->chan_nf = ev->chan_nf; |
| 17458 | pdev_stats->tx_frame_count = ev->tx_frame_count; |
| 17459 | pdev_stats->rx_frame_count = ev->rx_frame_count; |
| 17460 | pdev_stats->rx_clear_count = ev->rx_clear_count; |
| 17461 | pdev_stats->cycle_count = ev->cycle_count; |
| 17462 | pdev_stats->phy_err_count = ev->phy_err_count; |
| 17463 | pdev_stats->chan_tx_pwr = ev->chan_tx_pwr; |
| 17464 | |
| 17465 | extract_pdev_tx_stats(&(pdev_stats->pdev_stats.tx), |
| 17466 | &(ev->pdev_stats.tx)); |
| 17467 | extract_pdev_rx_stats(&(pdev_stats->pdev_stats.rx), |
| 17468 | &(ev->pdev_stats.rx)); |
| 17469 | } |
| 17470 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17471 | return QDF_STATUS_SUCCESS; |
| 17472 | } |
| 17473 | |
| 17474 | /** |
| 17475 | * extract_pdev_ext_stats_tlv() - extract extended pdev stats from event |
| 17476 | * @wmi_handle: wmi handle |
| 17477 | * @param evt_buf: pointer to event buffer |
| 17478 | * @param index: Index into extended pdev stats |
| 17479 | * @param pdev_ext_stats: Pointer to hold extended pdev stats |
| 17480 | * |
| 17481 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17482 | */ |
| 17483 | static QDF_STATUS extract_pdev_ext_stats_tlv(wmi_unified_t wmi_handle, |
| 17484 | void *evt_buf, uint32_t index, wmi_host_pdev_ext_stats *pdev_ext_stats) |
| 17485 | { |
| 17486 | return QDF_STATUS_SUCCESS; |
| 17487 | } |
| 17488 | |
| 17489 | /** |
| 17490 | * extract_vdev_stats_tlv() - extract vdev stats from event |
| 17491 | * @wmi_handle: wmi handle |
| 17492 | * @param evt_buf: pointer to event buffer |
| 17493 | * @param index: Index into vdev stats |
| 17494 | * @param vdev_stats: Pointer to hold vdev stats |
| 17495 | * |
| 17496 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17497 | */ |
| 17498 | static QDF_STATUS extract_vdev_stats_tlv(wmi_unified_t wmi_handle, |
| 17499 | void *evt_buf, uint32_t index, wmi_host_vdev_stats *vdev_stats) |
| 17500 | { |
| 17501 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17502 | wmi_stats_event_fixed_param *ev_param; |
| 17503 | uint8_t *data; |
| 17504 | |
| 17505 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17506 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17507 | data = (uint8_t *) param_buf->data; |
| 17508 | |
| 17509 | if (index < ev_param->num_vdev_stats) { |
| 17510 | wmi_vdev_stats *ev = (wmi_vdev_stats *) ((data) + |
| 17511 | ((ev_param->num_pdev_stats) * |
| 17512 | sizeof(wmi_pdev_stats)) + |
| 17513 | (index * sizeof(wmi_vdev_stats))); |
| 17514 | |
| 17515 | vdev_stats->vdev_id = ev->vdev_id; |
| 17516 | vdev_stats->vdev_snr.bcn_snr = ev->vdev_snr.bcn_snr; |
| 17517 | vdev_stats->vdev_snr.dat_snr = ev->vdev_snr.dat_snr; |
| 17518 | |
| 17519 | OS_MEMCPY(vdev_stats->tx_frm_cnt, ev->tx_frm_cnt, |
| 17520 | sizeof(ev->tx_frm_cnt)); |
| 17521 | vdev_stats->rx_frm_cnt = ev->rx_frm_cnt; |
| 17522 | OS_MEMCPY(vdev_stats->multiple_retry_cnt, |
| 17523 | ev->multiple_retry_cnt, |
| 17524 | sizeof(ev->multiple_retry_cnt)); |
| 17525 | OS_MEMCPY(vdev_stats->fail_cnt, ev->fail_cnt, |
| 17526 | sizeof(ev->fail_cnt)); |
| 17527 | vdev_stats->rts_fail_cnt = ev->rts_fail_cnt; |
| 17528 | vdev_stats->rts_succ_cnt = ev->rts_succ_cnt; |
| 17529 | vdev_stats->rx_err_cnt = ev->rx_err_cnt; |
| 17530 | vdev_stats->rx_discard_cnt = ev->rx_discard_cnt; |
| 17531 | vdev_stats->ack_fail_cnt = ev->ack_fail_cnt; |
| 17532 | OS_MEMCPY(vdev_stats->tx_rate_history, ev->tx_rate_history, |
| 17533 | sizeof(ev->tx_rate_history)); |
| 17534 | OS_MEMCPY(vdev_stats->bcn_rssi_history, ev->bcn_rssi_history, |
| 17535 | sizeof(ev->bcn_rssi_history)); |
| 17536 | |
| 17537 | } |
| 17538 | |
| 17539 | return QDF_STATUS_SUCCESS; |
| 17540 | } |
| 17541 | |
| 17542 | /** |
| 17543 | * extract_peer_stats_tlv() - extract peer stats from event |
| 17544 | * @wmi_handle: wmi handle |
| 17545 | * @param evt_buf: pointer to event buffer |
| 17546 | * @param index: Index into peer stats |
| 17547 | * @param peer_stats: Pointer to hold peer stats |
| 17548 | * |
| 17549 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17550 | */ |
| 17551 | static QDF_STATUS extract_peer_stats_tlv(wmi_unified_t wmi_handle, |
| 17552 | void *evt_buf, uint32_t index, wmi_host_peer_stats *peer_stats) |
| 17553 | { |
| 17554 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17555 | wmi_stats_event_fixed_param *ev_param; |
| 17556 | uint8_t *data; |
| 17557 | |
| 17558 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17559 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17560 | data = (uint8_t *) param_buf->data; |
| 17561 | |
| 17562 | if (index < ev_param->num_peer_stats) { |
| 17563 | wmi_peer_stats *ev = (wmi_peer_stats *) ((data) + |
| 17564 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 17565 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 17566 | (index * sizeof(wmi_peer_stats))); |
| 17567 | |
| 17568 | OS_MEMSET(peer_stats, 0, sizeof(wmi_host_peer_stats)); |
| 17569 | |
| 17570 | OS_MEMCPY(&(peer_stats->peer_macaddr), |
| 17571 | &(ev->peer_macaddr), sizeof(wmi_mac_addr)); |
| 17572 | |
| 17573 | peer_stats->peer_rssi = ev->peer_rssi; |
| 17574 | peer_stats->peer_tx_rate = ev->peer_tx_rate; |
| 17575 | peer_stats->peer_rx_rate = ev->peer_rx_rate; |
| 17576 | } |
| 17577 | |
| 17578 | return QDF_STATUS_SUCCESS; |
| 17579 | } |
| 17580 | |
| 17581 | /** |
| 17582 | * extract_bcnflt_stats_tlv() - extract bcn fault stats from event |
| 17583 | * @wmi_handle: wmi handle |
| 17584 | * @param evt_buf: pointer to event buffer |
| 17585 | * @param index: Index into bcn fault stats |
| 17586 | * @param bcnflt_stats: Pointer to hold bcn fault stats |
| 17587 | * |
| 17588 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17589 | */ |
| 17590 | static QDF_STATUS extract_bcnflt_stats_tlv(wmi_unified_t wmi_handle, |
| 17591 | void *evt_buf, uint32_t index, wmi_host_bcnflt_stats *peer_stats) |
| 17592 | { |
| 17593 | return QDF_STATUS_SUCCESS; |
| 17594 | } |
| 17595 | |
| 17596 | /** |
| 17597 | * extract_peer_extd_stats_tlv() - extract extended peer stats from event |
| 17598 | * @wmi_handle: wmi handle |
| 17599 | * @param evt_buf: pointer to event buffer |
| 17600 | * @param index: Index into extended peer stats |
| 17601 | * @param peer_extd_stats: Pointer to hold extended peer stats |
| 17602 | * |
| 17603 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17604 | */ |
| 17605 | static QDF_STATUS extract_peer_extd_stats_tlv(wmi_unified_t wmi_handle, |
| 17606 | void *evt_buf, uint32_t index, |
| 17607 | wmi_host_peer_extd_stats *peer_extd_stats) |
| 17608 | { |
| 17609 | return QDF_STATUS_SUCCESS; |
| 17610 | } |
| 17611 | |
| 17612 | /** |
| 17613 | * extract_chan_stats_tlv() - extract chan stats from event |
| 17614 | * @wmi_handle: wmi handle |
| 17615 | * @param evt_buf: pointer to event buffer |
| 17616 | * @param index: Index into chan stats |
| 17617 | * @param vdev_extd_stats: Pointer to hold chan stats |
| 17618 | * |
| 17619 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17620 | */ |
| 17621 | static QDF_STATUS extract_chan_stats_tlv(wmi_unified_t wmi_handle, |
| 17622 | void *evt_buf, uint32_t index, wmi_host_chan_stats *chan_stats) |
| 17623 | { |
| 17624 | WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; |
| 17625 | wmi_stats_event_fixed_param *ev_param; |
| 17626 | uint8_t *data; |
| 17627 | |
| 17628 | param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf; |
| 17629 | ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param; |
| 17630 | data = (uint8_t *) param_buf->data; |
| 17631 | |
| 17632 | if (index < ev_param->num_chan_stats) { |
| 17633 | wmi_chan_stats *ev = (wmi_chan_stats *) ((data) + |
| 17634 | ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) + |
| 17635 | ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) + |
| 17636 | ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) + |
| 17637 | (index * sizeof(wmi_chan_stats))); |
| 17638 | |
| 17639 | |
| 17640 | /* Non-TLV doesnt have num_chan_stats */ |
| 17641 | chan_stats->chan_mhz = ev->chan_mhz; |
| 17642 | chan_stats->sampling_period_us = ev->sampling_period_us; |
| 17643 | chan_stats->rx_clear_count = ev->rx_clear_count; |
| 17644 | chan_stats->tx_duration_us = ev->tx_duration_us; |
| 17645 | chan_stats->rx_duration_us = ev->rx_duration_us; |
| 17646 | } |
| 17647 | |
| 17648 | return QDF_STATUS_SUCCESS; |
| 17649 | } |
| 17650 | |
| 17651 | /** |
| 17652 | * extract_profile_ctx_tlv() - extract profile context from event |
| 17653 | * @wmi_handle: wmi handle |
| 17654 | * @param evt_buf: pointer to event buffer |
| 17655 | * @idx: profile stats index to extract |
| 17656 | * @param profile_ctx: Pointer to hold profile context |
| 17657 | * |
| 17658 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17659 | */ |
| 17660 | static QDF_STATUS extract_profile_ctx_tlv(wmi_unified_t wmi_handle, |
| 17661 | void *evt_buf, wmi_host_wlan_profile_ctx_t *profile_ctx) |
| 17662 | { |
| 17663 | return QDF_STATUS_SUCCESS; |
| 17664 | } |
| 17665 | |
| 17666 | /** |
| 17667 | * extract_profile_data_tlv() - extract profile data from event |
| 17668 | * @wmi_handle: wmi handle |
| 17669 | * @param evt_buf: pointer to event buffer |
| 17670 | * @param profile_data: Pointer to hold profile data |
| 17671 | * |
| 17672 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17673 | */ |
| 17674 | static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, |
| 17675 | void *evt_buf, uint8_t idx, wmi_host_wlan_profile_t *profile_data) |
| 17676 | { |
| 17677 | |
| 17678 | return QDF_STATUS_SUCCESS; |
| 17679 | } |
| 17680 | |
| 17681 | /** |
| 17682 | * extract_chan_info_event_tlv() - extract chan information from event |
| 17683 | * @wmi_handle: wmi handle |
| 17684 | * @param evt_buf: pointer to event buffer |
| 17685 | * @param chan_info: Pointer to hold chan information |
| 17686 | * |
| 17687 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17688 | */ |
| 17689 | static QDF_STATUS extract_chan_info_event_tlv(wmi_unified_t wmi_handle, |
| 17690 | void *evt_buf, wmi_host_chan_info_event *chan_info) |
| 17691 | { |
| 17692 | WMI_CHAN_INFO_EVENTID_param_tlvs *param_buf; |
| 17693 | wmi_chan_info_event_fixed_param *ev; |
| 17694 | |
| 17695 | param_buf = (WMI_CHAN_INFO_EVENTID_param_tlvs *) evt_buf; |
| 17696 | |
| 17697 | ev = (wmi_chan_info_event_fixed_param *) param_buf->fixed_param; |
| 17698 | if (!ev) { |
| 17699 | WMI_LOGE("%s: Failed to allocmemory\n", __func__); |
| 17700 | return QDF_STATUS_E_FAILURE; |
| 17701 | } |
| 17702 | |
| 17703 | chan_info->err_code = ev->err_code; |
| 17704 | chan_info->freq = ev->freq; |
| 17705 | chan_info->cmd_flags = ev->cmd_flags; |
| 17706 | chan_info->noise_floor = ev->noise_floor; |
| 17707 | chan_info->rx_clear_count = ev->rx_clear_count; |
| 17708 | chan_info->cycle_count = ev->cycle_count; |
Edayilliam Jayadev | 5d161a9 | 2017-09-22 13:21:03 +0530 | [diff] [blame] | 17709 | chan_info->tx_frame_cnt = ev->tx_frame_cnt; |
| 17710 | chan_info->mac_clk_mhz = ev->mac_clk_mhz; |
Sathish Kumar | 87db1bd | 2017-05-08 12:35:55 +0530 | [diff] [blame] | 17711 | chan_info->pdev_id = wlan_get_pdev_id_from_vdev_id( |
| 17712 | (struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc, |
| 17713 | ev->vdev_id, WLAN_SCAN_ID); |
Kiran Venkatappa | da3eae6 | 2017-08-10 17:48:37 +0530 | [diff] [blame] | 17714 | chan_info->chan_tx_pwr_range = ev->chan_tx_pwr_range; |
| 17715 | chan_info->chan_tx_pwr_tp = ev->chan_tx_pwr_tp; |
| 17716 | chan_info->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count; |
| 17717 | chan_info->rx_11b_mode_data_duration = ev->rx_11b_mode_data_duration; |
| 17718 | chan_info->tx_frame_cnt = ev->tx_frame_cnt; |
| 17719 | chan_info->rx_frame_count = ev->rx_frame_count; |
| 17720 | chan_info->mac_clk_mhz = ev->mac_clk_mhz; |
| 17721 | chan_info->vdev_id = ev->vdev_id; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17722 | |
| 17723 | return QDF_STATUS_SUCCESS; |
| 17724 | } |
| 17725 | |
| 17726 | /** |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 17727 | * extract_pdev_utf_event_tlv() - extract UTF data info from event |
| 17728 | * @wmi_handle: WMI handle |
| 17729 | * @param evt_buf: Pointer to event buffer |
| 17730 | * @param param: Pointer to hold data |
| 17731 | * |
| 17732 | * Return : QDF_STATUS_SUCCESS for success or error code |
| 17733 | */ |
| 17734 | static QDF_STATUS extract_pdev_utf_event_tlv(wmi_unified_t wmi_handle, |
| 17735 | uint8_t *evt_buf, |
| 17736 | struct wmi_host_pdev_utf_event *event) |
| 17737 | { |
| 17738 | WMI_PDEV_UTF_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 17739 | struct wmi_host_utf_seg_header_info *seg_hdr; |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 17740 | |
| 17741 | param_buf = (WMI_PDEV_UTF_EVENTID_param_tlvs *)evt_buf; |
| 17742 | event->data = param_buf->data; |
| 17743 | event->datalen = param_buf->num_data; |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 17744 | seg_hdr = (struct wmi_host_utf_seg_header_info *)param_buf->data; |
Kiran Venkatappa | 15978c6 | 2017-02-28 12:42:36 +0530 | [diff] [blame] | 17745 | /* Set pdev_id=1 until FW adds support to include pdev_id */ |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 17746 | event->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
Kiran Venkatappa | 2bd431e | 2017-06-01 16:08:17 +0530 | [diff] [blame] | 17747 | seg_hdr->pdev_id); |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 17748 | |
| 17749 | return QDF_STATUS_SUCCESS; |
| 17750 | } |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 17751 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17752 | /** |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 17753 | * extract_chainmask_tables_tlv() - extract chain mask tables from event |
| 17754 | * @wmi_handle: wmi handle |
| 17755 | * @param evt_buf: pointer to event buffer |
| 17756 | * @param param: Pointer to hold evt buf |
| 17757 | * |
| 17758 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17759 | */ |
| 17760 | static QDF_STATUS extract_chainmask_tables_tlv(wmi_unified_t wmi_handle, |
| 17761 | uint8_t *event, struct wlan_psoc_host_chainmask_table *chainmask_table) |
| 17762 | { |
| 17763 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 17764 | WMI_MAC_PHY_CHAINMASK_CAPABILITY *chainmask_caps; |
| 17765 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 17766 | uint8_t i = 0, j = 0; |
| 17767 | |
| 17768 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 17769 | if (!param_buf) |
| 17770 | return QDF_STATUS_E_INVAL; |
| 17771 | |
| 17772 | hw_caps = param_buf->soc_hw_mode_caps; |
| 17773 | if (!hw_caps) |
| 17774 | return QDF_STATUS_E_INVAL; |
| 17775 | |
| 17776 | if (!hw_caps->num_chainmask_tables) |
| 17777 | return QDF_STATUS_E_INVAL; |
| 17778 | |
| 17779 | chainmask_caps = param_buf->mac_phy_chainmask_caps; |
| 17780 | |
| 17781 | if (chainmask_caps == NULL) |
| 17782 | return QDF_STATUS_E_INVAL; |
| 17783 | |
| 17784 | for (i = 0; i < hw_caps->num_chainmask_tables; i++) { |
| 17785 | |
| 17786 | qdf_print("Dumping chain mask combo data for table : %d\n", i); |
| 17787 | for (j = 0; j < chainmask_table[i].num_valid_chainmasks; j++) { |
| 17788 | |
| 17789 | chainmask_table[i].cap_list[j].chainmask = |
| 17790 | chainmask_caps->chainmask; |
| 17791 | |
| 17792 | chainmask_table[i].cap_list[j].supports_chan_width_20 = |
| 17793 | WMI_SUPPORT_CHAN_WIDTH_20_GET(chainmask_caps->supported_flags); |
| 17794 | |
| 17795 | chainmask_table[i].cap_list[j].supports_chan_width_40 = |
| 17796 | WMI_SUPPORT_CHAN_WIDTH_40_GET(chainmask_caps->supported_flags); |
| 17797 | |
| 17798 | chainmask_table[i].cap_list[j].supports_chan_width_80 = |
| 17799 | WMI_SUPPORT_CHAN_WIDTH_80_GET(chainmask_caps->supported_flags); |
| 17800 | |
| 17801 | chainmask_table[i].cap_list[j].supports_chan_width_160 = |
| 17802 | WMI_SUPPORT_CHAN_WIDTH_160_GET(chainmask_caps->supported_flags); |
| 17803 | |
| 17804 | chainmask_table[i].cap_list[j].supports_chan_width_80P80 = |
| 17805 | WMI_SUPPORT_CHAN_WIDTH_80P80_GET(chainmask_caps->supported_flags); |
| 17806 | |
| 17807 | chainmask_table[i].cap_list[j].chain_mask_2G = |
| 17808 | WMI_SUPPORT_CHAIN_MASK_2G_GET(chainmask_caps->supported_flags); |
| 17809 | |
| 17810 | chainmask_table[i].cap_list[j].chain_mask_5G = |
| 17811 | WMI_SUPPORT_CHAIN_MASK_5G_GET(chainmask_caps->supported_flags); |
| 17812 | |
| 17813 | chainmask_table[i].cap_list[j].chain_mask_tx = |
| 17814 | WMI_SUPPORT_CHAIN_MASK_TX_GET(chainmask_caps->supported_flags); |
| 17815 | |
| 17816 | chainmask_table[i].cap_list[j].chain_mask_rx = |
| 17817 | WMI_SUPPORT_CHAIN_MASK_RX_GET(chainmask_caps->supported_flags); |
| 17818 | |
| 17819 | chainmask_table[i].cap_list[j].supports_aDFS = |
| 17820 | WMI_SUPPORT_CHAIN_MASK_ADFS_GET(chainmask_caps->supported_flags); |
| 17821 | |
| 17822 | qdf_print("supported_flags: 0x%08x chainmasks: 0x%08x\n", |
| 17823 | chainmask_caps->supported_flags, |
| 17824 | chainmask_caps->chainmask |
| 17825 | ); |
| 17826 | chainmask_caps++; |
| 17827 | } |
| 17828 | } |
| 17829 | |
| 17830 | return QDF_STATUS_SUCCESS; |
| 17831 | } |
| 17832 | |
| 17833 | /** |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17834 | * extract_service_ready_ext_tlv() - extract basic extended service ready params |
| 17835 | * from event |
| 17836 | * @wmi_handle: wmi handle |
| 17837 | * @param evt_buf: pointer to event buffer |
| 17838 | * @param param: Pointer to hold evt buf |
| 17839 | * |
| 17840 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17841 | */ |
| 17842 | 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] | 17843 | uint8_t *event, struct wlan_psoc_host_service_ext_param *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17844 | { |
| 17845 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 17846 | wmi_service_ready_ext_event_fixed_param *ev; |
| 17847 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 17848 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 17849 | WMI_MAC_PHY_CHAINMASK_COMBO *chain_mask_combo; |
| 17850 | uint8_t i = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17851 | |
| 17852 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 17853 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17854 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17855 | |
| 17856 | ev = param_buf->fixed_param; |
| 17857 | if (!ev) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17858 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17859 | |
| 17860 | /* Move this to host based bitmap */ |
| 17861 | param->default_conc_scan_config_bits = |
| 17862 | ev->default_conc_scan_config_bits; |
| 17863 | param->default_fw_config_bits = ev->default_fw_config_bits; |
| 17864 | param->he_cap_info = ev->he_cap_info; |
| 17865 | param->mpdu_density = ev->mpdu_density; |
| 17866 | param->max_bssid_rx_filters = ev->max_bssid_rx_filters; |
| 17867 | qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); |
| 17868 | |
| 17869 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17870 | if (hw_caps) |
| 17871 | param->num_hw_modes = hw_caps->num_hw_modes; |
| 17872 | else |
| 17873 | param->num_hw_modes = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17874 | |
| 17875 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17876 | if (reg_caps) |
| 17877 | param->num_phy = reg_caps->num_phy; |
| 17878 | else |
| 17879 | param->num_phy = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17880 | |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 17881 | if (hw_caps) { |
| 17882 | param->num_chainmask_tables = hw_caps->num_chainmask_tables; |
| 17883 | qdf_print("Num chain mask tables: %d\n", hw_caps->num_chainmask_tables); |
| 17884 | } else |
| 17885 | param->num_chainmask_tables = 0; |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 17886 | |
| 17887 | chain_mask_combo = param_buf->mac_phy_chainmask_combo; |
| 17888 | |
| 17889 | if (chain_mask_combo == NULL) |
| 17890 | return QDF_STATUS_SUCCESS; |
| 17891 | |
| 17892 | qdf_print("Dumping chain mask combo data\n"); |
| 17893 | |
Kapil Gupta | 0692a1a | 2017-05-15 15:57:36 +0530 | [diff] [blame] | 17894 | for (i = 0; i < param->num_chainmask_tables; i++) { |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 17895 | |
| 17896 | qdf_print("table_id : %d Num valid chainmasks: %d\n", |
| 17897 | chain_mask_combo->chainmask_table_id, |
| 17898 | chain_mask_combo->num_valid_chainmask |
| 17899 | ); |
| 17900 | |
| 17901 | param->chainmask_table[i].table_id = |
| 17902 | chain_mask_combo->chainmask_table_id; |
| 17903 | param->chainmask_table[i].num_valid_chainmasks = |
| 17904 | chain_mask_combo->num_valid_chainmask; |
| 17905 | chain_mask_combo++; |
| 17906 | } |
| 17907 | qdf_print("chain mask combo end\n"); |
| 17908 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17909 | return QDF_STATUS_SUCCESS; |
| 17910 | } |
| 17911 | |
| 17912 | /** |
| 17913 | * extract_hw_mode_cap_service_ready_ext_tlv() - |
| 17914 | * extract HW mode cap from service ready event |
| 17915 | * @wmi_handle: wmi handle |
| 17916 | * @param evt_buf: pointer to event buffer |
| 17917 | * @param param: Pointer to hold evt buf |
| 17918 | * @param hw_mode_idx: hw mode idx should be less than num_mode |
| 17919 | * |
| 17920 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17921 | */ |
| 17922 | static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( |
| 17923 | wmi_unified_t wmi_handle, |
| 17924 | uint8_t *event, uint8_t hw_mode_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 17925 | struct wlan_psoc_host_hw_mode_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17926 | { |
| 17927 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 17928 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 17929 | |
| 17930 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 17931 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17932 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17933 | |
| 17934 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17935 | if (!hw_caps) |
| 17936 | return QDF_STATUS_E_INVAL; |
| 17937 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17938 | if (hw_mode_idx >= hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17939 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17940 | |
| 17941 | param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; |
| 17942 | param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; |
| 17943 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17944 | param->hw_mode_config_type = |
| 17945 | param_buf->hw_mode_caps[hw_mode_idx].hw_mode_config_type; |
| 17946 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17947 | return QDF_STATUS_SUCCESS; |
| 17948 | } |
| 17949 | |
| 17950 | /** |
| 17951 | * extract_mac_phy_cap_service_ready_ext_tlv() - |
| 17952 | * extract MAC phy cap from service ready event |
| 17953 | * @wmi_handle: wmi handle |
| 17954 | * @param evt_buf: pointer to event buffer |
| 17955 | * @param param: Pointer to hold evt buf |
| 17956 | * @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] | 17957 | * @param phy_id: phy id within hw_mode |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17958 | * |
| 17959 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 17960 | */ |
| 17961 | static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( |
| 17962 | wmi_unified_t wmi_handle, |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17963 | uint8_t *event, uint8_t hw_mode_id, uint8_t phy_id, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 17964 | struct wlan_psoc_host_mac_phy_caps *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17965 | { |
| 17966 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17967 | WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17968 | WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; |
| 17969 | uint32_t phy_map; |
| 17970 | uint8_t hw_idx, phy_idx = 0; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17971 | |
| 17972 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 17973 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17974 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17975 | |
| 17976 | hw_caps = param_buf->soc_hw_mode_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17977 | if (!hw_caps) |
| 17978 | return QDF_STATUS_E_INVAL; |
| 17979 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17980 | for (hw_idx = 0; hw_idx < hw_caps->num_hw_modes; hw_idx++) { |
| 17981 | if (hw_mode_id == param_buf->hw_mode_caps[hw_idx].hw_mode_id) |
| 17982 | break; |
| 17983 | |
| 17984 | phy_map = param_buf->hw_mode_caps[hw_idx].phy_id_map; |
| 17985 | while (phy_map) { |
| 17986 | phy_map >>= 1; |
| 17987 | phy_idx++; |
| 17988 | } |
| 17989 | } |
| 17990 | |
| 17991 | if (hw_idx == hw_caps->num_hw_modes) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17992 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17993 | |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17994 | phy_idx += phy_id; |
| 17995 | if (phy_idx >= param_buf->num_mac_phy_caps) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 17996 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 17997 | |
| 17998 | mac_phy_caps = ¶m_buf->mac_phy_caps[phy_idx]; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 17999 | |
| 18000 | param->hw_mode_id = mac_phy_caps->hw_mode_id; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18001 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18002 | mac_phy_caps->pdev_id); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18003 | param->phy_id = mac_phy_caps->phy_id; |
Kiran Venkatappa | 2b1b0d2 | 2016-12-26 15:38:06 +0530 | [diff] [blame] | 18004 | param->supports_11b = |
| 18005 | WMI_SUPPORT_11B_GET(mac_phy_caps->supported_flags); |
| 18006 | param->supports_11g = |
| 18007 | WMI_SUPPORT_11G_GET(mac_phy_caps->supported_flags); |
| 18008 | param->supports_11a = |
| 18009 | WMI_SUPPORT_11A_GET(mac_phy_caps->supported_flags); |
| 18010 | param->supports_11n = |
| 18011 | WMI_SUPPORT_11N_GET(mac_phy_caps->supported_flags); |
| 18012 | param->supports_11ac = |
| 18013 | WMI_SUPPORT_11AC_GET(mac_phy_caps->supported_flags); |
| 18014 | param->supports_11ax = |
| 18015 | WMI_SUPPORT_11AX_GET(mac_phy_caps->supported_flags); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18016 | |
| 18017 | param->supported_bands = mac_phy_caps->supported_bands; |
| 18018 | param->ampdu_density = mac_phy_caps->ampdu_density; |
| 18019 | param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; |
| 18020 | param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; |
| 18021 | param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; |
| 18022 | param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; |
| 18023 | param->he_cap_info_2G = mac_phy_caps->he_cap_info_2G; |
| 18024 | param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; |
| 18025 | param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; |
| 18026 | param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; |
| 18027 | param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; |
| 18028 | param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; |
| 18029 | param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; |
| 18030 | param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; |
| 18031 | param->he_cap_info_5G = mac_phy_caps->he_cap_info_5G; |
| 18032 | param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; |
| 18033 | param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; |
| 18034 | param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; |
Kris Muthusamy | 61fe369 | 2017-02-20 02:35:47 -0800 | [diff] [blame] | 18035 | qdf_mem_copy(¶m->he_cap_phy_info_2G, |
| 18036 | &mac_phy_caps->he_cap_phy_info_2G, |
| 18037 | sizeof(param->he_cap_phy_info_2G)); |
| 18038 | qdf_mem_copy(¶m->he_cap_phy_info_5G, |
| 18039 | &mac_phy_caps->he_cap_phy_info_5G, |
| 18040 | sizeof(param->he_cap_phy_info_5G)); |
| 18041 | qdf_mem_copy(¶m->he_ppet2G, &mac_phy_caps->he_ppet2G, |
| 18042 | sizeof(param->he_ppet2G)); |
| 18043 | qdf_mem_copy(¶m->he_ppet5G, &mac_phy_caps->he_ppet5G, |
| 18044 | sizeof(param->he_ppet5G)); |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 18045 | param->chainmask_table_id = mac_phy_caps->chainmask_table_id; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18046 | |
| 18047 | return QDF_STATUS_SUCCESS; |
| 18048 | } |
| 18049 | |
| 18050 | /** |
| 18051 | * extract_reg_cap_service_ready_ext_tlv() - |
| 18052 | * extract REG cap from service ready event |
| 18053 | * @wmi_handle: wmi handle |
| 18054 | * @param evt_buf: pointer to event buffer |
| 18055 | * @param param: Pointer to hold evt buf |
| 18056 | * @param phy_idx: phy idx should be less than num_mode |
| 18057 | * |
| 18058 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18059 | */ |
| 18060 | static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( |
| 18061 | wmi_unified_t wmi_handle, |
| 18062 | uint8_t *event, uint8_t phy_idx, |
Rajeev Kumar | 037799b | 2017-02-03 00:39:49 -0800 | [diff] [blame] | 18063 | struct wlan_psoc_host_hal_reg_capabilities_ext *param) |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18064 | { |
| 18065 | WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; |
| 18066 | WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; |
| 18067 | WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; |
| 18068 | |
| 18069 | param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; |
| 18070 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18071 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18072 | |
| 18073 | reg_caps = param_buf->soc_hal_reg_caps; |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18074 | if (!reg_caps) |
| 18075 | return QDF_STATUS_E_INVAL; |
| 18076 | |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18077 | if (phy_idx >= reg_caps->num_phy) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18078 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18079 | |
| 18080 | ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; |
| 18081 | |
| 18082 | param->phy_id = ext_reg_cap->phy_id; |
| 18083 | param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; |
| 18084 | param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; |
| 18085 | param->regcap1 = ext_reg_cap->regcap1; |
| 18086 | param->regcap2 = ext_reg_cap->regcap2; |
Kiran Venkatappa | 270f1fd | 2017-02-25 20:29:29 +0530 | [diff] [blame] | 18087 | param->wireless_modes = convert_wireless_modes_tlv( |
| 18088 | ext_reg_cap->wireless_modes); |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 18089 | param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; |
| 18090 | param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; |
| 18091 | param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; |
| 18092 | param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; |
| 18093 | |
| 18094 | return QDF_STATUS_SUCCESS; |
| 18095 | } |
| 18096 | |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 18097 | /** |
| 18098 | * extract_dcs_interference_type_tlv() - extract dcs interference type |
| 18099 | * from event |
| 18100 | * @wmi_handle: wmi handle |
| 18101 | * @param evt_buf: pointer to event buffer |
| 18102 | * @param param: Pointer to hold dcs interference param |
| 18103 | * |
| 18104 | * Return: 0 for success or error code |
| 18105 | */ |
| 18106 | static QDF_STATUS extract_dcs_interference_type_tlv( |
| 18107 | wmi_unified_t wmi_handle, |
| 18108 | void *evt_buf, struct wmi_host_dcs_interference_param *param) |
| 18109 | { |
| 18110 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 18111 | |
| 18112 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 18113 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18114 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 18115 | |
| 18116 | param->interference_type = param_buf->fixed_param->interference_type; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18117 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18118 | param_buf->fixed_param->pdev_id); |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 18119 | |
| 18120 | return QDF_STATUS_SUCCESS; |
| 18121 | } |
| 18122 | |
| 18123 | /* |
| 18124 | * extract_dcs_cw_int_tlv() - extract dcs cw interference from event |
| 18125 | * @wmi_handle: wmi handle |
| 18126 | * @param evt_buf: pointer to event buffer |
| 18127 | * @param cw_int: Pointer to hold cw interference |
| 18128 | * |
| 18129 | * Return: 0 for success or error code |
| 18130 | */ |
| 18131 | static QDF_STATUS extract_dcs_cw_int_tlv(wmi_unified_t wmi_handle, |
| 18132 | void *evt_buf, |
| 18133 | wmi_host_ath_dcs_cw_int *cw_int) |
| 18134 | { |
| 18135 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 18136 | wlan_dcs_cw_int *ev; |
| 18137 | |
| 18138 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 18139 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18140 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 18141 | |
| 18142 | ev = param_buf->cw_int; |
| 18143 | |
| 18144 | cw_int->channel = ev->channel; |
| 18145 | |
| 18146 | return QDF_STATUS_SUCCESS; |
| 18147 | } |
| 18148 | |
| 18149 | /** |
| 18150 | * extract_dcs_im_tgt_stats_tlv() - extract dcs im target stats from event |
| 18151 | * @wmi_handle: wmi handle |
| 18152 | * @param evt_buf: pointer to event buffer |
| 18153 | * @param wlan_stat: Pointer to hold wlan stats |
| 18154 | * |
| 18155 | * Return: 0 for success or error code |
| 18156 | */ |
| 18157 | static QDF_STATUS extract_dcs_im_tgt_stats_tlv(wmi_unified_t wmi_handle, |
| 18158 | void *evt_buf, |
| 18159 | wmi_host_dcs_im_tgt_stats_t *wlan_stat) |
| 18160 | { |
| 18161 | WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf; |
| 18162 | wlan_dcs_im_tgt_stats_t *ev; |
| 18163 | |
| 18164 | param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf; |
| 18165 | if (!param_buf) |
Kiran Venkatappa | 41ef329 | 2017-02-23 11:39:37 +0530 | [diff] [blame] | 18166 | return QDF_STATUS_E_INVAL; |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 18167 | |
| 18168 | ev = param_buf->wlan_stat; |
| 18169 | wlan_stat->reg_tsf32 = ev->reg_tsf32; |
| 18170 | wlan_stat->last_ack_rssi = ev->last_ack_rssi; |
| 18171 | wlan_stat->tx_waste_time = ev->tx_waste_time; |
| 18172 | wlan_stat->rx_time = ev->rx_time; |
| 18173 | wlan_stat->phyerr_cnt = ev->phyerr_cnt; |
| 18174 | wlan_stat->mib_stats.listen_time = ev->listen_time; |
| 18175 | wlan_stat->mib_stats.reg_tx_frame_cnt = ev->reg_tx_frame_cnt; |
| 18176 | wlan_stat->mib_stats.reg_rx_frame_cnt = ev->reg_rx_frame_cnt; |
| 18177 | wlan_stat->mib_stats.reg_rxclr_cnt = ev->reg_rxclr_cnt; |
| 18178 | wlan_stat->mib_stats.reg_cycle_cnt = ev->reg_cycle_cnt; |
| 18179 | wlan_stat->mib_stats.reg_rxclr_ext_cnt = ev->reg_rxclr_ext_cnt; |
| 18180 | wlan_stat->mib_stats.reg_ofdm_phyerr_cnt = ev->reg_ofdm_phyerr_cnt; |
| 18181 | wlan_stat->mib_stats.reg_cck_phyerr_cnt = ev->reg_cck_phyerr_cnt; |
| 18182 | wlan_stat->chan_nf = ev->chan_nf; |
| 18183 | wlan_stat->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count; |
| 18184 | |
| 18185 | return QDF_STATUS_SUCCESS; |
| 18186 | } |
| 18187 | |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 18188 | /** |
| 18189 | * extract_thermal_stats_tlv() - extract thermal stats from event |
| 18190 | * @wmi_handle: wmi handle |
| 18191 | * @param evt_buf: Pointer to event buffer |
| 18192 | * @param temp: Pointer to hold extracted temperature |
| 18193 | * @param level: Pointer to hold extracted level |
| 18194 | * |
| 18195 | * Return: 0 for success or error code |
| 18196 | */ |
| 18197 | static QDF_STATUS |
| 18198 | extract_thermal_stats_tlv(wmi_unified_t wmi_handle, |
| 18199 | void *evt_buf, uint32_t *temp, |
| 18200 | uint32_t *level, uint32_t *pdev_id) |
| 18201 | { |
| 18202 | WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf; |
| 18203 | wmi_therm_throt_stats_event_fixed_param *tt_stats_event; |
| 18204 | |
| 18205 | param_buf = |
| 18206 | (WMI_THERM_THROT_STATS_EVENTID_param_tlvs *) evt_buf; |
| 18207 | if (!param_buf) |
| 18208 | return QDF_STATUS_E_INVAL; |
| 18209 | |
| 18210 | tt_stats_event = param_buf->fixed_param; |
| 18211 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18212 | *pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18213 | tt_stats_event->pdev_id); |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 18214 | *temp = tt_stats_event->temp; |
| 18215 | *level = tt_stats_event->level; |
| 18216 | |
| 18217 | return QDF_STATUS_SUCCESS; |
| 18218 | } |
| 18219 | |
| 18220 | /** |
| 18221 | * extract_thermal_level_stats_tlv() - extract thermal level stats from event |
| 18222 | * @wmi_handle: wmi handle |
| 18223 | * @param evt_buf: pointer to event buffer |
| 18224 | * @param idx: Index to level stats |
| 18225 | * @param levelcount: Pointer to hold levelcount |
| 18226 | * @param dccount: Pointer to hold dccount |
| 18227 | * |
| 18228 | * Return: 0 for success or error code |
| 18229 | */ |
| 18230 | static QDF_STATUS |
| 18231 | extract_thermal_level_stats_tlv(wmi_unified_t wmi_handle, |
| 18232 | void *evt_buf, uint8_t idx, uint32_t *levelcount, |
| 18233 | uint32_t *dccount) |
| 18234 | { |
| 18235 | WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf; |
| 18236 | wmi_therm_throt_level_stats_info *tt_level_info; |
| 18237 | |
| 18238 | param_buf = |
| 18239 | (WMI_THERM_THROT_STATS_EVENTID_param_tlvs *) evt_buf; |
| 18240 | if (!param_buf) |
| 18241 | return QDF_STATUS_E_INVAL; |
| 18242 | |
| 18243 | tt_level_info = param_buf->therm_throt_level_stats_info; |
| 18244 | |
| 18245 | if (idx < THERMAL_LEVELS) { |
| 18246 | *levelcount = tt_level_info[idx].level_count; |
| 18247 | *dccount = tt_level_info[idx].dc_count; |
| 18248 | return QDF_STATUS_SUCCESS; |
| 18249 | } |
| 18250 | |
| 18251 | return QDF_STATUS_E_FAILURE; |
| 18252 | } |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 18253 | #ifdef BIG_ENDIAN_HOST |
| 18254 | /** |
| 18255 | * fips_conv_data_be() - LE to BE conversion of FIPS ev data |
| 18256 | * @param data_len - data length |
| 18257 | * @param data - pointer to data |
| 18258 | * |
| 18259 | * Return: QDF_STATUS - success or error status |
| 18260 | */ |
| 18261 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 18262 | { |
| 18263 | uint8_t *data_aligned = NULL; |
| 18264 | int c; |
| 18265 | unsigned char *data_unaligned; |
| 18266 | |
| 18267 | data_unaligned = qdf_mem_malloc(((sizeof(uint8_t) * data_len) + |
| 18268 | FIPS_ALIGN)); |
| 18269 | /* Assigning unaligned space to copy the data */ |
| 18270 | /* Checking if kmalloc does succesful allocation */ |
| 18271 | if (data_unaligned == NULL) |
| 18272 | return QDF_STATUS_E_FAILURE; |
| 18273 | |
| 18274 | /* Checking if space is alligned */ |
| 18275 | if (!FIPS_IS_ALIGNED(data_unaligned, FIPS_ALIGN)) { |
| 18276 | /* align the data space */ |
| 18277 | data_aligned = |
| 18278 | (uint8_t *)FIPS_ALIGNTO(data_unaligned, FIPS_ALIGN); |
| 18279 | } else { |
| 18280 | data_aligned = (u_int8_t *)data_unaligned; |
| 18281 | } |
| 18282 | |
| 18283 | /* memset and copy content from data to data aligned */ |
| 18284 | OS_MEMSET(data_aligned, 0, data_len); |
| 18285 | OS_MEMCPY(data_aligned, data, data_len); |
| 18286 | /* Endianness to LE */ |
| 18287 | for (c = 0; c < data_len/4; c++) { |
| 18288 | *((u_int32_t *)data_aligned + c) = |
Padma Raghunathan | 1edbf23 | 2017-08-31 15:26:47 +0530 | [diff] [blame] | 18289 | qdf_le32_to_cpu(*((u_int32_t *)data_aligned + c)); |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 18290 | } |
| 18291 | |
| 18292 | /* Copy content to event->data */ |
| 18293 | OS_MEMCPY(data, data_aligned, data_len); |
| 18294 | |
| 18295 | /* clean up allocated space */ |
| 18296 | qdf_mem_free(data_unaligned); |
| 18297 | data_aligned = NULL; |
| 18298 | data_unaligned = NULL; |
| 18299 | |
| 18300 | /*************************************************************/ |
| 18301 | |
| 18302 | return QDF_STATUS_SUCCESS; |
| 18303 | } |
| 18304 | #else |
| 18305 | /** |
| 18306 | * fips_conv_data_be() - DUMMY for LE platform |
| 18307 | * |
| 18308 | * Return: QDF_STATUS - success |
| 18309 | */ |
| 18310 | static QDF_STATUS fips_conv_data_be(uint32_t data_len, uint8_t *data) |
| 18311 | { |
| 18312 | return QDF_STATUS_SUCCESS; |
| 18313 | } |
| 18314 | #endif |
| 18315 | |
| 18316 | /** |
| 18317 | * extract_fips_event_data_tlv() - extract fips event data |
| 18318 | * @wmi_handle: wmi handle |
| 18319 | * @param evt_buf: pointer to event buffer |
| 18320 | * @param param: pointer FIPS event params |
| 18321 | * |
| 18322 | * Return: 0 for success or error code |
| 18323 | */ |
| 18324 | static QDF_STATUS extract_fips_event_data_tlv(wmi_unified_t wmi_handle, |
| 18325 | void *evt_buf, struct wmi_host_fips_event_param *param) |
| 18326 | { |
| 18327 | WMI_PDEV_FIPS_EVENTID_param_tlvs *param_buf; |
| 18328 | wmi_pdev_fips_event_fixed_param *event; |
| 18329 | |
| 18330 | param_buf = (WMI_PDEV_FIPS_EVENTID_param_tlvs *) evt_buf; |
| 18331 | event = (wmi_pdev_fips_event_fixed_param *) param_buf->fixed_param; |
| 18332 | |
| 18333 | if (fips_conv_data_be(event->data_len, param_buf->data) != |
| 18334 | QDF_STATUS_SUCCESS) |
| 18335 | return QDF_STATUS_E_FAILURE; |
| 18336 | |
| 18337 | param->data = (uint32_t *)param_buf->data; |
| 18338 | param->data_len = event->data_len; |
| 18339 | param->error_status = event->error_status; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18340 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18341 | event->pdev_id); |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 18342 | |
| 18343 | return QDF_STATUS_SUCCESS; |
| 18344 | } |
| 18345 | |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 18346 | /* |
| 18347 | * extract_peer_delete_response_event_tlv() - extract peer delete response event |
| 18348 | * @wmi_handle: wmi handle |
| 18349 | * @param evt_buf: pointer to event buffer |
| 18350 | * @param vdev_id: Pointer to hold vdev_id |
| 18351 | * @param mac_addr: Pointer to hold peer mac address |
| 18352 | * |
| 18353 | * Return: QDF_STATUS_SUCCESS for success or error code |
| 18354 | */ |
| 18355 | static QDF_STATUS extract_peer_delete_response_event_tlv(wmi_unified_t wmi_hdl, |
| 18356 | void *evt_buf, struct wmi_host_peer_delete_response_event *param) |
| 18357 | { |
| 18358 | WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *param_buf; |
| 18359 | wmi_peer_delete_resp_event_fixed_param *ev; |
| 18360 | |
| 18361 | param_buf = (WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *)evt_buf; |
| 18362 | |
| 18363 | ev = (wmi_peer_delete_resp_event_fixed_param *) param_buf->fixed_param; |
| 18364 | if (!ev) { |
| 18365 | WMI_LOGE("%s: Invalid peer_delete response\n", __func__); |
| 18366 | return QDF_STATUS_E_FAILURE; |
| 18367 | } |
| 18368 | |
| 18369 | param->vdev_id = ev->vdev_id; |
| 18370 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->peer_macaddr, |
| 18371 | ¶m->mac_address.bytes[0]); |
| 18372 | |
| 18373 | return QDF_STATUS_SUCCESS; |
| 18374 | } |
| 18375 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 18376 | static bool is_management_record_tlv(uint32_t cmd_id) |
| 18377 | { |
Pratik Gandhi | 29e33f0 | 2016-09-16 01:32:51 +0530 | [diff] [blame] | 18378 | if (cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID) |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 18379 | return true; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 18380 | |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 18381 | return false; |
| 18382 | } |
| 18383 | |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 18384 | static uint16_t wmi_tag_vdev_set_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 18385 | { |
| 18386 | wmi_vdev_set_param_cmd_fixed_param *set_cmd; |
| 18387 | |
| 18388 | set_cmd = (wmi_vdev_set_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 18389 | |
| 18390 | switch (set_cmd->param_id) { |
| 18391 | case WMI_VDEV_PARAM_LISTEN_INTERVAL: |
| 18392 | case WMI_VDEV_PARAM_DTIM_POLICY: |
| 18393 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 18394 | default: |
| 18395 | break; |
| 18396 | } |
| 18397 | |
| 18398 | return 0; |
| 18399 | } |
| 18400 | |
| 18401 | static uint16_t wmi_tag_sta_powersave_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) |
| 18402 | { |
| 18403 | wmi_sta_powersave_param_cmd_fixed_param *ps_cmd; |
| 18404 | |
| 18405 | ps_cmd = (wmi_sta_powersave_param_cmd_fixed_param *)wmi_buf_data(buf); |
| 18406 | |
| 18407 | switch (ps_cmd->param) { |
| 18408 | case WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD: |
| 18409 | case WMI_STA_PS_PARAM_INACTIVITY_TIME: |
| 18410 | case WMI_STA_PS_ENABLE_QPOWER: |
| 18411 | return HTC_TX_PACKET_TAG_AUTO_PM; |
| 18412 | default: |
| 18413 | break; |
| 18414 | } |
| 18415 | |
| 18416 | return 0; |
| 18417 | } |
| 18418 | |
| 18419 | static uint16_t wmi_tag_common_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf, |
| 18420 | uint32_t cmd_id) |
| 18421 | { |
| 18422 | if (qdf_atomic_read(&wmi_hdl->is_wow_bus_suspended)) |
| 18423 | return 0; |
| 18424 | |
| 18425 | switch (cmd_id) { |
| 18426 | case WMI_VDEV_SET_PARAM_CMDID: |
| 18427 | return wmi_tag_vdev_set_cmd(wmi_hdl, buf); |
| 18428 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 18429 | return wmi_tag_sta_powersave_cmd(wmi_hdl, buf); |
| 18430 | default: |
| 18431 | break; |
| 18432 | } |
| 18433 | |
| 18434 | return 0; |
| 18435 | } |
| 18436 | |
| 18437 | static uint16_t wmi_tag_fw_hang_cmd(wmi_unified_t wmi_handle) |
| 18438 | { |
| 18439 | uint16_t tag = 0; |
| 18440 | |
| 18441 | if (qdf_atomic_read(&wmi_handle->is_target_suspended)) { |
| 18442 | pr_err("%s: Target is already suspended, Ignore FW Hang Command\n", |
| 18443 | __func__); |
| 18444 | return tag; |
| 18445 | } |
| 18446 | |
| 18447 | if (wmi_handle->tag_crash_inject) |
| 18448 | tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 18449 | |
| 18450 | wmi_handle->tag_crash_inject = false; |
| 18451 | return tag; |
| 18452 | } |
| 18453 | |
| 18454 | /** |
| 18455 | * wmi_set_htc_tx_tag_tlv() - set HTC TX tag for WMI commands |
| 18456 | * @wmi_handle: WMI handle |
| 18457 | * @buf: WMI buffer |
| 18458 | * @cmd_id: WMI command Id |
| 18459 | * |
| 18460 | * Return htc_tx_tag |
| 18461 | */ |
| 18462 | static uint16_t wmi_set_htc_tx_tag_tlv(wmi_unified_t wmi_handle, |
| 18463 | wmi_buf_t buf, |
| 18464 | uint32_t cmd_id) |
| 18465 | { |
| 18466 | uint16_t htc_tx_tag = 0; |
| 18467 | |
| 18468 | switch (cmd_id) { |
| 18469 | case WMI_WOW_ENABLE_CMDID: |
| 18470 | case WMI_PDEV_SUSPEND_CMDID: |
| 18471 | case WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID: |
| 18472 | case WMI_WOW_ADD_WAKE_PATTERN_CMDID: |
| 18473 | case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: |
| 18474 | case WMI_PDEV_RESUME_CMDID: |
| 18475 | case WMI_WOW_DEL_WAKE_PATTERN_CMDID: |
| 18476 | case WMI_WOW_SET_ACTION_WAKE_UP_CMDID: |
| 18477 | #ifdef FEATURE_WLAN_D0WOW |
| 18478 | case WMI_D0_WOW_ENABLE_DISABLE_CMDID: |
| 18479 | #endif |
| 18480 | htc_tx_tag = HTC_TX_PACKET_TAG_AUTO_PM; |
| 18481 | break; |
| 18482 | case WMI_FORCE_FW_HANG_CMDID: |
| 18483 | htc_tx_tag = wmi_tag_fw_hang_cmd(wmi_handle); |
| 18484 | break; |
| 18485 | case WMI_VDEV_SET_PARAM_CMDID: |
| 18486 | case WMI_STA_POWERSAVE_PARAM_CMDID: |
| 18487 | htc_tx_tag = wmi_tag_common_cmd(wmi_handle, buf, cmd_id); |
| 18488 | default: |
| 18489 | break; |
| 18490 | } |
| 18491 | |
| 18492 | return htc_tx_tag; |
| 18493 | } |
| 18494 | |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 18495 | /** |
| 18496 | * extract_channel_hopping_event_tlv() - extract channel hopping param |
| 18497 | * from event |
| 18498 | * @wmi_handle: wmi handle |
| 18499 | * @param evt_buf: pointer to event buffer |
| 18500 | * @param ch_hopping: Pointer to hold channel hopping param |
| 18501 | * |
| 18502 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18503 | */ |
| 18504 | static QDF_STATUS extract_channel_hopping_event_tlv( |
| 18505 | wmi_unified_t wmi_handle, void *evt_buf, |
| 18506 | wmi_host_pdev_channel_hopping_event *ch_hopping) |
| 18507 | { |
| 18508 | WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *param_buf; |
| 18509 | wmi_pdev_channel_hopping_event_fixed_param *event; |
| 18510 | |
| 18511 | param_buf = (WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *)evt_buf; |
| 18512 | event = (wmi_pdev_channel_hopping_event_fixed_param *) |
| 18513 | param_buf->fixed_param; |
| 18514 | |
| 18515 | ch_hopping->noise_floor_report_iter = event->noise_floor_report_iter; |
| 18516 | ch_hopping->noise_floor_total_iter = event->noise_floor_total_iter; |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18517 | ch_hopping->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18518 | event->pdev_id); |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 18519 | |
| 18520 | return QDF_STATUS_SUCCESS; |
| 18521 | } |
| 18522 | |
| 18523 | /** |
| 18524 | * extract_pdev_tpc_ev_param_tlv() - extract tpc param from event |
| 18525 | * @wmi_handle: wmi handle |
| 18526 | * @param evt_buf: pointer to event buffer |
| 18527 | * @param param: Pointer to hold tpc param |
| 18528 | * |
| 18529 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18530 | */ |
| 18531 | static QDF_STATUS extract_pdev_tpc_ev_param_tlv(wmi_unified_t wmi_handle, |
| 18532 | void *evt_buf, |
| 18533 | wmi_host_pdev_tpc_event *param) |
| 18534 | { |
| 18535 | WMI_PDEV_TPC_EVENTID_param_tlvs *param_buf; |
| 18536 | wmi_pdev_tpc_event_fixed_param *event; |
| 18537 | |
| 18538 | param_buf = (WMI_PDEV_TPC_EVENTID_param_tlvs *)evt_buf; |
| 18539 | event = (wmi_pdev_tpc_event_fixed_param *)param_buf->fixed_param; |
| 18540 | |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18541 | param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host( |
| 18542 | event->pdev_id); |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 18543 | qdf_mem_copy(param->tpc, param_buf->tpc, sizeof(param->tpc)); |
| 18544 | |
| 18545 | return QDF_STATUS_SUCCESS; |
| 18546 | } |
| 18547 | |
| 18548 | |
| 18549 | #ifdef BIG_ENDIAN_HOST |
| 18550 | /** |
| 18551 | * wds_addr_ev_conv_data_be() - LE to BE conversion of wds addr event |
| 18552 | * @param data_len - data length |
| 18553 | * @param data - pointer to data |
| 18554 | * |
| 18555 | * Return: QDF_STATUS - success or error status |
| 18556 | */ |
| 18557 | static QDF_STATUS wds_addr_ev_conv_data_be(uint16_t data_len, uint8_t *ev) |
| 18558 | { |
| 18559 | uint8_t *datap = (uint8_t *)ev; |
Padma Raghunathan | 1edbf23 | 2017-08-31 15:26:47 +0530 | [diff] [blame] | 18560 | int i; |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 18561 | /* Skip swapping the first word */ |
| 18562 | datap += sizeof(uint32_t); |
| 18563 | for (i = 0; i < ((data_len / sizeof(uint32_t))-1); |
| 18564 | i++, datap += sizeof(uint32_t)) { |
| 18565 | *(uint32_t *)datap = qdf_le32_to_cpu(*(uint32_t *)datap); |
| 18566 | } |
| 18567 | |
| 18568 | return QDF_STATUS_SUCCESS; |
| 18569 | } |
| 18570 | #else |
| 18571 | /** |
| 18572 | * wds_addr_ev_conv_data_be() - Dummy operation for LE platforms |
| 18573 | * @param data_len - data length |
| 18574 | * @param data - pointer to data |
| 18575 | * |
| 18576 | * Return: QDF_STATUS - success or error status |
| 18577 | */ |
| 18578 | static QDF_STATUS wds_addr_ev_conv_data_be(uint32_t data_len, uint8_t *ev) |
| 18579 | { |
| 18580 | return QDF_STATUS_SUCCESS; |
| 18581 | } |
| 18582 | #endif |
| 18583 | |
| 18584 | /** |
| 18585 | * extract_wds_addr_event_tlv() - extract wds address from event |
| 18586 | * @wmi_handle: wmi handle |
| 18587 | * @param evt_buf: pointer to event buffer |
| 18588 | * @param wds_ev: Pointer to hold wds address |
| 18589 | * |
| 18590 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18591 | */ |
| 18592 | static QDF_STATUS extract_wds_addr_event_tlv(wmi_unified_t wmi_handle, |
| 18593 | void *evt_buf, |
| 18594 | uint16_t len, wds_addr_event_t *wds_ev) |
| 18595 | { |
| 18596 | WMI_WDS_PEER_EVENTID_param_tlvs *param_buf; |
| 18597 | wmi_wds_addr_event_fixed_param *ev; |
| 18598 | int i; |
| 18599 | |
| 18600 | param_buf = (WMI_WDS_PEER_EVENTID_param_tlvs *)evt_buf; |
| 18601 | ev = (wmi_wds_addr_event_fixed_param *)param_buf->fixed_param; |
| 18602 | |
| 18603 | if (wds_addr_ev_conv_data_be(len, (uint8_t *)ev) != QDF_STATUS_SUCCESS) |
| 18604 | return QDF_STATUS_E_FAILURE; |
| 18605 | |
| 18606 | qdf_mem_copy(wds_ev->event_type, ev->event_type, |
| 18607 | sizeof(wds_ev->event_type)); |
| 18608 | for (i = 0; i < 4; i++) { |
| 18609 | wds_ev->peer_mac[i] = |
| 18610 | ((u_int8_t *)&(ev->peer_mac.mac_addr31to0))[i]; |
| 18611 | wds_ev->dest_mac[i] = |
| 18612 | ((u_int8_t *)&(ev->dest_mac.mac_addr31to0))[i]; |
| 18613 | } |
| 18614 | for (i = 0; i < 2; i++) { |
| 18615 | wds_ev->peer_mac[4+i] = |
| 18616 | ((u_int8_t *)&(ev->peer_mac.mac_addr47to32))[i]; |
| 18617 | wds_ev->dest_mac[4+i] = |
| 18618 | ((u_int8_t *)&(ev->dest_mac.mac_addr47to32))[i]; |
| 18619 | } |
| 18620 | return QDF_STATUS_SUCCESS; |
| 18621 | } |
| 18622 | |
| 18623 | /** |
| 18624 | * extract_peer_sta_ps_statechange_ev_tlv() - extract peer sta ps state |
| 18625 | * from event |
| 18626 | * @wmi_handle: wmi handle |
| 18627 | * @param evt_buf: pointer to event buffer |
| 18628 | * @param ev: Pointer to hold peer param and ps state |
| 18629 | * |
| 18630 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18631 | */ |
| 18632 | static QDF_STATUS extract_peer_sta_ps_statechange_ev_tlv(wmi_unified_t wmi_handle, |
| 18633 | void *evt_buf, wmi_host_peer_sta_ps_statechange_event *ev) |
| 18634 | { |
| 18635 | WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *param_buf; |
| 18636 | wmi_peer_sta_ps_statechange_event_fixed_param *event; |
| 18637 | |
| 18638 | param_buf = (WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *)evt_buf; |
| 18639 | event = (wmi_peer_sta_ps_statechange_event_fixed_param *) |
| 18640 | param_buf->fixed_param; |
| 18641 | |
| 18642 | WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->peer_macaddr, ev->peer_macaddr); |
| 18643 | ev->peer_ps_state = event->peer_ps_state; |
| 18644 | |
| 18645 | return QDF_STATUS_SUCCESS; |
| 18646 | } |
| 18647 | |
| 18648 | /** |
| 18649 | * extract_inst_rssi_stats_event_tlv() - extract inst rssi stats from event |
| 18650 | * @wmi_handle: wmi handle |
| 18651 | * @param evt_buf: pointer to event buffer |
| 18652 | * @param inst_rssi_resp: Pointer to hold inst rssi response |
| 18653 | * |
| 18654 | * @return QDF_STATUS_SUCCESS on success and -ve on failure. |
| 18655 | */ |
| 18656 | static QDF_STATUS extract_inst_rssi_stats_event_tlv( |
| 18657 | wmi_unified_t wmi_handle, void *evt_buf, |
| 18658 | wmi_host_inst_stats_resp *inst_rssi_resp) |
| 18659 | { |
| 18660 | WMI_INST_RSSI_STATS_EVENTID_param_tlvs *param_buf; |
| 18661 | wmi_inst_rssi_stats_resp_fixed_param *event; |
| 18662 | |
| 18663 | param_buf = (WMI_INST_RSSI_STATS_EVENTID_param_tlvs *)evt_buf; |
| 18664 | event = (wmi_inst_rssi_stats_resp_fixed_param *)param_buf->fixed_param; |
| 18665 | |
| 18666 | qdf_mem_copy(&(inst_rssi_resp->peer_macaddr), |
| 18667 | &(event->peer_macaddr), sizeof(wmi_mac_addr)); |
| 18668 | inst_rssi_resp->iRSSI = event->iRSSI; |
| 18669 | |
| 18670 | return QDF_STATUS_SUCCESS; |
| 18671 | } |
| 18672 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18673 | static struct cur_reg_rule |
| 18674 | *create_reg_rules_from_wmi(uint32_t num_reg_rules, |
| 18675 | wmi_regulatory_rule_struct *wmi_reg_rule) |
| 18676 | { |
| 18677 | struct cur_reg_rule *reg_rule_ptr; |
| 18678 | uint32_t count; |
| 18679 | |
| 18680 | reg_rule_ptr = qdf_mem_malloc(num_reg_rules * sizeof(*reg_rule_ptr)); |
| 18681 | |
| 18682 | if (NULL == reg_rule_ptr) { |
| 18683 | WMI_LOGE("memory allocation failure"); |
| 18684 | return NULL; |
| 18685 | } |
| 18686 | |
| 18687 | for (count = 0; count < num_reg_rules; count++) { |
| 18688 | reg_rule_ptr[count].start_freq = |
| 18689 | WMI_REG_RULE_START_FREQ_GET( |
| 18690 | wmi_reg_rule[count].freq_info); |
| 18691 | reg_rule_ptr[count].end_freq = |
| 18692 | WMI_REG_RULE_END_FREQ_GET( |
| 18693 | wmi_reg_rule[count].freq_info); |
| 18694 | reg_rule_ptr[count].max_bw = |
| 18695 | WMI_REG_RULE_MAX_BW_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 18696 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18697 | reg_rule_ptr[count].reg_power = |
| 18698 | WMI_REG_RULE_REG_POWER_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 18699 | wmi_reg_rule[count].bw_pwr_info); |
Abhijit Pradhan | b5a1d24 | 2017-04-27 20:36:31 +0530 | [diff] [blame] | 18700 | reg_rule_ptr[count].ant_gain = |
| 18701 | WMI_REG_RULE_ANTENNA_GAIN_GET( |
| 18702 | wmi_reg_rule[count].bw_pwr_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18703 | reg_rule_ptr[count].flags = |
| 18704 | WMI_REG_RULE_FLAGS_GET( |
Karunakar Dasineni | f6f8ca8 | 2017-03-31 17:42:44 -0700 | [diff] [blame] | 18705 | wmi_reg_rule[count].flag_info); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18706 | } |
| 18707 | |
| 18708 | return reg_rule_ptr; |
| 18709 | } |
| 18710 | |
| 18711 | static QDF_STATUS extract_reg_chan_list_update_event_tlv( |
| 18712 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 18713 | struct cur_regulatory_info *reg_info, uint32_t len) |
| 18714 | { |
| 18715 | WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *param_buf; |
| 18716 | wmi_reg_chan_list_cc_event_fixed_param *chan_list_event_hdr; |
| 18717 | wmi_regulatory_rule_struct *wmi_reg_rule; |
| 18718 | uint32_t num_2g_reg_rules, num_5g_reg_rules; |
| 18719 | |
| 18720 | WMI_LOGD("processing regulatory channel list"); |
| 18721 | |
| 18722 | param_buf = (WMI_REG_CHAN_LIST_CC_EVENTID_param_tlvs *)evt_buf; |
| 18723 | if (!param_buf) { |
| 18724 | WMI_LOGE("invalid channel list event buf"); |
| 18725 | return QDF_STATUS_E_FAILURE; |
| 18726 | } |
| 18727 | |
| 18728 | chan_list_event_hdr = param_buf->fixed_param; |
| 18729 | |
| 18730 | reg_info->num_2g_reg_rules = chan_list_event_hdr->num_2g_reg_rules; |
| 18731 | reg_info->num_5g_reg_rules = chan_list_event_hdr->num_5g_reg_rules; |
| 18732 | qdf_mem_copy(reg_info->alpha2, &(chan_list_event_hdr->alpha2), |
Amar Singhal | 7d20402 | 2017-06-23 12:17:00 +0530 | [diff] [blame] | 18733 | REG_ALPHA2_LEN); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18734 | reg_info->dfs_region = chan_list_event_hdr->dfs_region; |
| 18735 | reg_info->phybitmap = chan_list_event_hdr->phybitmap; |
Amar Singhal | a2d575f | 2017-05-04 17:12:34 -0700 | [diff] [blame] | 18736 | reg_info->offload_enabled = true; |
Amar Singhal | a522f21 | 2017-05-12 16:39:23 -0700 | [diff] [blame] | 18737 | reg_info->num_phy = chan_list_event_hdr->num_phy; |
Amar Singhal | 7d20402 | 2017-06-23 12:17:00 +0530 | [diff] [blame] | 18738 | reg_info->phy_id = chan_list_event_hdr->phy_id; |
Amar Singhal | a522f21 | 2017-05-12 16:39:23 -0700 | [diff] [blame] | 18739 | reg_info->ctry_code = chan_list_event_hdr->country_id; |
| 18740 | reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code; |
| 18741 | if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_PASS) |
| 18742 | reg_info->status_code = REG_SET_CC_STATUS_PASS; |
| 18743 | else if (chan_list_event_hdr->status_code == |
| 18744 | WMI_REG_CURRENT_ALPHA2_NOT_FOUND) |
| 18745 | reg_info->status_code = REG_CURRENT_ALPHA2_NOT_FOUND; |
| 18746 | else if (chan_list_event_hdr->status_code == |
| 18747 | WMI_REG_INIT_ALPHA2_NOT_FOUND) |
| 18748 | reg_info->status_code = REG_INIT_ALPHA2_NOT_FOUND; |
| 18749 | else if (chan_list_event_hdr->status_code == |
| 18750 | WMI_REG_SET_CC_CHANGE_NOT_ALLOWED) |
| 18751 | reg_info->status_code = REG_SET_CC_CHANGE_NOT_ALLOWED; |
| 18752 | else if (chan_list_event_hdr->status_code == |
| 18753 | WMI_REG_SET_CC_STATUS_NO_MEMORY) |
| 18754 | reg_info->status_code = REG_SET_CC_STATUS_NO_MEMORY; |
| 18755 | else if (chan_list_event_hdr->status_code == |
| 18756 | WMI_REG_SET_CC_STATUS_FAIL) |
| 18757 | reg_info->status_code = REG_SET_CC_STATUS_FAIL; |
| 18758 | |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18759 | reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g; |
| 18760 | reg_info->max_bw_2g = chan_list_event_hdr->max_bw_2g; |
| 18761 | reg_info->min_bw_5g = chan_list_event_hdr->min_bw_5g; |
| 18762 | reg_info->max_bw_5g = chan_list_event_hdr->max_bw_5g; |
| 18763 | |
| 18764 | num_2g_reg_rules = reg_info->num_2g_reg_rules; |
| 18765 | num_5g_reg_rules = reg_info->num_5g_reg_rules; |
| 18766 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 18767 | WMI_LOGD("%s:cc %s dsf %d BW: min_2g %d max_2g %d min_5g %d max_5g %d", |
| 18768 | __func__, reg_info->alpha2, reg_info->dfs_region, |
| 18769 | reg_info->min_bw_2g, reg_info->max_bw_2g, |
| 18770 | reg_info->min_bw_5g, reg_info->max_bw_5g); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18771 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 18772 | WMI_LOGD("%s: num_2g_reg_rules %d num_5g_reg_rules %d", __func__, |
| 18773 | num_2g_reg_rules, num_5g_reg_rules); |
Kiran Kumar Lokere | dd64e04 | 2017-03-31 15:50:26 -0700 | [diff] [blame] | 18774 | wmi_reg_rule = |
| 18775 | (wmi_regulatory_rule_struct *)((uint8_t *)chan_list_event_hdr |
| 18776 | + sizeof(wmi_reg_chan_list_cc_event_fixed_param) |
| 18777 | + WMI_TLV_HDR_SIZE); |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 18778 | reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules, |
| 18779 | wmi_reg_rule); |
| 18780 | wmi_reg_rule += num_2g_reg_rules; |
| 18781 | |
| 18782 | reg_info->reg_rules_5g_ptr = create_reg_rules_from_wmi(num_5g_reg_rules, |
| 18783 | wmi_reg_rule); |
| 18784 | |
| 18785 | WMI_LOGD("processed regulatory channel list"); |
| 18786 | |
| 18787 | return QDF_STATUS_SUCCESS; |
| 18788 | } |
| 18789 | |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 18790 | static QDF_STATUS extract_reg_11d_new_country_event_tlv( |
| 18791 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 18792 | struct reg_11d_new_country *reg_11d_country, uint32_t len) |
| 18793 | { |
| 18794 | wmi_11d_new_country_event_fixed_param *reg_11d_country_event; |
| 18795 | WMI_11D_NEW_COUNTRY_EVENTID_param_tlvs *param_buf; |
| 18796 | |
| 18797 | param_buf = (WMI_11D_NEW_COUNTRY_EVENTID_param_tlvs *)evt_buf; |
| 18798 | if (!param_buf) { |
| 18799 | WMI_LOGE("invalid 11d country event buf"); |
| 18800 | return QDF_STATUS_E_FAILURE; |
| 18801 | } |
| 18802 | |
| 18803 | reg_11d_country_event = param_buf->fixed_param; |
| 18804 | |
| 18805 | qdf_mem_copy(reg_11d_country->alpha2, |
| 18806 | ®_11d_country_event->new_alpha2, REG_ALPHA2_LEN); |
| 18807 | |
| 18808 | WMI_LOGD("processed 11d country event, new cc %s", |
| 18809 | reg_11d_country->alpha2); |
| 18810 | |
| 18811 | return QDF_STATUS_SUCCESS; |
| 18812 | } |
Kiran Kumar Lokere | ec65bb4 | 2017-06-30 19:13:02 -0700 | [diff] [blame] | 18813 | |
| 18814 | static QDF_STATUS extract_reg_ch_avoid_event_tlv( |
| 18815 | wmi_unified_t wmi_handle, uint8_t *evt_buf, |
| 18816 | struct ch_avoid_ind_type *ch_avoid_ind, uint32_t len) |
| 18817 | { |
| 18818 | wmi_avoid_freq_ranges_event_fixed_param *afr_fixed_param; |
| 18819 | wmi_avoid_freq_range_desc *afr_desc; |
| 18820 | uint32_t num_freq_ranges, freq_range_idx; |
| 18821 | WMI_WLAN_FREQ_AVOID_EVENTID_param_tlvs *param_buf = |
| 18822 | (WMI_WLAN_FREQ_AVOID_EVENTID_param_tlvs *) evt_buf; |
| 18823 | |
| 18824 | if (!param_buf) { |
| 18825 | WMI_LOGE("Invalid channel avoid event buffer"); |
| 18826 | return QDF_STATUS_E_INVAL; |
| 18827 | } |
| 18828 | |
| 18829 | afr_fixed_param = param_buf->fixed_param; |
| 18830 | if (!afr_fixed_param) { |
| 18831 | WMI_LOGE("Invalid channel avoid event fixed param buffer"); |
| 18832 | return QDF_STATUS_E_INVAL; |
| 18833 | } |
| 18834 | |
| 18835 | if (!ch_avoid_ind) { |
| 18836 | WMI_LOGE("Invalid channel avoid indication buffer"); |
| 18837 | return QDF_STATUS_E_INVAL; |
| 18838 | } |
| 18839 | num_freq_ranges = (afr_fixed_param->num_freq_ranges > |
| 18840 | CH_AVOID_MAX_RANGE) ? CH_AVOID_MAX_RANGE : |
| 18841 | afr_fixed_param->num_freq_ranges; |
| 18842 | |
| 18843 | WMI_LOGD("Channel avoid event received with %d ranges", |
| 18844 | num_freq_ranges); |
| 18845 | |
| 18846 | ch_avoid_ind->ch_avoid_range_cnt = num_freq_ranges; |
| 18847 | afr_desc = (wmi_avoid_freq_range_desc *)(param_buf->avd_freq_range); |
| 18848 | for (freq_range_idx = 0; freq_range_idx < num_freq_ranges; |
| 18849 | freq_range_idx++) { |
| 18850 | ch_avoid_ind->avoid_freq_range[freq_range_idx].start_freq = |
| 18851 | afr_desc->start_freq; |
| 18852 | ch_avoid_ind->avoid_freq_range[freq_range_idx].end_freq = |
| 18853 | afr_desc->end_freq; |
| 18854 | WMI_LOGD("range %d tlv id %u, start freq %u, end freq %u", |
| 18855 | freq_range_idx, afr_desc->tlv_header, |
| 18856 | afr_desc->start_freq, afr_desc->end_freq); |
| 18857 | afr_desc++; |
| 18858 | } |
| 18859 | |
| 18860 | return QDF_STATUS_SUCCESS; |
| 18861 | } |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 18862 | #ifdef DFS_COMPONENT_ENABLE |
| 18863 | /** |
| 18864 | * extract_dfs_cac_complete_event_tlv() - extract cac complete event |
| 18865 | * @wmi_handle: wma handle |
| 18866 | * @evt_buf: event buffer |
| 18867 | * @vdev_id: vdev id |
| 18868 | * @len: length of buffer |
| 18869 | * |
| 18870 | * Return: 0 for success or error code |
| 18871 | */ |
| 18872 | static QDF_STATUS extract_dfs_cac_complete_event_tlv(wmi_unified_t wmi_handle, |
| 18873 | uint8_t *evt_buf, |
| 18874 | uint32_t *vdev_id, |
| 18875 | uint32_t len) |
| 18876 | { |
| 18877 | WMI_VDEV_DFS_CAC_COMPLETE_EVENTID_param_tlvs *param_tlvs; |
| 18878 | wmi_vdev_dfs_cac_complete_event_fixed_param *cac_event; |
| 18879 | |
| 18880 | param_tlvs = (WMI_VDEV_DFS_CAC_COMPLETE_EVENTID_param_tlvs *) evt_buf; |
| 18881 | if (!param_tlvs) { |
| 18882 | WMI_LOGE("invalid cac complete event buf"); |
| 18883 | return QDF_STATUS_E_FAILURE; |
| 18884 | } |
| 18885 | |
| 18886 | cac_event = param_tlvs->fixed_param; |
| 18887 | *vdev_id = cac_event->vdev_id; |
| 18888 | WMI_LOGD("processed cac complete event vdev %d", *vdev_id); |
| 18889 | |
| 18890 | return QDF_STATUS_SUCCESS; |
| 18891 | } |
| 18892 | |
| 18893 | /** |
| 18894 | * extract_dfs_radar_detection_event_tlv() - extract radar found event |
| 18895 | * @wmi_handle: wma handle |
| 18896 | * @evt_buf: event buffer |
| 18897 | * @radar_found: radar found event info |
| 18898 | * @len: length of buffer |
| 18899 | * |
| 18900 | * Return: 0 for success or error code |
| 18901 | */ |
| 18902 | static QDF_STATUS extract_dfs_radar_detection_event_tlv( |
| 18903 | wmi_unified_t wmi_handle, |
| 18904 | uint8_t *evt_buf, |
| 18905 | struct radar_found_info *radar_found, |
| 18906 | uint32_t len) |
| 18907 | { |
| 18908 | WMI_PDEV_DFS_RADAR_DETECTION_EVENTID_param_tlvs *param_tlv; |
| 18909 | wmi_pdev_dfs_radar_detection_event_fixed_param *radar_event; |
| 18910 | |
| 18911 | param_tlv = (WMI_PDEV_DFS_RADAR_DETECTION_EVENTID_param_tlvs *) evt_buf; |
| 18912 | if (!param_tlv) { |
| 18913 | WMI_LOGE("invalid radar detection event buf"); |
| 18914 | return QDF_STATUS_E_FAILURE; |
| 18915 | } |
| 18916 | |
| 18917 | radar_event = param_tlv->fixed_param; |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame^] | 18918 | radar_found->pdev_id = wmi_handle->ops-> |
| 18919 | convert_pdev_id_target_to_host(radar_event->pdev_id); |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 18920 | radar_found->detection_mode = radar_event->detection_mode; |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame^] | 18921 | radar_found->chan_freq = radar_event->chan_freq; |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 18922 | radar_found->chan_width = radar_event->chan_width; |
| 18923 | radar_found->detector_id = radar_event->detector_id; |
| 18924 | radar_found->segment_id = radar_event->segment_id; |
| 18925 | radar_found->timestamp = radar_event->timestamp; |
| 18926 | radar_found->is_chirp = radar_event->is_chirp; |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame^] | 18927 | radar_found->freq_offset = radar_event->freq_offset; |
| 18928 | radar_found->sidx = radar_event->sidx; |
| 18929 | |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 18930 | |
| 18931 | WMI_LOGD("processed radar found event pdev %d", radar_event->pdev_id); |
Shaakir Mohamed | b8357a5 | 2017-10-04 17:09:07 -0700 | [diff] [blame^] | 18932 | WMI_LOGD("Radar Event Info:"); |
| 18933 | WMI_LOGD("pdev_id %d", radar_event->pdev_id); |
| 18934 | WMI_LOGD("detection mode %d", radar_event->detection_mode); |
| 18935 | WMI_LOGD("chan_freq (dur) %d", radar_event->chan_freq); |
| 18936 | WMI_LOGD("chan_width (RSSI) %d", radar_event->chan_width); |
| 18937 | WMI_LOGD("detector_id (false_radar) %d", radar_event->detector_id); |
| 18938 | WMI_LOGD("segment_id %d", radar_event->segment_id); |
| 18939 | WMI_LOGD("timestamp %d", radar_event->timestamp); |
| 18940 | WMI_LOGD("is_chirp %d", radar_event->is_chirp); |
| 18941 | WMI_LOGD("freq_offset (radar_check) %d", radar_event->freq_offset); |
| 18942 | WMI_LOGD("sidx %d", radar_event->sidx); |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 18943 | |
| 18944 | return QDF_STATUS_SUCCESS; |
| 18945 | } |
| 18946 | #endif |
| 18947 | |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 18948 | /** |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 18949 | * convert_host_pdev_id_to_target_pdev_id_legacy() - Convert pdev_id from |
| 18950 | * host to target defines. For legacy there is not conversion |
| 18951 | * required. Just return pdev_id as it is. |
| 18952 | * @param pdev_id: host pdev_id to be converted. |
| 18953 | * Return: target pdev_id after conversion. |
| 18954 | */ |
| 18955 | static uint32_t convert_host_pdev_id_to_target_pdev_id_legacy( |
| 18956 | uint32_t pdev_id) |
| 18957 | { |
| 18958 | if (pdev_id == WMI_HOST_PDEV_ID_SOC) |
| 18959 | return WMI_PDEV_ID_SOC; |
| 18960 | |
| 18961 | /*No conversion required*/ |
| 18962 | return pdev_id; |
| 18963 | } |
| 18964 | |
| 18965 | /** |
| 18966 | * convert_target_pdev_id_to_host_pdev_id_legacy() - Convert pdev_id from |
| 18967 | * target to host defines. For legacy there is not conversion |
| 18968 | * required. Just return pdev_id as it is. |
| 18969 | * @param pdev_id: target pdev_id to be converted. |
| 18970 | * Return: host pdev_id after conversion. |
| 18971 | */ |
| 18972 | static uint32_t convert_target_pdev_id_to_host_pdev_id_legacy( |
| 18973 | uint32_t pdev_id) |
| 18974 | { |
| 18975 | /*No conversion required*/ |
| 18976 | return pdev_id; |
| 18977 | } |
| 18978 | |
| 18979 | /** |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 18980 | * send_set_country_cmd_tlv() - WMI scan channel list function |
| 18981 | * @param wmi_handle : handle to WMI. |
| 18982 | * @param param : pointer to hold scan channel list parameter |
| 18983 | * |
| 18984 | * Return: 0 on success and -ve on failure. |
| 18985 | */ |
| 18986 | static QDF_STATUS send_set_country_cmd_tlv(wmi_unified_t wmi_handle, |
| 18987 | struct set_country *params) |
| 18988 | { |
| 18989 | wmi_buf_t buf; |
| 18990 | QDF_STATUS qdf_status; |
| 18991 | wmi_set_current_country_cmd_fixed_param *cmd; |
| 18992 | uint16_t len = sizeof(*cmd); |
| 18993 | |
| 18994 | buf = wmi_buf_alloc(wmi_handle, len); |
| 18995 | if (!buf) { |
| 18996 | WMI_LOGE("Failed to allocate memory"); |
| 18997 | qdf_status = QDF_STATUS_E_NOMEM; |
| 18998 | goto end; |
| 18999 | } |
| 19000 | |
| 19001 | cmd = (wmi_set_current_country_cmd_fixed_param *)wmi_buf_data(buf); |
| 19002 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 19003 | WMITLV_TAG_STRUC_wmi_set_current_country_cmd_fixed_param, |
| 19004 | WMITLV_GET_STRUCT_TLVLEN |
| 19005 | (wmi_set_current_country_cmd_fixed_param)); |
| 19006 | |
| 19007 | WMI_LOGD("setting cuurnet country to %s", params->country); |
| 19008 | |
| 19009 | qdf_mem_copy((uint8_t *)&cmd->new_alpha2, params->country, 3); |
| 19010 | |
| 19011 | cmd->pdev_id = params->pdev_id; |
| 19012 | |
| 19013 | qdf_status = wmi_unified_cmd_send(wmi_handle, |
| 19014 | buf, len, WMI_SET_CURRENT_COUNTRY_CMDID); |
| 19015 | |
| 19016 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 19017 | WMI_LOGE("Failed to send WMI_SET_CURRENT_COUNTRY_CMDID"); |
| 19018 | wmi_buf_free(buf); |
| 19019 | } |
| 19020 | |
| 19021 | end: |
| 19022 | return qdf_status; |
| 19023 | } |
| 19024 | |
Abhijit Pradhan | d38a269 | 2017-06-29 12:32:20 +0530 | [diff] [blame] | 19025 | #define WMI_REG_COUNTRY_ALPHA_SET(alpha, val0, val1, val2) do { \ |
| 19026 | WMI_SET_BITS(alpha, 0, 8, val0); \ |
| 19027 | WMI_SET_BITS(alpha, 8, 8, val1); \ |
| 19028 | WMI_SET_BITS(alpha, 16, 8, val2); \ |
| 19029 | } while (0) |
| 19030 | |
| 19031 | static QDF_STATUS send_user_country_code_cmd_tlv(wmi_unified_t wmi_handle, |
| 19032 | uint8_t pdev_id, struct cc_regdmn_s *rd) |
| 19033 | { |
| 19034 | wmi_set_init_country_cmd_fixed_param *cmd; |
| 19035 | uint16_t len; |
| 19036 | wmi_buf_t buf; |
| 19037 | int ret; |
| 19038 | |
| 19039 | len = sizeof(wmi_set_init_country_cmd_fixed_param); |
| 19040 | buf = wmi_buf_alloc(wmi_handle, len); |
| 19041 | if (!buf) { |
| 19042 | WMI_LOGE("%s: Failed allocate wmi buffer", __func__); |
| 19043 | return QDF_STATUS_E_NOMEM; |
| 19044 | } |
| 19045 | cmd = (wmi_set_init_country_cmd_fixed_param *) wmi_buf_data(buf); |
| 19046 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 19047 | WMITLV_TAG_STRUC_wmi_set_init_country_cmd_fixed_param, |
| 19048 | WMITLV_GET_STRUCT_TLVLEN |
| 19049 | (wmi_set_init_country_cmd_fixed_param)); |
| 19050 | |
| 19051 | cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id); |
| 19052 | |
| 19053 | if (rd->flags == CC_IS_SET) { |
| 19054 | cmd->countrycode_type = WMI_COUNTRYCODE_COUNTRY_ID; |
| 19055 | cmd->country_code.country_id = rd->cc.country_code; |
| 19056 | } else if (rd->flags == ALPHA_IS_SET) { |
| 19057 | cmd->countrycode_type = WMI_COUNTRYCODE_ALPHA2; |
| 19058 | WMI_REG_COUNTRY_ALPHA_SET(cmd->country_code.alpha2, |
| 19059 | rd->cc.alpha[0], |
| 19060 | rd->cc.alpha[1], |
| 19061 | rd->cc.alpha[2]); |
| 19062 | } else if (rd->flags == REGDMN_IS_SET) { |
| 19063 | cmd->countrycode_type = WMI_COUNTRYCODE_DOMAIN_CODE; |
| 19064 | cmd->country_code.domain_code = rd->cc.regdmn_id; |
| 19065 | } |
| 19066 | |
| 19067 | ret = wmi_unified_cmd_send(wmi_handle, buf, len, |
| 19068 | WMI_SET_INIT_COUNTRY_CMDID); |
| 19069 | if (ret) { |
| 19070 | WMI_LOGE("Failed to config wow wakeup event"); |
| 19071 | wmi_buf_free(buf); |
| 19072 | return QDF_STATUS_E_FAILURE; |
| 19073 | } |
| 19074 | |
| 19075 | return QDF_STATUS_SUCCESS; |
| 19076 | } |
| 19077 | |
Ganesh Kondabattini | 40252f5 | 2017-07-10 11:54:11 +0530 | [diff] [blame] | 19078 | /** |
| 19079 | * send_limit_off_chan_cmd_tlv() - send wmi cmd of limit off chan |
| 19080 | * configuration params |
| 19081 | * @wmi_handle: wmi handler |
| 19082 | * @limit_off_chan_param: pointer to wmi_off_chan_param |
| 19083 | * |
| 19084 | * Return: 0 for success and non zero for failure |
| 19085 | */ |
| 19086 | static |
| 19087 | QDF_STATUS send_limit_off_chan_cmd_tlv(wmi_unified_t wmi_handle, |
| 19088 | struct wmi_limit_off_chan_param *limit_off_chan_param) |
| 19089 | { |
| 19090 | wmi_vdev_limit_offchan_cmd_fixed_param *cmd; |
| 19091 | wmi_buf_t buf; |
| 19092 | uint32_t len = sizeof(*cmd); |
| 19093 | int err; |
| 19094 | |
| 19095 | buf = wmi_buf_alloc(wmi_handle, len); |
| 19096 | if (!buf) { |
| 19097 | WMI_LOGP("%s: failed to allocate memory for limit off chan cmd", |
| 19098 | __func__); |
| 19099 | return QDF_STATUS_E_NOMEM; |
| 19100 | } |
| 19101 | |
| 19102 | cmd = (wmi_vdev_limit_offchan_cmd_fixed_param *)wmi_buf_data(buf); |
| 19103 | |
| 19104 | WMITLV_SET_HDR(&cmd->tlv_header, |
| 19105 | WMITLV_TAG_STRUC_wmi_vdev_limit_offchan_cmd_fixed_param, |
| 19106 | WMITLV_GET_STRUCT_TLVLEN( |
| 19107 | wmi_vdev_limit_offchan_cmd_fixed_param)); |
| 19108 | |
| 19109 | cmd->vdev_id = limit_off_chan_param->vdev_id; |
| 19110 | |
| 19111 | cmd->flags &= 0; |
| 19112 | if (limit_off_chan_param->status) |
| 19113 | cmd->flags |= WMI_VDEV_LIMIT_OFFCHAN_ENABLE; |
| 19114 | if (limit_off_chan_param->skip_dfs_chans) |
| 19115 | cmd->flags |= WMI_VDEV_LIMIT_OFFCHAN_SKIP_DFS; |
| 19116 | |
| 19117 | cmd->max_offchan_time = limit_off_chan_param->max_offchan_time; |
| 19118 | cmd->rest_time = limit_off_chan_param->rest_time; |
| 19119 | |
| 19120 | WMI_LOGE("%s: vdev_id=%d, flags =%x, max_offchan_time=%d, rest_time=%d", |
| 19121 | __func__, cmd->vdev_id, cmd->flags, cmd->max_offchan_time, |
| 19122 | cmd->rest_time); |
| 19123 | |
| 19124 | err = wmi_unified_cmd_send(wmi_handle, buf, |
| 19125 | len, WMI_VDEV_LIMIT_OFFCHAN_CMDID); |
| 19126 | if (QDF_IS_STATUS_ERROR(err)) { |
| 19127 | WMI_LOGE("Failed to send limit off chan cmd err=%d", err); |
| 19128 | wmi_buf_free(buf); |
| 19129 | return QDF_STATUS_E_FAILURE; |
| 19130 | } |
| 19131 | |
| 19132 | return QDF_STATUS_SUCCESS; |
| 19133 | } |
| 19134 | |
Anurag Chouhan | 97f0042 | 2017-09-11 14:56:30 +0530 | [diff] [blame] | 19135 | /** |
| 19136 | * send_set_arp_stats_req_cmd_tlv() - send wmi cmd to set arp stats request |
| 19137 | * @wmi_handle: wmi handler |
| 19138 | * @req_buf: set arp stats request buffer |
| 19139 | * |
| 19140 | * Return: 0 for success and non zero for failure |
| 19141 | */ |
| 19142 | static QDF_STATUS send_set_arp_stats_req_cmd_tlv(wmi_unified_t wmi_handle, |
| 19143 | struct set_arp_stats *req_buf) |
| 19144 | { |
| 19145 | wmi_buf_t buf = NULL; |
| 19146 | QDF_STATUS status; |
| 19147 | int len; |
| 19148 | uint8_t *buf_ptr; |
| 19149 | wmi_vdev_set_arp_stats_cmd_fixed_param *wmi_set_arp; |
| 19150 | |
| 19151 | len = sizeof(wmi_vdev_set_arp_stats_cmd_fixed_param); |
| 19152 | buf = wmi_buf_alloc(wmi_handle, len); |
| 19153 | if (!buf) { |
| 19154 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 19155 | return QDF_STATUS_E_NOMEM; |
| 19156 | } |
| 19157 | |
| 19158 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 19159 | wmi_set_arp = |
| 19160 | (wmi_vdev_set_arp_stats_cmd_fixed_param *) buf_ptr; |
| 19161 | WMITLV_SET_HDR(&wmi_set_arp->tlv_header, |
| 19162 | WMITLV_TAG_STRUC_wmi_vdev_set_arp_stats_cmd_fixed_param, |
| 19163 | WMITLV_GET_STRUCT_TLVLEN |
| 19164 | (wmi_vdev_set_arp_stats_cmd_fixed_param)); |
| 19165 | |
| 19166 | /* fill in per roam config values */ |
| 19167 | wmi_set_arp->vdev_id = req_buf->vdev_id; |
| 19168 | |
| 19169 | wmi_set_arp->set_clr = req_buf->flag; |
| 19170 | wmi_set_arp->pkt_type = req_buf->pkt_type; |
| 19171 | wmi_set_arp->ipv4 = req_buf->ip_addr; |
| 19172 | |
| 19173 | /* Send per roam config parameters */ |
| 19174 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 19175 | len, WMI_VDEV_SET_ARP_STAT_CMDID); |
| 19176 | if (QDF_IS_STATUS_ERROR(status)) { |
| 19177 | WMI_LOGE("WMI_SET_ARP_STATS_CMDID failed, Error %d", |
| 19178 | status); |
| 19179 | goto error; |
| 19180 | } |
| 19181 | |
| 19182 | WMI_LOGI(FL("set arp stats flag=%d, vdev=%d"), |
| 19183 | req_buf->flag, req_buf->vdev_id); |
| 19184 | return QDF_STATUS_SUCCESS; |
| 19185 | error: |
| 19186 | wmi_buf_free(buf); |
| 19187 | |
| 19188 | return status; |
| 19189 | } |
| 19190 | |
| 19191 | /** |
| 19192 | * send_get_arp_stats_req_cmd_tlv() - send wmi cmd to get arp stats request |
| 19193 | * @wmi_handle: wmi handler |
| 19194 | * @req_buf: get arp stats request buffer |
| 19195 | * |
| 19196 | * Return: 0 for success and non zero for failure |
| 19197 | */ |
| 19198 | static QDF_STATUS send_get_arp_stats_req_cmd_tlv(wmi_unified_t wmi_handle, |
| 19199 | struct get_arp_stats *req_buf) |
| 19200 | { |
| 19201 | wmi_buf_t buf = NULL; |
| 19202 | QDF_STATUS status; |
| 19203 | int len; |
| 19204 | uint8_t *buf_ptr; |
| 19205 | wmi_vdev_get_arp_stats_cmd_fixed_param *get_arp_stats; |
| 19206 | |
| 19207 | len = sizeof(wmi_vdev_get_arp_stats_cmd_fixed_param); |
| 19208 | buf = wmi_buf_alloc(wmi_handle, len); |
| 19209 | if (!buf) { |
| 19210 | WMI_LOGE("%s : wmi_buf_alloc failed", __func__); |
| 19211 | return QDF_STATUS_E_NOMEM; |
| 19212 | } |
| 19213 | |
| 19214 | buf_ptr = (uint8_t *) wmi_buf_data(buf); |
| 19215 | get_arp_stats = |
| 19216 | (wmi_vdev_get_arp_stats_cmd_fixed_param *) buf_ptr; |
| 19217 | WMITLV_SET_HDR(&get_arp_stats->tlv_header, |
| 19218 | WMITLV_TAG_STRUC_wmi_vdev_get_arp_stats_cmd_fixed_param, |
| 19219 | WMITLV_GET_STRUCT_TLVLEN |
| 19220 | (wmi_vdev_get_arp_stats_cmd_fixed_param)); |
| 19221 | |
| 19222 | /* fill in arp stats req cmd values */ |
| 19223 | get_arp_stats->vdev_id = req_buf->vdev_id; |
| 19224 | |
| 19225 | WMI_LOGI(FL("vdev=%d"), req_buf->vdev_id); |
| 19226 | /* Send per roam config parameters */ |
| 19227 | status = wmi_unified_cmd_send(wmi_handle, buf, |
| 19228 | len, WMI_VDEV_GET_ARP_STAT_CMDID); |
| 19229 | if (QDF_IS_STATUS_ERROR(status)) { |
| 19230 | WMI_LOGE("WMI_GET_ARP_STATS_CMDID failed, Error %d", |
| 19231 | status); |
| 19232 | goto error; |
| 19233 | } |
| 19234 | |
| 19235 | return QDF_STATUS_SUCCESS; |
| 19236 | error: |
| 19237 | wmi_buf_free(buf); |
| 19238 | |
| 19239 | return status; |
| 19240 | } |
| 19241 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19242 | struct wmi_ops tlv_ops = { |
| 19243 | .send_vdev_create_cmd = send_vdev_create_cmd_tlv, |
| 19244 | .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, |
| 19245 | .send_vdev_down_cmd = send_vdev_down_cmd_tlv, |
Himanshu Agarwal | 0007b76 | 2016-03-09 16:49:38 +0530 | [diff] [blame] | 19246 | .send_vdev_start_cmd = send_vdev_start_cmd_tlv, |
| 19247 | .send_hidden_ssid_vdev_restart_cmd = |
| 19248 | send_hidden_ssid_vdev_restart_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19249 | .send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv, |
| 19250 | .send_peer_param_cmd = send_peer_param_cmd_tlv, |
| 19251 | .send_vdev_up_cmd = send_vdev_up_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 19252 | .send_vdev_stop_cmd = send_vdev_stop_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19253 | .send_peer_create_cmd = send_peer_create_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 19254 | .send_peer_delete_cmd = send_peer_delete_cmd_tlv, |
Leo Chang | eee4087 | 2016-09-28 13:43:36 -0700 | [diff] [blame] | 19255 | .send_peer_rx_reorder_queue_setup_cmd = |
| 19256 | send_peer_rx_reorder_queue_setup_cmd_tlv, |
| 19257 | .send_peer_rx_reorder_queue_remove_cmd = |
| 19258 | send_peer_rx_reorder_queue_remove_cmd_tlv, |
Ishank Jain | f4b8a7a | 2017-02-23 22:38:42 +0530 | [diff] [blame] | 19259 | .send_peer_add_wds_entry_cmd = send_peer_add_wds_entry_cmd_tlv, |
| 19260 | .send_peer_del_wds_entry_cmd = send_peer_del_wds_entry_cmd_tlv, |
| 19261 | .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] | 19262 | .send_green_ap_ps_cmd = send_green_ap_ps_cmd_tlv, |
| 19263 | .send_pdev_utf_cmd = send_pdev_utf_cmd_tlv, |
| 19264 | .send_pdev_param_cmd = send_pdev_param_cmd_tlv, |
| 19265 | .send_suspend_cmd = send_suspend_cmd_tlv, |
| 19266 | .send_resume_cmd = send_resume_cmd_tlv, |
| 19267 | .send_wow_enable_cmd = send_wow_enable_cmd_tlv, |
| 19268 | .send_set_ap_ps_param_cmd = send_set_ap_ps_param_cmd_tlv, |
| 19269 | .send_set_sta_ps_param_cmd = send_set_sta_ps_param_cmd_tlv, |
| 19270 | .send_crash_inject_cmd = send_crash_inject_cmd_tlv, |
| 19271 | .send_dbglog_cmd = send_dbglog_cmd_tlv, |
| 19272 | .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, |
| 19273 | .send_stats_request_cmd = send_stats_request_cmd_tlv, |
| 19274 | .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, |
Keyur Parekh | de52234 | 2017-08-18 14:01:05 -0700 | [diff] [blame] | 19275 | .send_packet_log_disable_cmd = send_packet_log_disable_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19276 | .send_beacon_send_cmd = send_beacon_send_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 19277 | .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19278 | .send_peer_assoc_cmd = send_peer_assoc_cmd_tlv, |
| 19279 | .send_scan_start_cmd = send_scan_start_cmd_tlv, |
| 19280 | .send_scan_stop_cmd = send_scan_stop_cmd_tlv, |
| 19281 | .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 19282 | .send_mgmt_cmd = send_mgmt_cmd_tlv, |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 19283 | .send_offchan_data_tx_cmd = send_offchan_data_tx_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 19284 | .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, |
| 19285 | .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] | 19286 | .send_set_sta_uapsd_auto_trig_cmd = |
| 19287 | send_set_sta_uapsd_auto_trig_cmd_tlv, |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 19288 | .send_get_temperature_cmd = send_get_temperature_cmd_tlv, |
| 19289 | .send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv, |
| 19290 | .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] | 19291 | #ifdef CONVERGED_P2P_ENABLE |
| 19292 | .send_p2p_lo_start_cmd = send_p2p_lo_start_cmd_tlv, |
| 19293 | .send_p2p_lo_stop_cmd = send_p2p_lo_stop_cmd_tlv, |
| 19294 | #endif |
Govind Singh | 427ee5a | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 19295 | .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, |
| 19296 | .send_set_mimops_cmd = send_set_mimops_cmd_tlv, |
Govind Singh | 2edc80f | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 19297 | .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, |
| 19298 | .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, |
| 19299 | .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, |
| 19300 | .send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv, |
| 19301 | .send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv, |
| 19302 | .send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv, |
| 19303 | .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] | 19304 | .send_ocb_start_timing_advert_cmd = |
| 19305 | send_ocb_start_timing_advert_cmd_tlv, |
Govind Singh | 17a9cfa | 2016-03-01 15:54:59 +0530 | [diff] [blame] | 19306 | .send_set_enable_disable_mcc_adaptive_scheduler_cmd = |
| 19307 | send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, |
| 19308 | .send_set_mcc_channel_time_latency_cmd = |
| 19309 | send_set_mcc_channel_time_latency_cmd_tlv, |
| 19310 | .send_set_mcc_channel_time_quota_cmd = |
| 19311 | send_set_mcc_channel_time_quota_cmd_tlv, |
| 19312 | .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, |
| 19313 | .send_lro_config_cmd = send_lro_config_cmd_tlv, |
Poddar, Siddarth | 98281c4 | 2016-04-28 15:49:11 +0530 | [diff] [blame] | 19314 | .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 19315 | .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, |
| 19316 | .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv, |
| 19317 | .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] | 19318 | .send_probe_rsp_tmpl_send_cmd = |
| 19319 | send_probe_rsp_tmpl_send_cmd_tlv, |
| 19320 | .send_p2p_go_set_beacon_ie_cmd = |
| 19321 | send_p2p_go_set_beacon_ie_cmd_tlv, |
Himanshu Agarwal | 712622f | 2016-03-09 18:49:18 +0530 | [diff] [blame] | 19322 | .send_setup_install_key_cmd = |
| 19323 | send_setup_install_key_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 19324 | .send_set_gateway_params_cmd = |
| 19325 | send_set_gateway_params_cmd_tlv, |
| 19326 | .send_set_rssi_monitoring_cmd = |
| 19327 | send_set_rssi_monitoring_cmd_tlv, |
| 19328 | .send_scan_probe_setoui_cmd = |
| 19329 | send_scan_probe_setoui_cmd_tlv, |
| 19330 | .send_reset_passpoint_network_list_cmd = |
| 19331 | send_reset_passpoint_network_list_cmd_tlv, |
| 19332 | .send_set_passpoint_network_list_cmd = |
| 19333 | send_set_passpoint_network_list_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 19334 | .send_roam_scan_offload_rssi_thresh_cmd = |
| 19335 | send_roam_scan_offload_rssi_thresh_cmd_tlv, |
Varun Reddy Yeturu | 412601c | 2017-07-20 09:45:01 -0700 | [diff] [blame] | 19336 | .send_roam_mawc_params_cmd = send_roam_mawc_params_cmd_tlv, |
Himanshu Agarwal | c5e4d89 | 2016-03-09 15:25:44 +0530 | [diff] [blame] | 19337 | .send_roam_scan_filter_cmd = |
| 19338 | send_roam_scan_filter_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 19339 | .send_set_epno_network_list_cmd = |
| 19340 | send_set_epno_network_list_cmd_tlv, |
| 19341 | .send_ipa_offload_control_cmd = |
| 19342 | send_ipa_offload_control_cmd_tlv, |
| 19343 | .send_extscan_get_capabilities_cmd = |
| 19344 | send_extscan_get_capabilities_cmd_tlv, |
| 19345 | .send_extscan_get_cached_results_cmd = |
| 19346 | send_extscan_get_cached_results_cmd_tlv, |
| 19347 | .send_extscan_stop_change_monitor_cmd = |
| 19348 | send_extscan_stop_change_monitor_cmd_tlv, |
| 19349 | .send_extscan_start_change_monitor_cmd = |
| 19350 | send_extscan_start_change_monitor_cmd_tlv, |
| 19351 | .send_extscan_stop_hotlist_monitor_cmd = |
| 19352 | send_extscan_stop_hotlist_monitor_cmd_tlv, |
| 19353 | .send_stop_extscan_cmd = send_stop_extscan_cmd_tlv, |
| 19354 | .send_start_extscan_cmd = send_start_extscan_cmd_tlv, |
| 19355 | .send_plm_stop_cmd = send_plm_stop_cmd_tlv, |
| 19356 | .send_plm_start_cmd = send_plm_start_cmd_tlv, |
| 19357 | .send_pno_stop_cmd = send_pno_stop_cmd_tlv, |
| 19358 | .send_pno_start_cmd = send_pno_start_cmd_tlv, |
Varun Reddy Yeturu | eac038b | 2017-07-24 16:11:22 -0700 | [diff] [blame] | 19359 | .send_nlo_mawc_cmd = send_nlo_mawc_cmd_tlv, |
Govind Singh | 4eacd2b | 2016-03-07 14:24:22 +0530 | [diff] [blame] | 19360 | .send_set_ric_req_cmd = send_set_ric_req_cmd_tlv, |
| 19361 | .send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv, |
| 19362 | .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, |
| 19363 | .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] | 19364 | .send_congestion_cmd = send_congestion_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19365 | .send_snr_request_cmd = send_snr_request_cmd_tlv, |
| 19366 | .send_snr_cmd = send_snr_cmd_tlv, |
| 19367 | .send_link_status_req_cmd = send_link_status_req_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 19368 | #ifdef WLAN_PMO_ENABLE |
| 19369 | .send_add_wow_wakeup_event_cmd = send_add_wow_wakeup_event_cmd_tlv, |
| 19370 | .send_wow_patterns_to_fw_cmd = send_wow_patterns_to_fw_cmd_tlv, |
| 19371 | .send_enable_arp_ns_offload_cmd = send_enable_arp_ns_offload_cmd_tlv, |
| 19372 | .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] | 19373 | .send_multiple_add_clear_mcbc_filter_cmd = |
| 19374 | send_multiple_add_clear_mcbc_filter_cmd_tlv, |
Dustin Brown | f31f88b | 2017-05-12 14:01:44 -0700 | [diff] [blame] | 19375 | .send_conf_hw_filter_cmd = send_conf_hw_filter_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 19376 | .send_gtk_offload_cmd = send_gtk_offload_cmd_tlv, |
| 19377 | .send_process_gtk_offload_getinfo_cmd = |
| 19378 | send_process_gtk_offload_getinfo_cmd_tlv, |
| 19379 | .send_enable_enhance_multicast_offload_cmd = |
| 19380 | send_enable_enhance_multicast_offload_tlv, |
| 19381 | .extract_gtk_rsp_event = extract_gtk_rsp_event_tlv, |
| 19382 | #ifdef FEATURE_WLAN_RA_FILTERING |
| 19383 | .send_wow_sta_ra_filter_cmd = send_wow_sta_ra_filter_cmd_tlv, |
| 19384 | #endif |
| 19385 | .send_action_frame_patterns_cmd = send_action_frame_patterns_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19386 | .send_lphb_config_hbenable_cmd = send_lphb_config_hbenable_cmd_tlv, |
| 19387 | .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] | 19388 | .send_lphb_config_tcp_pkt_filter_cmd = |
| 19389 | send_lphb_config_tcp_pkt_filter_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19390 | .send_lphb_config_udp_params_cmd = send_lphb_config_udp_params_cmd_tlv, |
| 19391 | .send_lphb_config_udp_pkt_filter_cmd = |
| 19392 | send_lphb_config_udp_pkt_filter_cmd_tlv, |
Ravi Kumar Bokka | 0f3f04d | 2017-04-20 17:14:33 +0530 | [diff] [blame] | 19393 | .send_enable_disable_packet_filter_cmd = |
| 19394 | send_enable_disable_packet_filter_cmd_tlv, |
| 19395 | .send_config_packet_filter_cmd = send_config_packet_filter_cmd_tlv, |
Mukul Sharma | b758ddf | 2017-02-25 01:50:47 +0530 | [diff] [blame] | 19396 | #endif /* End of WLAN_PMO_ENABLE */ |
| 19397 | #ifdef CONFIG_MCL |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19398 | .send_process_dhcp_ind_cmd = send_process_dhcp_ind_cmd_tlv, |
| 19399 | .send_get_link_speed_cmd = send_get_link_speed_cmd_tlv, |
| 19400 | .send_egap_conf_params_cmd = send_egap_conf_params_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 19401 | .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, |
Govind Singh | 8754248 | 2016-06-08 19:40:11 +0530 | [diff] [blame] | 19402 | .send_roam_scan_offload_mode_cmd = |
| 19403 | send_roam_scan_offload_mode_cmd_tlv, |
| 19404 | .send_pktlog_wmi_send_cmd = send_pktlog_wmi_send_cmd_tlv, |
| 19405 | .send_roam_scan_offload_ap_profile_cmd = |
| 19406 | send_roam_scan_offload_ap_profile_cmd_tlv, |
| 19407 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19408 | .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, |
| 19409 | .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19410 | .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, |
| 19411 | .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, |
Naveen Rawat | 42cd1e6 | 2017-05-13 15:56:57 -0700 | [diff] [blame] | 19412 | #ifdef WLAN_FEATURE_CIF_CFR |
| 19413 | .send_oem_dma_cfg_cmd = send_oem_dma_cfg_cmd_tlv, |
| 19414 | #endif |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19415 | .send_dfs_phyerr_filter_offload_en_cmd = |
| 19416 | send_dfs_phyerr_filter_offload_en_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19417 | .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv, |
| 19418 | .send_host_wakeup_ind_to_fw_cmd = send_host_wakeup_ind_to_fw_cmd_tlv, |
| 19419 | .send_del_ts_cmd = send_del_ts_cmd_tlv, |
| 19420 | .send_aggr_qos_cmd = send_aggr_qos_cmd_tlv, |
| 19421 | .send_add_ts_cmd = send_add_ts_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19422 | .send_process_add_periodic_tx_ptrn_cmd = |
| 19423 | send_process_add_periodic_tx_ptrn_cmd_tlv, |
| 19424 | .send_process_del_periodic_tx_ptrn_cmd = |
| 19425 | send_process_del_periodic_tx_ptrn_cmd_tlv, |
| 19426 | .send_stats_ext_req_cmd = send_stats_ext_req_cmd_tlv, |
| 19427 | .send_enable_ext_wow_cmd = send_enable_ext_wow_cmd_tlv, |
| 19428 | .send_set_app_type2_params_in_fw_cmd = |
| 19429 | send_set_app_type2_params_in_fw_cmd_tlv, |
| 19430 | .send_set_auto_shutdown_timer_cmd = |
| 19431 | send_set_auto_shutdown_timer_cmd_tlv, |
| 19432 | .send_nan_req_cmd = send_nan_req_cmd_tlv, |
| 19433 | .send_process_dhcpserver_offload_cmd = |
| 19434 | send_process_dhcpserver_offload_cmd_tlv, |
| 19435 | .send_set_led_flashing_cmd = send_set_led_flashing_cmd_tlv, |
| 19436 | .send_process_ch_avoid_update_cmd = |
| 19437 | send_process_ch_avoid_update_cmd_tlv, |
Kiran Venkatappa | 36445a7 | 2017-02-08 15:02:44 +0530 | [diff] [blame] | 19438 | .send_pdev_set_regdomain_cmd = |
| 19439 | send_pdev_set_regdomain_cmd_tlv, |
Govind Singh | 20c5dac | 2016-03-07 15:33:31 +0530 | [diff] [blame] | 19440 | .send_regdomain_info_to_fw_cmd = send_regdomain_info_to_fw_cmd_tlv, |
| 19441 | .send_set_tdls_offchan_mode_cmd = send_set_tdls_offchan_mode_cmd_tlv, |
| 19442 | .send_update_fw_tdls_state_cmd = send_update_fw_tdls_state_cmd_tlv, |
| 19443 | .send_update_tdls_peer_state_cmd = send_update_tdls_peer_state_cmd_tlv, |
| 19444 | .send_process_fw_mem_dump_cmd = send_process_fw_mem_dump_cmd_tlv, |
| 19445 | .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] | 19446 | #ifdef CONFIG_MCL |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 19447 | .send_init_cmd = send_init_cmd_tlv, |
Himanshu Agarwal | 7c83dcd | 2016-07-19 15:41:51 +0530 | [diff] [blame] | 19448 | #endif |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 19449 | .save_fw_version_cmd = save_fw_version_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19450 | .check_and_update_fw_version = |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 19451 | check_and_update_fw_version_cmd_tlv, |
Govind Singh | 9ddd516 | 2016-03-07 16:30:32 +0530 | [diff] [blame] | 19452 | .send_saved_init_cmd = send_saved_init_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 19453 | .send_set_base_macaddr_indicate_cmd = |
| 19454 | send_set_base_macaddr_indicate_cmd_tlv, |
| 19455 | .send_log_supported_evt_cmd = send_log_supported_evt_cmd_tlv, |
| 19456 | .send_enable_specific_fw_logs_cmd = |
| 19457 | send_enable_specific_fw_logs_cmd_tlv, |
| 19458 | .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] | 19459 | .send_pdev_set_pcl_cmd = send_pdev_set_pcl_cmd_tlv, |
Manishekar Chandrasekaran | 1718378 | 2016-04-27 12:29:16 +0530 | [diff] [blame] | 19460 | .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] | 19461 | .send_pdev_set_dual_mac_config_cmd = |
| 19462 | send_pdev_set_dual_mac_config_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 19463 | .send_app_type1_params_in_fw_cmd = |
| 19464 | send_app_type1_params_in_fw_cmd_tlv, |
| 19465 | .send_set_ssid_hotlist_cmd = send_set_ssid_hotlist_cmd_tlv, |
| 19466 | .send_process_roam_synch_complete_cmd = |
| 19467 | send_process_roam_synch_complete_cmd_tlv, |
| 19468 | .send_unit_test_cmd = send_unit_test_cmd_tlv, |
| 19469 | .send_roam_invoke_cmd = send_roam_invoke_cmd_tlv, |
| 19470 | .send_roam_scan_offload_cmd = send_roam_scan_offload_cmd_tlv, |
Govind Singh | a4836fd | 2016-03-07 16:45:38 +0530 | [diff] [blame] | 19471 | .send_roam_scan_offload_scan_period_cmd = |
| 19472 | send_roam_scan_offload_scan_period_cmd_tlv, |
| 19473 | .send_roam_scan_offload_chan_list_cmd = |
| 19474 | send_roam_scan_offload_chan_list_cmd_tlv, |
| 19475 | .send_roam_scan_offload_rssi_change_cmd = |
| 19476 | send_roam_scan_offload_rssi_change_cmd_tlv, |
| 19477 | .send_get_buf_extscan_hotlist_cmd = |
| 19478 | send_get_buf_extscan_hotlist_cmd_tlv, |
Dustin Brown | 4423f63 | 2017-01-13 15:24:07 -0800 | [diff] [blame] | 19479 | .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] | 19480 | .send_adapt_dwelltime_params_cmd = |
| 19481 | send_adapt_dwelltime_params_cmd_tlv, |
Nitesh Shah | 52323d0 | 2017-05-22 15:49:00 +0530 | [diff] [blame] | 19482 | .send_dbs_scan_sel_params_cmd = |
| 19483 | send_dbs_scan_sel_params_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19484 | .init_cmd_send = init_cmd_send_tlv, |
Sathish Kumar | 497bef4 | 2017-03-01 14:02:36 +0530 | [diff] [blame] | 19485 | .send_smart_ant_enable_cmd = send_smart_ant_enable_cmd_tlv, |
| 19486 | .send_smart_ant_set_rx_ant_cmd = send_smart_ant_set_rx_ant_cmd_tlv, |
| 19487 | .send_set_ctl_table_cmd = send_set_ctl_table_cmd_tlv, |
| 19488 | .send_set_mimogain_table_cmd = send_set_mimogain_table_cmd_tlv, |
| 19489 | .send_packet_power_info_get_cmd = send_packet_power_info_get_cmd_tlv, |
| 19490 | .send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_tlv, |
| 19491 | .send_set_vap_dscp_tid_map_cmd = send_set_vap_dscp_tid_map_cmd_tlv, |
| 19492 | .send_vdev_set_neighbour_rx_cmd = send_vdev_set_neighbour_rx_cmd_tlv, |
| 19493 | .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] | 19494 | .send_set_ant_switch_tbl_cmd = send_set_ant_switch_tbl_cmd_tlv, |
| 19495 | .send_smart_ant_set_training_info_cmd = |
| 19496 | send_smart_ant_set_training_info_cmd_tlv, |
| 19497 | .send_smart_ant_set_node_config_cmd = |
| 19498 | send_smart_ant_set_node_config_cmd_tlv, |
| 19499 | .send_set_atf_cmd = send_set_atf_cmd_tlv, |
| 19500 | .send_vdev_set_fwtest_param_cmd = send_vdev_set_fwtest_param_cmd_tlv, |
| 19501 | .send_set_qboost_param_cmd = send_set_qboost_param_cmd_tlv, |
Sathish Kumar | f6e3e63 | 2017-02-22 17:28:28 +0530 | [diff] [blame] | 19502 | .send_gpio_config_cmd = send_gpio_config_cmd_tlv, |
| 19503 | .send_gpio_output_cmd = send_gpio_output_cmd_tlv, |
| 19504 | .send_phyerr_disable_cmd = send_phyerr_disable_cmd_tlv, |
| 19505 | .send_phyerr_enable_cmd = send_phyerr_enable_cmd_tlv, |
| 19506 | .send_nf_dbr_dbm_info_get_cmd = send_nf_dbr_dbm_info_get_cmd_tlv, |
| 19507 | .send_set_ht_ie_cmd = send_set_ht_ie_cmd_tlv, |
| 19508 | .send_set_vht_ie_cmd = send_set_vht_ie_cmd_tlv, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 19509 | .send_set_quiet_mode_cmd = send_set_quiet_mode_cmd_tlv, |
| 19510 | .send_set_bwf_cmd = send_set_bwf_cmd_tlv, |
| 19511 | .send_mcast_group_update_cmd = send_mcast_group_update_cmd_tlv, |
| 19512 | .send_vdev_spectral_configure_cmd = |
| 19513 | send_vdev_spectral_configure_cmd_tlv, |
| 19514 | .send_vdev_spectral_enable_cmd = |
| 19515 | send_vdev_spectral_enable_cmd_tlv, |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 19516 | .send_thermal_mitigation_param_cmd = |
| 19517 | send_thermal_mitigation_param_cmd_tlv, |
Sathish Kumar | cc5d70d | 2017-03-21 17:37:50 +0530 | [diff] [blame] | 19518 | .send_pdev_qvit_cmd = send_pdev_qvit_cmd_tlv, |
| 19519 | .send_wmm_update_cmd = send_wmm_update_cmd_tlv, |
Vikram Kandukuri | 3bb482b | 2017-06-01 16:47:51 +0530 | [diff] [blame] | 19520 | .send_process_update_edca_param_cmd = |
| 19521 | send_process_update_edca_param_cmd_tlv, |
Sathish Kumar | 80f4f38 | 2017-04-24 11:36:00 +0530 | [diff] [blame] | 19522 | .send_coex_config_cmd = send_coex_config_cmd_tlv, |
Kiran Kumar Lokere | daf91e3 | 2017-04-24 00:56:03 -0700 | [diff] [blame] | 19523 | .send_set_country_cmd = send_set_country_cmd_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19524 | .get_target_cap_from_service_ready = extract_service_ready_tlv, |
| 19525 | .extract_hal_reg_cap = extract_hal_reg_cap_tlv, |
| 19526 | .extract_host_mem_req = extract_host_mem_req_tlv, |
| 19527 | .save_service_bitmap = save_service_bitmap_tlv, |
Kiran Venkatappa | 7d73914 | 2017-09-01 17:02:34 +0530 | [diff] [blame] | 19528 | .save_ext_service_bitmap = save_ext_service_bitmap_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19529 | .is_service_enabled = is_service_enabled_tlv, |
| 19530 | .save_fw_version = save_fw_version_in_service_ready_tlv, |
| 19531 | .ready_extract_init_status = ready_extract_init_status_tlv, |
| 19532 | .ready_extract_mac_addr = ready_extract_mac_addr_tlv, |
Manoj Ekbote | dd27390 | 2017-07-09 23:28:56 -0700 | [diff] [blame] | 19533 | .ready_extract_mac_addr_list = ready_extract_mac_addr_list_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19534 | .extract_dbglog_data_len = extract_dbglog_data_len_tlv, |
| 19535 | .extract_vdev_start_resp = extract_vdev_start_resp_tlv, |
| 19536 | .extract_tbttoffset_update_params = |
| 19537 | extract_tbttoffset_update_params_tlv, |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 19538 | .extract_ext_tbttoffset_update_params = |
| 19539 | extract_ext_tbttoffset_update_params_tlv, |
| 19540 | .extract_tbttoffset_num_vdevs = |
| 19541 | extract_tbttoffset_num_vdevs_tlv, |
| 19542 | .extract_ext_tbttoffset_num_vdevs = |
| 19543 | extract_ext_tbttoffset_num_vdevs_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19544 | .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, |
| 19545 | .extract_vdev_stopped_param = extract_vdev_stopped_param_tlv, |
| 19546 | .extract_vdev_roam_param = extract_vdev_roam_param_tlv, |
| 19547 | .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, |
Frank Liu | 3d5e999 | 2017-03-15 17:51:43 +0800 | [diff] [blame] | 19548 | #ifdef CONVERGED_TDLS_ENABLE |
| 19549 | .extract_vdev_tdls_ev_param = extract_vdev_tdls_ev_param_tlv, |
| 19550 | #endif |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19551 | .extract_mgmt_tx_compl_param = extract_mgmt_tx_compl_param_tlv, |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 19552 | .extract_swba_num_vdevs = extract_swba_num_vdevs_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19553 | .extract_swba_tim_info = extract_swba_tim_info_tlv, |
| 19554 | .extract_swba_noa_info = extract_swba_noa_info_tlv, |
Wu Gao | cd3a851 | 2017-03-13 20:17:34 +0800 | [diff] [blame] | 19555 | #ifdef CONVERGED_P2P_ENABLE |
| 19556 | .extract_p2p_noa_ev_param = extract_p2p_noa_ev_param_tlv, |
| 19557 | .extract_p2p_lo_stop_ev_param = |
| 19558 | extract_p2p_lo_stop_ev_param_tlv, |
| 19559 | #endif |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 19560 | .extract_offchan_data_tx_compl_param = |
| 19561 | extract_offchan_data_tx_compl_param_tlv, |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19562 | .extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv, |
| 19563 | .extract_all_stats_count = extract_all_stats_counts_tlv, |
| 19564 | .extract_pdev_stats = extract_pdev_stats_tlv, |
| 19565 | .extract_pdev_ext_stats = extract_pdev_ext_stats_tlv, |
| 19566 | .extract_vdev_stats = extract_vdev_stats_tlv, |
| 19567 | .extract_peer_stats = extract_peer_stats_tlv, |
| 19568 | .extract_bcnflt_stats = extract_bcnflt_stats_tlv, |
| 19569 | .extract_peer_extd_stats = extract_peer_extd_stats_tlv, |
| 19570 | .extract_chan_stats = extract_chan_stats_tlv, |
| 19571 | .extract_profile_ctx = extract_profile_ctx_tlv, |
| 19572 | .extract_profile_data = extract_profile_data_tlv, |
| 19573 | .extract_chan_info_event = extract_chan_info_event_tlv, |
| 19574 | .extract_channel_hopping_event = extract_channel_hopping_event_tlv, |
Anurag Chouhan | 459e015 | 2016-07-22 20:19:54 +0530 | [diff] [blame] | 19575 | .send_fw_test_cmd = send_fw_test_cmd_tlv, |
Padma, Santhosh Kumar | 8394bae | 2016-09-11 18:24:59 +0530 | [diff] [blame] | 19576 | .send_encrypt_decrypt_send_cmd = |
| 19577 | send_encrypt_decrypt_send_cmd_tlv, |
Manikandan Mohan | 31a13e2 | 2016-12-13 13:14:06 -0800 | [diff] [blame] | 19578 | .send_sar_limit_cmd = send_sar_limit_cmd_tlv, |
Govind Singh | 09523e2 | 2016-09-12 12:29:21 +0530 | [diff] [blame] | 19579 | .send_power_dbg_cmd = send_power_dbg_cmd_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 19580 | .send_multiple_vdev_restart_req_cmd = |
| 19581 | send_multiple_vdev_restart_req_cmd_tlv, |
Kiran Venkatappa | 0652082 | 2016-08-10 23:55:40 +0530 | [diff] [blame] | 19582 | .extract_service_ready_ext = extract_service_ready_ext_tlv, |
| 19583 | .extract_hw_mode_cap_service_ready_ext = |
| 19584 | extract_hw_mode_cap_service_ready_ext_tlv, |
| 19585 | .extract_mac_phy_cap_service_ready_ext = |
| 19586 | extract_mac_phy_cap_service_ready_ext_tlv, |
| 19587 | .extract_reg_cap_service_ready_ext = |
| 19588 | extract_reg_cap_service_ready_ext_tlv, |
Sathish Kumar | 27ee0a3 | 2017-01-24 17:51:26 +0530 | [diff] [blame] | 19589 | .extract_pdev_utf_event = extract_pdev_utf_event_tlv, |
Sarada Prasanna Garnayak | 17b9e9e | 2017-01-05 19:30:07 +0530 | [diff] [blame] | 19590 | .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_tlv, |
Kiran Venkatappa | fea8a80 | 2016-12-29 18:09:32 +0530 | [diff] [blame] | 19591 | .extract_dcs_interference_type = extract_dcs_interference_type_tlv, |
| 19592 | .extract_dcs_cw_int = extract_dcs_cw_int_tlv, |
| 19593 | .extract_dcs_im_tgt_stats = extract_dcs_im_tgt_stats_tlv, |
Kiran Venkatappa | c813ec9 | 2016-12-29 22:07:14 +0530 | [diff] [blame] | 19594 | .extract_fips_event_data = extract_fips_event_data_tlv, |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 19595 | .send_pdev_fips_cmd = send_pdev_fips_cmd_tlv, |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 19596 | .extract_peer_delete_response_event = |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 19597 | extract_peer_delete_response_event_tlv, |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 19598 | .is_management_record = is_management_record_tlv, |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 19599 | .extract_pdev_csa_switch_count_status = |
| 19600 | extract_pdev_csa_switch_count_status_tlv, |
Sathish Kumar | d3ab100 | 2017-02-07 17:10:59 +0530 | [diff] [blame] | 19601 | .extract_pdev_tpc_ev_param = extract_pdev_tpc_ev_param_tlv, |
| 19602 | .extract_wds_addr_event = extract_wds_addr_event_tlv, |
| 19603 | .extract_peer_sta_ps_statechange_ev = |
| 19604 | extract_peer_sta_ps_statechange_ev_tlv, |
| 19605 | .extract_inst_rssi_stats_event = extract_inst_rssi_stats_event_tlv, |
Kapil Gupta | 54ea36e | 2017-02-24 15:50:03 +0530 | [diff] [blame] | 19606 | .send_per_roam_config_cmd = send_per_roam_config_cmd_tlv, |
Arif Hussain | f00be1d | 2017-01-07 18:21:55 -0800 | [diff] [blame] | 19607 | .send_dfs_phyerr_offload_en_cmd = send_dfs_phyerr_offload_en_cmd_tlv, |
| 19608 | .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] | 19609 | .extract_reg_chan_list_update_event = |
Vikram Kandukuri | 45fc858 | 2017-03-07 18:40:13 +0530 | [diff] [blame] | 19610 | extract_reg_chan_list_update_event_tlv, |
| 19611 | .extract_chainmask_tables = |
| 19612 | extract_chainmask_tables_tlv, |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 19613 | .extract_thermal_stats = extract_thermal_stats_tlv, |
| 19614 | .extract_thermal_level_stats = extract_thermal_level_stats_tlv, |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 19615 | #ifdef DFS_COMPONENT_ENABLE |
| 19616 | .extract_dfs_cac_complete_event = extract_dfs_cac_complete_event_tlv, |
| 19617 | .extract_dfs_radar_detection_event = |
| 19618 | extract_dfs_radar_detection_event_tlv, |
| 19619 | #endif |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 19620 | .convert_pdev_id_host_to_target = |
| 19621 | convert_host_pdev_id_to_target_pdev_id_legacy, |
| 19622 | .convert_pdev_id_target_to_host = |
| 19623 | convert_target_pdev_id_to_host_pdev_id_legacy, |
Kiran Kumar Lokere | b12cf5c | 2017-04-26 19:51:29 -0700 | [diff] [blame] | 19624 | |
| 19625 | .send_start_11d_scan_cmd = send_start_11d_scan_cmd_tlv, |
| 19626 | .send_stop_11d_scan_cmd = send_stop_11d_scan_cmd_tlv, |
| 19627 | .extract_reg_11d_new_country_event = |
| 19628 | extract_reg_11d_new_country_event_tlv, |
Abhijit Pradhan | d38a269 | 2017-06-29 12:32:20 +0530 | [diff] [blame] | 19629 | .send_user_country_code_cmd = send_user_country_code_cmd_tlv, |
Ganesh Kondabattini | 40252f5 | 2017-07-10 11:54:11 +0530 | [diff] [blame] | 19630 | .send_limit_off_chan_cmd = |
| 19631 | send_limit_off_chan_cmd_tlv, |
Kiran Kumar Lokere | ec65bb4 | 2017-06-30 19:13:02 -0700 | [diff] [blame] | 19632 | .extract_reg_ch_avoid_event = |
| 19633 | extract_reg_ch_avoid_event_tlv, |
Anurag Chouhan | 97f0042 | 2017-09-11 14:56:30 +0530 | [diff] [blame] | 19634 | .send_set_arp_stats_req_cmd = send_set_arp_stats_req_cmd_tlv, |
| 19635 | .send_get_arp_stats_req_cmd = send_get_arp_stats_req_cmd_tlv, |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 19636 | }; |
| 19637 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19638 | /** |
| 19639 | * populate_tlv_event_id() - populates wmi event ids |
| 19640 | * |
| 19641 | * @param event_ids: Pointer to hold event ids |
| 19642 | * Return: None |
| 19643 | */ |
| 19644 | static void populate_tlv_events_id(uint32_t *event_ids) |
| 19645 | { |
| 19646 | event_ids[wmi_service_ready_event_id] = WMI_SERVICE_READY_EVENTID; |
| 19647 | event_ids[wmi_ready_event_id] = WMI_READY_EVENTID; |
| 19648 | event_ids[wmi_scan_event_id] = WMI_SCAN_EVENTID; |
| 19649 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 19650 | event_ids[wmi_chan_info_event_id] = WMI_CHAN_INFO_EVENTID; |
| 19651 | event_ids[wmi_phyerr_event_id] = WMI_PHYERR_EVENTID; |
| 19652 | event_ids[wmi_pdev_dump_event_id] = WMI_PDEV_DUMP_EVENTID; |
| 19653 | event_ids[wmi_tx_pause_event_id] = WMI_TX_PAUSE_EVENTID; |
| 19654 | event_ids[wmi_dfs_radar_event_id] = WMI_DFS_RADAR_EVENTID; |
| 19655 | event_ids[wmi_pdev_l1ss_track_event_id] = WMI_PDEV_L1SS_TRACK_EVENTID; |
| 19656 | event_ids[wmi_pdev_temperature_event_id] = WMI_PDEV_TEMPERATURE_EVENTID; |
| 19657 | event_ids[wmi_service_ready_ext_event_id] = |
| 19658 | WMI_SERVICE_READY_EXT_EVENTID; |
| 19659 | event_ids[wmi_vdev_start_resp_event_id] = WMI_VDEV_START_RESP_EVENTID; |
| 19660 | event_ids[wmi_vdev_stopped_event_id] = WMI_VDEV_STOPPED_EVENTID; |
| 19661 | event_ids[wmi_vdev_install_key_complete_event_id] = |
| 19662 | WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID; |
| 19663 | event_ids[wmi_vdev_mcc_bcn_intvl_change_req_event_id] = |
| 19664 | WMI_VDEV_MCC_BCN_INTERVAL_CHANGE_REQ_EVENTID; |
| 19665 | |
| 19666 | event_ids[wmi_vdev_tsf_report_event_id] = WMI_VDEV_TSF_REPORT_EVENTID; |
| 19667 | event_ids[wmi_peer_sta_kickout_event_id] = WMI_PEER_STA_KICKOUT_EVENTID; |
| 19668 | event_ids[wmi_peer_info_event_id] = WMI_PEER_INFO_EVENTID; |
| 19669 | event_ids[wmi_peer_tx_fail_cnt_thr_event_id] = |
| 19670 | WMI_PEER_TX_FAIL_CNT_THR_EVENTID; |
| 19671 | event_ids[wmi_peer_estimated_linkspeed_event_id] = |
| 19672 | WMI_PEER_ESTIMATED_LINKSPEED_EVENTID; |
| 19673 | event_ids[wmi_peer_state_event_id] = WMI_PEER_STATE_EVENTID; |
Vijay Pamidipati | d814b8d | 2017-01-17 12:53:05 +0530 | [diff] [blame] | 19674 | event_ids[wmi_peer_delete_response_event_id] = |
| 19675 | WMI_PEER_DELETE_RESP_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19676 | event_ids[wmi_mgmt_rx_event_id] = WMI_MGMT_RX_EVENTID; |
| 19677 | event_ids[wmi_host_swba_event_id] = WMI_HOST_SWBA_EVENTID; |
| 19678 | event_ids[wmi_tbttoffset_update_event_id] = |
| 19679 | WMI_TBTTOFFSET_UPDATE_EVENTID; |
Sathish Kumar | e5f0e0e | 2017-05-17 18:05:15 +0530 | [diff] [blame] | 19680 | event_ids[wmi_ext_tbttoffset_update_event_id] = |
| 19681 | WMI_TBTTOFFSET_EXT_UPDATE_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19682 | event_ids[wmi_offload_bcn_tx_status_event_id] = |
| 19683 | WMI_OFFLOAD_BCN_TX_STATUS_EVENTID; |
| 19684 | event_ids[wmi_offload_prob_resp_tx_status_event_id] = |
| 19685 | WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID; |
| 19686 | event_ids[wmi_mgmt_tx_completion_event_id] = |
| 19687 | WMI_MGMT_TX_COMPLETION_EVENTID; |
| 19688 | |
| 19689 | event_ids[wmi_tx_delba_complete_event_id] = |
| 19690 | WMI_TX_DELBA_COMPLETE_EVENTID; |
| 19691 | event_ids[wmi_tx_addba_complete_event_id] = |
| 19692 | WMI_TX_ADDBA_COMPLETE_EVENTID; |
| 19693 | event_ids[wmi_ba_rsp_ssn_event_id] = WMI_BA_RSP_SSN_EVENTID; |
| 19694 | |
| 19695 | event_ids[wmi_aggr_state_trig_event_id] = WMI_AGGR_STATE_TRIG_EVENTID; |
| 19696 | |
| 19697 | event_ids[wmi_roam_event_id] = WMI_ROAM_EVENTID; |
| 19698 | event_ids[wmi_profile_match] = WMI_PROFILE_MATCH; |
| 19699 | |
| 19700 | event_ids[wmi_roam_synch_event_id] = WMI_ROAM_SYNCH_EVENTID; |
| 19701 | |
| 19702 | event_ids[wmi_p2p_disc_event_id] = WMI_P2P_DISC_EVENTID; |
| 19703 | |
| 19704 | event_ids[wmi_p2p_noa_event_id] = WMI_P2P_NOA_EVENTID; |
Wu Gao | 84ed340 | 2017-03-15 19:12:20 +0800 | [diff] [blame] | 19705 | event_ids[wmi_p2p_lo_stop_event_id] = |
| 19706 | WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19707 | event_ids[wmi_pdev_resume_event_id] = WMI_PDEV_RESUME_EVENTID; |
| 19708 | event_ids[wmi_wow_wakeup_host_event_id] = WMI_WOW_WAKEUP_HOST_EVENTID; |
| 19709 | event_ids[wmi_do_wow_disable_ack_event_id] = |
| 19710 | WMI_D0_WOW_DISABLE_ACK_EVENTID; |
| 19711 | event_ids[wmi_wow_initial_wakeup_event_id] = |
| 19712 | WMI_WOW_INITIAL_WAKEUP_EVENTID; |
| 19713 | |
| 19714 | event_ids[wmi_rtt_meas_report_event_id] = |
| 19715 | WMI_RTT_MEASUREMENT_REPORT_EVENTID; |
| 19716 | event_ids[wmi_tsf_meas_report_event_id] = |
| 19717 | WMI_TSF_MEASUREMENT_REPORT_EVENTID; |
| 19718 | event_ids[wmi_rtt_error_report_event_id] = WMI_RTT_ERROR_REPORT_EVENTID; |
| 19719 | event_ids[wmi_stats_ext_event_id] = WMI_STATS_EXT_EVENTID; |
| 19720 | event_ids[wmi_iface_link_stats_event_id] = WMI_IFACE_LINK_STATS_EVENTID; |
| 19721 | event_ids[wmi_peer_link_stats_event_id] = WMI_PEER_LINK_STATS_EVENTID; |
| 19722 | event_ids[wmi_radio_link_stats_link] = WMI_RADIO_LINK_STATS_EVENTID; |
| 19723 | event_ids[wmi_update_fw_mem_dump_event_id] = |
| 19724 | WMI_UPDATE_FW_MEM_DUMP_EVENTID; |
| 19725 | event_ids[wmi_diag_event_id_log_supported_event_id] = |
| 19726 | WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID; |
| 19727 | event_ids[wmi_nlo_match_event_id] = WMI_NLO_MATCH_EVENTID; |
| 19728 | event_ids[wmi_nlo_scan_complete_event_id] = |
| 19729 | WMI_NLO_SCAN_COMPLETE_EVENTID; |
| 19730 | event_ids[wmi_apfind_event_id] = WMI_APFIND_EVENTID; |
| 19731 | event_ids[wmi_passpoint_match_event_id] = WMI_PASSPOINT_MATCH_EVENTID; |
| 19732 | |
| 19733 | event_ids[wmi_gtk_offload_status_event_id] = |
| 19734 | WMI_GTK_OFFLOAD_STATUS_EVENTID; |
| 19735 | event_ids[wmi_gtk_rekey_fail_event_id] = WMI_GTK_REKEY_FAIL_EVENTID; |
| 19736 | event_ids[wmi_csa_handling_event_id] = WMI_CSA_HANDLING_EVENTID; |
| 19737 | event_ids[wmi_chatter_pc_query_event_id] = WMI_CHATTER_PC_QUERY_EVENTID; |
| 19738 | |
| 19739 | event_ids[wmi_echo_event_id] = WMI_ECHO_EVENTID; |
| 19740 | |
| 19741 | event_ids[wmi_pdev_utf_event_id] = WMI_PDEV_UTF_EVENTID; |
| 19742 | |
| 19743 | event_ids[wmi_dbg_msg_event_id] = WMI_DEBUG_MESG_EVENTID; |
| 19744 | event_ids[wmi_update_stats_event_id] = WMI_UPDATE_STATS_EVENTID; |
| 19745 | event_ids[wmi_debug_print_event_id] = WMI_DEBUG_PRINT_EVENTID; |
| 19746 | event_ids[wmi_dcs_interference_event_id] = WMI_DCS_INTERFERENCE_EVENTID; |
| 19747 | event_ids[wmi_pdev_qvit_event_id] = WMI_PDEV_QVIT_EVENTID; |
| 19748 | event_ids[wmi_wlan_profile_data_event_id] = |
| 19749 | WMI_WLAN_PROFILE_DATA_EVENTID; |
| 19750 | event_ids[wmi_pdev_ftm_intg_event_id] = WMI_PDEV_FTM_INTG_EVENTID; |
| 19751 | event_ids[wmi_wlan_freq_avoid_event_id] = WMI_WLAN_FREQ_AVOID_EVENTID; |
| 19752 | event_ids[wmi_vdev_get_keepalive_event_id] = |
| 19753 | WMI_VDEV_GET_KEEPALIVE_EVENTID; |
| 19754 | event_ids[wmi_thermal_mgmt_event_id] = WMI_THERMAL_MGMT_EVENTID; |
| 19755 | |
| 19756 | event_ids[wmi_diag_container_event_id] = |
| 19757 | WMI_DIAG_DATA_CONTAINER_EVENTID; |
| 19758 | |
| 19759 | event_ids[wmi_host_auto_shutdown_event_id] = |
| 19760 | WMI_HOST_AUTO_SHUTDOWN_EVENTID; |
| 19761 | |
| 19762 | event_ids[wmi_update_whal_mib_stats_event_id] = |
| 19763 | WMI_UPDATE_WHAL_MIB_STATS_EVENTID; |
| 19764 | |
| 19765 | /*update ht/vht info based on vdev (rx and tx NSS and preamble) */ |
| 19766 | event_ids[wmi_update_vdev_rate_stats_event_id] = |
| 19767 | WMI_UPDATE_VDEV_RATE_STATS_EVENTID; |
| 19768 | |
| 19769 | event_ids[wmi_diag_event_id] = WMI_DIAG_EVENTID; |
| 19770 | |
| 19771 | /** Set OCB Sched Response, deprecated */ |
| 19772 | event_ids[wmi_ocb_set_sched_event_id] = WMI_OCB_SET_SCHED_EVENTID; |
| 19773 | |
| 19774 | event_ids[wmi_dbg_mesg_flush_complete_event_id] = |
| 19775 | WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID; |
| 19776 | event_ids[wmi_rssi_breach_event_id] = WMI_RSSI_BREACH_EVENTID; |
| 19777 | |
| 19778 | /* GPIO Event */ |
| 19779 | event_ids[wmi_gpio_input_event_id] = WMI_GPIO_INPUT_EVENTID; |
| 19780 | event_ids[wmi_uploadh_event_id] = WMI_UPLOADH_EVENTID; |
| 19781 | |
| 19782 | event_ids[wmi_captureh_event_id] = WMI_CAPTUREH_EVENTID; |
| 19783 | event_ids[wmi_rfkill_state_change_event_id] = |
| 19784 | WMI_RFKILL_STATE_CHANGE_EVENTID; |
| 19785 | |
| 19786 | /* TDLS Event */ |
| 19787 | event_ids[wmi_tdls_peer_event_id] = WMI_TDLS_PEER_EVENTID; |
| 19788 | |
| 19789 | event_ids[wmi_batch_scan_enabled_event_id] = |
| 19790 | WMI_BATCH_SCAN_ENABLED_EVENTID; |
| 19791 | event_ids[wmi_batch_scan_result_event_id] = |
| 19792 | WMI_BATCH_SCAN_RESULT_EVENTID; |
| 19793 | /* OEM Event */ |
| 19794 | event_ids[wmi_oem_cap_event_id] = WMI_OEM_CAPABILITY_EVENTID; |
| 19795 | event_ids[wmi_oem_meas_report_event_id] = |
| 19796 | WMI_OEM_MEASUREMENT_REPORT_EVENTID; |
| 19797 | event_ids[wmi_oem_report_event_id] = WMI_OEM_ERROR_REPORT_EVENTID; |
| 19798 | |
| 19799 | /* NAN Event */ |
| 19800 | event_ids[wmi_nan_event_id] = WMI_NAN_EVENTID; |
| 19801 | |
| 19802 | /* LPI Event */ |
| 19803 | event_ids[wmi_lpi_result_event_id] = WMI_LPI_RESULT_EVENTID; |
| 19804 | event_ids[wmi_lpi_status_event_id] = WMI_LPI_STATUS_EVENTID; |
| 19805 | event_ids[wmi_lpi_handoff_event_id] = WMI_LPI_HANDOFF_EVENTID; |
| 19806 | |
| 19807 | /* ExtScan events */ |
| 19808 | event_ids[wmi_extscan_start_stop_event_id] = |
| 19809 | WMI_EXTSCAN_START_STOP_EVENTID; |
| 19810 | event_ids[wmi_extscan_operation_event_id] = |
| 19811 | WMI_EXTSCAN_OPERATION_EVENTID; |
| 19812 | event_ids[wmi_extscan_table_usage_event_id] = |
| 19813 | WMI_EXTSCAN_TABLE_USAGE_EVENTID; |
| 19814 | event_ids[wmi_extscan_cached_results_event_id] = |
| 19815 | WMI_EXTSCAN_CACHED_RESULTS_EVENTID; |
| 19816 | event_ids[wmi_extscan_wlan_change_results_event_id] = |
| 19817 | WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID; |
| 19818 | event_ids[wmi_extscan_hotlist_match_event_id] = |
| 19819 | WMI_EXTSCAN_HOTLIST_MATCH_EVENTID; |
| 19820 | event_ids[wmi_extscan_capabilities_event_id] = |
| 19821 | WMI_EXTSCAN_CAPABILITIES_EVENTID; |
| 19822 | event_ids[wmi_extscan_hotlist_ssid_match_event_id] = |
| 19823 | WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID; |
| 19824 | |
| 19825 | /* mDNS offload events */ |
| 19826 | event_ids[wmi_mdns_stats_event_id] = WMI_MDNS_STATS_EVENTID; |
| 19827 | |
| 19828 | /* SAP Authentication offload events */ |
| 19829 | event_ids[wmi_sap_ofl_add_sta_event_id] = WMI_SAP_OFL_ADD_STA_EVENTID; |
| 19830 | event_ids[wmi_sap_ofl_del_sta_event_id] = WMI_SAP_OFL_DEL_STA_EVENTID; |
| 19831 | |
| 19832 | /** Out-of-context-of-bss (OCB) events */ |
| 19833 | event_ids[wmi_ocb_set_config_resp_event_id] = |
| 19834 | WMI_OCB_SET_CONFIG_RESP_EVENTID; |
| 19835 | event_ids[wmi_ocb_get_tsf_timer_resp_event_id] = |
| 19836 | WMI_OCB_GET_TSF_TIMER_RESP_EVENTID; |
| 19837 | event_ids[wmi_dcc_get_stats_resp_event_id] = |
| 19838 | WMI_DCC_GET_STATS_RESP_EVENTID; |
| 19839 | event_ids[wmi_dcc_update_ndl_resp_event_id] = |
| 19840 | WMI_DCC_UPDATE_NDL_RESP_EVENTID; |
| 19841 | event_ids[wmi_dcc_stats_event_id] = WMI_DCC_STATS_EVENTID; |
| 19842 | /* System-On-Chip events */ |
| 19843 | event_ids[wmi_soc_set_hw_mode_resp_event_id] = |
| 19844 | WMI_SOC_SET_HW_MODE_RESP_EVENTID; |
| 19845 | event_ids[wmi_soc_hw_mode_transition_event_id] = |
| 19846 | WMI_SOC_HW_MODE_TRANSITION_EVENTID; |
| 19847 | event_ids[wmi_soc_set_dual_mac_config_resp_event_id] = |
| 19848 | WMI_SOC_SET_DUAL_MAC_CONFIG_RESP_EVENTID; |
Nandha Kishore Easwaran | df989dc | 2017-01-09 21:33:00 +0530 | [diff] [blame] | 19849 | event_ids[wmi_pdev_fips_event_id] = WMI_PDEV_FIPS_EVENTID; |
Sathish Kumar | 45e991b | 2017-02-27 10:35:40 +0530 | [diff] [blame] | 19850 | event_ids[wmi_pdev_csa_switch_count_status_event_id] = |
| 19851 | WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID; |
Baila, Shashikala Prabhu | 4150902 | 2017-03-17 10:21:14 +0530 | [diff] [blame] | 19852 | 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] | 19853 | event_ids[wmi_inst_rssi_stats_event_id] = WMI_INST_RSSI_STATS_EVENTID; |
| 19854 | event_ids[wmi_pdev_tpc_config_event_id] = WMI_PDEV_TPC_CONFIG_EVENTID; |
| 19855 | event_ids[wmi_peer_sta_ps_statechg_event_id] = |
| 19856 | WMI_PEER_STA_PS_STATECHG_EVENTID; |
| 19857 | event_ids[wmi_pdev_channel_hopping_event_id] = |
| 19858 | WMI_PDEV_CHANNEL_HOPPING_EVENTID; |
Kiran Venkatappa | c13fc7b | 2017-03-19 22:58:09 +0530 | [diff] [blame] | 19859 | event_ids[wmi_offchan_data_tx_completion_event] = |
| 19860 | WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID; |
Arif Hussain | be58b4e | 2017-04-09 01:03:19 -0700 | [diff] [blame] | 19861 | event_ids[wmi_dfs_cac_complete_id] = WMI_VDEV_DFS_CAC_COMPLETE_EVENTID; |
| 19862 | event_ids[wmi_dfs_radar_detection_event_id] = |
| 19863 | WMI_PDEV_DFS_RADAR_DETECTION_EVENTID; |
Om Prakash Tripathi | c569cdb | 2017-04-19 16:57:31 +0530 | [diff] [blame] | 19864 | event_ids[wmi_tt_stats_event_id] = WMI_THERM_THROT_STATS_EVENTID; |
Amar Singhal | 7db15c8 | 2017-05-19 16:39:34 -0700 | [diff] [blame] | 19865 | 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] | 19866 | event_ids[wmi_pdev_tpc_event_id] = WMI_PDEV_TPC_EVENTID; |
Anurag Chouhan | 97f0042 | 2017-09-11 14:56:30 +0530 | [diff] [blame] | 19867 | 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] | 19868 | event_ids[wmi_service_available_event_id] = |
| 19869 | WMI_SERVICE_AVAILABLE_EVENTID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 19870 | } |
| 19871 | |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 19872 | #ifndef CONFIG_MCL |
| 19873 | /** |
| 19874 | * populate_tlv_service() - populates wmi services |
| 19875 | * |
| 19876 | * @param wmi_service: Pointer to hold wmi_service |
| 19877 | * Return: None |
| 19878 | */ |
| 19879 | static void populate_tlv_service(uint32_t *wmi_service) |
| 19880 | { |
| 19881 | wmi_service[wmi_service_beacon_offload] = WMI_SERVICE_BEACON_OFFLOAD; |
Sathish Kumar | eefe27e | 2017-10-04 09:58:00 +0530 | [diff] [blame] | 19882 | wmi_service[wmi_service_ack_timeout] = WMI_SERVICE_ACK_TIMEOUT; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 19883 | wmi_service[wmi_service_scan_offload] = WMI_SERVICE_SCAN_OFFLOAD; |
| 19884 | wmi_service[wmi_service_roam_scan_offload] = |
| 19885 | WMI_SERVICE_ROAM_SCAN_OFFLOAD; |
| 19886 | wmi_service[wmi_service_bcn_miss_offload] = |
| 19887 | WMI_SERVICE_BCN_MISS_OFFLOAD; |
| 19888 | wmi_service[wmi_service_sta_pwrsave] = WMI_SERVICE_STA_PWRSAVE; |
| 19889 | wmi_service[wmi_service_sta_advanced_pwrsave] = |
| 19890 | WMI_SERVICE_STA_ADVANCED_PWRSAVE; |
| 19891 | wmi_service[wmi_service_ap_uapsd] = WMI_SERVICE_AP_UAPSD; |
| 19892 | wmi_service[wmi_service_ap_dfs] = WMI_SERVICE_AP_DFS; |
| 19893 | wmi_service[wmi_service_11ac] = WMI_SERVICE_11AC; |
| 19894 | wmi_service[wmi_service_blockack] = WMI_SERVICE_BLOCKACK; |
| 19895 | wmi_service[wmi_service_phyerr] = WMI_SERVICE_PHYERR; |
| 19896 | wmi_service[wmi_service_bcn_filter] = WMI_SERVICE_BCN_FILTER; |
| 19897 | wmi_service[wmi_service_rtt] = WMI_SERVICE_RTT; |
| 19898 | wmi_service[wmi_service_wow] = WMI_SERVICE_WOW; |
| 19899 | wmi_service[wmi_service_ratectrl_cache] = WMI_SERVICE_RATECTRL_CACHE; |
| 19900 | wmi_service[wmi_service_iram_tids] = WMI_SERVICE_IRAM_TIDS; |
| 19901 | wmi_service[wmi_service_arpns_offload] = WMI_SERVICE_ARPNS_OFFLOAD; |
| 19902 | wmi_service[wmi_service_nlo] = WMI_SERVICE_NLO; |
| 19903 | wmi_service[wmi_service_gtk_offload] = WMI_SERVICE_GTK_OFFLOAD; |
| 19904 | wmi_service[wmi_service_scan_sch] = WMI_SERVICE_SCAN_SCH; |
| 19905 | wmi_service[wmi_service_csa_offload] = WMI_SERVICE_CSA_OFFLOAD; |
| 19906 | wmi_service[wmi_service_chatter] = WMI_SERVICE_CHATTER; |
| 19907 | wmi_service[wmi_service_coex_freqavoid] = WMI_SERVICE_COEX_FREQAVOID; |
| 19908 | wmi_service[wmi_service_packet_power_save] = |
| 19909 | WMI_SERVICE_PACKET_POWER_SAVE; |
| 19910 | wmi_service[wmi_service_force_fw_hang] = WMI_SERVICE_FORCE_FW_HANG; |
| 19911 | wmi_service[wmi_service_gpio] = WMI_SERVICE_GPIO; |
| 19912 | wmi_service[wmi_service_sta_dtim_ps_modulated_dtim] = |
| 19913 | WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM; |
| 19914 | wmi_service[wmi_sta_uapsd_basic_auto_trig] = |
| 19915 | WMI_STA_UAPSD_BASIC_AUTO_TRIG; |
| 19916 | wmi_service[wmi_sta_uapsd_var_auto_trig] = WMI_STA_UAPSD_VAR_AUTO_TRIG; |
| 19917 | wmi_service[wmi_service_sta_keep_alive] = WMI_SERVICE_STA_KEEP_ALIVE; |
| 19918 | wmi_service[wmi_service_tx_encap] = WMI_SERVICE_TX_ENCAP; |
| 19919 | wmi_service[wmi_service_ap_ps_detect_out_of_sync] = |
| 19920 | WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC; |
| 19921 | wmi_service[wmi_service_early_rx] = WMI_SERVICE_EARLY_RX; |
| 19922 | wmi_service[wmi_service_sta_smps] = WMI_SERVICE_STA_SMPS; |
| 19923 | wmi_service[wmi_service_fwtest] = WMI_SERVICE_FWTEST; |
| 19924 | wmi_service[wmi_service_sta_wmmac] = WMI_SERVICE_STA_WMMAC; |
| 19925 | wmi_service[wmi_service_tdls] = WMI_SERVICE_TDLS; |
| 19926 | wmi_service[wmi_service_burst] = WMI_SERVICE_BURST; |
| 19927 | wmi_service[wmi_service_mcc_bcn_interval_change] = |
| 19928 | WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE; |
| 19929 | wmi_service[wmi_service_adaptive_ocs] = WMI_SERVICE_ADAPTIVE_OCS; |
| 19930 | wmi_service[wmi_service_ba_ssn_support] = WMI_SERVICE_BA_SSN_SUPPORT; |
| 19931 | wmi_service[wmi_service_filter_ipsec_natkeepalive] = |
| 19932 | WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE; |
| 19933 | wmi_service[wmi_service_wlan_hb] = WMI_SERVICE_WLAN_HB; |
| 19934 | wmi_service[wmi_service_lte_ant_share_support] = |
| 19935 | WMI_SERVICE_LTE_ANT_SHARE_SUPPORT; |
| 19936 | wmi_service[wmi_service_batch_scan] = WMI_SERVICE_BATCH_SCAN; |
| 19937 | wmi_service[wmi_service_qpower] = WMI_SERVICE_QPOWER; |
| 19938 | wmi_service[wmi_service_plmreq] = WMI_SERVICE_PLMREQ; |
| 19939 | wmi_service[wmi_service_thermal_mgmt] = WMI_SERVICE_THERMAL_MGMT; |
| 19940 | wmi_service[wmi_service_rmc] = WMI_SERVICE_RMC; |
| 19941 | wmi_service[wmi_service_mhf_offload] = WMI_SERVICE_MHF_OFFLOAD; |
| 19942 | wmi_service[wmi_service_coex_sar] = WMI_SERVICE_COEX_SAR; |
| 19943 | wmi_service[wmi_service_bcn_txrate_override] = |
| 19944 | WMI_SERVICE_BCN_TXRATE_OVERRIDE; |
| 19945 | wmi_service[wmi_service_nan] = WMI_SERVICE_NAN; |
| 19946 | wmi_service[wmi_service_l1ss_stat] = WMI_SERVICE_L1SS_STAT; |
| 19947 | wmi_service[wmi_service_estimate_linkspeed] = |
| 19948 | WMI_SERVICE_ESTIMATE_LINKSPEED; |
| 19949 | wmi_service[wmi_service_obss_scan] = WMI_SERVICE_OBSS_SCAN; |
| 19950 | wmi_service[wmi_service_tdls_offchan] = WMI_SERVICE_TDLS_OFFCHAN; |
| 19951 | wmi_service[wmi_service_tdls_uapsd_buffer_sta] = |
| 19952 | WMI_SERVICE_TDLS_UAPSD_BUFFER_STA; |
| 19953 | wmi_service[wmi_service_tdls_uapsd_sleep_sta] = |
| 19954 | WMI_SERVICE_TDLS_UAPSD_SLEEP_STA; |
| 19955 | wmi_service[wmi_service_ibss_pwrsave] = WMI_SERVICE_IBSS_PWRSAVE; |
| 19956 | wmi_service[wmi_service_lpass] = WMI_SERVICE_LPASS; |
| 19957 | wmi_service[wmi_service_extscan] = WMI_SERVICE_EXTSCAN; |
| 19958 | wmi_service[wmi_service_d0wow] = WMI_SERVICE_D0WOW; |
| 19959 | wmi_service[wmi_service_hsoffload] = WMI_SERVICE_HSOFFLOAD; |
| 19960 | wmi_service[wmi_service_roam_ho_offload] = WMI_SERVICE_ROAM_HO_OFFLOAD; |
| 19961 | wmi_service[wmi_service_rx_full_reorder] = WMI_SERVICE_RX_FULL_REORDER; |
| 19962 | wmi_service[wmi_service_dhcp_offload] = WMI_SERVICE_DHCP_OFFLOAD; |
| 19963 | wmi_service[wmi_service_sta_rx_ipa_offload_support] = |
| 19964 | WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT; |
| 19965 | wmi_service[wmi_service_mdns_offload] = WMI_SERVICE_MDNS_OFFLOAD; |
| 19966 | wmi_service[wmi_service_sap_auth_offload] = |
| 19967 | WMI_SERVICE_SAP_AUTH_OFFLOAD; |
| 19968 | wmi_service[wmi_service_dual_band_simultaneous_support] = |
| 19969 | WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT; |
| 19970 | wmi_service[wmi_service_ocb] = WMI_SERVICE_OCB; |
| 19971 | wmi_service[wmi_service_ap_arpns_offload] = |
| 19972 | WMI_SERVICE_AP_ARPNS_OFFLOAD; |
| 19973 | wmi_service[wmi_service_per_band_chainmask_support] = |
| 19974 | WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT; |
| 19975 | wmi_service[wmi_service_packet_filter_offload] = |
| 19976 | WMI_SERVICE_PACKET_FILTER_OFFLOAD; |
| 19977 | wmi_service[wmi_service_mgmt_tx_htt] = WMI_SERVICE_MGMT_TX_HTT; |
| 19978 | wmi_service[wmi_service_mgmt_tx_wmi] = WMI_SERVICE_MGMT_TX_WMI; |
| 19979 | wmi_service[wmi_service_ext_msg] = WMI_SERVICE_EXT_MSG; |
| 19980 | wmi_service[wmi_service_mawc] = WMI_SERVICE_MAWC; |
| 19981 | wmi_service[wmi_service_multiple_vdev_restart] = |
| 19982 | WMI_SERVICE_MULTIPLE_VDEV_RESTART; |
| 19983 | |
| 19984 | wmi_service[wmi_service_roam_offload] = WMI_SERVICE_UNAVAILABLE; |
| 19985 | wmi_service[wmi_service_ratectrl] = WMI_SERVICE_UNAVAILABLE; |
| 19986 | wmi_service[wmi_service_smart_antenna_sw_support] = |
| 19987 | WMI_SERVICE_UNAVAILABLE; |
| 19988 | wmi_service[wmi_service_smart_antenna_hw_support] = |
| 19989 | WMI_SERVICE_UNAVAILABLE; |
| 19990 | wmi_service[wmi_service_enhanced_proxy_sta] = WMI_SERVICE_UNAVAILABLE; |
| 19991 | wmi_service[wmi_service_tt] = WMI_SERVICE_UNAVAILABLE; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 19992 | wmi_service[wmi_service_atf] = WMI_SERVICE_ATF; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 19993 | wmi_service[wmi_service_peer_caching] = WMI_SERVICE_UNAVAILABLE; |
| 19994 | wmi_service[wmi_service_coex_gpio] = WMI_SERVICE_UNAVAILABLE; |
| 19995 | wmi_service[wmi_service_aux_spectral_intf] = WMI_SERVICE_UNAVAILABLE; |
| 19996 | wmi_service[wmi_service_aux_chan_load_intf] = WMI_SERVICE_UNAVAILABLE; |
| 19997 | wmi_service[wmi_service_bss_channel_info_64] = WMI_SERVICE_UNAVAILABLE; |
| 19998 | wmi_service[wmi_service_ext_res_cfg_support] = WMI_SERVICE_UNAVAILABLE; |
| 19999 | wmi_service[wmi_service_mesh] = WMI_SERVICE_UNAVAILABLE; |
| 20000 | wmi_service[wmi_service_restrt_chnl_support] = WMI_SERVICE_UNAVAILABLE; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 20001 | wmi_service[wmi_service_peer_stats] = WMI_SERVICE_UNAVAILABLE; |
| 20002 | wmi_service[wmi_service_mesh_11s] = WMI_SERVICE_UNAVAILABLE; |
| 20003 | wmi_service[wmi_service_periodic_chan_stat_support] = |
| 20004 | WMI_SERVICE_UNAVAILABLE; |
| 20005 | wmi_service[wmi_service_tx_mode_push_only] = WMI_SERVICE_UNAVAILABLE; |
| 20006 | wmi_service[wmi_service_tx_mode_push_pull] = WMI_SERVICE_UNAVAILABLE; |
| 20007 | wmi_service[wmi_service_tx_mode_dynamic] = WMI_SERVICE_UNAVAILABLE; |
| 20008 | wmi_service[wmi_service_btcoex_duty_cycle] = WMI_SERVICE_UNAVAILABLE; |
| 20009 | wmi_service[wmi_service_4_wire_coex_support] = WMI_SERVICE_UNAVAILABLE; |
| 20010 | wmi_service[wmi_service_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
Kiran Venkatappa | 95c82a6 | 2017-05-10 14:34:17 +0530 | [diff] [blame] | 20011 | wmi_service[wmi_service_peer_assoc_conf] = WMI_SERVICE_PEER_ASSOC_CONF; |
| 20012 | wmi_service[wmi_service_egap] = WMI_SERVICE_EGAP; |
| 20013 | wmi_service[wmi_service_sta_pmf_offload] = WMI_SERVICE_STA_PMF_OFFLOAD; |
| 20014 | wmi_service[wmi_service_unified_wow_capability] = |
| 20015 | WMI_SERVICE_UNIFIED_WOW_CAPABILITY; |
| 20016 | wmi_service[wmi_service_enterprise_mesh] = WMI_SERVICE_ENTERPRISE_MESH; |
| 20017 | wmi_service[wmi_service_bpf_offload] = WMI_SERVICE_BPF_OFFLOAD; |
| 20018 | wmi_service[wmi_service_sync_delete_cmds] = |
| 20019 | WMI_SERVICE_SYNC_DELETE_CMDS; |
| 20020 | wmi_service[wmi_service_ratectrl_limit_max_min_rates] = |
| 20021 | WMI_SERVICE_RATECTRL_LIMIT_MAX_MIN_RATES; |
| 20022 | wmi_service[wmi_service_nan_data] = WMI_SERVICE_NAN_DATA; |
| 20023 | wmi_service[wmi_service_nan_rtt] = WMI_SERVICE_NAN_RTT; |
| 20024 | wmi_service[wmi_service_11ax] = WMI_SERVICE_11AX; |
| 20025 | wmi_service[wmi_service_deprecated_replace] = |
| 20026 | WMI_SERVICE_DEPRECATED_REPLACE; |
| 20027 | wmi_service[wmi_service_tdls_conn_tracker_in_host_mode] = |
| 20028 | WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE; |
| 20029 | wmi_service[wmi_service_enhanced_mcast_filter] = |
| 20030 | WMI_SERVICE_ENHANCED_MCAST_FILTER; |
| 20031 | wmi_service[wmi_service_half_rate_quarter_rate_support] = |
| 20032 | WMI_SERVICE_HALF_RATE_QUARTER_RATE_SUPPORT; |
| 20033 | wmi_service[wmi_service_vdev_rx_filter] = WMI_SERVICE_VDEV_RX_FILTER; |
| 20034 | wmi_service[wmi_service_p2p_listen_offload_support] = |
| 20035 | WMI_SERVICE_P2P_LISTEN_OFFLOAD_SUPPORT; |
| 20036 | wmi_service[wmi_service_mark_first_wakeup_packet] = |
| 20037 | WMI_SERVICE_MARK_FIRST_WAKEUP_PACKET; |
| 20038 | wmi_service[wmi_service_multiple_mcast_filter_set] = |
| 20039 | WMI_SERVICE_MULTIPLE_MCAST_FILTER_SET; |
| 20040 | wmi_service[wmi_service_host_managed_rx_reorder] = |
| 20041 | WMI_SERVICE_HOST_MANAGED_RX_REORDER; |
| 20042 | wmi_service[wmi_service_flash_rdwr_support] = |
| 20043 | WMI_SERVICE_FLASH_RDWR_SUPPORT; |
| 20044 | wmi_service[wmi_service_wlan_stats_report] = |
| 20045 | WMI_SERVICE_WLAN_STATS_REPORT; |
| 20046 | wmi_service[wmi_service_tx_msdu_id_new_partition_support] = |
| 20047 | WMI_SERVICE_TX_MSDU_ID_NEW_PARTITION_SUPPORT; |
| 20048 | wmi_service[wmi_service_dfs_phyerr_offload] = |
| 20049 | WMI_SERVICE_DFS_PHYERR_OFFLOAD; |
| 20050 | wmi_service[wmi_service_rcpi_support] = WMI_SERVICE_RCPI_SUPPORT; |
| 20051 | wmi_service[wmi_service_fw_mem_dump_support] = |
| 20052 | WMI_SERVICE_FW_MEM_DUMP_SUPPORT; |
| 20053 | wmi_service[wmi_service_peer_stats_info] = WMI_SERVICE_PEER_STATS_INFO; |
| 20054 | wmi_service[wmi_service_regulatory_db] = WMI_SERVICE_REGULATORY_DB; |
| 20055 | wmi_service[wmi_service_11d_offload] = WMI_SERVICE_11D_OFFLOAD; |
| 20056 | wmi_service[wmi_service_hw_data_filtering] = |
| 20057 | WMI_SERVICE_HW_DATA_FILTERING; |
| 20058 | wmi_service[wmi_service_pkt_routing] = WMI_SERVICE_PKT_ROUTING; |
| 20059 | 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] | 20060 | wmi_service[wmi_service_chan_load_info] = WMI_SERVICE_CHAN_LOAD_INFO; |
Soumya Bhat | 8db697d | 2017-08-29 18:49:13 +0530 | [diff] [blame] | 20061 | wmi_service[wmi_service_extended_nss_support] = |
| 20062 | WMI_SERVICE_EXTENDED_NSS_SUPPORT; |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 20063 | } |
| 20064 | |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20065 | /** |
| 20066 | * populate_pdev_param_tlv() - populates pdev params |
| 20067 | * |
| 20068 | * @param pdev_param: Pointer to hold pdev params |
| 20069 | * Return: None |
| 20070 | */ |
| 20071 | static void populate_pdev_param_tlv(uint32_t *pdev_param) |
| 20072 | { |
| 20073 | pdev_param[wmi_pdev_param_tx_chain_mask] = WMI_PDEV_PARAM_TX_CHAIN_MASK; |
| 20074 | pdev_param[wmi_pdev_param_rx_chain_mask] = WMI_PDEV_PARAM_RX_CHAIN_MASK; |
| 20075 | pdev_param[wmi_pdev_param_txpower_limit2g] = |
| 20076 | WMI_PDEV_PARAM_TXPOWER_LIMIT2G; |
| 20077 | pdev_param[wmi_pdev_param_txpower_limit5g] = |
| 20078 | WMI_PDEV_PARAM_TXPOWER_LIMIT5G; |
| 20079 | pdev_param[wmi_pdev_param_txpower_scale] = WMI_PDEV_PARAM_TXPOWER_SCALE; |
| 20080 | pdev_param[wmi_pdev_param_beacon_gen_mode] = |
| 20081 | WMI_PDEV_PARAM_BEACON_GEN_MODE; |
| 20082 | pdev_param[wmi_pdev_param_beacon_tx_mode] = |
| 20083 | WMI_PDEV_PARAM_BEACON_TX_MODE; |
| 20084 | pdev_param[wmi_pdev_param_resmgr_offchan_mode] = |
| 20085 | WMI_PDEV_PARAM_RESMGR_OFFCHAN_MODE; |
| 20086 | pdev_param[wmi_pdev_param_protection_mode] = |
| 20087 | WMI_PDEV_PARAM_PROTECTION_MODE; |
| 20088 | pdev_param[wmi_pdev_param_dynamic_bw] = WMI_PDEV_PARAM_DYNAMIC_BW; |
| 20089 | pdev_param[wmi_pdev_param_non_agg_sw_retry_th] = |
| 20090 | WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH; |
| 20091 | pdev_param[wmi_pdev_param_agg_sw_retry_th] = |
| 20092 | WMI_PDEV_PARAM_AGG_SW_RETRY_TH; |
| 20093 | pdev_param[wmi_pdev_param_sta_kickout_th] = |
| 20094 | WMI_PDEV_PARAM_STA_KICKOUT_TH; |
| 20095 | pdev_param[wmi_pdev_param_ac_aggrsize_scaling] = |
| 20096 | WMI_PDEV_PARAM_AC_AGGRSIZE_SCALING; |
| 20097 | pdev_param[wmi_pdev_param_ltr_enable] = WMI_PDEV_PARAM_LTR_ENABLE; |
| 20098 | pdev_param[wmi_pdev_param_ltr_ac_latency_be] = |
| 20099 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BE; |
| 20100 | pdev_param[wmi_pdev_param_ltr_ac_latency_bk] = |
| 20101 | WMI_PDEV_PARAM_LTR_AC_LATENCY_BK; |
| 20102 | pdev_param[wmi_pdev_param_ltr_ac_latency_vi] = |
| 20103 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VI; |
| 20104 | pdev_param[wmi_pdev_param_ltr_ac_latency_vo] = |
| 20105 | WMI_PDEV_PARAM_LTR_AC_LATENCY_VO; |
| 20106 | pdev_param[wmi_pdev_param_ltr_ac_latency_timeout] = |
| 20107 | WMI_PDEV_PARAM_LTR_AC_LATENCY_TIMEOUT; |
| 20108 | pdev_param[wmi_pdev_param_ltr_sleep_override] = |
| 20109 | WMI_PDEV_PARAM_LTR_SLEEP_OVERRIDE; |
| 20110 | pdev_param[wmi_pdev_param_ltr_rx_override] = |
| 20111 | WMI_PDEV_PARAM_LTR_RX_OVERRIDE; |
| 20112 | pdev_param[wmi_pdev_param_ltr_tx_activity_timeout] = |
| 20113 | WMI_PDEV_PARAM_LTR_TX_ACTIVITY_TIMEOUT; |
| 20114 | pdev_param[wmi_pdev_param_l1ss_enable] = WMI_PDEV_PARAM_L1SS_ENABLE; |
| 20115 | pdev_param[wmi_pdev_param_dsleep_enable] = WMI_PDEV_PARAM_DSLEEP_ENABLE; |
| 20116 | pdev_param[wmi_pdev_param_pcielp_txbuf_flush] = |
| 20117 | WMI_PDEV_PARAM_PCIELP_TXBUF_FLUSH; |
| 20118 | pdev_param[wmi_pdev_param_pcielp_txbuf_watermark] = |
| 20119 | WMI_PDEV_PARAM_PCIELP_TXBUF_WATERMARK; |
| 20120 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_en] = |
| 20121 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_EN; |
| 20122 | pdev_param[wmi_pdev_param_pcielp_txbuf_tmo_value] = |
| 20123 | WMI_PDEV_PARAM_PCIELP_TXBUF_TMO_VALUE; |
| 20124 | pdev_param[wmi_pdev_param_pdev_stats_update_period] = |
| 20125 | WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD; |
| 20126 | pdev_param[wmi_pdev_param_vdev_stats_update_period] = |
| 20127 | WMI_PDEV_PARAM_VDEV_STATS_UPDATE_PERIOD; |
| 20128 | pdev_param[wmi_pdev_param_peer_stats_update_period] = |
| 20129 | WMI_PDEV_PARAM_PEER_STATS_UPDATE_PERIOD; |
| 20130 | pdev_param[wmi_pdev_param_bcnflt_stats_update_period] = |
| 20131 | WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD; |
| 20132 | pdev_param[wmi_pdev_param_pmf_qos] = WMI_PDEV_PARAM_PMF_QOS; |
| 20133 | pdev_param[wmi_pdev_param_arp_ac_override] = |
| 20134 | WMI_PDEV_PARAM_ARP_AC_OVERRIDE; |
| 20135 | pdev_param[wmi_pdev_param_dcs] = WMI_PDEV_PARAM_DCS; |
| 20136 | pdev_param[wmi_pdev_param_ani_enable] = WMI_PDEV_PARAM_ANI_ENABLE; |
| 20137 | pdev_param[wmi_pdev_param_ani_poll_period] = |
| 20138 | WMI_PDEV_PARAM_ANI_POLL_PERIOD; |
| 20139 | pdev_param[wmi_pdev_param_ani_listen_period] = |
| 20140 | WMI_PDEV_PARAM_ANI_LISTEN_PERIOD; |
| 20141 | pdev_param[wmi_pdev_param_ani_ofdm_level] = |
| 20142 | WMI_PDEV_PARAM_ANI_OFDM_LEVEL; |
| 20143 | pdev_param[wmi_pdev_param_ani_cck_level] = WMI_PDEV_PARAM_ANI_CCK_LEVEL; |
| 20144 | pdev_param[wmi_pdev_param_dyntxchain] = WMI_PDEV_PARAM_DYNTXCHAIN; |
| 20145 | pdev_param[wmi_pdev_param_proxy_sta] = WMI_PDEV_PARAM_PROXY_STA; |
| 20146 | pdev_param[wmi_pdev_param_idle_ps_config] = |
| 20147 | WMI_PDEV_PARAM_IDLE_PS_CONFIG; |
| 20148 | pdev_param[wmi_pdev_param_power_gating_sleep] = |
| 20149 | WMI_PDEV_PARAM_POWER_GATING_SLEEP; |
| 20150 | pdev_param[wmi_pdev_param_rfkill_enable] = WMI_PDEV_PARAM_RFKILL_ENABLE; |
| 20151 | pdev_param[wmi_pdev_param_burst_dur] = WMI_PDEV_PARAM_BURST_DUR; |
| 20152 | pdev_param[wmi_pdev_param_burst_enable] = WMI_PDEV_PARAM_BURST_ENABLE; |
| 20153 | pdev_param[wmi_pdev_param_hw_rfkill_config] = |
| 20154 | WMI_PDEV_PARAM_HW_RFKILL_CONFIG; |
| 20155 | pdev_param[wmi_pdev_param_low_power_rf_enable] = |
| 20156 | WMI_PDEV_PARAM_LOW_POWER_RF_ENABLE; |
| 20157 | pdev_param[wmi_pdev_param_l1ss_track] = WMI_PDEV_PARAM_L1SS_TRACK; |
| 20158 | pdev_param[wmi_pdev_param_hyst_en] = WMI_PDEV_PARAM_HYST_EN; |
| 20159 | pdev_param[wmi_pdev_param_power_collapse_enable] = |
| 20160 | WMI_PDEV_PARAM_POWER_COLLAPSE_ENABLE; |
| 20161 | pdev_param[wmi_pdev_param_led_sys_state] = WMI_PDEV_PARAM_LED_SYS_STATE; |
| 20162 | pdev_param[wmi_pdev_param_led_enable] = WMI_PDEV_PARAM_LED_ENABLE; |
| 20163 | pdev_param[wmi_pdev_param_audio_over_wlan_latency] = |
| 20164 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_LATENCY; |
| 20165 | pdev_param[wmi_pdev_param_audio_over_wlan_enable] = |
| 20166 | WMI_PDEV_PARAM_AUDIO_OVER_WLAN_ENABLE; |
| 20167 | pdev_param[wmi_pdev_param_whal_mib_stats_update_enable] = |
| 20168 | WMI_PDEV_PARAM_WHAL_MIB_STATS_UPDATE_ENABLE; |
| 20169 | pdev_param[wmi_pdev_param_vdev_rate_stats_update_period] = |
| 20170 | WMI_PDEV_PARAM_VDEV_RATE_STATS_UPDATE_PERIOD; |
| 20171 | pdev_param[wmi_pdev_param_cts_cbw] = WMI_PDEV_PARAM_CTS_CBW; |
| 20172 | pdev_param[wmi_pdev_param_wnts_config] = WMI_PDEV_PARAM_WNTS_CONFIG; |
| 20173 | pdev_param[wmi_pdev_param_adaptive_early_rx_enable] = |
| 20174 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_ENABLE; |
| 20175 | pdev_param[wmi_pdev_param_adaptive_early_rx_min_sleep_slop] = |
| 20176 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_MIN_SLEEP_SLOP; |
| 20177 | pdev_param[wmi_pdev_param_adaptive_early_rx_inc_dec_step] = |
| 20178 | WMI_PDEV_PARAM_ADAPTIVE_EARLY_RX_INC_DEC_STEP; |
| 20179 | pdev_param[wmi_pdev_param_early_rx_fix_sleep_slop] = |
| 20180 | WMI_PDEV_PARAM_EARLY_RX_FIX_SLEEP_SLOP; |
| 20181 | pdev_param[wmi_pdev_param_bmiss_based_adaptive_bto_enable] = |
| 20182 | WMI_PDEV_PARAM_BMISS_BASED_ADAPTIVE_BTO_ENABLE; |
| 20183 | pdev_param[wmi_pdev_param_bmiss_bto_min_bcn_timeout] = |
| 20184 | WMI_PDEV_PARAM_BMISS_BTO_MIN_BCN_TIMEOUT; |
| 20185 | pdev_param[wmi_pdev_param_bmiss_bto_inc_dec_step] = |
| 20186 | WMI_PDEV_PARAM_BMISS_BTO_INC_DEC_STEP; |
| 20187 | pdev_param[wmi_pdev_param_bto_fix_bcn_timeout] = |
| 20188 | WMI_PDEV_PARAM_BTO_FIX_BCN_TIMEOUT; |
| 20189 | pdev_param[wmi_pdev_param_ce_based_adaptive_bto_enable] = |
| 20190 | WMI_PDEV_PARAM_CE_BASED_ADAPTIVE_BTO_ENABLE; |
| 20191 | pdev_param[wmi_pdev_param_ce_bto_combo_ce_value] = |
| 20192 | WMI_PDEV_PARAM_CE_BTO_COMBO_CE_VALUE; |
| 20193 | pdev_param[wmi_pdev_param_tx_chain_mask_2g] = |
| 20194 | WMI_PDEV_PARAM_TX_CHAIN_MASK_2G; |
| 20195 | pdev_param[wmi_pdev_param_rx_chain_mask_2g] = |
| 20196 | WMI_PDEV_PARAM_RX_CHAIN_MASK_2G; |
| 20197 | pdev_param[wmi_pdev_param_tx_chain_mask_5g] = |
| 20198 | WMI_PDEV_PARAM_TX_CHAIN_MASK_5G; |
| 20199 | pdev_param[wmi_pdev_param_rx_chain_mask_5g] = |
| 20200 | WMI_PDEV_PARAM_RX_CHAIN_MASK_5G; |
| 20201 | pdev_param[wmi_pdev_param_tx_chain_mask_cck] = |
| 20202 | WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK; |
| 20203 | pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = |
| 20204 | WMI_PDEV_PARAM_TX_CHAIN_MASK_1SS; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20205 | pdev_param[wmi_pdev_param_rx_filter] = WMI_PDEV_PARAM_RX_FILTER; |
| 20206 | pdev_param[wmi_pdev_set_mcast_to_ucast_tid] = |
| 20207 | WMI_PDEV_SET_MCAST_TO_UCAST_TID; |
Sathish Kumar | d99852a | 2017-07-08 12:32:27 +0530 | [diff] [blame] | 20208 | pdev_param[wmi_pdev_param_mgmt_retry_limit] = |
| 20209 | WMI_PDEV_PARAM_MGMT_RETRY_LIMIT; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20210 | pdev_param[wmi_pdev_param_aggr_burst] = WMI_PDEV_PARAM_AGGR_BURST; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20211 | pdev_param[wmi_pdev_peer_sta_ps_statechg_enable] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20212 | WMI_PDEV_PEER_STA_PS_STATECHG_ENABLE; |
| 20213 | pdev_param[wmi_pdev_param_proxy_sta_mode] = |
| 20214 | WMI_PDEV_PARAM_PROXY_STA_MODE; |
| 20215 | pdev_param[wmi_pdev_param_mu_group_policy] = |
| 20216 | WMI_PDEV_PARAM_MU_GROUP_POLICY; |
| 20217 | pdev_param[wmi_pdev_param_noise_detection] = |
| 20218 | WMI_PDEV_PARAM_NOISE_DETECTION; |
| 20219 | pdev_param[wmi_pdev_param_noise_threshold] = |
| 20220 | WMI_PDEV_PARAM_NOISE_THRESHOLD; |
| 20221 | pdev_param[wmi_pdev_param_dpd_enable] = WMI_PDEV_PARAM_DPD_ENABLE; |
| 20222 | pdev_param[wmi_pdev_param_set_mcast_bcast_echo] = |
| 20223 | WMI_PDEV_PARAM_SET_MCAST_BCAST_ECHO; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 20224 | pdev_param[wmi_pdev_param_atf_strict_sch] = |
| 20225 | WMI_PDEV_PARAM_ATF_STRICT_SCH; |
| 20226 | pdev_param[wmi_pdev_param_atf_sched_duration] = |
| 20227 | WMI_PDEV_PARAM_ATF_SCHED_DURATION; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20228 | pdev_param[wmi_pdev_param_ant_plzn] = WMI_PDEV_PARAM_ANT_PLZN; |
| 20229 | pdev_param[wmi_pdev_param_sensitivity_level] = |
| 20230 | WMI_PDEV_PARAM_SENSITIVITY_LEVEL; |
| 20231 | pdev_param[wmi_pdev_param_signed_txpower_2g] = |
| 20232 | WMI_PDEV_PARAM_SIGNED_TXPOWER_2G; |
| 20233 | pdev_param[wmi_pdev_param_signed_txpower_5g] = |
| 20234 | WMI_PDEV_PARAM_SIGNED_TXPOWER_5G; |
Karunakar Dasineni | 39a5ff7 | 2017-08-10 12:12:28 -0700 | [diff] [blame] | 20235 | pdev_param[wmi_pdev_param_enable_per_tid_amsdu] = |
| 20236 | WMI_PDEV_PARAM_ENABLE_PER_TID_AMSDU; |
| 20237 | pdev_param[wmi_pdev_param_enable_per_tid_ampdu] = |
| 20238 | WMI_PDEV_PARAM_ENABLE_PER_TID_AMPDU; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20239 | pdev_param[wmi_pdev_param_cca_threshold] = |
| 20240 | WMI_PDEV_PARAM_CCA_THRESHOLD; |
| 20241 | pdev_param[wmi_pdev_param_rts_fixed_rate] = |
| 20242 | WMI_PDEV_PARAM_RTS_FIXED_RATE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20243 | pdev_param[wmi_pdev_param_cal_period] = WMI_UNAVAILABLE_PARAM; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20244 | pdev_param[wmi_pdev_param_pdev_reset] = WMI_PDEV_PARAM_PDEV_RESET; |
| 20245 | pdev_param[wmi_pdev_param_wapi_mbssid_offset] = |
| 20246 | WMI_PDEV_PARAM_WAPI_MBSSID_OFFSET; |
| 20247 | pdev_param[wmi_pdev_param_arp_srcaddr] = |
| 20248 | WMI_PDEV_PARAM_ARP_DBG_SRCADDR; |
| 20249 | pdev_param[wmi_pdev_param_arp_dstaddr] = |
| 20250 | WMI_PDEV_PARAM_ARP_DBG_DSTADDR; |
| 20251 | pdev_param[wmi_pdev_param_txpower_decr_db] = |
| 20252 | WMI_PDEV_PARAM_TXPOWER_DECR_DB; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20253 | pdev_param[wmi_pdev_param_rx_batchmode] = WMI_UNAVAILABLE_PARAM; |
| 20254 | pdev_param[wmi_pdev_param_packet_aggr_delay] = WMI_UNAVAILABLE_PARAM; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 20255 | pdev_param[wmi_pdev_param_atf_obss_noise_sch] = |
| 20256 | WMI_PDEV_PARAM_ATF_OBSS_NOISE_SCH; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20257 | pdev_param[wmi_pdev_param_atf_obss_noise_scaling_factor] = |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 20258 | WMI_PDEV_PARAM_ATF_OBSS_NOISE_SCALING_FACTOR; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20259 | pdev_param[wmi_pdev_param_cust_txpower_scale] = |
| 20260 | WMI_PDEV_PARAM_CUST_TXPOWER_SCALE; |
Subrat Mishra | a1c92f5 | 2017-04-03 12:32:42 +0530 | [diff] [blame] | 20261 | pdev_param[wmi_pdev_param_atf_dynamic_enable] = |
| 20262 | WMI_PDEV_PARAM_ATF_DYNAMIC_ENABLE; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20263 | pdev_param[wmi_pdev_param_atf_ssid_group_policy] = |
| 20264 | WMI_UNAVAILABLE_PARAM; |
| 20265 | pdev_param[wmi_pdev_param_igmpmld_override] = WMI_UNAVAILABLE_PARAM; |
| 20266 | pdev_param[wmi_pdev_param_igmpmld_tid] = WMI_UNAVAILABLE_PARAM; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20267 | pdev_param[wmi_pdev_param_antenna_gain] = WMI_PDEV_PARAM_ANTENNA_GAIN; |
| 20268 | pdev_param[wmi_pdev_param_block_interbss] = |
| 20269 | WMI_PDEV_PARAM_BLOCK_INTERBSS; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20270 | pdev_param[wmi_pdev_param_set_disable_reset_cmdid] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20271 | WMI_PDEV_PARAM_SET_DISABLE_RESET_CMDID; |
| 20272 | pdev_param[wmi_pdev_param_set_msdu_ttl_cmdid] = |
| 20273 | WMI_PDEV_PARAM_SET_MSDU_TTL_CMDID; |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20274 | pdev_param[wmi_pdev_param_txbf_sound_period_cmdid] = |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20275 | WMI_PDEV_PARAM_TXBF_SOUND_PERIOD_CMDID; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 20276 | pdev_param[wmi_pdev_param_set_burst_mode_cmdid] = |
| 20277 | WMI_PDEV_PARAM_SET_BURST_MODE_CMDID; |
Sathish Kumar | fd414b9 | 2017-08-24 13:32:49 +0530 | [diff] [blame] | 20278 | 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] | 20279 | pdev_param[wmi_pdev_param_mesh_mcast_enable] = |
| 20280 | WMI_PDEV_PARAM_MESH_MCAST_ENABLE; |
Sathish Kumar | a059f41 | 2017-03-22 19:10:28 +0530 | [diff] [blame] | 20281 | pdev_param[wmi_pdev_param_set_promisc_mode_cmdid] = |
| 20282 | WMI_PDEV_PARAM_SET_PROMISC_MODE_CMDID; |
| 20283 | pdev_param[wmi_pdev_param_set_ppdu_duration_cmdid] = |
| 20284 | WMI_PDEV_PARAM_SET_PPDU_DURATION_CMDID; |
| 20285 | pdev_param[wmi_pdev_param_igmpmld_ac_override] = |
| 20286 | WMI_PDEV_PARAM_IGMPMLD_AC_OVERRIDE; |
| 20287 | pdev_param[wmi_pdev_param_remove_mcast2ucast_buffer] = |
| 20288 | WMI_PDEV_PARAM_REMOVE_MCAST2UCAST_BUFFER; |
| 20289 | pdev_param[wmi_pdev_param_set_mcast2ucast_buffer] = |
| 20290 | WMI_PDEV_PARAM_SET_MCAST2UCAST_BUFFER; |
| 20291 | pdev_param[wmi_pdev_param_set_mcast2ucast_mode] = |
| 20292 | WMI_PDEV_PARAM_SET_MCAST2UCAST_MODE; |
| 20293 | pdev_param[wmi_pdev_param_smart_antenna_default_antenna] = |
| 20294 | WMI_PDEV_PARAM_SMART_ANTENNA_DEFAULT_ANTENNA; |
| 20295 | pdev_param[wmi_pdev_param_fast_channel_reset] = |
| 20296 | WMI_PDEV_PARAM_FAST_CHANNEL_RESET; |
| 20297 | 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] | 20298 | 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] | 20299 | } |
| 20300 | |
| 20301 | /** |
| 20302 | * populate_vdev_param_tlv() - populates vdev params |
| 20303 | * |
| 20304 | * @param vdev_param: Pointer to hold vdev params |
| 20305 | * Return: None |
| 20306 | */ |
| 20307 | static void populate_vdev_param_tlv(uint32_t *vdev_param) |
| 20308 | { |
| 20309 | vdev_param[wmi_vdev_param_rts_threshold] = WMI_VDEV_PARAM_RTS_THRESHOLD; |
| 20310 | vdev_param[wmi_vdev_param_fragmentation_threshold] = |
| 20311 | WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD; |
| 20312 | vdev_param[wmi_vdev_param_beacon_interval] = |
| 20313 | WMI_VDEV_PARAM_BEACON_INTERVAL; |
| 20314 | vdev_param[wmi_vdev_param_listen_interval] = |
| 20315 | WMI_VDEV_PARAM_LISTEN_INTERVAL; |
| 20316 | vdev_param[wmi_vdev_param_multicast_rate] = |
| 20317 | WMI_VDEV_PARAM_MULTICAST_RATE; |
| 20318 | vdev_param[wmi_vdev_param_mgmt_tx_rate] = WMI_VDEV_PARAM_MGMT_TX_RATE; |
| 20319 | vdev_param[wmi_vdev_param_slot_time] = WMI_VDEV_PARAM_SLOT_TIME; |
| 20320 | vdev_param[wmi_vdev_param_preamble] = WMI_VDEV_PARAM_PREAMBLE; |
| 20321 | vdev_param[wmi_vdev_param_swba_time] = WMI_VDEV_PARAM_SWBA_TIME; |
| 20322 | vdev_param[wmi_vdev_stats_update_period] = WMI_VDEV_STATS_UPDATE_PERIOD; |
| 20323 | vdev_param[wmi_vdev_pwrsave_ageout_time] = WMI_VDEV_PWRSAVE_AGEOUT_TIME; |
| 20324 | vdev_param[wmi_vdev_host_swba_interval] = WMI_VDEV_HOST_SWBA_INTERVAL; |
| 20325 | vdev_param[wmi_vdev_param_dtim_period] = WMI_VDEV_PARAM_DTIM_PERIOD; |
| 20326 | vdev_param[wmi_vdev_oc_scheduler_air_time_limit] = |
| 20327 | WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT; |
| 20328 | vdev_param[wmi_vdev_param_wds] = WMI_VDEV_PARAM_WDS; |
| 20329 | vdev_param[wmi_vdev_param_atim_window] = WMI_VDEV_PARAM_ATIM_WINDOW; |
| 20330 | vdev_param[wmi_vdev_param_bmiss_count_max] = |
| 20331 | WMI_VDEV_PARAM_BMISS_COUNT_MAX; |
| 20332 | vdev_param[wmi_vdev_param_bmiss_first_bcnt] = |
| 20333 | WMI_VDEV_PARAM_BMISS_FIRST_BCNT; |
| 20334 | vdev_param[wmi_vdev_param_bmiss_final_bcnt] = |
| 20335 | WMI_VDEV_PARAM_BMISS_FINAL_BCNT; |
| 20336 | vdev_param[wmi_vdev_param_feature_wmm] = WMI_VDEV_PARAM_FEATURE_WMM; |
| 20337 | vdev_param[wmi_vdev_param_chwidth] = WMI_VDEV_PARAM_CHWIDTH; |
| 20338 | vdev_param[wmi_vdev_param_chextoffset] = WMI_VDEV_PARAM_CHEXTOFFSET; |
| 20339 | vdev_param[wmi_vdev_param_disable_htprotection] = |
| 20340 | WMI_VDEV_PARAM_DISABLE_HTPROTECTION; |
| 20341 | vdev_param[wmi_vdev_param_sta_quickkickout] = |
| 20342 | WMI_VDEV_PARAM_STA_QUICKKICKOUT; |
| 20343 | vdev_param[wmi_vdev_param_mgmt_rate] = WMI_VDEV_PARAM_MGMT_RATE; |
| 20344 | vdev_param[wmi_vdev_param_protection_mode] = |
| 20345 | WMI_VDEV_PARAM_PROTECTION_MODE; |
| 20346 | vdev_param[wmi_vdev_param_fixed_rate] = WMI_VDEV_PARAM_FIXED_RATE; |
| 20347 | vdev_param[wmi_vdev_param_sgi] = WMI_VDEV_PARAM_SGI; |
| 20348 | vdev_param[wmi_vdev_param_ldpc] = WMI_VDEV_PARAM_LDPC; |
| 20349 | vdev_param[wmi_vdev_param_tx_stbc] = WMI_VDEV_PARAM_TX_STBC; |
| 20350 | vdev_param[wmi_vdev_param_rx_stbc] = WMI_VDEV_PARAM_RX_STBC; |
| 20351 | vdev_param[wmi_vdev_param_intra_bss_fwd] = WMI_VDEV_PARAM_INTRA_BSS_FWD; |
| 20352 | vdev_param[wmi_vdev_param_def_keyid] = WMI_VDEV_PARAM_DEF_KEYID; |
| 20353 | vdev_param[wmi_vdev_param_nss] = WMI_VDEV_PARAM_NSS; |
| 20354 | vdev_param[wmi_vdev_param_bcast_data_rate] = |
| 20355 | WMI_VDEV_PARAM_BCAST_DATA_RATE; |
| 20356 | vdev_param[wmi_vdev_param_mcast_data_rate] = |
| 20357 | WMI_VDEV_PARAM_MCAST_DATA_RATE; |
| 20358 | vdev_param[wmi_vdev_param_mcast_indicate] = |
| 20359 | WMI_VDEV_PARAM_MCAST_INDICATE; |
| 20360 | vdev_param[wmi_vdev_param_dhcp_indicate] = |
| 20361 | WMI_VDEV_PARAM_DHCP_INDICATE; |
| 20362 | vdev_param[wmi_vdev_param_unknown_dest_indicate] = |
| 20363 | WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE; |
| 20364 | vdev_param[wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs] = |
| 20365 | WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS; |
| 20366 | vdev_param[wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs] = |
| 20367 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS; |
| 20368 | vdev_param[wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs] = |
| 20369 | WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS; |
| 20370 | vdev_param[wmi_vdev_param_ap_enable_nawds] = |
| 20371 | WMI_VDEV_PARAM_AP_ENABLE_NAWDS; |
| 20372 | vdev_param[wmi_vdev_param_enable_rtscts] = WMI_VDEV_PARAM_ENABLE_RTSCTS; |
| 20373 | vdev_param[wmi_vdev_param_txbf] = WMI_VDEV_PARAM_TXBF; |
| 20374 | vdev_param[wmi_vdev_param_packet_powersave] = |
| 20375 | WMI_VDEV_PARAM_PACKET_POWERSAVE; |
| 20376 | vdev_param[wmi_vdev_param_drop_unencry] = WMI_VDEV_PARAM_DROP_UNENCRY; |
| 20377 | vdev_param[wmi_vdev_param_tx_encap_type] = WMI_VDEV_PARAM_TX_ENCAP_TYPE; |
| 20378 | vdev_param[wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs] = |
| 20379 | WMI_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS; |
| 20380 | vdev_param[wmi_vdev_param_early_rx_adjust_enable] = |
| 20381 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE; |
| 20382 | vdev_param[wmi_vdev_param_early_rx_tgt_bmiss_num] = |
| 20383 | WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM; |
| 20384 | vdev_param[wmi_vdev_param_early_rx_bmiss_sample_cycle] = |
| 20385 | WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE; |
| 20386 | vdev_param[wmi_vdev_param_early_rx_slop_step] = |
| 20387 | WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP; |
| 20388 | vdev_param[wmi_vdev_param_early_rx_init_slop] = |
| 20389 | WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP; |
| 20390 | vdev_param[wmi_vdev_param_early_rx_adjust_pause] = |
| 20391 | WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE; |
| 20392 | vdev_param[wmi_vdev_param_tx_pwrlimit] = WMI_VDEV_PARAM_TX_PWRLIMIT; |
| 20393 | vdev_param[wmi_vdev_param_snr_num_for_cal] = |
| 20394 | WMI_VDEV_PARAM_SNR_NUM_FOR_CAL; |
| 20395 | vdev_param[wmi_vdev_param_roam_fw_offload] = |
| 20396 | WMI_VDEV_PARAM_ROAM_FW_OFFLOAD; |
| 20397 | vdev_param[wmi_vdev_param_enable_rmc] = WMI_VDEV_PARAM_ENABLE_RMC; |
| 20398 | vdev_param[wmi_vdev_param_ibss_max_bcn_lost_ms] = |
| 20399 | WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS; |
| 20400 | vdev_param[wmi_vdev_param_max_rate] = WMI_VDEV_PARAM_MAX_RATE; |
| 20401 | vdev_param[wmi_vdev_param_early_rx_drift_sample] = |
| 20402 | WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE; |
| 20403 | vdev_param[wmi_vdev_param_set_ibss_tx_fail_cnt_thr] = |
| 20404 | WMI_VDEV_PARAM_SET_IBSS_TX_FAIL_CNT_THR; |
| 20405 | vdev_param[wmi_vdev_param_ebt_resync_timeout] = |
| 20406 | WMI_VDEV_PARAM_EBT_RESYNC_TIMEOUT; |
| 20407 | vdev_param[wmi_vdev_param_aggr_trig_event_enable] = |
| 20408 | WMI_VDEV_PARAM_AGGR_TRIG_EVENT_ENABLE; |
| 20409 | vdev_param[wmi_vdev_param_is_ibss_power_save_allowed] = |
| 20410 | WMI_VDEV_PARAM_IS_IBSS_POWER_SAVE_ALLOWED; |
| 20411 | vdev_param[wmi_vdev_param_is_power_collapse_allowed] = |
| 20412 | WMI_VDEV_PARAM_IS_POWER_COLLAPSE_ALLOWED; |
| 20413 | vdev_param[wmi_vdev_param_is_awake_on_txrx_enabled] = |
| 20414 | WMI_VDEV_PARAM_IS_AWAKE_ON_TXRX_ENABLED; |
| 20415 | vdev_param[wmi_vdev_param_inactivity_cnt] = |
| 20416 | WMI_VDEV_PARAM_INACTIVITY_CNT; |
| 20417 | vdev_param[wmi_vdev_param_txsp_end_inactivity_time_ms] = |
| 20418 | WMI_VDEV_PARAM_TXSP_END_INACTIVITY_TIME_MS; |
| 20419 | vdev_param[wmi_vdev_param_dtim_policy] = WMI_VDEV_PARAM_DTIM_POLICY; |
| 20420 | vdev_param[wmi_vdev_param_ibss_ps_warmup_time_secs] = |
| 20421 | WMI_VDEV_PARAM_IBSS_PS_WARMUP_TIME_SECS; |
| 20422 | vdev_param[wmi_vdev_param_ibss_ps_1rx_chain_in_atim_window_enable] = |
| 20423 | WMI_VDEV_PARAM_IBSS_PS_1RX_CHAIN_IN_ATIM_WINDOW_ENABLE; |
| 20424 | vdev_param[wmi_vdev_param_rx_leak_window] = |
| 20425 | WMI_VDEV_PARAM_RX_LEAK_WINDOW; |
| 20426 | vdev_param[wmi_vdev_param_stats_avg_factor] = |
| 20427 | WMI_VDEV_PARAM_STATS_AVG_FACTOR; |
| 20428 | vdev_param[wmi_vdev_param_disconnect_th] = WMI_VDEV_PARAM_DISCONNECT_TH; |
| 20429 | vdev_param[wmi_vdev_param_rtscts_rate] = WMI_VDEV_PARAM_RTSCTS_RATE; |
| 20430 | vdev_param[wmi_vdev_param_mcc_rtscts_protection_enable] = |
| 20431 | WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE; |
| 20432 | vdev_param[wmi_vdev_param_mcc_broadcast_probe_enable] = |
| 20433 | WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE; |
Kiran Venkatappa | 0663f21 | 2016-12-13 16:50:59 +0530 | [diff] [blame] | 20434 | vdev_param[wmi_vdev_param_mgmt_tx_power] = WMI_VDEV_PARAM_MGMT_TX_POWER; |
| 20435 | vdev_param[wmi_vdev_param_beacon_rate] = WMI_VDEV_PARAM_BEACON_RATE; |
Kalyan Tallapragada | d9a6abd | 2017-01-30 14:25:27 +0530 | [diff] [blame] | 20436 | 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] | 20437 | vdev_param[wmi_vdev_param_he_dcm_enable] = WMI_VDEV_PARAM_HE_DCM; |
| 20438 | vdev_param[wmi_vdev_param_he_range_ext_enable] = |
| 20439 | WMI_VDEV_PARAM_HE_RANGE_EXT; |
| 20440 | vdev_param[wmi_vdev_param_he_bss_color] = WMI_VDEV_PARAM_BSS_COLOR; |
| 20441 | 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] | 20442 | vdev_param[wmi_vdev_param_sensor_ap] = WMI_VDEV_PARAM_SENSOR_AP; |
| 20443 | vdev_param[wmi_vdev_param_dtim_enable_cts] = |
| 20444 | WMI_VDEV_PARAM_DTIM_ENABLE_CTS; |
| 20445 | vdev_param[wmi_vdev_param_atf_ssid_sched_policy] = |
| 20446 | WMI_VDEV_PARAM_ATF_SSID_SCHED_POLICY; |
| 20447 | vdev_param[wmi_vdev_param_disable_dyn_bw_rts] = |
| 20448 | WMI_VDEV_PARAM_DISABLE_DYN_BW_RTS; |
Sathish Kumar | 2ac4070 | 2017-03-22 19:18:45 +0530 | [diff] [blame] | 20449 | vdev_param[wmi_vdev_param_mcast2ucast_set] = |
| 20450 | WMI_VDEV_PARAM_MCAST2UCAST_SET; |
| 20451 | vdev_param[wmi_vdev_param_rc_num_retries] = |
| 20452 | WMI_VDEV_PARAM_RC_NUM_RETRIES; |
| 20453 | vdev_param[wmi_vdev_param_cabq_maxdur] = WMI_VDEV_PARAM_CABQ_MAXDUR; |
| 20454 | vdev_param[wmi_vdev_param_mfptest_set] = WMI_VDEV_PARAM_MFPTEST_SET; |
| 20455 | vdev_param[wmi_vdev_param_rts_fixed_rate] = |
| 20456 | WMI_VDEV_PARAM_RTS_FIXED_RATE; |
| 20457 | vdev_param[wmi_vdev_param_vht_sgimask] = WMI_VDEV_PARAM_VHT_SGIMASK; |
| 20458 | vdev_param[wmi_vdev_param_vht80_ratemask] = |
| 20459 | WMI_VDEV_PARAM_VHT80_RATEMASK; |
| 20460 | vdev_param[wmi_vdev_param_proxy_sta] = WMI_VDEV_PARAM_PROXY_STA; |
| 20461 | vdev_param[wmi_vdev_param_bw_nss_ratemask] = |
| 20462 | WMI_VDEV_PARAM_BW_NSS_RATEMASK; |
Gyanranjan Hazarika | 88e1183 | 2017-09-18 15:59:34 -0700 | [diff] [blame] | 20463 | 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] | 20464 | } |
| 20465 | #endif |
| 20466 | |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20467 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20468 | * populate_target_defines_tlv() - Populate target defines and params |
| 20469 | * @wmi_handle: pointer to wmi handle |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20470 | * |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 20471 | * Return: None |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20472 | */ |
Kiran Venkatappa | 1d5f5ab | 2016-08-09 22:52:35 +0530 | [diff] [blame] | 20473 | #ifndef CONFIG_MCL |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20474 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20475 | { |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20476 | populate_tlv_service(wmi_handle->services); |
Govind Singh | e7f2f34 | 2016-05-23 12:12:52 +0530 | [diff] [blame] | 20477 | populate_pdev_param_tlv(wmi_handle->pdev_param); |
| 20478 | populate_vdev_param_tlv(wmi_handle->vdev_param); |
| 20479 | } |
| 20480 | #else |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20481 | static void populate_target_defines_tlv(struct wmi_unified *wmi_handle) |
| 20482 | { } |
| 20483 | #endif |
| 20484 | |
| 20485 | /** |
Kiran Venkatappa | 1241bb8 | 2017-05-10 16:24:51 +0530 | [diff] [blame] | 20486 | * convert_host_pdev_id_to_target_pdev_id() - Convert pdev_id from |
| 20487 | * host to target defines. |
| 20488 | * @param pdev_id: host pdev_id to be converted. |
| 20489 | * Return: target pdev_id after conversion. |
| 20490 | */ |
| 20491 | static uint32_t convert_host_pdev_id_to_target_pdev_id(uint32_t pdev_id) |
| 20492 | { |
| 20493 | switch (pdev_id) { |
| 20494 | case WMI_HOST_PDEV_ID_SOC: |
| 20495 | return WMI_PDEV_ID_SOC; |
| 20496 | case WMI_HOST_PDEV_ID_0: |
| 20497 | return WMI_PDEV_ID_1ST; |
| 20498 | case WMI_HOST_PDEV_ID_1: |
| 20499 | return WMI_PDEV_ID_2ND; |
| 20500 | case WMI_HOST_PDEV_ID_2: |
| 20501 | return WMI_PDEV_ID_3RD; |
| 20502 | } |
| 20503 | |
| 20504 | QDF_ASSERT(0); |
| 20505 | |
| 20506 | return WMI_PDEV_ID_SOC; |
| 20507 | } |
| 20508 | |
| 20509 | /** |
| 20510 | * convert_target_pdev_id_to_host_pdev_id() - Convert pdev_id from |
| 20511 | * target to host defines. |
| 20512 | * @param pdev_id: target pdev_id to be converted. |
| 20513 | * Return: host pdev_id after conversion. |
| 20514 | */ |
| 20515 | static uint32_t convert_target_pdev_id_to_host_pdev_id(uint32_t pdev_id) |
| 20516 | { |
| 20517 | switch (pdev_id) { |
| 20518 | case WMI_PDEV_ID_SOC: |
| 20519 | return WMI_HOST_PDEV_ID_SOC; |
| 20520 | case WMI_PDEV_ID_1ST: |
| 20521 | return WMI_HOST_PDEV_ID_0; |
| 20522 | case WMI_PDEV_ID_2ND: |
| 20523 | return WMI_HOST_PDEV_ID_1; |
| 20524 | case WMI_PDEV_ID_3RD: |
| 20525 | return WMI_HOST_PDEV_ID_2; |
| 20526 | } |
| 20527 | |
| 20528 | QDF_ASSERT(0); |
| 20529 | |
| 20530 | return WMI_HOST_PDEV_ID_SOC; |
| 20531 | } |
| 20532 | |
| 20533 | /** |
| 20534 | * wmi_tlv_pdev_id_conversion_enable() - Enable pdev_id conversion |
| 20535 | * |
| 20536 | * Return None. |
| 20537 | */ |
| 20538 | void wmi_tlv_pdev_id_conversion_enable(wmi_unified_t wmi_handle) |
| 20539 | { |
| 20540 | wmi_handle->ops->convert_pdev_id_host_to_target = |
| 20541 | convert_host_pdev_id_to_target_pdev_id; |
| 20542 | wmi_handle->ops->convert_pdev_id_target_to_host = |
| 20543 | convert_target_pdev_id_to_host_pdev_id; |
| 20544 | } |
| 20545 | /** |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20546 | * wmi_tlv_attach() - Attach TLV APIs |
| 20547 | * |
| 20548 | * Return: None |
| 20549 | */ |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 20550 | void wmi_tlv_attach(wmi_unified_t wmi_handle) |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20551 | { |
Govind Singh | e7d9f3e | 2016-04-15 13:58:27 +0530 | [diff] [blame] | 20552 | wmi_handle->ops = &tlv_ops; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 20553 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 20554 | wmi_handle->log_info.buf_offset_command = 2; |
| 20555 | wmi_handle->log_info.buf_offset_event = 4; |
Govind Singh | ecf03cd | 2016-05-12 12:45:51 +0530 | [diff] [blame] | 20556 | #endif |
Soumya Bhat | 488092d | 2017-03-22 14:41:01 +0530 | [diff] [blame] | 20557 | populate_tlv_events_id(wmi_handle->wmi_events); |
Kiran Venkatappa | 5bffce5 | 2017-02-10 16:57:59 +0530 | [diff] [blame] | 20558 | populate_target_defines_tlv(wmi_handle); |
Govind Singh | 5eb5153 | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 20559 | } |