Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [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 | |
| 28 | /**========================================================================= |
| 29 | |
| 30 | \file smeApi.c |
| 31 | |
| 32 | \brief Definitions for SME APIs |
| 33 | |
| 34 | ========================================================================*/ |
| 35 | |
| 36 | /*-------------------------------------------------------------------------- |
| 37 | Include Files |
| 38 | ------------------------------------------------------------------------*/ |
| 39 | |
| 40 | #include "sms_debug.h" |
| 41 | #include "sme_api.h" |
| 42 | #include "csr_inside_api.h" |
| 43 | #include "sme_inside.h" |
| 44 | #include "csr_internal.h" |
| 45 | #include "wma_types.h" |
| 46 | #include "wma_if.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 47 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 48 | #include "sme_trace.h" |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 49 | #include "qdf_types.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 50 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 51 | #include "cds_utils.h" |
| 52 | #include "sap_api.h" |
| 53 | #include "mac_trace.h" |
| 54 | #ifdef WLAN_FEATURE_NAN |
| 55 | #include "nan_api.h" |
| 56 | #endif |
Naveen Rawat | 3b6068c | 2016-04-14 19:01:06 -0700 | [diff] [blame] | 57 | #include "cds_regdomain.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 58 | #include "cfg_api.h" |
| 59 | #include "sme_power_save_api.h" |
| 60 | #include "wma.h" |
Naveen Rawat | b4d3762 | 2015-11-13 16:15:25 -0800 | [diff] [blame] | 61 | #include "sch_api.h" |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 62 | #include "sme_nan_datapath.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 63 | |
| 64 | extern tSirRetStatus u_mac_post_ctrl_msg(void *pSirGlobal, tSirMbMsg *pMb); |
| 65 | |
| 66 | #define LOG_SIZE 256 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 67 | |
| 68 | static tSelfRecoveryStats g_self_recovery_stats; |
| 69 | /* TxMB Functions */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 70 | extern QDF_STATUS pmc_prepare_command(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 71 | eSmeCommandType cmdType, void *pvParam, |
| 72 | uint32_t size, tSmeCmd **ppCmd); |
| 73 | extern void pmc_release_command(tpAniSirGlobal pMac, tSmeCmd *pCommand); |
| 74 | extern void qos_release_command(tpAniSirGlobal pMac, tSmeCmd *pCommand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 75 | extern QDF_STATUS p2p_process_remain_on_channel_cmd(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 76 | tSmeCmd *p2pRemainonChn); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 77 | extern QDF_STATUS sme_remain_on_chn_rsp(tpAniSirGlobal pMac, uint8_t *pMsg); |
| 78 | extern QDF_STATUS sme_remain_on_chn_ready(tHalHandle hHal, uint8_t *pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 79 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 80 | static QDF_STATUS init_sme_cmd_list(tpAniSirGlobal pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 81 | static void sme_abort_command(tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 82 | bool fStopping); |
| 83 | |
| 84 | eCsrPhyMode sme_get_phy_mode(tHalHandle hHal); |
| 85 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 86 | QDF_STATUS sme_handle_change_country_code(tpAniSirGlobal pMac, void *pMsgBuf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 87 | |
| 88 | void sme_disconnect_connected_sessions(tpAniSirGlobal pMac); |
| 89 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 90 | QDF_STATUS sme_handle_generic_change_country_code(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 91 | void *pMsgBuf); |
| 92 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 93 | QDF_STATUS sme_process_nss_update_resp(tpAniSirGlobal mac, uint8_t *msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 94 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 95 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 96 | bool csr_is_supported_channel(tpAniSirGlobal pMac, uint8_t channelId); |
| 97 | #endif |
| 98 | |
| 99 | #ifdef WLAN_FEATURE_11W |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 100 | QDF_STATUS sme_unprotected_mgmt_frm_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 101 | tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm); |
| 102 | #endif |
| 103 | |
| 104 | /* Message processor for events from DFS */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 105 | QDF_STATUS dfs_msg_processor(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 106 | uint16_t msg_type, void *pMsgBuf); |
| 107 | |
| 108 | /* Channel Change Response Indication Handler */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 109 | QDF_STATUS sme_process_channel_change_resp(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 110 | uint16_t msg_type, void *pMsgBuf); |
| 111 | |
| 112 | /* Internal SME APIs */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 113 | QDF_STATUS sme_acquire_global_lock(tSmeStruct *psSme) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 114 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 115 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 116 | |
| 117 | if (psSme) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 118 | if (QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 119 | (qdf_mutex_acquire(&psSme->lkSmeGlobalLock))) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 120 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 121 | } |
| 122 | } |
| 123 | |
| 124 | return status; |
| 125 | } |
| 126 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 127 | QDF_STATUS sme_release_global_lock(tSmeStruct *psSme) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 128 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 129 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 130 | |
| 131 | if (psSme) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 132 | if (QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 133 | (qdf_mutex_release(&psSme->lkSmeGlobalLock))) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 134 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 135 | } |
| 136 | } |
| 137 | |
| 138 | return status; |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * sme_process_set_hw_mode_resp() - Process set HW mode response |
| 143 | * @mac: Global MAC pointer |
| 144 | * @msg: HW mode response |
| 145 | * |
| 146 | * Processes the HW mode response and invokes the HDD callback |
| 147 | * to process further |
| 148 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 149 | static QDF_STATUS sme_process_set_hw_mode_resp(tpAniSirGlobal mac, uint8_t *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 150 | { |
| 151 | tListElem *entry = NULL; |
| 152 | tSmeCmd *command = NULL; |
| 153 | bool found; |
| 154 | hw_mode_cb callback = NULL; |
| 155 | struct sir_set_hw_mode_resp *param; |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 156 | enum sir_conn_update_reason reason; |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 157 | tSmeCmd *saved_cmd; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 158 | |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 159 | sms_log(mac, LOG1, FL("%s"), __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 160 | param = (struct sir_set_hw_mode_resp *)msg; |
| 161 | if (!param) { |
| 162 | sms_log(mac, LOGE, FL("HW mode resp param is NULL")); |
| 163 | /* Not returning. Need to check if active command list |
| 164 | * needs to be freed |
| 165 | */ |
| 166 | } |
| 167 | |
| 168 | entry = csr_ll_peek_head(&mac->sme.smeCmdActiveList, |
| 169 | LL_ACCESS_LOCK); |
| 170 | if (!entry) { |
| 171 | sms_log(mac, LOGE, FL("No cmd found in active list")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 172 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 176 | if (!command) { |
| 177 | sms_log(mac, LOGE, FL("Base address is NULL")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 178 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 179 | } |
| 180 | |
| 181 | if (e_sme_command_set_hw_mode != command->command) { |
| 182 | sms_log(mac, LOGE, FL("Command mismatch!")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 183 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | callback = command->u.set_hw_mode_cmd.set_hw_mode_cb; |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 187 | reason = command->u.set_hw_mode_cmd.reason; |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 188 | |
| 189 | sms_log(mac, LOG1, FL("reason:%d session:%d"), |
| 190 | command->u.set_hw_mode_cmd.reason, |
| 191 | command->u.set_hw_mode_cmd.session_id); |
| 192 | |
Chandrasekaran, Manishekar | 4dd215e | 2016-04-16 18:48:34 -0700 | [diff] [blame] | 193 | if (!callback) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 194 | sms_log(mac, LOGE, FL("Callback does not exist")); |
Chandrasekaran, Manishekar | 4dd215e | 2016-04-16 18:48:34 -0700 | [diff] [blame] | 195 | goto end; |
| 196 | } |
| 197 | |
| 198 | if (!param) { |
| 199 | sms_log(mac, LOGE, |
| 200 | FL("Callback failed since HW mode params is NULL")); |
| 201 | goto end; |
| 202 | } |
| 203 | |
| 204 | /* Irrespective of the reason for which the hw mode change request |
| 205 | * was issued, the policy manager connection table needs to be updated |
| 206 | * with the new vdev-mac id mapping, tx/rx spatial streams etc., if the |
| 207 | * set hw mode was successful. |
| 208 | */ |
| 209 | callback(param->status, |
| 210 | param->cfgd_hw_mode_index, |
| 211 | param->num_vdev_mac_entries, |
| 212 | param->vdev_mac_map); |
| 213 | |
| 214 | if (reason == SIR_UPDATE_REASON_HIDDEN_STA) { |
| 215 | /* In the case of hidden SSID, connection update |
| 216 | * (set hw mode) is done after the scan with reason |
| 217 | * code eCsrScanForSsid completes. The connect/failure |
| 218 | * needs to be handled after the response of set hw |
| 219 | * mode |
| 220 | */ |
| 221 | saved_cmd = (tSmeCmd *)mac->sme.saved_scan_cmd; |
| 222 | if (!saved_cmd) { |
| 223 | sms_log(mac, LOGP, |
| 224 | FL("saved cmd is NULL, Check this")); |
| 225 | goto end; |
| 226 | } |
| 227 | if (param->status == SET_HW_MODE_STATUS_OK) { |
| 228 | sms_log(mac, LOG1, |
| 229 | FL("search for ssid success")); |
| 230 | csr_scan_handle_search_for_ssid(mac, |
| 231 | saved_cmd); |
| 232 | } else { |
| 233 | sms_log(mac, LOG1, |
| 234 | FL("search for ssid failure")); |
| 235 | csr_scan_handle_search_for_ssid_failure(mac, |
| 236 | saved_cmd); |
| 237 | } |
| 238 | if (saved_cmd->u.roamCmd.pRoamBssEntry) |
| 239 | qdf_mem_free( |
| 240 | saved_cmd->u.roamCmd.pRoamBssEntry); |
| 241 | if (saved_cmd->u.scanCmd.u.scanRequest.SSIDs.SSIDList) |
| 242 | qdf_mem_free(saved_cmd->u.scanCmd.u. |
| 243 | scanRequest.SSIDs.SSIDList); |
| 244 | if (saved_cmd->u.scanCmd.pToRoamProfile) |
| 245 | qdf_mem_free(saved_cmd->u.scanCmd. |
| 246 | pToRoamProfile); |
| 247 | if (saved_cmd) { |
| 248 | qdf_mem_free(saved_cmd); |
| 249 | saved_cmd = NULL; |
| 250 | mac->sme.saved_scan_cmd = NULL; |
| 251 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 252 | } |
| 253 | |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 254 | end: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 255 | found = csr_ll_remove_entry(&mac->sme.smeCmdActiveList, entry, |
| 256 | LL_ACCESS_LOCK); |
| 257 | if (found) { |
| 258 | /* Now put this command back on the avilable command list */ |
| 259 | sme_release_command(mac, command); |
| 260 | } |
| 261 | sme_process_pending_queue(mac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 262 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | /** |
| 266 | * sme_process_hw_mode_trans_ind() - Process HW mode transition indication |
| 267 | * @mac: Global MAC pointer |
| 268 | * @msg: HW mode transition response |
| 269 | * |
| 270 | * Processes the HW mode transition indication and invoke the HDD callback |
| 271 | * to process further |
| 272 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 273 | static QDF_STATUS sme_process_hw_mode_trans_ind(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 274 | uint8_t *msg) |
| 275 | { |
| 276 | hw_mode_transition_cb callback = NULL; |
| 277 | struct sir_hw_mode_trans_ind *param; |
| 278 | |
| 279 | param = (struct sir_hw_mode_trans_ind *)msg; |
| 280 | if (!param) { |
| 281 | sms_log(mac, LOGE, FL("HW mode trans ind param is NULL")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 282 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 283 | } |
| 284 | |
| 285 | callback = mac->sme.sme_hw_mode_trans_cb; |
| 286 | if (callback) { |
| 287 | sms_log(mac, LOGE, FL("Calling registered callback...")); |
| 288 | callback(param->old_hw_mode_index, |
| 289 | param->new_hw_mode_index, |
| 290 | param->num_vdev_mac_entries, |
| 291 | param->vdev_mac_map); |
| 292 | } |
| 293 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 294 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 295 | } |
| 296 | |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 297 | /** |
| 298 | * free_sme_cmds() - This function frees memory allocated for SME commands |
| 299 | * @mac_ctx: Pointer to Global MAC structure |
| 300 | * |
| 301 | * This function frees memory allocated for SME commands |
| 302 | * |
| 303 | * @Return: void |
| 304 | */ |
| 305 | static void free_sme_cmds(tpAniSirGlobal mac_ctx) |
| 306 | { |
| 307 | uint32_t idx; |
| 308 | if (NULL == mac_ctx->sme.pSmeCmdBufAddr) |
| 309 | return; |
| 310 | |
| 311 | for (idx = 0; idx < mac_ctx->sme.totalSmeCmd; idx++) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 312 | qdf_mem_free(mac_ctx->sme.pSmeCmdBufAddr[idx]); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 313 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 314 | qdf_mem_free(mac_ctx->sme.pSmeCmdBufAddr); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 315 | mac_ctx->sme.pSmeCmdBufAddr = NULL; |
| 316 | } |
| 317 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 318 | static QDF_STATUS init_sme_cmd_list(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 319 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 320 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 321 | tSmeCmd *pCmd; |
| 322 | uint32_t cmd_idx; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 323 | QDF_STATUS qdf_status; |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 324 | qdf_mc_timer_t *cmdTimeoutTimer = NULL; |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 325 | uint32_t sme_cmd_ptr_ary_sz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 326 | |
| 327 | pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND; |
| 328 | |
| 329 | status = csr_ll_open(pMac->hHdd, &pMac->sme.smeCmdActiveList); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 330 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 331 | goto end; |
| 332 | |
| 333 | status = csr_ll_open(pMac->hHdd, &pMac->sme.smeCmdPendingList); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 334 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 335 | goto end; |
| 336 | |
| 337 | status = csr_ll_open(pMac->hHdd, &pMac->sme.smeScanCmdActiveList); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 338 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 339 | goto end; |
| 340 | |
| 341 | status = csr_ll_open(pMac->hHdd, &pMac->sme.smeScanCmdPendingList); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 342 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 343 | goto end; |
| 344 | |
| 345 | status = csr_ll_open(pMac->hHdd, &pMac->sme.smeCmdFreeList); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 346 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 347 | goto end; |
| 348 | |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 349 | /* following pointer contains array of pointers for tSmeCmd* */ |
| 350 | sme_cmd_ptr_ary_sz = sizeof(void *) * pMac->sme.totalSmeCmd; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 351 | pMac->sme.pSmeCmdBufAddr = qdf_mem_malloc(sme_cmd_ptr_ary_sz); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 352 | if (NULL == pMac->sme.pSmeCmdBufAddr) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 353 | status = QDF_STATUS_E_NOMEM; |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 354 | goto end; |
| 355 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 356 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 357 | status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 358 | qdf_mem_set(pMac->sme.pSmeCmdBufAddr, sme_cmd_ptr_ary_sz, 0); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 359 | for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++) { |
| 360 | /* |
| 361 | * Since total size of all commands together can be huge chunk |
| 362 | * of memory, allocate SME cmd individually. These SME CMDs are |
| 363 | * moved between pending and active queues. And these freeing of |
| 364 | * these queues just manipulates the list but does not actually |
| 365 | * frees SME CMD pointers. Hence store each SME CMD address in |
| 366 | * the array, sme.pSmeCmdBufAddr. This will later facilitate |
| 367 | * freeing up of all SME CMDs with just a for loop. |
| 368 | */ |
| 369 | pMac->sme.pSmeCmdBufAddr[cmd_idx] = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 370 | qdf_mem_malloc(sizeof(tSmeCmd)); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 371 | if (NULL == pMac->sme.pSmeCmdBufAddr[cmd_idx]) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 372 | status = QDF_STATUS_E_NOMEM; |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 373 | free_sme_cmds(pMac); |
| 374 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 375 | } |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 376 | pCmd = (tSmeCmd *)pMac->sme.pSmeCmdBufAddr[cmd_idx]; |
| 377 | csr_ll_insert_tail(&pMac->sme.smeCmdFreeList, |
| 378 | &pCmd->Link, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 379 | } |
| 380 | |
| 381 | /* This timer is only to debug the active list command timeout */ |
| 382 | |
| 383 | cmdTimeoutTimer = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 384 | (qdf_mc_timer_t *) qdf_mem_malloc(sizeof(qdf_mc_timer_t)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 385 | if (cmdTimeoutTimer) { |
| 386 | pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 387 | qdf_status = |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 388 | qdf_mc_timer_init(pMac->sme.smeCmdActiveList. |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 389 | cmdTimeoutTimer, QDF_TIMER_TYPE_SW, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 390 | active_list_cmd_timeout_handle, (void *)pMac); |
| 391 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 392 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 393 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 394 | "Init Timer fail for active list command process time out"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 395 | qdf_mem_free(pMac->sme.smeCmdActiveList. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 396 | cmdTimeoutTimer); |
| 397 | pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL; |
| 398 | } else { |
| 399 | pMac->sme.smeCmdActiveList.cmdTimeoutDuration = |
| 400 | CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE; |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | end: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 405 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 406 | sms_log(pMac, LOGE, "failed to initialize sme command list:%d\n", |
| 407 | status); |
| 408 | |
| 409 | return status; |
| 410 | } |
| 411 | |
| 412 | void sme_release_command(tpAniSirGlobal pMac, tSmeCmd *pCmd) |
| 413 | { |
| 414 | pCmd->command = eSmeNoCommand; |
| 415 | csr_ll_insert_tail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK); |
| 416 | } |
| 417 | |
| 418 | static void sme_release_cmd_list(tpAniSirGlobal pMac, tDblLinkList *pList) |
| 419 | { |
| 420 | tListElem *pEntry; |
| 421 | tSmeCmd *pCommand; |
| 422 | |
| 423 | while ((pEntry = csr_ll_remove_head(pList, LL_ACCESS_LOCK)) != NULL) { |
| 424 | /* TODO: base on command type to call release functions */ |
| 425 | /* reinitialize different command types so they can be reused */ |
| 426 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 427 | sme_abort_command(pMac, pCommand, true); |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | static void purge_sme_cmd_list(tpAniSirGlobal pMac) |
| 432 | { |
| 433 | /* release any out standing commands back to free command list */ |
| 434 | sme_release_cmd_list(pMac, &pMac->sme.smeCmdPendingList); |
| 435 | sme_release_cmd_list(pMac, &pMac->sme.smeCmdActiveList); |
| 436 | sme_release_cmd_list(pMac, &pMac->sme.smeScanCmdPendingList); |
| 437 | sme_release_cmd_list(pMac, &pMac->sme.smeScanCmdActiveList); |
| 438 | } |
| 439 | |
| 440 | void purge_sme_session_cmd_list(tpAniSirGlobal pMac, uint32_t sessionId, |
| 441 | tDblLinkList *pList) |
| 442 | { |
| 443 | /* release any out standing commands back to free command list */ |
| 444 | tListElem *pEntry, *pNext; |
| 445 | tSmeCmd *pCommand; |
| 446 | tDblLinkList localList; |
| 447 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 448 | qdf_mem_zero(&localList, sizeof(tDblLinkList)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 449 | if (!QDF_IS_STATUS_SUCCESS(csr_ll_open(pMac->hHdd, &localList))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 450 | sms_log(pMac, LOGE, FL(" failed to open list")); |
| 451 | return; |
| 452 | } |
| 453 | |
| 454 | csr_ll_lock(pList); |
| 455 | pEntry = csr_ll_peek_head(pList, LL_ACCESS_NOLOCK); |
| 456 | while (pEntry != NULL) { |
| 457 | pNext = csr_ll_next(pList, pEntry, LL_ACCESS_NOLOCK); |
| 458 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 459 | if (pCommand->sessionId == sessionId) { |
| 460 | if (csr_ll_remove_entry(pList, pEntry, LL_ACCESS_NOLOCK)) { |
| 461 | csr_ll_insert_tail(&localList, pEntry, |
| 462 | LL_ACCESS_NOLOCK); |
| 463 | } |
| 464 | } |
| 465 | pEntry = pNext; |
| 466 | } |
| 467 | csr_ll_unlock(pList); |
| 468 | |
| 469 | while ((pEntry = csr_ll_remove_head(&localList, LL_ACCESS_NOLOCK))) { |
| 470 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 471 | sme_abort_command(pMac, pCommand, true); |
| 472 | } |
| 473 | csr_ll_close(&localList); |
| 474 | } |
| 475 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 476 | static QDF_STATUS free_sme_cmd_list(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 477 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 478 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 479 | |
| 480 | purge_sme_cmd_list(pMac); |
| 481 | csr_ll_close(&pMac->sme.smeCmdPendingList); |
| 482 | csr_ll_close(&pMac->sme.smeCmdActiveList); |
| 483 | csr_ll_close(&pMac->sme.smeScanCmdPendingList); |
| 484 | csr_ll_close(&pMac->sme.smeScanCmdActiveList); |
| 485 | csr_ll_close(&pMac->sme.smeCmdFreeList); |
| 486 | |
| 487 | /*destroy active list command time out timer */ |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 488 | qdf_mc_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 489 | qdf_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 490 | pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL; |
| 491 | |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 492 | status = qdf_mutex_acquire(&pMac->sme.lkSmeGlobalLock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 493 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 494 | sms_log(pMac, LOGE, |
| 495 | FL("Failed to acquire the lock status = %d"), status); |
| 496 | goto done; |
| 497 | } |
| 498 | |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 499 | free_sme_cmds(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 500 | |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 501 | status = qdf_mutex_release(&pMac->sme.lkSmeGlobalLock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 502 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 503 | sms_log(pMac, LOGE, |
| 504 | FL("Failed to release the lock status = %d"), status); |
| 505 | } |
| 506 | done: |
| 507 | return status; |
| 508 | } |
| 509 | |
| 510 | void dump_csr_command_info(tpAniSirGlobal pMac, tSmeCmd *pCmd) |
| 511 | { |
| 512 | switch (pCmd->command) { |
| 513 | case eSmeCommandScan: |
| 514 | sms_log(pMac, LOGE, " scan command reason is %d", |
| 515 | pCmd->u.scanCmd.reason); |
| 516 | break; |
| 517 | |
| 518 | case eSmeCommandRoam: |
| 519 | sms_log(pMac, LOGE, " roam command reason is %d", |
| 520 | pCmd->u.roamCmd.roamReason); |
| 521 | break; |
| 522 | |
| 523 | case eSmeCommandWmStatusChange: |
| 524 | sms_log(pMac, LOGE, " WMStatusChange command type is %d", |
| 525 | pCmd->u.wmStatusChangeCmd.Type); |
| 526 | break; |
| 527 | |
| 528 | case eSmeCommandSetKey: |
| 529 | sms_log(pMac, LOGE, " setKey command auth(%d) enc(%d)", |
| 530 | pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType); |
| 531 | break; |
| 532 | |
| 533 | default: |
| 534 | sms_log(pMac, LOGE, " default: Unhandled command %d", |
| 535 | pCmd->command); |
| 536 | break; |
| 537 | } |
| 538 | } |
| 539 | |
| 540 | tSmeCmd *sme_get_command_buffer(tpAniSirGlobal pMac) |
| 541 | { |
| 542 | tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL; |
| 543 | tListElem *pEntry; |
| 544 | static int sme_command_queue_full; |
| 545 | |
| 546 | pEntry = csr_ll_remove_head(&pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK); |
| 547 | |
| 548 | /* If we can get another MS Msg buffer, then we are ok. Just link */ |
| 549 | /* the entry onto the linked list. (We are using the linked list */ |
| 550 | /* to keep track of tfhe message buffers). */ |
| 551 | if (pEntry) { |
| 552 | pRetCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 553 | /* reset when free list is available */ |
| 554 | sme_command_queue_full = 0; |
| 555 | } else { |
| 556 | int idx = 1; |
| 557 | |
| 558 | /* Cannot change pRetCmd here since it needs to return later. */ |
| 559 | pEntry = |
| 560 | csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 561 | if (pEntry) { |
| 562 | pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 563 | } |
| 564 | sms_log(pMac, LOGE, |
| 565 | "Out of command buffer.... command (0x%X) stuck", |
| 566 | (pTempCmd) ? pTempCmd->command : eSmeNoCommand); |
| 567 | if (pTempCmd) { |
| 568 | if (eSmeCsrCommandMask & pTempCmd->command) { |
| 569 | /* CSR command is stuck. See what the reason code is for that command */ |
| 570 | dump_csr_command_info(pMac, pTempCmd); |
| 571 | } |
| 572 | } /* if(pTempCmd) */ |
| 573 | |
| 574 | /* dump what is in the pending queue */ |
| 575 | csr_ll_lock(&pMac->sme.smeCmdPendingList); |
| 576 | pEntry = |
| 577 | csr_ll_peek_head(&pMac->sme.smeCmdPendingList, |
| 578 | LL_ACCESS_NOLOCK); |
| 579 | while (pEntry && !sme_command_queue_full) { |
| 580 | pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 581 | /* Print only 1st five commands from pending queue. */ |
| 582 | if (idx <= 5) |
| 583 | sms_log(pMac, LOGE, |
| 584 | "Out of command buffer.... SME pending command #%d (0x%X)", |
| 585 | idx, pTempCmd->command); |
| 586 | idx++; |
| 587 | if (eSmeCsrCommandMask & pTempCmd->command) { |
| 588 | /* CSR command is stuck. See what the reason code is for that command */ |
| 589 | dump_csr_command_info(pMac, pTempCmd); |
| 590 | } |
| 591 | pEntry = |
| 592 | csr_ll_next(&pMac->sme.smeCmdPendingList, pEntry, |
| 593 | LL_ACCESS_NOLOCK); |
| 594 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 595 | csr_ll_unlock(&pMac->sme.smeCmdPendingList); |
| 596 | |
DARAM SUDHA | f6c3f97 | 2015-05-26 19:26:16 +0530 | [diff] [blame] | 597 | idx = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 598 | /* There may be some more command in CSR's own pending queue */ |
| 599 | csr_ll_lock(&pMac->roam.roamCmdPendingList); |
| 600 | pEntry = |
| 601 | csr_ll_peek_head(&pMac->roam.roamCmdPendingList, |
| 602 | LL_ACCESS_NOLOCK); |
DARAM SUDHA | f6c3f97 | 2015-05-26 19:26:16 +0530 | [diff] [blame] | 603 | while (pEntry && !sme_command_queue_full) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 604 | pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
DARAM SUDHA | f6c3f97 | 2015-05-26 19:26:16 +0530 | [diff] [blame] | 605 | /* Print only 1st five commands from CSR pending queue */ |
| 606 | if (idx <= 5) |
| 607 | sms_log(pMac, LOGE, |
| 608 | "Out of command buffer.... " |
| 609 | "CSR roamCmdPendingList command #%d (0x%X)", |
| 610 | idx, pTempCmd->command); |
| 611 | idx++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 612 | dump_csr_command_info(pMac, pTempCmd); |
| 613 | pEntry = |
| 614 | csr_ll_next(&pMac->roam.roamCmdPendingList, pEntry, |
| 615 | LL_ACCESS_NOLOCK); |
| 616 | } |
DARAM SUDHA | f6c3f97 | 2015-05-26 19:26:16 +0530 | [diff] [blame] | 617 | |
| 618 | /* Increment static variable so that it prints |
| 619 | * pending command only once |
| 620 | */ |
| 621 | sme_command_queue_full++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 622 | csr_ll_unlock(&pMac->roam.roamCmdPendingList); |
DARAM SUDHA | f6c3f97 | 2015-05-26 19:26:16 +0530 | [diff] [blame] | 623 | |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 624 | if (pMac->roam.configParam.enable_fatal_event) |
| 625 | cds_flush_logs(WLAN_LOG_TYPE_FATAL, |
| 626 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 627 | WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF, |
| 628 | false, |
| 629 | pMac->sme.enableSelfRecovery ? true : false); |
| 630 | else if (pMac->sme.enableSelfRecovery) |
| 631 | cds_trigger_recovery(); |
| 632 | else |
| 633 | QDF_BUG(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 634 | } |
| 635 | |
| 636 | /* memset to zero */ |
| 637 | if (pRetCmd) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 638 | qdf_mem_set((uint8_t *)&pRetCmd->command, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 639 | sizeof(pRetCmd->command), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 640 | qdf_mem_set((uint8_t *)&pRetCmd->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 641 | sizeof(pRetCmd->sessionId), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 642 | qdf_mem_set((uint8_t *)&pRetCmd->u, sizeof(pRetCmd->u), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 643 | } |
| 644 | |
| 645 | return pRetCmd; |
| 646 | } |
| 647 | |
| 648 | void sme_push_command(tpAniSirGlobal pMac, tSmeCmd *pCmd, bool fHighPriority) |
| 649 | { |
| 650 | if (!SME_IS_START(pMac)) { |
| 651 | sms_log(pMac, LOGE, FL("Sme in stop state")); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 652 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 653 | return; |
| 654 | } |
| 655 | |
| 656 | if (fHighPriority) { |
| 657 | csr_ll_insert_head(&pMac->sme.smeCmdPendingList, &pCmd->Link, |
| 658 | LL_ACCESS_LOCK); |
| 659 | } else { |
| 660 | csr_ll_insert_tail(&pMac->sme.smeCmdPendingList, &pCmd->Link, |
| 661 | LL_ACCESS_LOCK); |
| 662 | } |
| 663 | |
| 664 | /* process the command queue... */ |
| 665 | sme_process_pending_queue(pMac); |
| 666 | |
| 667 | return; |
| 668 | } |
| 669 | |
| 670 | /* For commands that need to do extra cleanup. */ |
| 671 | static void sme_abort_command(tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 672 | bool fStopping) |
| 673 | { |
| 674 | if (eSmePmcCommandMask & pCommand->command) { |
| 675 | sms_log(pMac, LOG1, |
| 676 | "No need to process PMC commands"); |
| 677 | return; |
| 678 | } |
| 679 | if (eSmeCsrCommandMask & pCommand->command) { |
| 680 | csr_abort_command(pMac, pCommand, fStopping); |
| 681 | return; |
| 682 | } |
| 683 | switch (pCommand->command) { |
| 684 | case eSmeCommandRemainOnChannel: |
| 685 | if (NULL != pCommand->u.remainChlCmd.callback) { |
| 686 | remainOnChanCallback callback = |
| 687 | pCommand->u.remainChlCmd.callback; |
| 688 | /* process the msg */ |
| 689 | if (callback) { |
| 690 | callback(pMac, pCommand->u.remainChlCmd. |
| 691 | callbackCtx, eCSR_SCAN_ABORT, |
| 692 | pCommand->u.remainChlCmd.scan_id); |
| 693 | } |
| 694 | } |
| 695 | sme_release_command(pMac, pCommand); |
| 696 | break; |
| 697 | default: |
| 698 | sme_release_command(pMac, pCommand); |
| 699 | break; |
| 700 | } |
| 701 | |
| 702 | } |
| 703 | |
| 704 | tListElem *csr_get_cmd_to_process(tpAniSirGlobal pMac, tDblLinkList *pList, |
| 705 | uint8_t sessionId, bool fInterlocked) |
| 706 | { |
| 707 | tListElem *pCurEntry = NULL; |
| 708 | tSmeCmd *pCommand; |
| 709 | |
| 710 | /* Go through the list and return the command whose session id is not |
| 711 | * matching with the current ongoing scan cmd sessionId */ |
| 712 | pCurEntry = csr_ll_peek_head(pList, LL_ACCESS_LOCK); |
| 713 | while (pCurEntry) { |
| 714 | pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link); |
| 715 | if (pCommand->sessionId != sessionId) { |
| 716 | sms_log(pMac, LOG1, |
| 717 | "selected the command with different sessionId"); |
| 718 | return pCurEntry; |
| 719 | } |
| 720 | |
| 721 | pCurEntry = csr_ll_next(pList, pCurEntry, fInterlocked); |
| 722 | } |
| 723 | |
| 724 | sms_log(pMac, LOG1, "No command pending with different sessionId"); |
| 725 | return NULL; |
| 726 | } |
| 727 | |
| 728 | bool sme_process_scan_queue(tpAniSirGlobal pMac) |
| 729 | { |
| 730 | tListElem *pEntry; |
| 731 | tSmeCmd *pCommand; |
| 732 | tListElem *pSmeEntry = NULL; |
| 733 | tSmeCmd *pSmeCommand = NULL; |
| 734 | bool status = true; |
| 735 | |
| 736 | if ((!csr_ll_is_list_empty(&pMac->sme.smeCmdActiveList, |
| 737 | LL_ACCESS_LOCK))) { |
| 738 | pSmeEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, |
| 739 | LL_ACCESS_LOCK); |
| 740 | if (pSmeEntry) |
| 741 | pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link); |
| 742 | } |
| 743 | csr_ll_lock(&pMac->sme.smeScanCmdActiveList); |
| 744 | if (csr_ll_is_list_empty(&pMac->sme.smeScanCmdPendingList, |
| 745 | LL_ACCESS_LOCK)) |
| 746 | goto end; |
| 747 | pEntry = csr_ll_peek_head(&pMac->sme.smeScanCmdPendingList, |
| 748 | LL_ACCESS_LOCK); |
| 749 | if (!pEntry) |
| 750 | goto end; |
| 751 | |
| 752 | sms_log(pMac, LOGE, |
| 753 | FL("scan_count in active scanlist %d "), |
| 754 | pMac->sme.smeScanCmdActiveList.Count); |
| 755 | |
| 756 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 757 | if (pSmeCommand != NULL) { |
| 758 | /* |
| 759 | * if scan is running on one interface and SME receives |
| 760 | * the next command on the same interface then |
| 761 | * dont the allow the command to be queued to |
| 762 | * smeCmdPendingList. If next scan is allowed on |
| 763 | * the same interface the CSR state machine will |
| 764 | * get screwed up. |
| 765 | */ |
| 766 | if (pSmeCommand->sessionId == pCommand->sessionId) { |
| 767 | status = false; |
| 768 | goto end; |
| 769 | } |
| 770 | } |
| 771 | /* |
| 772 | * We cannot execute any command in wait-for-key state until setKey is |
| 773 | * through. |
| 774 | */ |
| 775 | if (CSR_IS_WAIT_FOR_KEY(pMac, pCommand->sessionId)) { |
| 776 | if (!CSR_IS_SET_KEY_COMMAND(pCommand)) { |
| 777 | sms_log(pMac, LOGE, |
| 778 | FL("Can't process cmd(%d), waiting for key"), |
| 779 | pCommand->command); |
| 780 | status = false; |
| 781 | goto end; |
| 782 | } |
| 783 | } |
| 784 | if (csr_ll_remove_entry(&pMac->sme.smeScanCmdPendingList, pEntry, |
| 785 | LL_ACCESS_LOCK)) { |
| 786 | csr_ll_insert_head(&pMac->sme.smeScanCmdActiveList, |
| 787 | &pCommand->Link, LL_ACCESS_NOLOCK); |
| 788 | switch (pCommand->command) { |
| 789 | case eSmeCommandScan: |
| 790 | sms_log(pMac, LOG1, FL("Processing scan offload cmd.")); |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 791 | qdf_mc_timer_start(&pCommand->u.scanCmd.csr_scan_timer, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 792 | CSR_ACTIVE_SCAN_LIST_CMD_TIMEOUT); |
| 793 | csr_process_scan_command(pMac, pCommand); |
| 794 | break; |
| 795 | case eSmeCommandRemainOnChannel: |
| 796 | sms_log(pMac, LOG1, |
| 797 | FL("Processing remain on channel offload cmd")); |
| 798 | p2p_process_remain_on_channel_cmd(pMac, pCommand); |
| 799 | break; |
| 800 | default: |
| 801 | sms_log(pMac, LOGE, |
| 802 | FL("Wrong cmd enqueued to ScanCmdPendingList")); |
| 803 | pEntry = csr_ll_remove_head( |
| 804 | &pMac->sme.smeScanCmdActiveList, |
| 805 | LL_ACCESS_NOLOCK); |
| 806 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 807 | sme_release_command(pMac, pCommand); |
| 808 | break; |
| 809 | } |
| 810 | } |
| 811 | end: |
| 812 | csr_ll_unlock(&pMac->sme.smeScanCmdActiveList); |
| 813 | return status; |
| 814 | } |
| 815 | |
| 816 | /** |
| 817 | * sme_process_command() - processes SME commnd |
| 818 | * @mac_ctx: mac global context |
| 819 | * |
| 820 | * This function is called by sme_process_pending_queue() in a while loop |
| 821 | * |
| 822 | * Return: true indicates that caller function can proceed to next cmd |
| 823 | * false otherwise. |
| 824 | */ |
| 825 | bool sme_process_command(tpAniSirGlobal pMac) |
| 826 | { |
| 827 | bool fContinue = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 828 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 829 | tListElem *pEntry; |
| 830 | tSmeCmd *pCommand; |
| 831 | tListElem *pSmeEntry; |
| 832 | tSmeCmd *pSmeCommand; |
| 833 | |
| 834 | /* |
| 835 | * if the ActiveList is empty, then nothing is active so we can process |
| 836 | * a pending command... |
| 837 | * alwasy lock active list before locking pending list |
| 838 | */ |
| 839 | csr_ll_lock(&pMac->sme.smeCmdActiveList); |
| 840 | if (!csr_ll_is_list_empty(&pMac->sme.smeCmdActiveList, |
| 841 | LL_ACCESS_NOLOCK)) { |
| 842 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 843 | goto process_scan_q; |
| 844 | } |
| 845 | |
| 846 | if (csr_ll_is_list_empty(&pMac->sme.smeCmdPendingList, |
| 847 | LL_ACCESS_LOCK)) { |
| 848 | /* No command waiting */ |
| 849 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 850 | goto process_scan_q; |
| 851 | } |
| 852 | |
| 853 | /* |
| 854 | * If scan command is pending in the smeScanCmdActive list then pick the |
| 855 | * command from smeCmdPendingList which is not matching with the scan |
| 856 | * command session id. At any point of time only one command will be |
| 857 | * allowed on a single session. |
| 858 | */ |
| 859 | if (!csr_ll_is_list_empty( |
| 860 | &pMac->sme.smeScanCmdActiveList, LL_ACCESS_LOCK)) { |
| 861 | pSmeEntry = csr_ll_peek_head(&pMac->sme.smeScanCmdActiveList, |
| 862 | LL_ACCESS_LOCK); |
| 863 | if (pSmeEntry) { |
| 864 | pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link); |
| 865 | pEntry = csr_get_cmd_to_process(pMac, |
| 866 | &pMac->sme.smeCmdPendingList, |
| 867 | pSmeCommand->sessionId, |
| 868 | LL_ACCESS_LOCK); |
| 869 | goto sme_process_cmd; |
| 870 | } |
| 871 | } |
| 872 | |
| 873 | /* Peek the command */ |
| 874 | pEntry = csr_ll_peek_head(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK); |
| 875 | sme_process_cmd: |
| 876 | if (!pEntry) { |
| 877 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 878 | goto process_scan_q; |
| 879 | } |
| 880 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 881 | /* |
| 882 | * Allow only disconnect command in wait-for-key state until setKey is |
| 883 | * through. |
| 884 | */ |
| 885 | if (CSR_IS_WAIT_FOR_KEY(pMac, pCommand->sessionId) |
| 886 | && !CSR_IS_DISCONNECT_COMMAND(pCommand) |
| 887 | && !CSR_IS_SET_KEY_COMMAND(pCommand)) { |
| 888 | if (CSR_IS_CLOSE_SESSION_COMMAND(pCommand)) { |
| 889 | tSmeCmd *sme_cmd = NULL; |
| 890 | |
| 891 | sms_log(pMac, LOGE, |
| 892 | FL("SessionId %d: close session command issued while waiting for key, issue disconnect first"), |
| 893 | pCommand->sessionId); |
| 894 | status = csr_prepare_disconnect_command(pMac, |
| 895 | pCommand->sessionId, &sme_cmd); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 896 | if (status == QDF_STATUS_SUCCESS && sme_cmd) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 897 | csr_ll_lock(&pMac->sme.smeCmdPendingList); |
| 898 | csr_ll_insert_head(&pMac->sme.smeCmdPendingList, |
| 899 | &sme_cmd->Link, LL_ACCESS_NOLOCK); |
| 900 | pEntry = csr_ll_peek_head( |
| 901 | &pMac->sme.smeCmdPendingList, |
| 902 | LL_ACCESS_NOLOCK); |
| 903 | csr_ll_unlock(&pMac->sme.smeCmdPendingList); |
| 904 | goto sme_process_cmd; |
| 905 | } |
| 906 | } |
| 907 | |
| 908 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 909 | sms_log(pMac, LOGE, |
| 910 | FL("SessionId %d: Can't process cmd(%d), waiting for key"), |
| 911 | pCommand->sessionId, pCommand->command); |
| 912 | fContinue = false; |
| 913 | goto process_scan_q; |
| 914 | } |
| 915 | |
| 916 | if (!csr_ll_remove_entry(&pMac->sme.smeCmdPendingList, pEntry, |
| 917 | LL_ACCESS_LOCK)) { |
| 918 | /* This is odd. Some one else pull off the command. */ |
| 919 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 920 | goto process_scan_q; |
| 921 | } |
| 922 | /* we can reuse the pCommand. Insert the command onto the ActiveList */ |
| 923 | csr_ll_insert_head(&pMac->sme.smeCmdActiveList, &pCommand->Link, |
| 924 | LL_ACCESS_NOLOCK); |
| 925 | /* .... and process the command. */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 926 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_COMMAND, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 927 | pCommand->sessionId, pCommand->command)); |
| 928 | |
| 929 | switch (pCommand->command) { |
| 930 | case eSmeCommandScan: |
| 931 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 932 | status = csr_process_scan_command(pMac, pCommand); |
| 933 | break; |
| 934 | case eSmeCommandRoam: |
| 935 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 936 | status = csr_roam_process_command(pMac, pCommand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 937 | if (!QDF_IS_STATUS_SUCCESS(status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 938 | && csr_ll_remove_entry(&pMac->sme.smeCmdActiveList, |
| 939 | &pCommand->Link, LL_ACCESS_LOCK)) |
| 940 | csr_release_command_roam(pMac, pCommand); |
| 941 | break; |
| 942 | case eSmeCommandWmStatusChange: |
| 943 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 944 | csr_roam_process_wm_status_change_command(pMac, pCommand); |
| 945 | break; |
| 946 | case eSmeCommandSetKey: |
| 947 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 948 | status = csr_roam_process_set_key_command(pMac, pCommand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 949 | if (!QDF_IS_STATUS_SUCCESS(status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 950 | && csr_ll_remove_entry(&pMac->sme.smeCmdActiveList, |
| 951 | &pCommand->Link, LL_ACCESS_LOCK)) { |
| 952 | csr_release_command_set_key(pMac, pCommand); |
| 953 | } |
| 954 | break; |
| 955 | case eSmeCommandAddStaSession: |
| 956 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 957 | csr_process_add_sta_session_command(pMac, pCommand); |
| 958 | break; |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 959 | case eSmeCommandNdpInitiatorRequest: |
| 960 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 961 | if (csr_process_ndp_initiator_request(pMac, pCommand) != |
| 962 | QDF_STATUS_SUCCESS) |
| 963 | if (csr_ll_remove_entry( |
| 964 | &pMac->sme.smeCmdActiveList, |
| 965 | &pCommand->Link, LL_ACCESS_LOCK)) |
| 966 | csr_release_command(pMac, pCommand); |
Abhishek Singh | 4fef747 | 2016-06-06 11:36:03 -0700 | [diff] [blame] | 967 | break; |
| 968 | case eSmeCommandNdpResponderRequest: |
| 969 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 970 | status = csr_process_ndp_responder_request(pMac, pCommand); |
| 971 | if (status != QDF_STATUS_SUCCESS) { |
| 972 | if (csr_ll_remove_entry(&pMac->sme.smeCmdActiveList, |
Naveen Rawat | f28315c | 2016-06-29 18:06:02 -0700 | [diff] [blame] | 973 | &pCommand->Link, LL_ACCESS_LOCK)) |
| 974 | csr_release_command(pMac, pCommand); |
| 975 | } |
| 976 | break; |
| 977 | case eSmeCommandNdpDataEndInitiatorRequest: |
| 978 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 979 | status = csr_process_ndp_data_end_request(pMac, pCommand); |
| 980 | if (status != QDF_STATUS_SUCCESS) { |
| 981 | if (csr_ll_remove_entry(&pMac->sme.smeCmdActiveList, |
| 982 | &pCommand->Link, LL_ACCESS_LOCK)) |
Abhishek Singh | 4fef747 | 2016-06-06 11:36:03 -0700 | [diff] [blame] | 983 | csr_release_command(pMac, pCommand); |
| 984 | } |
| 985 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 986 | case eSmeCommandDelStaSession: |
| 987 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 988 | csr_process_del_sta_session_command(pMac, pCommand); |
| 989 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 990 | case eSmeCommandRemainOnChannel: |
| 991 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 992 | p2p_process_remain_on_channel_cmd(pMac, pCommand); |
| 993 | break; |
| 994 | /* |
| 995 | * Treat standby differently here because caller may not be able |
| 996 | * to handle the failure so we do our best here |
| 997 | */ |
| 998 | case eSmeCommandEnterStandby: |
| 999 | break; |
| 1000 | case eSmeCommandAddTs: |
| 1001 | case eSmeCommandDelTs: |
| 1002 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 1003 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 1004 | fContinue = qos_process_command(pMac, pCommand); |
| 1005 | if (fContinue && csr_ll_remove_entry( |
| 1006 | &pMac->sme.smeCmdActiveList, |
| 1007 | &pCommand->Link, LL_ACCESS_NOLOCK)) { |
| 1008 | /* The command failed, remove it */ |
| 1009 | qos_release_command(pMac, pCommand); |
| 1010 | } |
| 1011 | #endif |
| 1012 | break; |
| 1013 | #ifdef FEATURE_WLAN_TDLS |
| 1014 | case eSmeCommandTdlsSendMgmt: |
| 1015 | case eSmeCommandTdlsAddPeer: |
| 1016 | case eSmeCommandTdlsDelPeer: |
| 1017 | case eSmeCommandTdlsLinkEstablish: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1018 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1019 | FL("sending TDLS Command 0x%x to PE"), |
| 1020 | pCommand->command); |
| 1021 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 1022 | status = csr_tdls_process_cmd(pMac, pCommand); |
| 1023 | break; |
| 1024 | #endif |
| 1025 | case e_sme_command_set_hw_mode: |
| 1026 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 1027 | csr_process_set_hw_mode(pMac, pCommand); |
| 1028 | break; |
| 1029 | case e_sme_command_nss_update: |
| 1030 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 1031 | csr_process_nss_update_req(pMac, pCommand); |
| 1032 | break; |
| 1033 | case e_sme_command_set_dual_mac_config: |
| 1034 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 1035 | csr_process_set_dual_mac_config(pMac, pCommand); |
| 1036 | break; |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1037 | case e_sme_command_set_antenna_mode: |
| 1038 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 1039 | csr_process_set_antenna_mode(pMac, pCommand); |
| 1040 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1041 | default: |
| 1042 | /* something is wrong */ |
| 1043 | /* remove it from the active list */ |
| 1044 | sms_log(pMac, LOGE, FL("unknown command %d"), |
| 1045 | pCommand->command); |
| 1046 | pEntry = csr_ll_remove_head(&pMac->sme.smeCmdActiveList, |
| 1047 | LL_ACCESS_NOLOCK); |
| 1048 | csr_ll_unlock(&pMac->sme.smeCmdActiveList); |
| 1049 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 1050 | sme_release_command(pMac, pCommand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1051 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1052 | break; |
| 1053 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1054 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1055 | fContinue = true; |
| 1056 | process_scan_q: |
| 1057 | if (!(sme_process_scan_queue(pMac))) |
| 1058 | fContinue = false; |
| 1059 | return fContinue; |
| 1060 | } |
| 1061 | |
| 1062 | void sme_process_pending_queue(tpAniSirGlobal pMac) |
| 1063 | { |
| 1064 | while (sme_process_command(pMac)) |
| 1065 | ; |
| 1066 | } |
| 1067 | |
| 1068 | bool sme_command_pending(tpAniSirGlobal pMac) |
| 1069 | { |
| 1070 | return !csr_ll_is_list_empty(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK) |
| 1071 | || !csr_ll_is_list_empty(&pMac->sme.smeCmdPendingList, |
| 1072 | LL_ACCESS_NOLOCK); |
| 1073 | } |
| 1074 | |
| 1075 | /* Global APIs */ |
| 1076 | |
| 1077 | /** |
| 1078 | * sme_open() - Initialze all SME modules and put them at idle state |
| 1079 | * @hHal: The handle returned by mac_open |
| 1080 | * |
| 1081 | * The function initializes each module inside SME, PMC, CSR, etc. Upon |
| 1082 | * successfully return, all modules are at idle state ready to start. |
| 1083 | * smeOpen must be called before any other SME APIs can be involved. |
| 1084 | * smeOpen must be called after mac_open. |
| 1085 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1086 | * Return: QDF_STATUS_SUCCESS - SME is successfully initialized. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1087 | * Other status means SME is failed to be initialized |
| 1088 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1089 | QDF_STATUS sme_open(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1090 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1091 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1092 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1093 | |
| 1094 | pMac->sme.state = SME_STATE_STOP; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1095 | pMac->sme.currDeviceMode = QDF_STA_MODE; |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 1096 | if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_create( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1097 | &pMac->sme.lkSmeGlobalLock))) { |
| 1098 | sms_log(pMac, LOGE, FL("sme_open failed init lock")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1099 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1100 | } |
| 1101 | status = csr_open(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1102 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1103 | sms_log(pMac, LOGE, FL("csr_open failed, status=%d"), status); |
| 1104 | return status; |
| 1105 | } |
| 1106 | |
| 1107 | status = sme_ps_open(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1108 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1109 | sms_log(pMac, LOGE, |
| 1110 | FL("sme_ps_open failed during initialization with status=%d"), |
| 1111 | status); |
| 1112 | return status; |
| 1113 | } |
| 1114 | #ifdef FEATURE_WLAN_TDLS |
| 1115 | pMac->is_tdls_power_save_prohibited = 0; |
| 1116 | #endif |
| 1117 | |
| 1118 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 1119 | status = sme_qos_open(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1120 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1121 | sms_log(pMac, LOGE, FL("Qos open, status=%d"), status); |
| 1122 | return status; |
| 1123 | } |
| 1124 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1125 | status = init_sme_cmd_list(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1126 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1127 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1128 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1129 | status = rrm_open(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1130 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1131 | sms_log(pMac, LOGE, FL("rrm_open failed, status=%d"), status); |
| 1132 | return status; |
| 1133 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1134 | sme_p2p_open(pMac); |
| 1135 | sme_trace_init(pMac); |
| 1136 | return status; |
| 1137 | } |
| 1138 | |
| 1139 | /* |
| 1140 | * sme_init_chan_list, triggers channel setup based on country code. |
| 1141 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1142 | QDF_STATUS sme_init_chan_list(tHalHandle hal, uint8_t *alpha2, |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 1143 | enum country_src cc_src) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1144 | { |
| 1145 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 1146 | |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 1147 | if ((cc_src == SOURCE_USERSPACE) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1148 | (pmac->roam.configParam.fSupplicantCountryCodeHasPriority)) { |
| 1149 | pmac->roam.configParam.Is11dSupportEnabled = false; |
| 1150 | } |
| 1151 | |
| 1152 | return csr_init_chan_list(pmac, alpha2); |
| 1153 | } |
| 1154 | |
| 1155 | /*-------------------------------------------------------------------------- |
| 1156 | |
| 1157 | \brief sme_set11dinfo() - Set the 11d information about valid channels |
| 1158 | and there power using information from nvRAM |
| 1159 | This function is called only for AP. |
| 1160 | |
| 1161 | This is a synchronous call |
| 1162 | |
| 1163 | \param hHal - The handle returned by mac_open. |
| 1164 | \Param pSmeConfigParams - a pointer to a caller allocated object of |
| 1165 | typedef struct _smeConfigParams. |
| 1166 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1167 | \return QDF_STATUS_SUCCESS - SME update the config parameters successfully. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1168 | |
| 1169 | Other status means SME is failed to update the config parameters. |
| 1170 | \sa |
| 1171 | --------------------------------------------------------------------------*/ |
| 1172 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1173 | QDF_STATUS sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1174 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1175 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1176 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1177 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1178 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1179 | TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0)); |
| 1180 | if (NULL == pSmeConfigParams) { |
| 1181 | sms_log(pMac, LOGE, |
| 1182 | "Empty config param structure for SME, nothing to update"); |
| 1183 | return status; |
| 1184 | } |
| 1185 | |
| 1186 | status = csr_set_channels(hHal, &pSmeConfigParams->csrConfig); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1187 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1188 | sms_log(pMac, LOGE, |
| 1189 | "csr_change_default_config_param failed with status=%d", |
| 1190 | status); |
| 1191 | } |
| 1192 | return status; |
| 1193 | } |
| 1194 | |
| 1195 | /** |
| 1196 | * sme_set_scan_disable() - Dynamically enable/disable scan |
| 1197 | * @h_hal: Handle to HAL |
| 1198 | * |
| 1199 | * This command gives the user an option to dynamically |
| 1200 | * enable or disable scans. |
| 1201 | * |
| 1202 | * Return: None |
| 1203 | */ |
| 1204 | void sme_set_scan_disable(tHalHandle h_hal, int value) |
| 1205 | { |
| 1206 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(h_hal); |
| 1207 | mac_ctx->lim.scan_disabled = value; |
| 1208 | sms_log(mac_ctx, LOG1, FL("value=%d"), value); |
| 1209 | } |
| 1210 | /*-------------------------------------------------------------------------- |
| 1211 | |
| 1212 | \brief sme_get_soft_ap_domain() - Get the current regulatory domain of softAp. |
| 1213 | |
| 1214 | This is a synchronous call |
| 1215 | |
| 1216 | \param hHal - The handle returned by HostapdAdapter. |
| 1217 | \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp. |
| 1218 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1219 | \return QDF_STATUS_SUCCESS - SME successfully completed the request. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1220 | |
| 1221 | Other status means, failed to get the current regulatory domain. |
| 1222 | \sa |
| 1223 | --------------------------------------------------------------------------*/ |
| 1224 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1225 | QDF_STATUS sme_get_soft_ap_domain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1226 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1227 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1228 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1229 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1230 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1231 | TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, |
| 1232 | NO_SESSION, 0)); |
| 1233 | if (NULL == domainIdSoftAp) { |
| 1234 | sms_log(pMac, LOGE, "Uninitialized domain Id"); |
| 1235 | return status; |
| 1236 | } |
| 1237 | |
| 1238 | *domainIdSoftAp = pMac->scan.domainIdCurrent; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1239 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1240 | |
| 1241 | return status; |
| 1242 | } |
| 1243 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1244 | QDF_STATUS sme_set_reg_info(tHalHandle hHal, uint8_t *apCntryCode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1245 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1246 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1247 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1248 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1249 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1250 | TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0)); |
| 1251 | if (NULL == apCntryCode) { |
| 1252 | sms_log(pMac, LOGE, "Empty Country Code, nothing to update"); |
| 1253 | return status; |
| 1254 | } |
| 1255 | |
| 1256 | status = csr_set_reg_info(hHal, apCntryCode); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1257 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1258 | sms_log(pMac, LOGE, "csr_set_reg_info failed with status=%d", |
| 1259 | status); |
| 1260 | } |
| 1261 | return status; |
| 1262 | } |
| 1263 | |
Krunal Soni | e353194 | 2016-04-12 17:43:53 -0700 | [diff] [blame] | 1264 | /** |
| 1265 | * sme_update_fine_time_measurement_capab() - Update the FTM capabitlies from |
| 1266 | * incoming val |
| 1267 | * @hal: Handle for Hal layer |
| 1268 | * @val: New FTM capability value |
| 1269 | * |
| 1270 | * Return: None |
| 1271 | */ |
| 1272 | void sme_update_fine_time_measurement_capab(tHalHandle hal, uint32_t val) |
| 1273 | { |
| 1274 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 1275 | mac_ctx->fine_time_meas_cap = val; |
| 1276 | |
| 1277 | if (val == 0) { |
| 1278 | mac_ctx->rrm.rrmPEContext.rrmEnabledCaps.fine_time_meas_rpt = 0; |
| 1279 | ((tpRRMCaps)mac_ctx->rrm.rrmSmeContext. |
| 1280 | rrmConfig.rm_capability)->fine_time_meas_rpt = 0; |
| 1281 | } else { |
| 1282 | mac_ctx->rrm.rrmPEContext.rrmEnabledCaps.fine_time_meas_rpt = 1; |
| 1283 | ((tpRRMCaps)mac_ctx->rrm.rrmSmeContext. |
| 1284 | rrmConfig.rm_capability)->fine_time_meas_rpt = 1; |
| 1285 | } |
| 1286 | } |
| 1287 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1288 | /*-------------------------------------------------------------------------- |
| 1289 | |
| 1290 | \brief sme_update_config() - Change configurations for all SME moduels |
| 1291 | |
| 1292 | The function updates some configuration for modules in SME, CSR, etc |
| 1293 | during SMEs close open sequence. |
| 1294 | |
| 1295 | Modules inside SME apply the new configuration at the next transaction. |
| 1296 | |
| 1297 | This is a synchronous call |
| 1298 | |
| 1299 | \param hHal - The handle returned by mac_open. |
| 1300 | \Param pSmeConfigParams - a pointer to a caller allocated object of |
| 1301 | typedef struct _smeConfigParams. |
| 1302 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1303 | \return QDF_STATUS_SUCCESS - SME update the config parameters successfully. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1304 | |
| 1305 | Other status means SME is failed to update the config parameters. |
| 1306 | \sa |
| 1307 | |
| 1308 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1309 | QDF_STATUS sme_update_config(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1310 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1311 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1312 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1313 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1314 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1315 | TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, |
| 1316 | 0)); |
| 1317 | if (NULL == pSmeConfigParams) { |
| 1318 | sms_log(pMac, LOGE, |
| 1319 | "Empty config param structure for SME, nothing to update"); |
| 1320 | return status; |
| 1321 | } |
| 1322 | |
| 1323 | status = |
| 1324 | csr_change_default_config_param(pMac, &pSmeConfigParams->csrConfig); |
| 1325 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1326 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1327 | sms_log(pMac, LOGE, |
| 1328 | "csr_change_default_config_param failed with status=%d", |
| 1329 | status); |
| 1330 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1331 | status = |
| 1332 | rrm_change_default_config_param(hHal, &pSmeConfigParams->rrmConfig); |
| 1333 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1334 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1335 | sms_log(pMac, LOGE, |
| 1336 | "rrm_change_default_config_param failed with status=%d", |
| 1337 | status); |
| 1338 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1339 | /* For SOC, CFG is set before start */ |
| 1340 | /* We don't want to apply global CFG in connect state because that may cause some side affect */ |
| 1341 | if (csr_is_all_session_disconnected(pMac)) { |
| 1342 | csr_set_global_cfgs(pMac); |
| 1343 | } |
| 1344 | |
| 1345 | /* |
| 1346 | * If scan offload is enabled then lim has allow the sending of |
| 1347 | * scan request to firmware even in powersave mode. The firmware has |
| 1348 | * to take care of exiting from power save mode |
| 1349 | */ |
| 1350 | status = sme_cfg_set_int(hHal, WNI_CFG_SCAN_IN_POWERSAVE, true); |
| 1351 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1352 | if (QDF_STATUS_SUCCESS != status) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1353 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1354 | "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CFG"); |
| 1355 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1356 | return status; |
| 1357 | } |
| 1358 | |
| 1359 | /** |
| 1360 | * sme_update_roam_params() - Store/Update the roaming params |
| 1361 | * @hal: Handle for Hal layer |
| 1362 | * @session_id: SME Session ID |
| 1363 | * @roam_params_src: The source buffer to copy |
| 1364 | * @update_param: Type of parameter to be updated |
| 1365 | * |
| 1366 | * Return: Return the status of the updation. |
| 1367 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1368 | QDF_STATUS sme_update_roam_params(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1369 | uint8_t session_id, struct roam_ext_params roam_params_src, |
| 1370 | int update_param) |
| 1371 | { |
| 1372 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 1373 | struct roam_ext_params *roam_params_dst; |
| 1374 | uint8_t i; |
| 1375 | |
| 1376 | roam_params_dst = &mac_ctx->roam.configParam.roam_params; |
| 1377 | switch (update_param) { |
| 1378 | case REASON_ROAM_EXT_SCAN_PARAMS_CHANGED: |
| 1379 | roam_params_dst->raise_rssi_thresh_5g = |
| 1380 | roam_params_src.raise_rssi_thresh_5g; |
| 1381 | roam_params_dst->drop_rssi_thresh_5g = |
| 1382 | roam_params_src.drop_rssi_thresh_5g; |
| 1383 | roam_params_dst->raise_factor_5g = |
| 1384 | roam_params_src.raise_factor_5g; |
| 1385 | roam_params_dst->drop_factor_5g = |
| 1386 | roam_params_src.drop_factor_5g; |
| 1387 | roam_params_dst->max_raise_rssi_5g = |
| 1388 | roam_params_src.max_raise_rssi_5g; |
| 1389 | roam_params_dst->max_drop_rssi_5g = |
| 1390 | roam_params_src.max_drop_rssi_5g; |
| 1391 | roam_params_dst->alert_rssi_threshold = |
| 1392 | roam_params_src.alert_rssi_threshold; |
| 1393 | roam_params_dst->is_5g_pref_enabled = true; |
| 1394 | break; |
| 1395 | case REASON_ROAM_SET_SSID_ALLOWED: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1396 | qdf_mem_set(&roam_params_dst->ssid_allowed_list, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1397 | sizeof(tSirMacSSid) * MAX_SSID_ALLOWED_LIST); |
| 1398 | roam_params_dst->num_ssid_allowed_list = |
| 1399 | roam_params_src.num_ssid_allowed_list; |
| 1400 | for (i = 0; i < roam_params_dst->num_ssid_allowed_list; i++) { |
| 1401 | roam_params_dst->ssid_allowed_list[i].length = |
| 1402 | roam_params_src.ssid_allowed_list[i].length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1403 | qdf_mem_copy(roam_params_dst->ssid_allowed_list[i].ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1404 | roam_params_src.ssid_allowed_list[i].ssId, |
| 1405 | roam_params_dst->ssid_allowed_list[i].length); |
| 1406 | } |
| 1407 | break; |
| 1408 | case REASON_ROAM_SET_FAVORED_BSSID: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1409 | qdf_mem_set(&roam_params_dst->bssid_favored, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1410 | sizeof(tSirMacAddr) * MAX_BSSID_FAVORED); |
| 1411 | roam_params_dst->num_bssid_favored = |
| 1412 | roam_params_src.num_bssid_favored; |
| 1413 | for (i = 0; i < roam_params_dst->num_bssid_favored; i++) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1414 | qdf_mem_copy(&roam_params_dst->bssid_favored[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1415 | &roam_params_src.bssid_favored[i], |
| 1416 | sizeof(tSirMacAddr)); |
| 1417 | roam_params_dst->bssid_favored_factor[i] = |
| 1418 | roam_params_src.bssid_favored_factor[i]; |
| 1419 | } |
| 1420 | break; |
| 1421 | case REASON_ROAM_SET_BLACKLIST_BSSID: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1422 | qdf_mem_set(&roam_params_dst->bssid_avoid_list, 0, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1423 | QDF_MAC_ADDR_SIZE * MAX_BSSID_AVOID_LIST); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1424 | roam_params_dst->num_bssid_avoid_list = |
| 1425 | roam_params_src.num_bssid_avoid_list; |
| 1426 | for (i = 0; i < roam_params_dst->num_bssid_avoid_list; i++) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1427 | qdf_copy_macaddr(&roam_params_dst->bssid_avoid_list[i], |
Srinivas Girigowda | b053239 | 2015-11-24 11:50:16 -0800 | [diff] [blame] | 1428 | &roam_params_src.bssid_avoid_list[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1429 | } |
| 1430 | break; |
| 1431 | case REASON_ROAM_GOOD_RSSI_CHANGED: |
| 1432 | roam_params_dst->good_rssi_roam = |
| 1433 | roam_params_src.good_rssi_roam; |
| 1434 | break; |
| 1435 | default: |
| 1436 | break; |
| 1437 | } |
| 1438 | csr_roam_offload_scan(mac_ctx, session_id, ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 1439 | update_param); |
| 1440 | return 0; |
| 1441 | } |
| 1442 | |
| 1443 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 1444 | void sme_process_get_gtk_info_rsp(tHalHandle hHal, |
| 1445 | tpSirGtkOffloadGetInfoRspParams |
| 1446 | pGtkOffloadGetInfoRsp) |
| 1447 | { |
| 1448 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1449 | |
| 1450 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1451 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1452 | "%s: pMac is null", __func__); |
| 1453 | return; |
| 1454 | } |
| 1455 | if (pMac->sme.gtk_offload_get_info_cb == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1456 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1457 | "%s: HDD callback is null", __func__); |
| 1458 | return; |
| 1459 | } |
| 1460 | pMac->sme.gtk_offload_get_info_cb( |
| 1461 | pMac->sme.gtk_offload_get_info_cb_context, |
| 1462 | pGtkOffloadGetInfoRsp); |
| 1463 | } |
| 1464 | #endif |
| 1465 | |
| 1466 | /*-------------------------------------------------------------------------- |
| 1467 | |
| 1468 | \fn - sme_process_ready_to_suspend |
| 1469 | \brief - On getting ready to suspend indication, this function calls |
| 1470 | callback registered (HDD callbacks) with SME to inform |
| 1471 | ready to suspend indication. |
| 1472 | |
| 1473 | \param hHal - Handle returned by mac_open. |
| 1474 | pReadyToSuspend - Parameter received along with ready to suspend |
| 1475 | indication from WMA. |
| 1476 | |
| 1477 | \return None |
| 1478 | |
| 1479 | \sa |
| 1480 | |
| 1481 | --------------------------------------------------------------------------*/ |
| 1482 | void sme_process_ready_to_suspend(tHalHandle hHal, |
| 1483 | tpSirReadyToSuspendInd pReadyToSuspend) |
| 1484 | { |
| 1485 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1486 | |
| 1487 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1488 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1489 | "%s: pMac is null", __func__); |
| 1490 | return; |
| 1491 | } |
| 1492 | |
| 1493 | if (NULL != pMac->readyToSuspendCallback) { |
| 1494 | pMac->readyToSuspendCallback(pMac->readyToSuspendContext, |
| 1495 | pReadyToSuspend->suspended); |
| 1496 | pMac->readyToSuspendCallback = NULL; |
| 1497 | } |
| 1498 | } |
| 1499 | |
| 1500 | #ifdef WLAN_FEATURE_EXTWOW_SUPPORT |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1501 | |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 1502 | /** |
| 1503 | * sme_process_ready_to_ext_wow() - inform ready to ExtWoW indication. |
| 1504 | * @hHal - Handle returned by mac_open. |
| 1505 | * @pReadyToExtWoW - Parameter received along with ready to Ext WoW |
| 1506 | * indication from WMA. |
| 1507 | * |
| 1508 | * On getting ready to Ext WoW indication, this function calls callback |
| 1509 | * registered (HDD callback)with SME to inform ready to ExtWoW indication. |
| 1510 | * |
| 1511 | * Return: None |
| 1512 | */ |
| 1513 | void sme_process_ready_to_ext_wow(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1514 | tpSirReadyToExtWoWInd pReadyToExtWoW) |
| 1515 | { |
| 1516 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1517 | |
| 1518 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1519 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1520 | "%s: pMac is null", __func__); |
| 1521 | return; |
| 1522 | } |
| 1523 | |
| 1524 | if (NULL != pMac->readyToExtWoWCallback) { |
| 1525 | pMac->readyToExtWoWCallback(pMac->readyToExtWoWContext, |
| 1526 | pReadyToExtWoW->status); |
| 1527 | pMac->readyToExtWoWCallback = NULL; |
| 1528 | pMac->readyToExtWoWContext = NULL; |
| 1529 | } |
| 1530 | |
| 1531 | } |
| 1532 | #endif |
| 1533 | |
| 1534 | /* --------------------------------------------------------------------------- |
| 1535 | \fn sme_change_config_params |
| 1536 | \brief The SME API exposed for HDD to provide config params to SME during |
| 1537 | SMEs stop -> start sequence. |
| 1538 | |
| 1539 | If HDD changed the domain that will cause a reset. This function will |
| 1540 | provide the new set of 11d information for the new domain. Currrently this |
| 1541 | API provides info regarding 11d only at reset but we can extend this for |
| 1542 | other params (PMC, QoS) which needs to be initialized again at reset. |
| 1543 | |
| 1544 | This is a synchronous call |
| 1545 | |
| 1546 | \param hHal - The handle returned by mac_open. |
| 1547 | |
| 1548 | \Param |
| 1549 | pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that |
| 1550 | currently provides 11d related information like Country code, |
| 1551 | Regulatory domain, valid channel list, Tx power per channel, a |
| 1552 | list with active/passive scan allowed per valid channel. |
| 1553 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1554 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1555 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1556 | QDF_STATUS sme_change_config_params(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1557 | tCsrUpdateConfigParam *pUpdateConfigParam) |
| 1558 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1559 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1560 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1561 | |
| 1562 | if (NULL == pUpdateConfigParam) { |
| 1563 | sms_log(pMac, LOGE, |
| 1564 | "Empty config param structure for SME, nothing to reset"); |
| 1565 | return status; |
| 1566 | } |
| 1567 | |
| 1568 | status = csr_change_config_params(pMac, pUpdateConfigParam); |
| 1569 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1570 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1571 | sms_log(pMac, LOGE, "csrUpdateConfigParam failed with status=%d", |
| 1572 | status); |
| 1573 | } |
| 1574 | |
| 1575 | return status; |
| 1576 | |
| 1577 | } |
| 1578 | |
| 1579 | /*-------------------------------------------------------------------------- |
| 1580 | |
| 1581 | \brief sme_hdd_ready_ind() - SME sends eWNI_SME_SYS_READY_IND to PE to inform |
| 1582 | that the NIC is ready tio run. |
| 1583 | |
| 1584 | The function is called by HDD at the end of initialization stage so PE/HAL can |
| 1585 | enable the NIC to running state. |
| 1586 | |
| 1587 | This is a synchronous call |
| 1588 | \param hHal - The handle returned by mac_open. |
| 1589 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1590 | \return QDF_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1591 | successfully. |
| 1592 | |
| 1593 | Other status means SME failed to send the message to PE. |
| 1594 | \sa |
| 1595 | |
| 1596 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1597 | QDF_STATUS sme_hdd_ready_ind(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1598 | { |
| 1599 | tSirSmeReadyReq Msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1600 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1601 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1602 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1603 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1604 | TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0)); |
| 1605 | do { |
| 1606 | |
| 1607 | Msg.messageType = eWNI_SME_SYS_READY_IND; |
| 1608 | Msg.length = sizeof(tSirSmeReadyReq); |
| 1609 | Msg.add_bssdescr_cb = csr_scan_process_single_bssdescr; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 1610 | Msg.csr_roam_synch_cb = csr_roam_synch_callback; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1611 | |
| 1612 | |
| 1613 | if (eSIR_FAILURE != u_mac_post_ctrl_msg(hHal, (tSirMbMsg *) &Msg)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1614 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1615 | } else { |
| 1616 | sms_log(pMac, LOGE, |
| 1617 | "u_mac_post_ctrl_msg failed to send eWNI_SME_SYS_READY_IND"); |
| 1618 | break; |
| 1619 | } |
| 1620 | |
| 1621 | status = csr_ready(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1622 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1623 | sms_log(pMac, LOGE, |
| 1624 | "csr_ready failed with status=%d", |
| 1625 | status); |
| 1626 | break; |
| 1627 | } |
| 1628 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1629 | if (QDF_STATUS_SUCCESS != rrm_ready(hHal)) { |
| 1630 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1631 | sms_log(pMac, LOGE, "rrm_ready failed"); |
| 1632 | break; |
| 1633 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1634 | pMac->sme.state = SME_STATE_READY; |
| 1635 | } while (0); |
| 1636 | |
| 1637 | return status; |
| 1638 | } |
| 1639 | |
| 1640 | /*-------------------------------------------------------------------------- |
| 1641 | |
| 1642 | \brief sme_start() - Put all SME modules at ready state. |
| 1643 | |
| 1644 | The function starts each module in SME, PMC, CSR, etc. . Upon |
| 1645 | successfully return, all modules are ready to run. |
| 1646 | This is a synchronous call |
| 1647 | \param hHal - The handle returned by mac_open. |
| 1648 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1649 | \return QDF_STATUS_SUCCESS - SME is ready. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1650 | |
| 1651 | Other status means SME is failed to start |
| 1652 | \sa |
| 1653 | |
| 1654 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1655 | QDF_STATUS sme_start(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1656 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1657 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1658 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1659 | |
| 1660 | do { |
| 1661 | status = csr_start(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1662 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1663 | sms_log(pMac, LOGE, |
| 1664 | "csr_start failed during smeStart with status=%d", |
| 1665 | status); |
| 1666 | break; |
| 1667 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1668 | pMac->sme.state = SME_STATE_START; |
| 1669 | } while (0); |
| 1670 | |
| 1671 | return status; |
| 1672 | } |
| 1673 | |
| 1674 | /** |
| 1675 | * sme_handle_scan_req() - Scan request handler |
| 1676 | * @mac_ctx: MAC global context |
| 1677 | * @msg: message buffer |
| 1678 | * |
| 1679 | * Scan request message from upper layer is handled as |
| 1680 | * part of this API |
| 1681 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1682 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1683 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1684 | static QDF_STATUS sme_handle_scan_req(tpAniSirGlobal mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1685 | void *msg) |
| 1686 | { |
| 1687 | struct ani_scan_req *scan_msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1688 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1689 | uint16_t session_id; |
| 1690 | csr_scan_completeCallback callback; |
| 1691 | |
| 1692 | scan_msg = msg; |
| 1693 | session_id = scan_msg->session_id; |
| 1694 | callback = scan_msg->callback; |
| 1695 | status = csr_scan_request(mac_ctx, session_id, |
| 1696 | scan_msg->scan_param, |
| 1697 | callback, scan_msg->ctx); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1698 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1699 | sms_log(mac_ctx, LOGE, |
| 1700 | FL("scan request failed. session_id %d"), session_id); |
| 1701 | } |
| 1702 | csr_scan_free_request(mac_ctx, scan_msg->scan_param); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1703 | qdf_mem_free(scan_msg->scan_param); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1704 | return status; |
| 1705 | } |
| 1706 | |
| 1707 | /** |
| 1708 | * sme_handle_roc_req() - Roc request handler |
| 1709 | * @mac_ctx: MAC global context |
| 1710 | * @msg: message buffer |
| 1711 | * |
| 1712 | * Roc request message from upper layer is handled as |
| 1713 | * part of this API |
| 1714 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1715 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1716 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1717 | static QDF_STATUS sme_handle_roc_req(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1718 | void *msg) |
| 1719 | { |
| 1720 | struct ani_roc_req *roc_msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1721 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1722 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 1723 | remainOnChanCallback callback; |
| 1724 | |
| 1725 | if (msg == NULL) { |
| 1726 | sms_log(mac_ctx, LOGE, FL("ROC request is NULL")); |
| 1727 | return status; |
| 1728 | } |
| 1729 | |
| 1730 | roc_msg = msg; |
| 1731 | callback = roc_msg->callback; |
| 1732 | status = p2p_remain_on_channel(hal, roc_msg->session_id, |
| 1733 | roc_msg->channel, roc_msg->duration, callback, |
| 1734 | roc_msg->ctx, roc_msg->is_p2pprobe_allowed, |
| 1735 | roc_msg->scan_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1736 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1737 | sms_log(mac_ctx, LOGE, |
| 1738 | FL("scan request failed. session_id %d scan_id %d"), |
| 1739 | roc_msg->session_id, roc_msg->scan_id); |
| 1740 | } |
| 1741 | return status; |
| 1742 | } |
| 1743 | |
| 1744 | #ifdef WLAN_FEATURE_11W |
| 1745 | /*------------------------------------------------------------------ |
| 1746 | * |
| 1747 | * Handle the unprotected management frame indication from LIM and |
| 1748 | * forward it to HDD. |
| 1749 | * |
| 1750 | *------------------------------------------------------------------*/ |
| 1751 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1752 | QDF_STATUS sme_unprotected_mgmt_frm_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1753 | tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm) |
| 1754 | { |
| 1755 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1756 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1757 | tCsrRoamInfo pRoamInfo = { 0 }; |
| 1758 | uint32_t SessionId = pSmeMgmtFrm->sessionId; |
| 1759 | |
| 1760 | pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen; |
| 1761 | pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf; |
| 1762 | pRoamInfo.frameType = pSmeMgmtFrm->frameType; |
| 1763 | |
| 1764 | /* forward the mgmt frame to HDD */ |
| 1765 | csr_roam_call_callback(pMac, SessionId, &pRoamInfo, 0, |
| 1766 | eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0); |
| 1767 | |
| 1768 | return status; |
| 1769 | } |
| 1770 | #endif |
| 1771 | |
| 1772 | /*------------------------------------------------------------------ |
| 1773 | * |
| 1774 | * Handle the DFS Radar Event and indicate it to the SAP |
| 1775 | * |
| 1776 | *------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1777 | QDF_STATUS dfs_msg_processor(tpAniSirGlobal pMac, uint16_t msgType, void *pMsgBuf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1778 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1779 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1780 | tCsrRoamInfo roamInfo = { 0 }; |
| 1781 | tSirSmeDfsEventInd *dfs_event; |
| 1782 | tSirSmeCSAIeTxCompleteRsp *csaIeTxCompleteRsp; |
| 1783 | uint32_t sessionId = 0; |
| 1784 | eRoamCmdStatus roamStatus; |
| 1785 | eCsrRoamResult roamResult; |
| 1786 | int i; |
| 1787 | |
| 1788 | switch (msgType) { |
| 1789 | case eWNI_SME_DFS_RADAR_FOUND: |
| 1790 | { |
| 1791 | /* Radar found !! */ |
| 1792 | dfs_event = (tSirSmeDfsEventInd *) pMsgBuf; |
| 1793 | if (NULL == dfs_event) { |
| 1794 | sms_log(pMac, LOGE, |
| 1795 | "%s: pMsg is NULL for eWNI_SME_DFS_RADAR_FOUND message", |
| 1796 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1797 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1798 | } |
| 1799 | sessionId = dfs_event->sessionId; |
| 1800 | roamInfo.dfs_event.sessionId = sessionId; |
| 1801 | roamInfo.dfs_event.chan_list.nchannels = |
| 1802 | dfs_event->chan_list.nchannels; |
| 1803 | for (i = 0; i < dfs_event->chan_list.nchannels; i++) { |
| 1804 | roamInfo.dfs_event.chan_list.channels[i] = |
| 1805 | dfs_event->chan_list.channels[i]; |
| 1806 | } |
| 1807 | |
| 1808 | roamInfo.dfs_event.dfs_radar_status = |
| 1809 | dfs_event->dfs_radar_status; |
| 1810 | roamInfo.dfs_event.use_nol = dfs_event->use_nol; |
| 1811 | |
| 1812 | roamStatus = eCSR_ROAM_DFS_RADAR_IND; |
| 1813 | roamResult = eCSR_ROAM_RESULT_DFS_RADAR_FOUND_IND; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1814 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO_MED, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1815 | "sapdfs: Radar indication event occurred"); |
| 1816 | break; |
| 1817 | } |
| 1818 | case eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND: |
| 1819 | { |
| 1820 | csaIeTxCompleteRsp = |
| 1821 | (tSirSmeCSAIeTxCompleteRsp *) pMsgBuf; |
| 1822 | if (NULL == csaIeTxCompleteRsp) { |
| 1823 | sms_log(pMac, LOGE, |
| 1824 | "%s: pMsg is NULL for eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND", |
| 1825 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1826 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1827 | } |
| 1828 | sessionId = csaIeTxCompleteRsp->sessionId; |
| 1829 | roamStatus = eCSR_ROAM_DFS_CHAN_SW_NOTIFY; |
| 1830 | roamResult = eCSR_ROAM_RESULT_DFS_CHANSW_UPDATE_SUCCESS; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1831 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO_MED, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1832 | "sapdfs: Received eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND for session id [%d]", |
| 1833 | sessionId); |
| 1834 | break; |
| 1835 | } |
| 1836 | default: |
| 1837 | { |
| 1838 | sms_log(pMac, LOG1, "%s: Invalid DFS message = 0x%x", |
| 1839 | __func__, msgType); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1840 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1841 | return status; |
| 1842 | } |
| 1843 | } |
| 1844 | |
| 1845 | /* Indicate Radar Event to SAP */ |
| 1846 | csr_roam_call_callback(pMac, sessionId, &roamInfo, 0, |
| 1847 | roamStatus, roamResult); |
| 1848 | return status; |
| 1849 | } |
| 1850 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1851 | /** |
| 1852 | * sme_extended_change_channel_ind()- function to indicate ECSA |
| 1853 | * action frame is received in lim to SAP |
| 1854 | * @mac_ctx: pointer to global mac structure |
| 1855 | * @msg_buf: contain new channel and session id. |
| 1856 | * |
| 1857 | * This function is called to post ECSA action frame |
| 1858 | * receive event to SAP. |
| 1859 | * |
| 1860 | * Return: success if msg indicated to SAP else return failure |
| 1861 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1862 | static QDF_STATUS sme_extended_change_channel_ind(tpAniSirGlobal mac_ctx, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1863 | void *msg_buf) |
| 1864 | { |
| 1865 | struct sir_sme_ext_cng_chan_ind *ext_chan_ind; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1866 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1867 | uint32_t session_id = 0; |
| 1868 | tCsrRoamInfo roamInfo = {0}; |
| 1869 | eRoamCmdStatus roam_status; |
| 1870 | eCsrRoamResult roam_result; |
| 1871 | |
| 1872 | |
| 1873 | ext_chan_ind = msg_buf; |
| 1874 | if (NULL == ext_chan_ind) { |
| 1875 | sms_log(mac_ctx, LOGE, |
| 1876 | FL("pMsg is NULL for eWNI_SME_EXT_CHANGE_CHANNEL_IND")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1877 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1878 | } |
| 1879 | session_id = ext_chan_ind->session_id; |
| 1880 | roamInfo.target_channel = ext_chan_ind->new_channel; |
| 1881 | roam_status = eCSR_ROAM_EXT_CHG_CHNL_IND; |
| 1882 | roam_result = eCSR_ROAM_EXT_CHG_CHNL_UPDATE_IND; |
| 1883 | sms_log(mac_ctx, LOG1, |
| 1884 | FL("sapdfs: Received eWNI_SME_EXT_CHANGE_CHANNEL_IND for session id [%d]"), |
| 1885 | session_id); |
| 1886 | |
| 1887 | /* Indicate Ext Channel Change event to SAP */ |
| 1888 | csr_roam_call_callback(mac_ctx, session_id, &roamInfo, 0, |
| 1889 | roam_status, roam_result); |
| 1890 | return status; |
| 1891 | } |
| 1892 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1893 | /** |
| 1894 | * sme_process_fw_mem_dump_rsp - process fw memory dump response from WMA |
| 1895 | * |
| 1896 | * @mac_ctx: pointer to MAC handle. |
| 1897 | * @msg: pointer to received SME msg. |
| 1898 | * |
| 1899 | * This function process the received SME message and calls the corresponding |
| 1900 | * callback which was already registered with SME. |
| 1901 | * |
| 1902 | * Return: None |
| 1903 | */ |
| 1904 | #ifdef WLAN_FEATURE_MEMDUMP |
| 1905 | static void sme_process_fw_mem_dump_rsp(tpAniSirGlobal mac_ctx, cds_msg_t *msg) |
| 1906 | { |
| 1907 | if (msg->bodyptr) { |
| 1908 | if (mac_ctx->sme.fw_dump_callback) |
| 1909 | mac_ctx->sme.fw_dump_callback(mac_ctx->hHdd, |
| 1910 | (struct fw_dump_rsp *) msg->bodyptr); |
| 1911 | qdf_mem_free(msg->bodyptr); |
| 1912 | } |
| 1913 | } |
| 1914 | #else |
| 1915 | static void sme_process_fw_mem_dump_rsp(tpAniSirGlobal mac_ctx, cds_msg_t *msg) |
| 1916 | { |
| 1917 | } |
| 1918 | #endif |
| 1919 | |
| 1920 | #ifdef FEATURE_WLAN_ESE |
| 1921 | /** |
| 1922 | * sme_update_is_ese_feature_enabled() - enable/disable ESE support at runtime |
| 1923 | * @hHal: HAL handle |
| 1924 | * @sessionId: session id |
| 1925 | * @isEseIniFeatureEnabled: ese ini enabled |
| 1926 | * |
| 1927 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 1928 | * isEseIniFeatureEnabled. This is a synchronous call |
| 1929 | * |
| 1930 | * Return: QDF_STATUS enumeration |
| 1931 | */ |
| 1932 | QDF_STATUS sme_update_is_ese_feature_enabled(tHalHandle hHal, |
| 1933 | uint8_t sessionId, const bool isEseIniFeatureEnabled) |
| 1934 | { |
| 1935 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1936 | |
| 1937 | if (pMac->roam.configParam.isEseIniFeatureEnabled == |
| 1938 | isEseIniFeatureEnabled) { |
| 1939 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
| 1940 | "%s: ESE Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", |
| 1941 | __func__, |
| 1942 | pMac->roam.configParam.isEseIniFeatureEnabled, |
| 1943 | isEseIniFeatureEnabled); |
| 1944 | return QDF_STATUS_SUCCESS; |
| 1945 | } |
| 1946 | |
| 1947 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
| 1948 | "%s: EseEnabled is changed from %d to %d", __func__, |
| 1949 | pMac->roam.configParam.isEseIniFeatureEnabled, |
| 1950 | isEseIniFeatureEnabled); |
| 1951 | pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled; |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 1952 | csr_neighbor_roam_update_fast_roaming_enabled( |
| 1953 | pMac, sessionId, isEseIniFeatureEnabled); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1954 | |
| 1955 | if (true == isEseIniFeatureEnabled) |
| 1956 | sme_update_fast_transition_enabled(hHal, true); |
| 1957 | |
| 1958 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 1959 | csr_roam_offload_scan(pMac, sessionId, |
| 1960 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 1961 | REASON_ESE_INI_CFG_CHANGED); |
| 1962 | |
| 1963 | return QDF_STATUS_SUCCESS; |
| 1964 | } |
| 1965 | |
| 1966 | /** |
| 1967 | * sme_set_plm_request() - set plm request |
| 1968 | * @hHal: HAL handle |
| 1969 | * @pPlmReq: Pointer to input plm request |
| 1970 | * |
| 1971 | * Return: QDF_STATUS enumeration |
| 1972 | */ |
| 1973 | QDF_STATUS sme_set_plm_request(tHalHandle hHal, tpSirPlmReq pPlmReq) |
| 1974 | { |
| 1975 | QDF_STATUS status; |
| 1976 | bool ret = false; |
| 1977 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1978 | uint8_t ch_list[WNI_CFG_VALID_CHANNEL_LIST] = { 0 }; |
| 1979 | uint8_t count, valid_count = 0; |
| 1980 | cds_msg_t msg; |
| 1981 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, pPlmReq->sessionId); |
| 1982 | |
| 1983 | status = sme_acquire_global_lock(&pMac->sme); |
| 1984 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 1985 | return status; |
| 1986 | |
| 1987 | if (!pSession) { |
| 1988 | sms_log(pMac, LOGE, FL("session %d not found"), |
| 1989 | pPlmReq->sessionId); |
| 1990 | sme_release_global_lock(&pMac->sme); |
| 1991 | return QDF_STATUS_E_FAILURE; |
| 1992 | } |
| 1993 | |
| 1994 | if (!pSession->sessionActive) { |
| 1995 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 1996 | FL("Invalid Sessionid")); |
| 1997 | sme_release_global_lock(&pMac->sme); |
| 1998 | return QDF_STATUS_E_FAILURE; |
| 1999 | } |
| 2000 | |
| 2001 | if (!pPlmReq->enable) |
| 2002 | goto send_plm_start; |
| 2003 | /* validating channel numbers */ |
| 2004 | for (count = 0; count < pPlmReq->plmNumCh; count++) { |
| 2005 | ret = csr_is_supported_channel(pMac, pPlmReq->plmChList[count]); |
| 2006 | if (ret && pPlmReq->plmChList[count] > 14) { |
| 2007 | if (CHANNEL_STATE_DFS == cds_get_channel_state( |
| 2008 | pPlmReq->plmChList[count])) { |
| 2009 | /* DFS channel is provided, no PLM bursts can be |
| 2010 | * transmitted. Ignoring these channels. |
| 2011 | */ |
| 2012 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 2013 | QDF_TRACE_LEVEL_INFO, |
| 2014 | FL("DFS channel %d ignored for PLM"), |
| 2015 | pPlmReq->plmChList[count]); |
| 2016 | continue; |
| 2017 | } |
| 2018 | } else if (!ret) { |
| 2019 | /* Not supported, ignore the channel */ |
| 2020 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
| 2021 | FL("Unsupported channel %d ignored for PLM"), |
| 2022 | pPlmReq->plmChList[count]); |
| 2023 | continue; |
| 2024 | } |
| 2025 | ch_list[valid_count] = pPlmReq->plmChList[count]; |
| 2026 | valid_count++; |
| 2027 | } /* End of for () */ |
| 2028 | |
| 2029 | /* Copying back the valid channel list to plm struct */ |
| 2030 | qdf_mem_set((void *)pPlmReq->plmChList, |
| 2031 | pPlmReq->plmNumCh, 0); |
| 2032 | if (valid_count) |
| 2033 | qdf_mem_copy(pPlmReq->plmChList, ch_list, |
| 2034 | valid_count); |
| 2035 | /* All are invalid channels, FW need to send the PLM |
| 2036 | * report with "incapable" bit set. |
| 2037 | */ |
| 2038 | pPlmReq->plmNumCh = valid_count; |
| 2039 | |
| 2040 | send_plm_start: |
| 2041 | /* PLM START */ |
| 2042 | msg.type = WMA_SET_PLM_REQ; |
| 2043 | msg.reserved = 0; |
| 2044 | msg.bodyptr = pPlmReq; |
| 2045 | |
| 2046 | if (!QDF_IS_STATUS_SUCCESS(cds_mq_post_message(QDF_MODULE_ID_WMA, |
| 2047 | &msg))) { |
| 2048 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 2049 | FL("Not able to post WMA_SET_PLM_REQ to WMA")); |
| 2050 | sme_release_global_lock(&pMac->sme); |
| 2051 | return QDF_STATUS_E_FAILURE; |
| 2052 | } |
| 2053 | |
| 2054 | sme_release_global_lock(&pMac->sme); |
| 2055 | return status; |
| 2056 | } |
| 2057 | |
| 2058 | /** |
| 2059 | * sme_tsm_ie_ind() - sme tsm ie indication |
| 2060 | * @hHal: HAL handle |
| 2061 | * @pSmeTsmIeInd: Pointer to tsm ie indication |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2062 | * |
| 2063 | * Handle the tsm ie indication from LIM and forward it to HDD. |
| 2064 | * |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 2065 | * Return: QDF_STATUS enumeration |
| 2066 | */ |
| 2067 | static QDF_STATUS sme_tsm_ie_ind(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2068 | { |
| 2069 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2070 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2071 | tCsrRoamInfo pRoamInfo = { 0 }; |
| 2072 | uint32_t SessionId = pSmeTsmIeInd->sessionId; |
| 2073 | pRoamInfo.tsmIe.tsid = pSmeTsmIeInd->tsmIe.tsid; |
| 2074 | pRoamInfo.tsmIe.state = pSmeTsmIeInd->tsmIe.state; |
| 2075 | pRoamInfo.tsmIe.msmt_interval = pSmeTsmIeInd->tsmIe.msmt_interval; |
| 2076 | /* forward the tsm ie information to HDD */ |
| 2077 | csr_roam_call_callback(pMac, |
| 2078 | SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0); |
| 2079 | return status; |
| 2080 | } |
| 2081 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 2082 | /** |
| 2083 | * sme_set_cckm_ie() - set cckm ie |
| 2084 | * @hHal: HAL handle |
| 2085 | * @sessionId: session id |
| 2086 | * @pCckmIe: Pointer to CCKM Ie |
| 2087 | * @cckmIeLen: Length of @pCckmIe |
| 2088 | * |
| 2089 | * Function to store the CCKM IE passed from supplicant and use |
| 2090 | * it while packing reassociation request. |
| 2091 | * |
| 2092 | * Return: QDF_STATUS enumeration |
| 2093 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2094 | QDF_STATUS sme_set_cckm_ie(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2095 | uint8_t *pCckmIe, uint8_t cckmIeLen) |
| 2096 | { |
| 2097 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2098 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2099 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2100 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2101 | csr_set_cckm_ie(pMac, sessionId, pCckmIe, cckmIeLen); |
| 2102 | sme_release_global_lock(&pMac->sme); |
| 2103 | } |
| 2104 | return status; |
| 2105 | } |
| 2106 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 2107 | /** |
| 2108 | * sme_set_ese_beacon_request() - set ese beacon request |
| 2109 | * @hHal: HAL handle |
| 2110 | * @sessionId: session id |
| 2111 | * @pEseBcnReq: Ese beacon report |
| 2112 | * |
| 2113 | * function to set ESE beacon request parameters |
| 2114 | * |
| 2115 | * Return: QDF_STATUS enumeration |
| 2116 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2117 | QDF_STATUS sme_set_ese_beacon_request(tHalHandle hHal, const uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2118 | const tCsrEseBeaconReq *pEseBcnReq) |
| 2119 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2120 | QDF_STATUS status = eSIR_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2121 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2122 | tpSirBeaconReportReqInd pSmeBcnReportReq = NULL; |
| 2123 | tCsrEseBeaconReqParams *pBeaconReq = NULL; |
| 2124 | uint8_t counter = 0; |
| 2125 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 2126 | tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext; |
| 2127 | |
| 2128 | if (pSmeRrmContext->eseBcnReqInProgress == true) { |
| 2129 | sms_log(pMac, LOGE, |
| 2130 | "A Beacon Report Req is already in progress"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2131 | return QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2132 | } |
| 2133 | |
| 2134 | /* Store the info in RRM context */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2135 | qdf_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2136 | sizeof(tCsrEseBeaconReq)); |
| 2137 | |
| 2138 | /* Prepare the request to send to SME. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2139 | pSmeBcnReportReq = qdf_mem_malloc(sizeof(tSirBeaconReportReqInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2140 | if (NULL == pSmeBcnReportReq) { |
| 2141 | sms_log(pMac, LOGP, |
| 2142 | "Memory Allocation Failure!!! ESE BcnReq Ind to SME"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2143 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2144 | } |
| 2145 | |
| 2146 | pSmeRrmContext->eseBcnReqInProgress = true; |
| 2147 | |
| 2148 | sms_log(pMac, LOGE, "Sending Beacon Report Req to SME"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2149 | qdf_mem_zero(pSmeBcnReportReq, sizeof(tSirBeaconReportReqInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2150 | |
| 2151 | pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND; |
| 2152 | pSmeBcnReportReq->length = sizeof(tSirBeaconReportReqInd); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2153 | qdf_mem_copy(pSmeBcnReportReq->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2154 | pSession->connectedProfile.bssid.bytes, |
| 2155 | sizeof(tSirMacAddr)); |
| 2156 | pSmeBcnReportReq->channelInfo.channelNum = 255; |
| 2157 | pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe; |
| 2158 | pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD; |
| 2159 | |
| 2160 | for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++) { |
| 2161 | pBeaconReq = |
| 2162 | (tCsrEseBeaconReqParams *) &pEseBcnReq->bcnReq[counter]; |
| 2163 | pSmeBcnReportReq->fMeasurementtype[counter] = |
| 2164 | pBeaconReq->scanMode; |
| 2165 | pSmeBcnReportReq->measurementDuration[counter] = |
| 2166 | SYS_TU_TO_MS(pBeaconReq->measurementDuration); |
| 2167 | pSmeBcnReportReq->channelList.channelNumber[counter] = |
| 2168 | pBeaconReq->channel; |
| 2169 | } |
| 2170 | |
| 2171 | status = sme_rrm_process_beacon_report_req_ind(pMac, pSmeBcnReportReq); |
| 2172 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2173 | if (status != QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2174 | pSmeRrmContext->eseBcnReqInProgress = false; |
| 2175 | |
Hanumanth Reddy Pothula | 7f7a271 | 2016-09-07 18:44:47 +0530 | [diff] [blame] | 2176 | qdf_mem_free(pSmeBcnReportReq); |
| 2177 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2178 | return status; |
| 2179 | } |
| 2180 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 2181 | /** |
| 2182 | * sme_get_tsm_stats() - SME get tsm stats |
| 2183 | * @hHal: HAL handle |
| 2184 | * @callback: SME sends back the requested stats using the callback |
| 2185 | * @staId: The station ID for which the stats is requested for |
| 2186 | * @bssId: bssid |
| 2187 | * @pContext: user context to be passed back along with the callback |
| 2188 | * @p_cds_context: CDS context |
| 2189 | * @tid: Traffic id |
| 2190 | * |
| 2191 | * API register a callback to get TSM Stats. |
| 2192 | * |
| 2193 | * Return: QDF_STATUS enumeration |
| 2194 | */ |
| 2195 | QDF_STATUS sme_get_tsm_stats(tHalHandle hHal, |
| 2196 | tCsrTsmStatsCallback callback, |
| 2197 | uint8_t staId, struct qdf_mac_addr bssId, |
| 2198 | void *pContext, void *p_cds_context, uint8_t tid) |
| 2199 | { |
| 2200 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 2201 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2202 | |
| 2203 | status = sme_acquire_global_lock(&pMac->sme); |
| 2204 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 2205 | status = csr_get_tsm_stats(pMac, callback, |
| 2206 | staId, bssId, pContext, |
| 2207 | p_cds_context, tid); |
| 2208 | sme_release_global_lock(&pMac->sme); |
| 2209 | } |
| 2210 | return status; |
| 2211 | } |
| 2212 | |
| 2213 | /** |
| 2214 | * sme_set_ese_roam_scan_channel_list() - To set ese roam scan channel list |
| 2215 | * @hHal: pointer HAL handle returned by mac_open |
| 2216 | * @sessionId: sme session id |
| 2217 | * @pChannelList: Output channel list |
| 2218 | * @numChannels: Output number of channels |
| 2219 | * |
| 2220 | * This routine is called to set ese roam scan channel list. |
| 2221 | * This is a synchronous call |
| 2222 | * |
| 2223 | * Return: QDF_STATUS |
| 2224 | */ |
| 2225 | QDF_STATUS sme_set_ese_roam_scan_channel_list(tHalHandle hHal, |
| 2226 | uint8_t sessionId, |
| 2227 | uint8_t *pChannelList, |
| 2228 | uint8_t numChannels) |
| 2229 | { |
| 2230 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2231 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2232 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo |
| 2233 | = &pMac->roam.neighborRoamInfo[sessionId]; |
| 2234 | tpCsrChannelInfo curchnl_list_info |
| 2235 | = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
| 2236 | uint8_t oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN * 2] = { 0 }; |
| 2237 | uint8_t newChannelList[128] = { 0 }; |
| 2238 | uint8_t i = 0, j = 0; |
| 2239 | |
| 2240 | status = sme_acquire_global_lock(&pMac->sme); |
| 2241 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 2242 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 2243 | csr_roam_offload_scan(pMac, sessionId, |
| 2244 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 2245 | REASON_CHANNEL_LIST_CHANGED); |
| 2246 | return status; |
| 2247 | } |
| 2248 | if (NULL != curchnl_list_info->ChannelList) { |
| 2249 | for (i = 0; i < curchnl_list_info->numOfChannels; i++) { |
| 2250 | j += snprintf(oldChannelList + j, |
| 2251 | sizeof(oldChannelList) - j, "%d", |
| 2252 | curchnl_list_info->ChannelList[i]); |
| 2253 | } |
| 2254 | } |
| 2255 | status = csr_create_roam_scan_channel_list(pMac, sessionId, |
| 2256 | pChannelList, numChannels, |
| 2257 | csr_get_current_band(hHal)); |
| 2258 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 2259 | if (NULL != curchnl_list_info->ChannelList) { |
| 2260 | j = 0; |
| 2261 | for (i = 0; i < curchnl_list_info->numOfChannels; i++) { |
| 2262 | j += snprintf(newChannelList + j, |
| 2263 | sizeof(newChannelList) - j, "%d", |
| 2264 | curchnl_list_info->ChannelList[i]); |
| 2265 | } |
| 2266 | } |
| 2267 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 2268 | "ESE roam scan chnl list successfully set to %s-old value is %s-roam state is %d", |
| 2269 | newChannelList, oldChannelList, |
| 2270 | pNeighborRoamInfo->neighborRoamState); |
| 2271 | } |
| 2272 | sme_release_global_lock(&pMac->sme); |
| 2273 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 2274 | csr_roam_offload_scan(pMac, sessionId, |
| 2275 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 2276 | REASON_CHANNEL_LIST_CHANGED); |
| 2277 | return status; |
| 2278 | } |
| 2279 | |
| 2280 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2281 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 2282 | QDF_STATUS sme_ibss_peer_info_response_handleer(tHalHandle hHal, |
| 2283 | tpSirIbssGetPeerInfoRspParams |
| 2284 | pIbssPeerInfoParams) |
| 2285 | { |
| 2286 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2287 | |
| 2288 | if (NULL == pMac) { |
| 2289 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
| 2290 | "%s: pMac is null", __func__); |
| 2291 | return QDF_STATUS_E_FAILURE; |
| 2292 | } |
| 2293 | if (pMac->sme.peerInfoParams.peerInfoCbk == NULL) { |
| 2294 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 2295 | "%s: HDD callback is null", __func__); |
| 2296 | return QDF_STATUS_E_FAILURE; |
| 2297 | } |
| 2298 | pMac->sme.peerInfoParams.peerInfoCbk(pMac->sme.peerInfoParams.pUserData, |
| 2299 | &pIbssPeerInfoParams-> |
| 2300 | ibssPeerInfoRspParams); |
| 2301 | return QDF_STATUS_SUCCESS; |
| 2302 | } |
| 2303 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2304 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2305 | * sme_process_dual_mac_config_resp() - Process set Dual mac config response |
| 2306 | * @mac: Global MAC pointer |
| 2307 | * @msg: Dual mac config response |
| 2308 | * |
| 2309 | * Processes the dual mac configuration response and invokes the HDD callback |
| 2310 | * to process further |
| 2311 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2312 | static QDF_STATUS sme_process_dual_mac_config_resp(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2313 | uint8_t *msg) |
| 2314 | { |
| 2315 | tListElem *entry = NULL; |
| 2316 | tSmeCmd *command = NULL; |
| 2317 | bool found; |
| 2318 | dual_mac_cb callback = NULL; |
| 2319 | struct sir_dual_mac_config_resp *param; |
| 2320 | |
| 2321 | param = (struct sir_dual_mac_config_resp *)msg; |
| 2322 | if (!param) { |
| 2323 | sms_log(mac, LOGE, FL("Dual mac config resp param is NULL")); |
| 2324 | /* Not returning. Need to check if active command list |
| 2325 | * needs to be freed |
| 2326 | */ |
| 2327 | } |
| 2328 | |
| 2329 | entry = csr_ll_peek_head(&mac->sme.smeCmdActiveList, |
| 2330 | LL_ACCESS_LOCK); |
| 2331 | if (!entry) { |
| 2332 | sms_log(mac, LOGE, FL("No cmd found in active list")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2333 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2334 | } |
| 2335 | |
| 2336 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 2337 | if (!command) { |
| 2338 | sms_log(mac, LOGE, FL("Base address is NULL")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2339 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2340 | } |
| 2341 | |
| 2342 | if (e_sme_command_set_dual_mac_config != command->command) { |
| 2343 | sms_log(mac, LOGE, FL("Command mismatch!")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2344 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2345 | } |
| 2346 | |
| 2347 | callback = command->u.set_dual_mac_cmd.set_dual_mac_cb; |
| 2348 | if (callback) { |
| 2349 | if (!param) { |
| 2350 | sms_log(mac, LOGE, |
| 2351 | FL("Callback failed-Dual mac config is NULL")); |
| 2352 | } else { |
| 2353 | sms_log(mac, LOG1, |
| 2354 | FL("Calling HDD callback for Dual mac config")); |
| 2355 | callback(param->status, |
| 2356 | command->u.set_dual_mac_cmd.scan_config, |
| 2357 | command->u.set_dual_mac_cmd.fw_mode_config); |
| 2358 | } |
| 2359 | } else { |
| 2360 | sms_log(mac, LOGE, FL("Callback does not exist")); |
| 2361 | } |
| 2362 | |
| 2363 | found = csr_ll_remove_entry(&mac->sme.smeCmdActiveList, entry, |
| 2364 | LL_ACCESS_LOCK); |
| 2365 | if (found) |
| 2366 | /* Now put this command back on the available command list */ |
| 2367 | sme_release_command(mac, command); |
| 2368 | |
| 2369 | sme_process_pending_queue(mac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2370 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2371 | } |
| 2372 | |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 2373 | /** |
| 2374 | * sme_process_antenna_mode_resp() - Process set antenna mode |
| 2375 | * response |
| 2376 | * @mac: Global MAC pointer |
| 2377 | * @msg: antenna mode response |
| 2378 | * |
| 2379 | * Processes the antenna mode response and invokes the HDD |
| 2380 | * callback to process further |
| 2381 | */ |
| 2382 | static QDF_STATUS sme_process_antenna_mode_resp(tpAniSirGlobal mac, |
| 2383 | uint8_t *msg) |
| 2384 | { |
| 2385 | tListElem *entry; |
| 2386 | tSmeCmd *command; |
| 2387 | bool found; |
| 2388 | antenna_mode_cb callback; |
| 2389 | struct sir_antenna_mode_resp *param; |
| 2390 | |
| 2391 | param = (struct sir_antenna_mode_resp *)msg; |
| 2392 | if (!param) { |
| 2393 | sms_log(mac, LOGE, FL("set antenna mode resp is NULL")); |
| 2394 | /* Not returning. Need to check if active command list |
| 2395 | * needs to be freed |
| 2396 | */ |
| 2397 | } |
| 2398 | |
| 2399 | entry = csr_ll_peek_head(&mac->sme.smeCmdActiveList, |
| 2400 | LL_ACCESS_LOCK); |
| 2401 | if (!entry) { |
| 2402 | sms_log(mac, LOGE, FL("No cmd found in active list")); |
| 2403 | return QDF_STATUS_E_FAILURE; |
| 2404 | } |
| 2405 | |
| 2406 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 2407 | if (!command) { |
| 2408 | sms_log(mac, LOGE, FL("Base address is NULL")); |
| 2409 | return QDF_STATUS_E_FAILURE; |
| 2410 | } |
| 2411 | |
| 2412 | if (e_sme_command_set_antenna_mode != command->command) { |
| 2413 | sms_log(mac, LOGE, FL("Command mismatch!")); |
| 2414 | return QDF_STATUS_E_FAILURE; |
| 2415 | } |
| 2416 | |
| 2417 | callback = |
| 2418 | command->u.set_antenna_mode_cmd.set_antenna_mode_resp; |
| 2419 | if (callback) { |
| 2420 | if (!param) { |
| 2421 | sms_log(mac, LOGE, |
| 2422 | FL("Set antenna mode call back is NULL")); |
| 2423 | } else { |
| 2424 | sms_log(mac, LOG1, |
| 2425 | FL("HDD callback for set antenna mode")); |
| 2426 | callback(param->status); |
| 2427 | } |
| 2428 | } else { |
| 2429 | sms_log(mac, LOGE, FL("Callback does not exist")); |
| 2430 | } |
| 2431 | |
| 2432 | found = csr_ll_remove_entry(&mac->sme.smeCmdActiveList, entry, |
| 2433 | LL_ACCESS_LOCK); |
| 2434 | if (found) |
| 2435 | /* Now put this command back on the available command list */ |
| 2436 | sme_release_command(mac, command); |
| 2437 | |
| 2438 | sme_process_pending_queue(mac); |
| 2439 | return QDF_STATUS_SUCCESS; |
| 2440 | } |
| 2441 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2442 | /*-------------------------------------------------------------------------- |
| 2443 | |
| 2444 | \brief sme_process_msg() - The main message processor for SME. |
| 2445 | |
| 2446 | The function is called by a message dispatcher when to process a message |
| 2447 | targeted for SME. |
| 2448 | |
| 2449 | This is a synchronous call |
| 2450 | \param hHal - The handle returned by mac_open. |
| 2451 | \param pMsg - A pointer to a caller allocated object of tSirMsgQ. |
| 2452 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2453 | \return QDF_STATUS_SUCCESS - SME successfully process the message. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2454 | |
| 2455 | Other status means SME failed to process the message to HAL. |
| 2456 | \sa |
| 2457 | |
| 2458 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2459 | QDF_STATUS sme_process_msg(tHalHandle hHal, cds_msg_t *pMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2460 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2461 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2462 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2463 | |
| 2464 | if (pMsg == NULL) { |
| 2465 | sms_log(pMac, LOGE, "Empty message for SME"); |
| 2466 | return status; |
| 2467 | } |
| 2468 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2469 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2470 | sms_log(pMac, LOGW, FL("Locking failed, bailing out")); |
| 2471 | if (pMsg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2472 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2473 | return status; |
| 2474 | } |
| 2475 | if (!SME_IS_START(pMac)) { |
| 2476 | sms_log(pMac, LOGW, FL("message type %d in stop state ignored"), |
| 2477 | pMsg->type); |
| 2478 | if (pMsg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2479 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2480 | goto release_lock; |
| 2481 | } |
| 2482 | switch (pMsg->type) { |
| 2483 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2484 | case eWNI_SME_HO_FAIL_IND: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2485 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2486 | FL("LFR3: Rcvd eWNI_SME_HO_FAIL_IND")); |
| 2487 | csr_process_ho_fail_ind(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2488 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2489 | break; |
| 2490 | #endif |
| 2491 | case eWNI_PMC_SMPS_STATE_IND: |
| 2492 | break; |
| 2493 | case WNI_CFG_SET_CNF: |
| 2494 | case WNI_CFG_DNLD_CNF: |
| 2495 | case WNI_CFG_GET_RSP: |
| 2496 | case WNI_CFG_ADD_GRP_ADDR_CNF: |
| 2497 | case WNI_CFG_DEL_GRP_ADDR_CNF: |
| 2498 | break; |
| 2499 | case eWNI_SME_ADDTS_RSP: |
| 2500 | case eWNI_SME_DELTS_RSP: |
| 2501 | case eWNI_SME_DELTS_IND: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2502 | case eWNI_SME_FT_AGGR_QOS_RSP: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2503 | /* QoS */ |
| 2504 | if (pMsg->bodyptr) { |
| 2505 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 2506 | status = sme_qos_msg_processor(pMac, pMsg->type, |
| 2507 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2508 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2509 | #endif |
| 2510 | } else { |
| 2511 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2512 | pMsg->type); |
| 2513 | } |
| 2514 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2515 | case eWNI_SME_NEIGHBOR_REPORT_IND: |
| 2516 | case eWNI_SME_BEACON_REPORT_REQ_IND: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2517 | if (pMsg->bodyptr) { |
| 2518 | status = sme_rrm_msg_processor(pMac, pMsg->type, |
| 2519 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2520 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2521 | } else { |
| 2522 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2523 | pMsg->type); |
| 2524 | } |
| 2525 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2526 | case eWNI_SME_ADD_STA_SELF_RSP: |
| 2527 | if (pMsg->bodyptr) { |
| 2528 | status = csr_process_add_sta_session_rsp(pMac, |
| 2529 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2530 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2531 | } else { |
| 2532 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2533 | pMsg->type); |
| 2534 | } |
| 2535 | break; |
| 2536 | case eWNI_SME_DEL_STA_SELF_RSP: |
| 2537 | if (pMsg->bodyptr) { |
| 2538 | status = csr_process_del_sta_session_rsp(pMac, |
| 2539 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2540 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2541 | } else { |
| 2542 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2543 | pMsg->type); |
| 2544 | } |
| 2545 | break; |
| 2546 | case eWNI_SME_REMAIN_ON_CHN_RSP: |
| 2547 | if (pMsg->bodyptr) { |
| 2548 | status = sme_remain_on_chn_rsp(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2549 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2550 | } else { |
| 2551 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2552 | pMsg->type); |
| 2553 | } |
| 2554 | break; |
| 2555 | case eWNI_SME_REMAIN_ON_CHN_RDY_IND: |
| 2556 | if (pMsg->bodyptr) { |
| 2557 | status = sme_remain_on_chn_ready(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2558 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2559 | } else { |
| 2560 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2561 | pMsg->type); |
| 2562 | } |
| 2563 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2564 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 2565 | case eWNI_SME_PREF_NETWORK_FOUND_IND: |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 2566 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_WMA_MSG, |
| 2567 | NO_SESSION, pMsg->type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2568 | if (pMsg->bodyptr) { |
| 2569 | status = sme_preferred_network_found_ind((void *)pMac, |
| 2570 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2571 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2572 | } else { |
| 2573 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2574 | pMsg->type); |
| 2575 | } |
| 2576 | break; |
| 2577 | #endif /* FEATURE_WLAN_SCAN_PNO */ |
| 2578 | case eWNI_SME_CHANGE_COUNTRY_CODE: |
| 2579 | if (pMsg->bodyptr) { |
| 2580 | status = sme_handle_change_country_code((void *)pMac, |
| 2581 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2582 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2583 | } else { |
| 2584 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2585 | pMsg->type); |
| 2586 | } |
| 2587 | break; |
| 2588 | case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE: |
| 2589 | if (pMsg->bodyptr) { |
| 2590 | status = sme_handle_generic_change_country_code( |
| 2591 | (void *)pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2592 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2593 | } else { |
| 2594 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2595 | pMsg->type); |
| 2596 | } |
| 2597 | break; |
| 2598 | case eWNI_SME_SCAN_CMD: |
| 2599 | if (pMsg->bodyptr) { |
| 2600 | status = sme_handle_scan_req(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2601 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2602 | } else { |
| 2603 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2604 | pMsg->type); |
| 2605 | } |
| 2606 | break; |
| 2607 | case eWNI_SME_ROC_CMD: |
| 2608 | if (pMsg->bodyptr) { |
| 2609 | status = sme_handle_roc_req(hHal, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2610 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2611 | } else { |
| 2612 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2613 | pMsg->type); |
| 2614 | } |
| 2615 | break; |
| 2616 | #ifdef FEATURE_WLAN_TDLS |
| 2617 | /* |
| 2618 | * command rescived from PE, SME tdls msg processor shall be called |
| 2619 | * to process commands recieved from PE |
| 2620 | */ |
| 2621 | case eWNI_SME_TDLS_SEND_MGMT_RSP: |
| 2622 | case eWNI_SME_TDLS_ADD_STA_RSP: |
| 2623 | case eWNI_SME_TDLS_DEL_STA_RSP: |
| 2624 | case eWNI_SME_TDLS_DEL_STA_IND: |
| 2625 | case eWNI_SME_TDLS_DEL_ALL_PEER_IND: |
| 2626 | case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND: |
| 2627 | case eWNI_SME_TDLS_LINK_ESTABLISH_RSP: |
| 2628 | case eWNI_SME_TDLS_SHOULD_DISCOVER: |
| 2629 | case eWNI_SME_TDLS_SHOULD_TEARDOWN: |
| 2630 | case eWNI_SME_TDLS_PEER_DISCONNECTED: |
| 2631 | if (pMsg->bodyptr) { |
| 2632 | status = tdls_msg_processor(pMac, pMsg->type, |
| 2633 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2634 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2635 | } else { |
| 2636 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2637 | pMsg->type); |
| 2638 | } |
| 2639 | break; |
| 2640 | #endif |
| 2641 | #ifdef WLAN_FEATURE_11W |
| 2642 | case eWNI_SME_UNPROT_MGMT_FRM_IND: |
| 2643 | if (pMsg->bodyptr) { |
| 2644 | sme_unprotected_mgmt_frm_ind(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2645 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2646 | } else { |
| 2647 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2648 | pMsg->type); |
| 2649 | } |
| 2650 | break; |
| 2651 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 2652 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2653 | case eWNI_SME_TSM_IE_IND: |
| 2654 | if (pMsg->bodyptr) { |
| 2655 | sme_tsm_ie_ind(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2656 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2657 | } else { |
| 2658 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2659 | pMsg->type); |
| 2660 | } |
| 2661 | break; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 2662 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2663 | case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP: |
| 2664 | status = csr_roam_offload_scan_rsp_hdlr((void *)pMac, |
| 2665 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2666 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2667 | break; |
| 2668 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 2669 | case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP: |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 2670 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_WMA_MSG, |
| 2671 | NO_SESSION, pMsg->type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2672 | if (pMsg->bodyptr) { |
| 2673 | sme_process_get_gtk_info_rsp(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2674 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2675 | } else { |
| 2676 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2677 | pMsg->type); |
| 2678 | } |
| 2679 | break; |
| 2680 | #endif |
| 2681 | #ifdef FEATURE_WLAN_LPHB |
| 2682 | /* LPHB timeout indication arrived, send IND to client */ |
| 2683 | case eWNI_SME_LPHB_IND: |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 2684 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_WMA_MSG, |
| 2685 | NO_SESSION, pMsg->type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2686 | if (pMac->sme.pLphbIndCb) |
| 2687 | pMac->sme.pLphbIndCb(pMac->hHdd, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2688 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2689 | break; |
| 2690 | #endif /* FEATURE_WLAN_LPHB */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 2691 | case eWNI_SME_IBSS_PEER_INFO_RSP: |
| 2692 | if (pMsg->bodyptr) { |
| 2693 | sme_ibss_peer_info_response_handleer(pMac, |
| 2694 | pMsg-> |
| 2695 | bodyptr); |
| 2696 | qdf_mem_free(pMsg->bodyptr); |
| 2697 | } else { |
| 2698 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2699 | pMsg->type); |
| 2700 | } |
| 2701 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2702 | case eWNI_SME_READY_TO_SUSPEND_IND: |
| 2703 | if (pMsg->bodyptr) { |
| 2704 | sme_process_ready_to_suspend(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2705 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2706 | } else { |
| 2707 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2708 | pMsg->type); |
| 2709 | } |
| 2710 | break; |
| 2711 | #ifdef WLAN_FEATURE_EXTWOW_SUPPORT |
| 2712 | case eWNI_SME_READY_TO_EXTWOW_IND: |
| 2713 | if (pMsg->bodyptr) { |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 2714 | sme_process_ready_to_ext_wow(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2715 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2716 | } else { |
| 2717 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2718 | pMsg->type); |
| 2719 | } |
| 2720 | break; |
| 2721 | #endif |
| 2722 | #ifdef FEATURE_WLAN_CH_AVOID |
| 2723 | /* channel avoid message arrived, send IND to client */ |
| 2724 | case eWNI_SME_CH_AVOID_IND: |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 2725 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_WMA_MSG, |
| 2726 | NO_SESSION, pMsg->type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2727 | if (pMac->sme.pChAvoidNotificationCb) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2728 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2729 | FL("CH avoid notification")); |
| 2730 | pMac->sme.pChAvoidNotificationCb(pMac->hHdd, |
| 2731 | pMsg->bodyptr); |
| 2732 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2733 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2734 | break; |
| 2735 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 2736 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 2737 | case eWNI_SME_AUTO_SHUTDOWN_IND: |
| 2738 | if (pMac->sme.pAutoShutdownNotificationCb) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2739 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2740 | FL("Auto shutdown notification")); |
| 2741 | pMac->sme.pAutoShutdownNotificationCb(); |
| 2742 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2743 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2744 | break; |
| 2745 | #endif |
| 2746 | case eWNI_SME_DFS_RADAR_FOUND: |
| 2747 | case eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND: |
| 2748 | status = dfs_msg_processor(pMac, pMsg->type, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2749 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2750 | break; |
| 2751 | case eWNI_SME_CHANNEL_CHANGE_RSP: |
| 2752 | if (pMsg->bodyptr) { |
| 2753 | status = sme_process_channel_change_resp(pMac, |
| 2754 | pMsg->type, |
| 2755 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2756 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2757 | } else { |
| 2758 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2759 | pMsg->type); |
| 2760 | } |
| 2761 | break; |
| 2762 | #ifdef WLAN_FEATURE_STATS_EXT |
| 2763 | case eWNI_SME_STATS_EXT_EVENT: |
| 2764 | if (pMsg->bodyptr) { |
| 2765 | status = sme_stats_ext_event(hHal, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2766 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2767 | } else { |
| 2768 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2769 | pMsg->type); |
| 2770 | } |
| 2771 | break; |
| 2772 | #endif |
| 2773 | case eWNI_SME_LINK_SPEED_IND: |
| 2774 | if (pMac->sme.pLinkSpeedIndCb) |
| 2775 | pMac->sme.pLinkSpeedIndCb(pMsg->bodyptr, |
| 2776 | pMac->sme.pLinkSpeedCbContext); |
| 2777 | if (pMsg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2778 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2779 | break; |
| 2780 | case eWNI_SME_CSA_OFFLOAD_EVENT: |
| 2781 | if (pMsg->bodyptr) { |
| 2782 | csr_scan_flush_bss_entry(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2783 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2784 | } |
| 2785 | break; |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 2786 | case eWNI_SME_TSF_EVENT: |
| 2787 | if (pMac->sme.get_tsf_cb) { |
| 2788 | pMac->sme.get_tsf_cb(pMac->sme.get_tsf_cxt, |
| 2789 | (struct stsf *)pMsg->bodyptr); |
| 2790 | } |
| 2791 | if (pMsg->bodyptr) |
| 2792 | qdf_mem_free(pMsg->bodyptr); |
| 2793 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2794 | #ifdef WLAN_FEATURE_NAN |
| 2795 | case eWNI_SME_NAN_EVENT: |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 2796 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_WMA_MSG, |
| 2797 | NO_SESSION, pMsg->type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2798 | if (pMsg->bodyptr) { |
| 2799 | sme_nan_event(hHal, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2800 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2801 | } |
| 2802 | break; |
| 2803 | #endif /* WLAN_FEATURE_NAN */ |
| 2804 | case eWNI_SME_LINK_STATUS_IND: |
| 2805 | { |
| 2806 | tAniGetLinkStatus *pLinkStatus = |
| 2807 | (tAniGetLinkStatus *) pMsg->bodyptr; |
| 2808 | if (pLinkStatus) { |
| 2809 | if (pMac->sme.linkStatusCallback) { |
| 2810 | pMac->sme.linkStatusCallback( |
| 2811 | pLinkStatus->linkStatus, |
| 2812 | pMac->sme.linkStatusContext); |
| 2813 | } |
| 2814 | pMac->sme.linkStatusCallback = NULL; |
| 2815 | pMac->sme.linkStatusContext = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2816 | qdf_mem_free(pLinkStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2817 | } |
| 2818 | break; |
| 2819 | } |
| 2820 | case eWNI_SME_MSG_GET_TEMPERATURE_IND: |
| 2821 | if (pMac->sme.pGetTemperatureCb) { |
| 2822 | pMac->sme.pGetTemperatureCb(pMsg->bodyval, |
| 2823 | pMac->sme.pTemperatureCbContext); |
| 2824 | } |
| 2825 | break; |
| 2826 | case eWNI_SME_SNR_IND: |
| 2827 | { |
| 2828 | tAniGetSnrReq *pSnrReq = (tAniGetSnrReq *) pMsg->bodyptr; |
| 2829 | if (pSnrReq) { |
| 2830 | if (pSnrReq->snrCallback) { |
| 2831 | ((tCsrSnrCallback) |
| 2832 | (pSnrReq->snrCallback)) |
| 2833 | (pSnrReq->snr, pSnrReq->staId, |
| 2834 | pSnrReq->pDevContext); |
| 2835 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2836 | qdf_mem_free(pSnrReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2837 | } |
| 2838 | break; |
| 2839 | } |
| 2840 | #ifdef FEATURE_WLAN_EXTSCAN |
| 2841 | case eWNI_SME_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 2842 | if (pMac->sme.pExtScanIndCb) |
| 2843 | pMac->sme.pExtScanIndCb(pMac->hHdd, |
| 2844 | eSIR_EXTSCAN_FULL_SCAN_RESULT_IND, |
| 2845 | pMsg->bodyptr); |
| 2846 | else |
| 2847 | sms_log(pMac, LOGE, |
| 2848 | FL("callback not registered to process %d"), |
| 2849 | pMsg->type); |
| 2850 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2851 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2852 | break; |
| 2853 | case eWNI_SME_EPNO_NETWORK_FOUND_IND: |
| 2854 | if (pMac->sme.pExtScanIndCb) |
| 2855 | pMac->sme.pExtScanIndCb(pMac->hHdd, |
| 2856 | eSIR_EPNO_NETWORK_FOUND_IND, |
| 2857 | pMsg->bodyptr); |
| 2858 | else |
| 2859 | sms_log(pMac, LOGE, |
| 2860 | FL("callback not registered to process %d"), |
| 2861 | pMsg->type); |
| 2862 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2863 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2864 | break; |
| 2865 | #endif |
| 2866 | case eWNI_SME_FW_DUMP_IND: |
| 2867 | sme_process_fw_mem_dump_rsp(pMac, pMsg); |
| 2868 | break; |
| 2869 | case eWNI_SME_SET_HW_MODE_RESP: |
| 2870 | if (pMsg->bodyptr) { |
| 2871 | status = sme_process_set_hw_mode_resp(pMac, |
| 2872 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2873 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2874 | } else { |
| 2875 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2876 | pMsg->type); |
| 2877 | } |
| 2878 | break; |
| 2879 | case eWNI_SME_HW_MODE_TRANS_IND: |
| 2880 | if (pMsg->bodyptr) { |
| 2881 | status = sme_process_hw_mode_trans_ind(pMac, |
| 2882 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2883 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2884 | } else { |
| 2885 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2886 | pMsg->type); |
| 2887 | } |
| 2888 | break; |
| 2889 | case eWNI_SME_NSS_UPDATE_RSP: |
| 2890 | if (pMsg->bodyptr) { |
| 2891 | status = sme_process_nss_update_resp(pMac, |
| 2892 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2893 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2894 | } else { |
| 2895 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2896 | pMsg->type); |
| 2897 | } |
| 2898 | break; |
| 2899 | case eWNI_SME_OCB_SET_CONFIG_RSP: |
| 2900 | if (pMac->sme.ocb_set_config_callback) { |
| 2901 | pMac->sme.ocb_set_config_callback( |
| 2902 | pMac->sme.ocb_set_config_context, |
| 2903 | pMsg->bodyptr); |
| 2904 | } else { |
| 2905 | sms_log(pMac, LOGE, FL( |
| 2906 | "Message error. The callback is NULL.")); |
| 2907 | } |
| 2908 | pMac->sme.ocb_set_config_callback = NULL; |
| 2909 | pMac->sme.ocb_set_config_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2910 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2911 | break; |
| 2912 | case eWNI_SME_OCB_GET_TSF_TIMER_RSP: |
| 2913 | if (pMac->sme.ocb_get_tsf_timer_callback) { |
| 2914 | pMac->sme.ocb_get_tsf_timer_callback( |
| 2915 | pMac->sme.ocb_get_tsf_timer_context, |
| 2916 | pMsg->bodyptr); |
| 2917 | } else { |
| 2918 | sms_log(pMac, LOGE, FL( |
| 2919 | "Message error. The callback is NULL.")); |
| 2920 | } |
| 2921 | pMac->sme.ocb_get_tsf_timer_callback = NULL; |
| 2922 | pMac->sme.ocb_get_tsf_timer_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2923 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2924 | break; |
| 2925 | case eWNI_SME_DCC_GET_STATS_RSP: |
| 2926 | if (pMac->sme.dcc_get_stats_callback) { |
| 2927 | pMac->sme.dcc_get_stats_callback( |
| 2928 | pMac->sme.dcc_get_stats_context, |
| 2929 | pMsg->bodyptr); |
| 2930 | } else { |
| 2931 | sms_log(pMac, LOGE, FL( |
| 2932 | "Message error. The callback is NULL.")); |
| 2933 | } |
| 2934 | pMac->sme.dcc_get_stats_callback = NULL; |
| 2935 | pMac->sme.dcc_get_stats_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2936 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2937 | break; |
| 2938 | case eWNI_SME_DCC_UPDATE_NDL_RSP: |
| 2939 | if (pMac->sme.dcc_update_ndl_callback) { |
| 2940 | pMac->sme.dcc_update_ndl_callback( |
| 2941 | pMac->sme.dcc_update_ndl_context, |
| 2942 | pMsg->bodyptr); |
| 2943 | } else { |
| 2944 | sms_log(pMac, LOGE, FL( |
| 2945 | "Message error. The callback is NULL.")); |
| 2946 | } |
| 2947 | pMac->sme.dcc_update_ndl_callback = NULL; |
| 2948 | pMac->sme.dcc_update_ndl_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2949 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2950 | break; |
| 2951 | case eWNI_SME_DCC_STATS_EVENT: |
| 2952 | if (pMac->sme.dcc_stats_event_callback) { |
| 2953 | pMac->sme.dcc_stats_event_callback( |
| 2954 | pMac->sme.dcc_stats_event_context, |
| 2955 | pMsg->bodyptr); |
| 2956 | } else { |
| 2957 | sms_log(pMac, LOGE, FL( |
| 2958 | "Message error. The callback is NULL.")); |
| 2959 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2960 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2961 | break; |
| 2962 | case eWNI_SME_SET_DUAL_MAC_CFG_RESP: |
| 2963 | if (pMsg->bodyptr) { |
| 2964 | status = sme_process_dual_mac_config_resp(pMac, |
| 2965 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2966 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2967 | } else { |
| 2968 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2969 | pMsg->type); |
| 2970 | } |
| 2971 | case eWNI_SME_SET_THERMAL_LEVEL_IND: |
| 2972 | if (pMac->sme.set_thermal_level_cb) |
| 2973 | pMac->sme.set_thermal_level_cb(pMac->hHdd, |
| 2974 | pMsg->bodyval); |
| 2975 | break; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 2976 | case eWNI_SME_EXT_CHANGE_CHANNEL_IND: |
| 2977 | status = sme_extended_change_channel_ind(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2978 | qdf_mem_free(pMsg->bodyptr); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 2979 | break; |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 2980 | case eWNI_SME_SET_ANTENNA_MODE_RESP: |
| 2981 | if (pMsg->bodyptr) { |
| 2982 | status = sme_process_antenna_mode_resp(pMac, |
| 2983 | pMsg->bodyptr); |
| 2984 | qdf_mem_free(pMsg->bodyptr); |
| 2985 | } else { |
| 2986 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 2987 | pMsg->type); |
| 2988 | } |
| 2989 | break; |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 2990 | case eWNI_SME_NDP_CONFIRM_IND: |
| 2991 | case eWNI_SME_NDP_NEW_PEER_IND: |
| 2992 | case eWNI_SME_NDP_INITIATOR_RSP: |
Abhishek Singh | 4fef747 | 2016-06-06 11:36:03 -0700 | [diff] [blame] | 2993 | case eWNI_SME_NDP_INDICATION: |
| 2994 | case eWNI_SME_NDP_RESPONDER_RSP: |
Naveen Rawat | f28315c | 2016-06-29 18:06:02 -0700 | [diff] [blame] | 2995 | case eWNI_SME_NDP_END_RSP: |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 2996 | case eWNI_SME_NDP_END_IND: |
| 2997 | case eWNI_SME_NDP_PEER_DEPARTED_IND: |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 2998 | sme_ndp_msg_processor(pMac, pMsg); |
| 2999 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3000 | default: |
| 3001 | |
| 3002 | if ((pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN) |
| 3003 | && (pMsg->type <= eWNI_SME_MSG_TYPES_END)) { |
| 3004 | /* CSR */ |
| 3005 | if (pMsg->bodyptr) { |
| 3006 | status = csr_msg_processor(hHal, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3007 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3008 | } else { |
| 3009 | sms_log(pMac, LOGE, FL("Empty message for %d"), |
| 3010 | pMsg->type); |
| 3011 | } |
| 3012 | } else { |
| 3013 | sms_log(pMac, LOGW, FL("Unknown message type %d"), |
| 3014 | pMsg->type); |
| 3015 | if (pMsg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3016 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3017 | } |
| 3018 | } /* switch */ |
| 3019 | release_lock: |
| 3020 | sme_release_global_lock(&pMac->sme); |
| 3021 | return status; |
| 3022 | } |
| 3023 | |
| 3024 | /** |
| 3025 | * sme_process_nss_update_resp() - Process nss update response |
| 3026 | * @mac: Global MAC pointer |
| 3027 | * @msg: nss update response |
| 3028 | * |
| 3029 | * Processes the nss update response and invokes the HDD |
| 3030 | * callback to process further |
| 3031 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3032 | QDF_STATUS sme_process_nss_update_resp(tpAniSirGlobal mac, uint8_t *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3033 | { |
| 3034 | tListElem *entry = NULL; |
| 3035 | tSmeCmd *command = NULL; |
| 3036 | bool found; |
| 3037 | nss_update_cb callback = NULL; |
| 3038 | struct sir_beacon_tx_complete_rsp *param; |
| 3039 | |
| 3040 | param = (struct sir_beacon_tx_complete_rsp *)msg; |
| 3041 | if (!param) { |
| 3042 | sms_log(mac, LOGE, FL("nss update resp param is NULL")); |
| 3043 | /* Not returning. Need to check if active command list |
| 3044 | * needs to be freed |
| 3045 | */ |
| 3046 | } |
| 3047 | |
| 3048 | entry = csr_ll_peek_head(&mac->sme.smeCmdActiveList, |
| 3049 | LL_ACCESS_LOCK); |
| 3050 | if (!entry) { |
| 3051 | sms_log(mac, LOGE, FL("No cmd found in active list")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3052 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3053 | } |
| 3054 | |
| 3055 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 3056 | if (!command) { |
| 3057 | sms_log(mac, LOGE, FL("Base address is NULL")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3058 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3059 | } |
| 3060 | |
| 3061 | if (e_sme_command_nss_update != command->command) { |
| 3062 | sms_log(mac, LOGE, FL("Command mismatch!")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3063 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3064 | } |
| 3065 | |
| 3066 | callback = command->u.nss_update_cmd.nss_update_cb; |
| 3067 | if (callback) { |
| 3068 | if (!param) { |
| 3069 | sms_log(mac, LOGE, |
| 3070 | FL("Callback failed since nss update params is NULL")); |
| 3071 | } else { |
| 3072 | sms_log(mac, LOGE, |
| 3073 | FL("Calling HDD callback for nss update response")); |
| 3074 | callback(command->u.nss_update_cmd.context, |
| 3075 | param->tx_status, |
| 3076 | param->session_id, |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 3077 | command->u.nss_update_cmd.next_action, |
| 3078 | command->u.nss_update_cmd.reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3079 | } |
| 3080 | } else { |
| 3081 | sms_log(mac, LOGE, FL("Callback does not exisit")); |
| 3082 | } |
| 3083 | |
| 3084 | found = csr_ll_remove_entry(&mac->sme.smeCmdActiveList, entry, |
| 3085 | LL_ACCESS_LOCK); |
| 3086 | if (found) { |
| 3087 | /* Now put this command back on the avilable command list */ |
| 3088 | sme_release_command(mac, command); |
| 3089 | } |
| 3090 | sme_process_pending_queue(mac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3091 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3092 | } |
| 3093 | |
| 3094 | /* No need to hold the global lock here because this function can only be called */ |
| 3095 | /* after sme_stop. */ |
| 3096 | void sme_free_msg(tHalHandle hHal, cds_msg_t *pMsg) |
| 3097 | { |
| 3098 | if (pMsg) { |
| 3099 | if (pMsg->bodyptr) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3100 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3101 | } |
| 3102 | } |
| 3103 | |
| 3104 | } |
| 3105 | |
| 3106 | /*-------------------------------------------------------------------------- |
| 3107 | |
| 3108 | \brief sme_stop() - Stop all SME modules and put them at idle state |
| 3109 | |
| 3110 | The function stops each module in SME, PMC, CSR, etc. . Upon |
| 3111 | return, all modules are at idle state ready to start. |
| 3112 | |
| 3113 | This is a synchronous call |
| 3114 | \param hHal - The handle returned by mac_open |
| 3115 | \param tHalStopType - reason for stopping |
| 3116 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3117 | \return QDF_STATUS_SUCCESS - SME is stopped. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3118 | |
| 3119 | Other status means SME is failed to stop but caller should still |
| 3120 | consider SME is stopped. |
| 3121 | \sa |
| 3122 | |
| 3123 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3124 | QDF_STATUS sme_stop(tHalHandle hHal, tHalStopType stopType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3125 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3126 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 3127 | QDF_STATUS fail_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3128 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3129 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3130 | p2p_stop(hHal); |
| 3131 | |
| 3132 | status = csr_stop(pMac, stopType); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3133 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3134 | sms_log(pMac, LOGE, |
| 3135 | "csr_stop failed during smeStop with status=%d", status); |
| 3136 | fail_status = status; |
| 3137 | } |
| 3138 | |
| 3139 | purge_sme_cmd_list(pMac); |
| 3140 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3141 | if (!QDF_IS_STATUS_SUCCESS(fail_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3142 | status = fail_status; |
| 3143 | } |
| 3144 | |
| 3145 | pMac->sme.state = SME_STATE_STOP; |
| 3146 | |
| 3147 | return status; |
| 3148 | } |
| 3149 | |
| 3150 | /*-------------------------------------------------------------------------- |
| 3151 | |
| 3152 | \brief sme_close() - Release all SME modules and their resources. |
| 3153 | |
| 3154 | The function release each module in SME, PMC, CSR, etc. . Upon |
| 3155 | return, all modules are at closed state. |
| 3156 | |
| 3157 | No SME APIs can be involved after smeClose except smeOpen. |
| 3158 | smeClose must be called before mac_close. |
| 3159 | This is a synchronous call |
| 3160 | \param hHal - The handle returned by mac_open |
| 3161 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3162 | \return QDF_STATUS_SUCCESS - SME is successfully close. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3163 | |
| 3164 | Other status means SME is failed to be closed but caller still cannot |
| 3165 | call any other SME functions except smeOpen. |
| 3166 | \sa |
| 3167 | |
| 3168 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3169 | QDF_STATUS sme_close(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3170 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3171 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 3172 | QDF_STATUS fail_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3173 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3174 | |
| 3175 | if (!pMac) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3176 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3177 | |
| 3178 | /* Note: pSession will be invalid from here on, do not access */ |
| 3179 | status = csr_close(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3180 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3181 | sms_log(pMac, LOGE, |
| 3182 | "csr_close failed during sme close with status=%d", |
| 3183 | status); |
| 3184 | fail_status = status; |
| 3185 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3186 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 3187 | status = sme_qos_close(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3188 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3189 | sms_log(pMac, LOGE, |
| 3190 | "Qos close failed during sme close with status=%d", |
| 3191 | status); |
| 3192 | fail_status = status; |
| 3193 | } |
| 3194 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3195 | status = sme_ps_close(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3196 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3197 | sms_log(pMac, LOGE, |
| 3198 | "sme_ps_close failed during smeClose status=%d", |
| 3199 | status); |
| 3200 | fail_status = status; |
| 3201 | } |
| 3202 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3203 | status = rrm_close(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3204 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3205 | sms_log(pMac, LOGE, |
| 3206 | "RRM close failed during sme close with status=%d", |
| 3207 | status); |
| 3208 | fail_status = status; |
| 3209 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3210 | |
| 3211 | sme_p2p_close(hHal); |
| 3212 | |
| 3213 | free_sme_cmd_list(pMac); |
| 3214 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3215 | if (!QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 3216 | (qdf_mutex_destroy(&pMac->sme.lkSmeGlobalLock))) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3217 | fail_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3218 | } |
| 3219 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3220 | if (!QDF_IS_STATUS_SUCCESS(fail_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3221 | status = fail_status; |
| 3222 | } |
| 3223 | |
| 3224 | pMac->sme.state = SME_STATE_STOP; |
| 3225 | |
| 3226 | return status; |
| 3227 | } |
| 3228 | |
| 3229 | /** |
| 3230 | * sme_scan_request() - wrapper function to Request a 11d or full scan from CSR. |
| 3231 | * @hal: hal global context |
| 3232 | * @session_id: session id |
| 3233 | * @scan_req: scan req |
| 3234 | * @callback: a callback function that scan calls upon finish, will not |
| 3235 | * be called if csr_scan_request returns error |
| 3236 | * @ctx: a pointer passed in for the callback |
| 3237 | * |
| 3238 | * This is a wrapper function to Request a 11d or full scan from CSR. This is |
| 3239 | * an asynchronous call |
| 3240 | * |
| 3241 | * Return: Status of operation |
| 3242 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3243 | QDF_STATUS sme_scan_request(tHalHandle hal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3244 | tCsrScanRequest *scan_req, |
| 3245 | csr_scan_completeCallback callback, void *ctx) |
| 3246 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3247 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3248 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 3249 | struct ani_scan_req *scan_msg; |
| 3250 | cds_msg_t msg; |
| 3251 | uint32_t scan_req_id, scan_count; |
| 3252 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3253 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3254 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, session_id, |
| 3255 | scan_req->scanType)); |
Chandrasekaran, Manishekar | 2859de4 | 2016-02-11 16:17:38 +0530 | [diff] [blame] | 3256 | |
| 3257 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
| 3258 | sms_log(mac_ctx, LOGE, FL("Invalid session id:%d"), |
| 3259 | session_id); |
| 3260 | return status; |
| 3261 | } |
| 3262 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3263 | if (!mac_ctx->scan.fScanEnable) { |
| 3264 | sms_log(mac_ctx, LOGE, FL("fScanEnable false")); |
| 3265 | return status; |
| 3266 | } |
| 3267 | |
| 3268 | scan_count = csr_ll_count(&mac_ctx->sme.smeScanCmdActiveList); |
| 3269 | if (scan_count >= mac_ctx->scan.max_scan_count) { |
| 3270 | sms_log(mac_ctx, LOGE, FL("Max scan reached")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3271 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3272 | } |
| 3273 | wma_get_scan_id(&scan_req_id); |
| 3274 | scan_req->scan_id = scan_req_id; |
| 3275 | |
| 3276 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3277 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3278 | sms_log(mac_ctx, LOGE, FL("Unable to acquire lock")); |
| 3279 | return status; |
| 3280 | } |
| 3281 | sms_log(mac_ctx, LOG1, FL(" called")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3282 | scan_msg = qdf_mem_malloc(sizeof(struct ani_scan_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3283 | if (NULL == scan_msg) { |
| 3284 | sms_log(mac_ctx, LOGE, |
| 3285 | " scan_req: failed to allocate mem for msg"); |
| 3286 | sme_release_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3287 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3288 | } |
| 3289 | scan_msg->msg_type = eWNI_SME_SCAN_CMD; |
| 3290 | scan_msg->msg_len = (uint16_t) sizeof(struct ani_scan_req); |
| 3291 | scan_msg->session_id = session_id; |
| 3292 | scan_msg->callback = callback; |
| 3293 | scan_msg->ctx = ctx; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3294 | scan_msg->scan_param = qdf_mem_malloc(sizeof(tCsrScanRequest)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3295 | if (NULL == scan_msg->scan_param) { |
| 3296 | sms_log(mac_ctx, LOGE, |
| 3297 | "scan_req:failed to allocate mem for scanreq"); |
| 3298 | sme_release_global_lock(&mac_ctx->sme); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3299 | qdf_mem_free(scan_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3300 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3301 | } |
| 3302 | csr_scan_copy_request(mac_ctx, scan_msg->scan_param, scan_req); |
| 3303 | msg.type = eWNI_SME_SCAN_CMD; |
| 3304 | msg.bodyptr = scan_msg; |
| 3305 | msg.reserved = 0; |
| 3306 | msg.bodyval = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3307 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3308 | cds_mq_post_message(CDS_MQ_ID_SME, &msg)) { |
| 3309 | sms_log(mac_ctx, LOGE, |
| 3310 | " sme_scan_req failed to post msg"); |
| 3311 | csr_scan_free_request(mac_ctx, scan_msg->scan_param); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3312 | qdf_mem_free(scan_msg->scan_param); |
| 3313 | qdf_mem_free(scan_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3314 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3315 | } |
| 3316 | sme_release_global_lock(&mac_ctx->sme); |
| 3317 | return status; |
| 3318 | } |
| 3319 | |
| 3320 | /* --------------------------------------------------------------------------- |
| 3321 | \fn sme_scan_get_result |
| 3322 | \brief a wrapper function to request scan results from CSR. |
| 3323 | This is a synchronous call |
| 3324 | \param pFilter - If pFilter is NULL, all cached results are returned |
| 3325 | \param phResult - an object for the result. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3326 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3327 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3328 | QDF_STATUS sme_scan_get_result(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3329 | tCsrScanResultFilter *pFilter, |
| 3330 | tScanResultHandle *phResult) |
| 3331 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3332 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3333 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3334 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3335 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3336 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId, |
| 3337 | 0)); |
| 3338 | sms_log(pMac, LOG2, FL("enter")); |
| 3339 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3340 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3341 | status = csr_scan_get_result(hHal, pFilter, phResult); |
| 3342 | sme_release_global_lock(&pMac->sme); |
| 3343 | } |
| 3344 | sms_log(pMac, LOG2, FL("exit status %d"), status); |
| 3345 | |
| 3346 | return status; |
| 3347 | } |
| 3348 | |
| 3349 | /** |
| 3350 | * sme_get_ap_channel_from_scan_cache() - a wrapper function to get AP's |
| 3351 | * channel id from CSR by filtering the |
| 3352 | * result which matches our roam profile. |
| 3353 | * @profile: SAP adapter |
| 3354 | * @ap_chnl_id: pointer to channel id of SAP. Fill the value after finding the |
| 3355 | * best ap from scan cache. |
| 3356 | * |
| 3357 | * This function is written to get AP's channel id from CSR by filtering |
| 3358 | * the result which matches our roam profile. This is a synchronous call. |
| 3359 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3360 | * Return: QDF_STATUS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3361 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3362 | QDF_STATUS sme_get_ap_channel_from_scan_cache(tHalHandle hal_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3363 | tCsrRoamProfile *profile, |
| 3364 | tScanResultHandle *scan_cache, |
| 3365 | uint8_t *ap_chnl_id) |
| 3366 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3367 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3368 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
| 3369 | tCsrScanResultFilter *scan_filter = NULL; |
| 3370 | tScanResultHandle filtered_scan_result = NULL; |
| 3371 | tSirBssDescription first_ap_profile; |
| 3372 | |
| 3373 | if (NULL == mac_ctx) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3374 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3375 | FL("mac_ctx is NULL")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3376 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3377 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3378 | scan_filter = qdf_mem_malloc(sizeof(tCsrScanResultFilter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3379 | if (NULL == scan_filter) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3380 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3381 | FL("scan_filter mem alloc failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3382 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3383 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3384 | qdf_mem_set(scan_filter, sizeof(tCsrScanResultFilter), 0); |
| 3385 | qdf_mem_set(&first_ap_profile, sizeof(tSirBssDescription), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3386 | |
| 3387 | if (NULL == profile) { |
| 3388 | scan_filter->EncryptionType.numEntries = 1; |
| 3389 | scan_filter->EncryptionType.encryptionType[0] |
| 3390 | = eCSR_ENCRYPT_TYPE_NONE; |
| 3391 | } else { |
| 3392 | /* Here is the profile we need to connect to */ |
| 3393 | status = csr_roam_prepare_filter_from_profile(mac_ctx, |
| 3394 | profile, |
| 3395 | scan_filter); |
| 3396 | } |
| 3397 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3398 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3399 | /* Save the WPS info */ |
| 3400 | if (NULL != profile) { |
| 3401 | scan_filter->bWPSAssociation = |
| 3402 | profile->bWPSAssociation; |
| 3403 | scan_filter->bOSENAssociation = |
| 3404 | profile->bOSENAssociation; |
| 3405 | } else { |
| 3406 | scan_filter->bWPSAssociation = 0; |
| 3407 | scan_filter->bOSENAssociation = 0; |
| 3408 | } |
| 3409 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3410 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3411 | FL("Preparing the profile filter failed")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3412 | qdf_mem_free(scan_filter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3413 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3414 | } |
| 3415 | } |
| 3416 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3417 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3418 | status = csr_scan_get_result(hal_handle, scan_filter, |
| 3419 | &filtered_scan_result); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3420 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3421 | csr_get_bssdescr_from_scan_handle(filtered_scan_result, |
| 3422 | &first_ap_profile); |
| 3423 | *scan_cache = filtered_scan_result; |
| 3424 | if (0 != first_ap_profile.channelId) { |
| 3425 | *ap_chnl_id = first_ap_profile.channelId; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3426 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 3427 | QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3428 | FL("Found best AP & its on chnl[%d]"), |
| 3429 | first_ap_profile.channelId); |
| 3430 | } else { |
| 3431 | /* |
| 3432 | * This means scan result is empty |
| 3433 | * so set the channel to zero, caller should |
| 3434 | * take of zero channel id case. |
| 3435 | */ |
| 3436 | *ap_chnl_id = 0; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3437 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 3438 | QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3439 | FL("Scan is empty, set chnl to 0")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3440 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3441 | } |
| 3442 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3443 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3444 | FL("Failed to get scan get result")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3445 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3446 | } |
| 3447 | csr_free_scan_filter(mac_ctx, scan_filter); |
| 3448 | sme_release_global_lock(&mac_ctx->sme); |
| 3449 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3450 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3451 | FL("Aquiring lock failed")); |
Krunal Soni | f988222 | 2016-01-22 17:16:50 -0800 | [diff] [blame] | 3452 | csr_free_scan_filter(mac_ctx, scan_filter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3453 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3454 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3455 | qdf_mem_free(scan_filter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3456 | return status; |
| 3457 | } |
| 3458 | |
| 3459 | /** |
| 3460 | * sme_store_joinreq_param() - This function will pass station's join |
| 3461 | * request to store to csr. |
| 3462 | * @hal_handle: pointer to hal context. |
| 3463 | * @profile: pointer to station's roam profile. |
| 3464 | * @scan_cache: pointer to station's scan cache. |
| 3465 | * @roam_id: reference to roam_id variable being passed. |
| 3466 | * @session_id: station's session id. |
| 3467 | * |
| 3468 | * This function will pass station's join request further down to csr |
| 3469 | * to store it. this stored parameter will be used later. |
| 3470 | * |
| 3471 | * Return: true or false based on function's overall success. |
| 3472 | **/ |
| 3473 | bool sme_store_joinreq_param(tHalHandle hal_handle, |
| 3474 | tCsrRoamProfile *profile, |
| 3475 | tScanResultHandle scan_cache, |
| 3476 | uint32_t *roam_id, |
| 3477 | uint32_t session_id) |
| 3478 | { |
| 3479 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3480 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3481 | bool ret_status = true; |
| 3482 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3483 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3484 | TRACE_CODE_SME_RX_HDD_STORE_JOIN_REQ, |
| 3485 | session_id, 0)); |
| 3486 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3487 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3488 | if (false == csr_store_joinreq_param(mac_ctx, profile, |
| 3489 | scan_cache, roam_id, session_id)) { |
| 3490 | ret_status = false; |
| 3491 | } |
| 3492 | sme_release_global_lock(&mac_ctx->sme); |
| 3493 | } else { |
| 3494 | ret_status = false; |
| 3495 | } |
| 3496 | |
| 3497 | return ret_status; |
| 3498 | } |
| 3499 | |
| 3500 | /** |
| 3501 | * sme_clear_joinreq_param() - This function will pass station's clear |
| 3502 | * the join request to csr. |
| 3503 | * @hal_handle: pointer to hal context. |
| 3504 | * @session_id: station's session id. |
| 3505 | * |
| 3506 | * This function will pass station's clear join request further down to csr |
| 3507 | * to cleanup. |
| 3508 | * |
| 3509 | * Return: true or false based on function's overall success. |
| 3510 | **/ |
| 3511 | bool sme_clear_joinreq_param(tHalHandle hal_handle, |
| 3512 | uint32_t session_id) |
| 3513 | { |
| 3514 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3515 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3516 | bool ret_status = true; |
| 3517 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3518 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3519 | TRACE_CODE_SME_RX_HDD_CLEAR_JOIN_REQ, |
| 3520 | session_id, 0)); |
| 3521 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3522 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3523 | if (false == csr_clear_joinreq_param(mac_ctx, |
| 3524 | session_id)) { |
| 3525 | ret_status = false; |
| 3526 | } |
| 3527 | sme_release_global_lock(&mac_ctx->sme); |
| 3528 | } else { |
| 3529 | ret_status = false; |
| 3530 | } |
| 3531 | |
| 3532 | return ret_status; |
| 3533 | } |
| 3534 | |
| 3535 | /** |
| 3536 | * sme_issue_stored_joinreq() - This function will issues station's stored |
| 3537 | * the join request to csr. |
| 3538 | * @hal_handle: pointer to hal context. |
| 3539 | * @roam_id: reference to roam_id variable being passed. |
| 3540 | * @session_id: station's session id. |
| 3541 | * |
| 3542 | * This function will issue station's stored join request further down to csr |
| 3543 | * to proceed forward. |
| 3544 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3545 | * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3546 | **/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3547 | QDF_STATUS sme_issue_stored_joinreq(tHalHandle hal_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3548 | uint32_t *roam_id, |
| 3549 | uint32_t session_id) |
| 3550 | { |
| 3551 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3552 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 3553 | QDF_STATUS ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3554 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3555 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3556 | TRACE_CODE_SME_RX_HDD_ISSUE_JOIN_REQ, |
| 3557 | session_id, 0)); |
| 3558 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3559 | if (QDF_STATUS_SUCCESS == status) { |
| 3560 | if (QDF_STATUS_SUCCESS != csr_issue_stored_joinreq(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3561 | roam_id, |
| 3562 | session_id)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3563 | ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3564 | } |
| 3565 | sme_release_global_lock(&mac_ctx->sme); |
| 3566 | } else { |
| 3567 | csr_clear_joinreq_param(mac_ctx, session_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3568 | ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3569 | } |
| 3570 | return ret_status; |
| 3571 | } |
| 3572 | |
| 3573 | /* --------------------------------------------------------------------------- |
| 3574 | \fn sme_scan_flush_result |
| 3575 | \brief a wrapper function to request CSR to clear scan results. |
| 3576 | This is a synchronous call |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3577 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3578 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3579 | QDF_STATUS sme_scan_flush_result(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3580 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3581 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3582 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3583 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3584 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3585 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, |
| 3586 | 0, 0)); |
| 3587 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3588 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3589 | status = csr_scan_flush_result(hHal); |
| 3590 | sme_release_global_lock(&pMac->sme); |
| 3591 | } |
| 3592 | |
| 3593 | return status; |
| 3594 | } |
| 3595 | |
| 3596 | /* --------------------------------------------------------------------------- |
| 3597 | \fn sme_filter_scan_results |
| 3598 | \brief a wrapper function to request CSR to clear scan results. |
| 3599 | This is a synchronous call |
| 3600 | \param tHalHandle - HAL context handle |
| 3601 | \param sessionId - session id |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3602 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3603 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3604 | QDF_STATUS sme_filter_scan_results(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3605 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3606 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3607 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3608 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3609 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3610 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, |
| 3611 | sessionId, 0)); |
| 3612 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3613 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3614 | csr_scan_filter_results(pMac); |
| 3615 | sme_release_global_lock(&pMac->sme); |
| 3616 | } |
| 3617 | |
| 3618 | return status; |
| 3619 | } |
| 3620 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3621 | QDF_STATUS sme_scan_flush_p2p_result(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3622 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3623 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3624 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3625 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3626 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3627 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, |
| 3628 | sessionId, 0)); |
| 3629 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3630 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3631 | status = csr_scan_flush_selective_result(hHal, true); |
| 3632 | sme_release_global_lock(&pMac->sme); |
| 3633 | } |
| 3634 | |
| 3635 | return status; |
| 3636 | } |
| 3637 | |
| 3638 | /* --------------------------------------------------------------------------- |
| 3639 | \fn sme_scan_result_get_first |
| 3640 | \brief a wrapper function to request CSR to returns the first element of |
| 3641 | scan result. |
| 3642 | This is a synchronous call |
| 3643 | \param hScanResult - returned from csr_scan_get_result |
| 3644 | \return tCsrScanResultInfo * - NULL if no result |
| 3645 | ---------------------------------------------------------------------------*/ |
| 3646 | tCsrScanResultInfo *sme_scan_result_get_first(tHalHandle hHal, |
| 3647 | tScanResultHandle hScanResult) |
| 3648 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3649 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3650 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3651 | tCsrScanResultInfo *pRet = NULL; |
| 3652 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3653 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3654 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, |
| 3655 | NO_SESSION, 0)); |
| 3656 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3657 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3658 | pRet = csr_scan_result_get_first(pMac, hScanResult); |
| 3659 | sme_release_global_lock(&pMac->sme); |
| 3660 | } |
| 3661 | |
| 3662 | return pRet; |
| 3663 | } |
| 3664 | |
| 3665 | /* --------------------------------------------------------------------------- |
| 3666 | \fn sme_scan_result_get_next |
| 3667 | \brief a wrapper function to request CSR to returns the next element of |
| 3668 | scan result. It can be called without calling csr_scan_result_get_first |
| 3669 | first |
| 3670 | This is a synchronous call |
| 3671 | \param hScanResult - returned from csr_scan_get_result |
| 3672 | \return Null if no result or reach the end |
| 3673 | ---------------------------------------------------------------------------*/ |
| 3674 | tCsrScanResultInfo *sme_scan_result_get_next(tHalHandle hHal, |
| 3675 | tScanResultHandle hScanResult) |
| 3676 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3677 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3678 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3679 | tCsrScanResultInfo *pRet = NULL; |
| 3680 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3681 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3682 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3683 | pRet = csr_scan_result_get_next(pMac, hScanResult); |
| 3684 | sme_release_global_lock(&pMac->sme); |
| 3685 | } |
| 3686 | |
| 3687 | return pRet; |
| 3688 | } |
| 3689 | |
| 3690 | /* --------------------------------------------------------------------------- |
| 3691 | \fn sme_scan_result_purge |
| 3692 | \brief a wrapper function to request CSR to remove all items(tCsrScanResult) |
| 3693 | in the list and free memory for each item |
| 3694 | This is a synchronous call |
| 3695 | \param hScanResult - returned from csr_scan_get_result. hScanResult is |
| 3696 | considered gone by |
| 3697 | calling this function and even before this function reutrns. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3698 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3699 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3700 | QDF_STATUS sme_scan_result_purge(tHalHandle hHal, tScanResultHandle hScanResult) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3701 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3702 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3703 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3704 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3705 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3706 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, |
| 3707 | NO_SESSION, 0)); |
| 3708 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3709 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3710 | status = csr_scan_result_purge(hHal, hScanResult); |
| 3711 | sme_release_global_lock(&pMac->sme); |
| 3712 | } |
| 3713 | |
| 3714 | return status; |
| 3715 | } |
| 3716 | |
| 3717 | /* --------------------------------------------------------------------------- |
| 3718 | \fn sme_scan_get_pmkid_candidate_list |
| 3719 | \brief a wrapper function to return the PMKID candidate list |
| 3720 | This is a synchronous call |
| 3721 | \param pPmkidList - caller allocated buffer point to an array of |
| 3722 | tPmkidCandidateInfo |
| 3723 | \param pNumItems - pointer to a variable that has the number of |
| 3724 | tPmkidCandidateInfo allocated when retruning, this is |
| 3725 | either the number needed or number of items put into |
| 3726 | pPmkidList |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3727 | \return QDF_STATUS - when fail, it usually means the buffer allocated is not |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3728 | big enough and pNumItems |
| 3729 | has the number of tPmkidCandidateInfo. |
| 3730 | \Note: pNumItems is a number of tPmkidCandidateInfo, |
| 3731 | not sizeof(tPmkidCandidateInfo) * something |
| 3732 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3733 | QDF_STATUS sme_scan_get_pmkid_candidate_list(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3734 | tPmkidCandidateInfo *pPmkidList, |
| 3735 | uint32_t *pNumItems) |
| 3736 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3737 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3738 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3739 | |
| 3740 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3741 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3742 | status = |
| 3743 | csr_scan_get_pmkid_candidate_list(pMac, sessionId, |
| 3744 | pPmkidList, |
| 3745 | pNumItems); |
| 3746 | sme_release_global_lock(&pMac->sme); |
| 3747 | } |
| 3748 | |
| 3749 | return status; |
| 3750 | } |
| 3751 | |
| 3752 | eCsrPhyMode sme_get_phy_mode(tHalHandle hHal) |
| 3753 | { |
| 3754 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3755 | return pMac->roam.configParam.phyMode; |
| 3756 | } |
| 3757 | |
| 3758 | /* --------------------------------------------------------------------------- |
| 3759 | \fn sme_get_channel_bonding_mode5_g |
| 3760 | \brief get the channel bonding mode for 5G band |
| 3761 | \param hHal - HAL handle |
| 3762 | \return channel bonding mode for 5G |
| 3763 | ---------------------------------------------------------------------------*/ |
| 3764 | uint32_t sme_get_channel_bonding_mode5_g(tHalHandle hHal) |
| 3765 | { |
| 3766 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3767 | tSmeConfigParams smeConfig; |
| 3768 | |
| 3769 | sme_get_config_param(pMac, &smeConfig); |
| 3770 | |
| 3771 | return smeConfig.csrConfig.channelBondingMode5GHz; |
| 3772 | } |
| 3773 | |
| 3774 | /* --------------------------------------------------------------------------- |
| 3775 | \fn sme_get_channel_bonding_mode24_g |
| 3776 | \brief get the channel bonding mode for 2.4G band |
| 3777 | \param hHal - HAL handle |
| 3778 | \return channel bonding mode for 2.4G |
| 3779 | ---------------------------------------------------------------------------*/ |
| 3780 | uint32_t sme_get_channel_bonding_mode24_g(tHalHandle hHal) |
| 3781 | { |
| 3782 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3783 | tSmeConfigParams smeConfig; |
| 3784 | |
| 3785 | sme_get_config_param(pMac, &smeConfig); |
| 3786 | |
| 3787 | return smeConfig.csrConfig.channelBondingMode24GHz; |
| 3788 | } |
| 3789 | |
| 3790 | /* --------------------------------------------------------------------------- |
| 3791 | \fn sme_roam_connect |
| 3792 | \brief a wrapper function to request CSR to inititiate an association |
| 3793 | This is an asynchronous call. |
| 3794 | \param sessionId - the sessionId returned by sme_open_session. |
| 3795 | \param pProfile - description of the network to which to connect |
| 3796 | \param hBssListIn - a list of BSS descriptor to roam to. It is returned |
| 3797 | from csr_scan_get_result |
| 3798 | \param pRoamId - to get back the request ID |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3799 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3800 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3801 | QDF_STATUS sme_roam_connect(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3802 | tCsrRoamProfile *pProfile, uint32_t *pRoamId) |
| 3803 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3804 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3805 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3806 | |
| 3807 | if (!pMac) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3808 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3809 | } |
| 3810 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3811 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3812 | TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0)); |
| 3813 | sms_log(pMac, LOG2, FL("enter")); |
| 3814 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3815 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3816 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 3817 | status = |
| 3818 | csr_roam_connect(pMac, sessionId, pProfile, |
| 3819 | pRoamId); |
| 3820 | } else { |
| 3821 | sms_log(pMac, LOGE, FL("invalid sessionID %d"), |
| 3822 | sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3823 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3824 | } |
| 3825 | sme_release_global_lock(&pMac->sme); |
| 3826 | } else { |
| 3827 | sms_log(pMac, LOGE, FL("sme_acquire_global_lock failed")); |
| 3828 | } |
| 3829 | |
| 3830 | return status; |
| 3831 | } |
| 3832 | |
| 3833 | /* --------------------------------------------------------------------------- |
| 3834 | |
| 3835 | \fn sme_set_phy_mode |
| 3836 | |
| 3837 | \brief Changes the PhyMode. |
| 3838 | |
| 3839 | \param hHal - The handle returned by mac_open. |
| 3840 | |
| 3841 | \param phyMode new phyMode which is to set |
| 3842 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3843 | \return QDF_STATUS SUCCESS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3844 | |
| 3845 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3846 | QDF_STATUS sme_set_phy_mode(tHalHandle hHal, eCsrPhyMode phyMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3847 | { |
| 3848 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3849 | |
| 3850 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3851 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3852 | "%s: invalid context", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3853 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3854 | } |
| 3855 | |
| 3856 | pMac->roam.configParam.phyMode = phyMode; |
| 3857 | pMac->roam.configParam.uCfgDot11Mode = |
| 3858 | csr_get_cfg_dot11_mode_from_csr_phy_mode(NULL, |
| 3859 | pMac->roam.configParam.phyMode, |
| 3860 | pMac->roam.configParam. |
| 3861 | ProprietaryRatesEnabled); |
| 3862 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3863 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3864 | } |
| 3865 | |
| 3866 | /* --------------------------------------------------------------------------- |
| 3867 | \fn sme_roam_reassoc |
| 3868 | \brief a wrapper function to request CSR to inititiate a re-association |
| 3869 | \param pProfile - can be NULL to join the currently connected AP. In that |
| 3870 | case modProfileFields should carry the modified field(s) which could trigger |
| 3871 | reassoc |
| 3872 | \param modProfileFields - fields which are part of tCsrRoamConnectedProfile |
| 3873 | that might need modification dynamically once STA is up & running and this |
| 3874 | could trigger a reassoc |
| 3875 | \param pRoamId - to get back the request ID |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3876 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3877 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3878 | QDF_STATUS sme_roam_reassoc(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3879 | tCsrRoamProfile *pProfile, |
| 3880 | tCsrRoamModifyProfileFields modProfileFields, |
| 3881 | uint32_t *pRoamId, bool fForce) |
| 3882 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3883 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3884 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3885 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3886 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3887 | TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0)); |
| 3888 | sms_log(pMac, LOG2, FL("enter")); |
| 3889 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3890 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3891 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 3892 | if ((NULL == pProfile) && (fForce == 1)) { |
| 3893 | status = |
| 3894 | csr_reassoc(pMac, sessionId, |
| 3895 | &modProfileFields, pRoamId, |
| 3896 | fForce); |
| 3897 | } else { |
| 3898 | status = |
| 3899 | csr_roam_reassoc(pMac, sessionId, pProfile, |
| 3900 | modProfileFields, pRoamId); |
| 3901 | } |
| 3902 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3903 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3904 | } |
| 3905 | sme_release_global_lock(&pMac->sme); |
| 3906 | } |
| 3907 | |
| 3908 | return status; |
| 3909 | } |
| 3910 | |
| 3911 | /* --------------------------------------------------------------------------- |
| 3912 | \fn sme_roam_connect_to_last_profile |
| 3913 | \brief a wrapper function to request CSR to disconnect and reconnect with |
| 3914 | the same profile |
| 3915 | This is an asynchronous call. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3916 | \return QDF_STATUS. It returns fail if currently connected |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3917 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3918 | QDF_STATUS sme_roam_connect_to_last_profile(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3919 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3920 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3921 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3922 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3923 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3924 | TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, |
| 3925 | sessionId, 0)); |
| 3926 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3927 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3928 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 3929 | status = csr_roam_connect_to_last_profile(pMac, sessionId); |
| 3930 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3931 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3932 | } |
| 3933 | sme_release_global_lock(&pMac->sme); |
| 3934 | } |
| 3935 | |
| 3936 | return status; |
| 3937 | } |
| 3938 | |
| 3939 | /* --------------------------------------------------------------------------- |
| 3940 | \fn sme_roam_disconnect |
| 3941 | \brief a wrapper function to request CSR to disconnect from a network |
| 3942 | This is an asynchronous call. |
| 3943 | \param reason -- To indicate the reason for disconnecting. Currently, only |
| 3944 | eCSR_DISCONNECT_REASON_MIC_ERROR is meanful. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3945 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3946 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3947 | QDF_STATUS sme_roam_disconnect(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3948 | eCsrRoamDisconnectReason reason) |
| 3949 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3950 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3951 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3952 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3953 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3954 | TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, |
| 3955 | reason)); |
| 3956 | sms_log(pMac, LOG2, FL("enter")); |
| 3957 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3958 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3959 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 3960 | status = csr_roam_disconnect(pMac, sessionId, reason); |
| 3961 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3962 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3963 | } |
| 3964 | sme_release_global_lock(&pMac->sme); |
| 3965 | } |
| 3966 | |
| 3967 | return status; |
| 3968 | } |
| 3969 | |
| 3970 | /* --------------------------------------------------------------------------- |
| 3971 | \fn sme_roam_stop_bss |
| 3972 | \brief To stop BSS for Soft AP. This is an asynchronous API. |
| 3973 | \param hHal - Global structure |
| 3974 | \param sessionId - sessionId of SoftAP |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3975 | \return QDF_STATUS SUCCESS Roam callback will be called to indicate actual results |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3976 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3977 | QDF_STATUS sme_roam_stop_bss(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3978 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3979 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3980 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3981 | |
| 3982 | sms_log(pMac, LOG2, FL("enter")); |
| 3983 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3984 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3985 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 3986 | status = csr_roam_issue_stop_bss_cmd(pMac, sessionId, true); |
| 3987 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3988 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3989 | } |
| 3990 | sme_release_global_lock(&pMac->sme); |
| 3991 | } |
| 3992 | |
| 3993 | return status; |
| 3994 | } |
| 3995 | |
Deepthi Gowri | b3bfefd | 2016-09-13 15:14:34 +0530 | [diff] [blame] | 3996 | /** |
| 3997 | * sme_roam_disconnect_sta() - disassociate a station |
| 3998 | * @hHal: Global structure |
| 3999 | * @sessionId: SessionId of SoftAP |
| 4000 | * @p_del_sta_params: Pointer to parameters of the station to disassoc |
| 4001 | * |
| 4002 | * To disassociate a station. This is an asynchronous API. |
| 4003 | * |
| 4004 | * Return: QDF_STATUS_SUCCESS on success.Roam callback will |
| 4005 | * be called to indicate actual result. |
| 4006 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4007 | QDF_STATUS sme_roam_disconnect_sta(tHalHandle hHal, uint8_t sessionId, |
Deepthi Gowri | b3bfefd | 2016-09-13 15:14:34 +0530 | [diff] [blame] | 4008 | struct tagCsrDelStaParams *p_del_sta_params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4009 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4010 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4011 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4012 | |
| 4013 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4014 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4015 | return status; |
| 4016 | } |
| 4017 | |
| 4018 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4019 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4020 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4021 | status = csr_roam_issue_disassociate_sta_cmd(pMac, |
Deepthi Gowri | b3bfefd | 2016-09-13 15:14:34 +0530 | [diff] [blame] | 4022 | sessionId, p_del_sta_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4023 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4024 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4025 | } |
| 4026 | sme_release_global_lock(&pMac->sme); |
| 4027 | } |
| 4028 | |
| 4029 | return status; |
| 4030 | } |
| 4031 | |
| 4032 | /** |
| 4033 | * sme_roam_deauth_sta() - deauthenticate a station |
| 4034 | * @hHal: Global structure |
| 4035 | * @sessionId: SessionId of SoftAP |
| 4036 | * @pDelStaParams: Pointer to parameters of the station to deauthenticate |
| 4037 | * |
| 4038 | * To disassociate a station. This is an asynchronous API. |
| 4039 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4040 | * Return: QDF_STATUS_SUCCESS on success or another QDF_STATUS error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4041 | * code on error. Roam callback will be called to indicate actual |
| 4042 | * result |
| 4043 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4044 | QDF_STATUS sme_roam_deauth_sta(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4045 | struct tagCsrDelStaParams *pDelStaParams) |
| 4046 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4047 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4048 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4049 | |
| 4050 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4051 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4052 | return status; |
| 4053 | } |
| 4054 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4055 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 4056 | TRACE_CODE_SME_RX_HDD_MSG_DEAUTH_STA, |
| 4057 | sessionId, pDelStaParams->reason_code)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4058 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4059 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4060 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4061 | status = |
| 4062 | csr_roam_issue_deauth_sta_cmd(pMac, sessionId, |
| 4063 | pDelStaParams); |
| 4064 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4065 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4066 | } |
| 4067 | sme_release_global_lock(&pMac->sme); |
| 4068 | } |
| 4069 | |
| 4070 | return status; |
| 4071 | } |
| 4072 | |
| 4073 | /* --------------------------------------------------------------------------- |
| 4074 | \fn sme_roam_tkip_counter_measures |
| 4075 | \brief To start or stop TKIP counter measures. This is an asynchronous API. |
| 4076 | \param sessionId - sessionId of SoftAP |
| 4077 | \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4078 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4079 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4080 | QDF_STATUS sme_roam_tkip_counter_measures(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4081 | bool bEnable) |
| 4082 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4083 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4084 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4085 | |
| 4086 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4087 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4088 | return status; |
| 4089 | } |
| 4090 | |
| 4091 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4092 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4093 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4094 | status = |
| 4095 | csr_roam_issue_tkip_counter_measures(pMac, sessionId, |
| 4096 | bEnable); |
| 4097 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4098 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4099 | } |
| 4100 | sme_release_global_lock(&pMac->sme); |
| 4101 | } |
| 4102 | |
| 4103 | return status; |
| 4104 | } |
| 4105 | |
| 4106 | /* --------------------------------------------------------------------------- |
| 4107 | \fn sme_roam_get_associated_stas |
| 4108 | \brief To probe the list of associated stations from various modules |
| 4109 | of CORE stack. |
| 4110 | \This is an asynchronous API. |
| 4111 | \param sessionId - sessionId of SoftAP |
| 4112 | \param modId - Module from whom list of associtated stations is |
| 4113 | to be probed. If an invalid module is passed then |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4114 | by default QDF_MODULE_ID_PE will be probed. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4115 | \param pUsrContext - Opaque HDD context |
| 4116 | \param pfnSapEventCallback - Sap event callback in HDD |
| 4117 | \param pAssocBuf - Caller allocated memory to be filled with associatd |
| 4118 | stations info |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4119 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4120 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4121 | QDF_STATUS sme_roam_get_associated_stas(tHalHandle hHal, uint8_t sessionId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4122 | QDF_MODULE_ID modId, void *pUsrContext, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4123 | void *pfnSapEventCallback, |
| 4124 | uint8_t *pAssocStasBuf) |
| 4125 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4126 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4127 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4128 | |
| 4129 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4130 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4131 | return status; |
| 4132 | } |
| 4133 | |
| 4134 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4135 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4136 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4137 | status = |
| 4138 | csr_roam_get_associated_stas(pMac, sessionId, modId, |
| 4139 | pUsrContext, |
| 4140 | pfnSapEventCallback, |
| 4141 | pAssocStasBuf); |
| 4142 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4143 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4144 | } |
| 4145 | sme_release_global_lock(&pMac->sme); |
| 4146 | } |
| 4147 | |
| 4148 | return status; |
| 4149 | } |
| 4150 | |
| 4151 | /* --------------------------------------------------------------------------- |
| 4152 | \fn sme_roam_get_wps_session_overlap |
| 4153 | \brief To get the WPS PBC session overlap information. |
| 4154 | \This is an asynchronous API. |
| 4155 | \param sessionId - sessionId of SoftAP |
| 4156 | \param pUsrContext - Opaque HDD context |
| 4157 | \param pfnSapEventCallback - Sap event callback in HDD |
| 4158 | \pRemoveMac - pointer to Mac address which needs to be removed from session |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4159 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4160 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4161 | QDF_STATUS sme_roam_get_wps_session_overlap(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4162 | void *pUsrContext, void |
| 4163 | *pfnSapEventCallback, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4164 | struct qdf_mac_addr pRemoveMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4165 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4166 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4167 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4168 | |
| 4169 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4170 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4171 | return status; |
| 4172 | } |
| 4173 | |
| 4174 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4175 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4176 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4177 | status = |
| 4178 | csr_roam_get_wps_session_overlap(pMac, sessionId, |
| 4179 | pUsrContext, |
| 4180 | pfnSapEventCallback, |
| 4181 | pRemoveMac); |
| 4182 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4183 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4184 | } |
| 4185 | sme_release_global_lock(&pMac->sme); |
| 4186 | } |
| 4187 | |
| 4188 | return status; |
| 4189 | } |
| 4190 | |
| 4191 | /* --------------------------------------------------------------------------- |
| 4192 | \fn sme_roam_get_connect_state |
| 4193 | \brief a wrapper function to request CSR to return the current connect state |
| 4194 | of Roaming |
| 4195 | This is a synchronous call. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4196 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4197 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4198 | QDF_STATUS sme_roam_get_connect_state(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4199 | eCsrConnectState *pState) |
| 4200 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4201 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4202 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4203 | |
| 4204 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4205 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4206 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4207 | status = |
| 4208 | csr_roam_get_connect_state(pMac, sessionId, pState); |
| 4209 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4210 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4211 | } |
| 4212 | sme_release_global_lock(&pMac->sme); |
| 4213 | } |
| 4214 | |
| 4215 | return status; |
| 4216 | } |
| 4217 | |
| 4218 | /* --------------------------------------------------------------------------- |
| 4219 | \fn sme_roam_get_connect_profile |
| 4220 | \brief a wrapper function to request CSR to return the current connect |
| 4221 | profile. Caller must call csr_roam_free_connect_profile after it is done |
| 4222 | and before reuse for another csr_roam_get_connect_profile call. |
| 4223 | This is a synchronous call. |
| 4224 | \param pProfile - pointer to a caller allocated structure |
| 4225 | tCsrRoamConnectedProfile |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4226 | \return QDF_STATUS. Failure if not connected |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4227 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4228 | QDF_STATUS sme_roam_get_connect_profile(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4229 | tCsrRoamConnectedProfile *pProfile) |
| 4230 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4231 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4232 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4233 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4234 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4235 | TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, |
| 4236 | sessionId, 0)); |
| 4237 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4238 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4239 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4240 | status = |
| 4241 | csr_roam_get_connect_profile(pMac, sessionId, pProfile); |
| 4242 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4243 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4244 | } |
| 4245 | sme_release_global_lock(&pMac->sme); |
| 4246 | } |
| 4247 | |
| 4248 | return status; |
| 4249 | } |
| 4250 | |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 4251 | /** |
| 4252 | * sme_roam_free_connect_profile - a wrapper function to request CSR to free and |
| 4253 | * reinitialize the profile returned previously by csr_roam_get_connect_profile. |
| 4254 | * |
| 4255 | * @profile - pointer to a caller allocated structure tCsrRoamConnectedProfile |
| 4256 | * |
| 4257 | * Return: none |
| 4258 | */ |
| 4259 | void sme_roam_free_connect_profile(tCsrRoamConnectedProfile *profile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4260 | { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4261 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4262 | TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, |
| 4263 | NO_SESSION, 0)); |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 4264 | csr_roam_free_connect_profile(profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4265 | } |
| 4266 | |
| 4267 | /* --------------------------------------------------------------------------- |
| 4268 | \fn sme_roam_set_pmkid_cache |
| 4269 | \brief a wrapper function to request CSR to return the PMKID candidate list |
| 4270 | This is a synchronous call. |
| 4271 | \param pPMKIDCache - caller allocated buffer point to an array of |
| 4272 | tPmkidCacheInfo |
| 4273 | \param numItems - a variable that has the number of tPmkidCacheInfo |
| 4274 | allocated when retruning, this is either the number needed |
| 4275 | or number of items put into pPMKIDCache |
| 4276 | \param update_entire_cache - this bool value specifies if the entire pmkid |
| 4277 | cache should be overwritten or should it be |
| 4278 | updated entry by entry. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4279 | \return QDF_STATUS - when fail, it usually means the buffer allocated is not |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4280 | big enough and pNumItems has the number of |
| 4281 | tPmkidCacheInfo. |
| 4282 | \Note: pNumItems is a number of tPmkidCacheInfo, |
| 4283 | not sizeof(tPmkidCacheInfo) * something |
| 4284 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4285 | QDF_STATUS sme_roam_set_pmkid_cache(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4286 | tPmkidCacheInfo *pPMKIDCache, |
| 4287 | uint32_t numItems, bool update_entire_cache) |
| 4288 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4289 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4290 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4291 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4292 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4293 | TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, |
| 4294 | numItems)); |
| 4295 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4296 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4297 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4298 | status = |
| 4299 | csr_roam_set_pmkid_cache(pMac, sessionId, pPMKIDCache, |
| 4300 | numItems, update_entire_cache); |
| 4301 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4302 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4303 | } |
| 4304 | sme_release_global_lock(&pMac->sme); |
| 4305 | } |
| 4306 | |
| 4307 | return status; |
| 4308 | } |
| 4309 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4310 | QDF_STATUS sme_roam_del_pmkid_from_cache(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4311 | const uint8_t *pBSSId, bool flush_cache) |
| 4312 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4313 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4314 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 4315 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4316 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 4317 | TRACE_CODE_SME_RX_HDD_ROAM_DEL_PMKIDCACHE, |
| 4318 | sessionId, flush_cache)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4319 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4320 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4321 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4322 | status = csr_roam_del_pmkid_from_cache(pMac, sessionId, |
| 4323 | pBSSId, flush_cache); |
| 4324 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4325 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4326 | } |
| 4327 | sme_release_global_lock(&pMac->sme); |
| 4328 | } |
| 4329 | return status; |
| 4330 | } |
| 4331 | |
| 4332 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4333 | /* --------------------------------------------------------------------------- |
| 4334 | * \fn sme_roam_set_psk_pmk |
| 4335 | * \brief a wrapper function to request CSR to save PSK/PMK |
| 4336 | * This is a synchronous call. |
| 4337 | * \param hHal - Global structure |
| 4338 | * \param sessionId - SME sessionId |
| 4339 | * \param pPSK_PMK - pointer to an array of Psk[]/Pmk |
| 4340 | * \param pmk_len - Length could be only 16 bytes in case if LEAP |
| 4341 | * connections. Need to pass this information to |
| 4342 | * firmware. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4343 | * \return QDF_STATUS -status whether PSK/PMK is set or not |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4344 | *--------------------------------------------------------------------------- |
| 4345 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4346 | QDF_STATUS sme_roam_set_psk_pmk(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4347 | uint8_t *pPSK_PMK, size_t pmk_len) |
| 4348 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4349 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4350 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4351 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4352 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4353 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4354 | status = |
| 4355 | csr_roam_set_psk_pmk(pMac, sessionId, pPSK_PMK, |
| 4356 | pmk_len); |
| 4357 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4358 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4359 | } |
| 4360 | sme_release_global_lock(&pMac->sme); |
| 4361 | } |
| 4362 | return status; |
| 4363 | } |
| 4364 | #endif |
| 4365 | /* --------------------------------------------------------------------------- |
| 4366 | \fn sme_roam_get_security_req_ie |
| 4367 | \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR |
| 4368 | passes to PE to JOIN request or START_BSS request |
| 4369 | This is a synchronous call. |
| 4370 | \param pLen - caller allocated memory that has the length of pBuf as input. |
| 4371 | Upon returned, *pLen has the needed or IE length in pBuf. |
| 4372 | \param pBuf - Caller allocated memory that contain the IE field, if any, |
| 4373 | upon return |
| 4374 | \param secType - Specifies whether looking for WPA/WPA2/WAPI IE |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4375 | \return QDF_STATUS - when fail, it usually means the buffer allocated is not |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4376 | big enough |
| 4377 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4378 | QDF_STATUS sme_roam_get_security_req_ie(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4379 | uint32_t *pLen, uint8_t *pBuf, |
| 4380 | eCsrSecurityType secType) |
| 4381 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4382 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4383 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4384 | |
| 4385 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4386 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4387 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4388 | status = |
| 4389 | csr_roam_get_wpa_rsn_req_ie(hHal, sessionId, pLen, pBuf); |
| 4390 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4391 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4392 | } |
| 4393 | sme_release_global_lock(&pMac->sme); |
| 4394 | } |
| 4395 | |
| 4396 | return status; |
| 4397 | } |
| 4398 | |
| 4399 | /* --------------------------------------------------------------------------- |
| 4400 | \fn sme_roam_get_security_rsp_ie |
| 4401 | \brief a wrapper function to request CSR to return the WPA or RSN or |
| 4402 | WAPI IE from the beacon or probe rsp if connected |
| 4403 | This is a synchronous call. |
| 4404 | \param pLen - caller allocated memory that has the length of pBuf as input. |
| 4405 | Upon returned, *pLen has the needed or IE length in pBuf. |
| 4406 | \param pBuf - Caller allocated memory that contain the IE field, if any, |
| 4407 | upon return |
| 4408 | \param secType - Specifies whether looking for WPA/WPA2/WAPI IE |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4409 | \return QDF_STATUS - when fail, it usually means the buffer allocated is not |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4410 | big enough |
| 4411 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4412 | QDF_STATUS sme_roam_get_security_rsp_ie(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4413 | uint32_t *pLen, uint8_t *pBuf, |
| 4414 | eCsrSecurityType secType) |
| 4415 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4416 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4417 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4418 | |
| 4419 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4420 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4421 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4422 | status = |
| 4423 | csr_roam_get_wpa_rsn_rsp_ie(pMac, sessionId, pLen, pBuf); |
| 4424 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4425 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4426 | } |
| 4427 | sme_release_global_lock(&pMac->sme); |
| 4428 | } |
| 4429 | |
| 4430 | return status; |
| 4431 | |
| 4432 | } |
| 4433 | |
| 4434 | /* --------------------------------------------------------------------------- |
| 4435 | \fn sme_roam_get_num_pmkid_cache |
| 4436 | \brief a wrapper function to request CSR to return number of PMKID cache |
| 4437 | entries |
| 4438 | This is a synchronous call. |
| 4439 | \return uint32_t - the number of PMKID cache entries |
| 4440 | ---------------------------------------------------------------------------*/ |
| 4441 | uint32_t sme_roam_get_num_pmkid_cache(tHalHandle hHal, uint8_t sessionId) |
| 4442 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4443 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4444 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4445 | uint32_t numPmkidCache = 0; |
| 4446 | |
| 4447 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4448 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4449 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4450 | numPmkidCache = |
| 4451 | csr_roam_get_num_pmkid_cache(pMac, sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4452 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4453 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4454 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4455 | } |
| 4456 | sme_release_global_lock(&pMac->sme); |
| 4457 | } |
| 4458 | |
| 4459 | return numPmkidCache; |
| 4460 | } |
| 4461 | |
| 4462 | /* --------------------------------------------------------------------------- |
| 4463 | \fn sme_roam_get_pmkid_cache |
| 4464 | \brief a wrapper function to request CSR to return PMKID cache from CSR |
| 4465 | This is a synchronous call. |
| 4466 | \param pNum - caller allocated memory that has the space of the number of |
| 4467 | pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the |
| 4468 | needed or actually number in tPmkidCacheInfo. |
| 4469 | \param pPmkidCache - Caller allocated memory that contains PMKID cache, if |
| 4470 | any, upon return |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4471 | \return QDF_STATUS - when fail, it usually means the buffer allocated is not |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4472 | big enough |
| 4473 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4474 | QDF_STATUS sme_roam_get_pmkid_cache(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4475 | uint32_t *pNum, tPmkidCacheInfo *pPmkidCache) |
| 4476 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4477 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4478 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4479 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4480 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4481 | TRACE_CODE_SME_RX_HDD_ROAM_GET_PMKIDCACHE, sessionId, |
| 4482 | 0)); |
| 4483 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4484 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4485 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4486 | status = |
| 4487 | csr_roam_get_pmkid_cache(pMac, sessionId, pNum, |
| 4488 | pPmkidCache); |
| 4489 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4490 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4491 | } |
| 4492 | sme_release_global_lock(&pMac->sme); |
| 4493 | } |
| 4494 | |
| 4495 | return status; |
| 4496 | } |
| 4497 | |
| 4498 | /* --------------------------------------------------------------------------- |
| 4499 | \fn sme_get_config_param |
| 4500 | \brief a wrapper function that HDD calls to get the global settings |
| 4501 | currently maintained by CSR. |
| 4502 | This is a synchronous call. |
| 4503 | \param pParam - caller allocated memory |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4504 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4505 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4506 | QDF_STATUS sme_get_config_param(tHalHandle hHal, tSmeConfigParams *pParam) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4507 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4508 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4509 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4510 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4511 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4512 | TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0)); |
| 4513 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4514 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4515 | status = csr_get_config_param(pMac, &pParam->csrConfig); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4516 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4517 | sms_log(pMac, LOGE, "%s csr_get_config_param failed", |
| 4518 | __func__); |
| 4519 | sme_release_global_lock(&pMac->sme); |
| 4520 | return status; |
| 4521 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4522 | qdf_mem_copy(&pParam->rrmConfig, |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 4523 | &pMac->rrm.rrmSmeContext.rrmConfig, |
| 4524 | sizeof(pMac->rrm.rrmSmeContext.rrmConfig)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4525 | sme_release_global_lock(&pMac->sme); |
| 4526 | } |
| 4527 | |
| 4528 | return status; |
| 4529 | } |
| 4530 | |
| 4531 | /** |
| 4532 | * sme_cfg_set_int() - Sets the cfg parameter value. |
| 4533 | * @hal: Handle to hal. |
| 4534 | * @cfg_id: Configuration parameter ID. |
| 4535 | * @value: value to be saved in the cfg parameter. |
| 4536 | * |
| 4537 | * This function sets the string value in cfg parameter. |
| 4538 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4539 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4540 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4541 | QDF_STATUS sme_cfg_set_int(tHalHandle hal, uint16_t cfg_id, uint32_t value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4542 | { |
| 4543 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4544 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4545 | |
| 4546 | if (eSIR_SUCCESS != cfg_set_int(pmac, cfg_id, value)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4547 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4548 | |
| 4549 | return status; |
| 4550 | } |
| 4551 | |
| 4552 | /** |
| 4553 | * sme_cfg_set_str() - Sets the cfg parameter string. |
| 4554 | * @hal: Handle to hal. |
| 4555 | * @cfg_id: Configuration parameter ID. |
| 4556 | * @str: Pointer to the string buffer. |
| 4557 | * @length: Length of the string. |
| 4558 | * |
| 4559 | * This function sets the string value in cfg parameter. |
| 4560 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4561 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4562 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4563 | QDF_STATUS sme_cfg_set_str(tHalHandle hal, uint16_t cfg_id, uint8_t *str, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4564 | uint32_t length) |
| 4565 | { |
| 4566 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4567 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4568 | |
| 4569 | if (eSIR_SUCCESS != cfg_set_str(pmac, cfg_id, str, length)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4570 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4571 | |
| 4572 | return status; |
| 4573 | } |
| 4574 | |
| 4575 | /** |
| 4576 | * sme_cfg_get_int() - Gets the cfg parameter value. |
| 4577 | * @hal: Handle to hal. |
| 4578 | * @cfg_id: Configuration parameter ID. |
| 4579 | * @cfg_value: Pointer to variable in which cfg value |
| 4580 | * will be saved. |
| 4581 | * |
| 4582 | * This function gets the value of the cfg parameter. |
| 4583 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4584 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4585 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4586 | QDF_STATUS sme_cfg_get_int(tHalHandle hal, uint16_t cfg_id, uint32_t *cfg_value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4587 | { |
| 4588 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4589 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4590 | |
| 4591 | if (eSIR_SUCCESS != wlan_cfg_get_int(pmac, cfg_id, cfg_value)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4592 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4593 | |
| 4594 | return status; |
| 4595 | } |
| 4596 | |
| 4597 | /** |
| 4598 | * sme_cfg_get_str() - Gets the cfg parameter string. |
| 4599 | * @hal: Handle to hal. |
| 4600 | * @cfg_id: Configuration parameter ID. |
| 4601 | * @str: Pointer to the string buffer. |
| 4602 | * @length: Pointer to length of the string. |
| 4603 | * |
| 4604 | * This function gets the string value of the cfg parameter. |
| 4605 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4606 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4607 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4608 | QDF_STATUS sme_cfg_get_str(tHalHandle hal, uint16_t cfg_id, uint8_t *str, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4609 | uint32_t *length) |
| 4610 | { |
| 4611 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4612 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4613 | |
| 4614 | if (eSIR_SUCCESS != wlan_cfg_get_str(pmac, cfg_id, str, length)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4615 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4616 | |
| 4617 | return status; |
| 4618 | } |
| 4619 | |
| 4620 | /* --------------------------------------------------------------------------- |
| 4621 | \fn sme_get_modify_profile_fields |
| 4622 | \brief HDD or SME - QOS calls this function to get the current values of |
| 4623 | connected profile fields, changing which can cause reassoc. |
| 4624 | This function must be called after CFG is downloaded and STA is in connected |
| 4625 | state. Also, make sure to call this function to get the current profile |
| 4626 | fields before calling the reassoc. So that pModifyProfileFields will have |
| 4627 | all the latest values plus the one(s) has been updated as part of reassoc |
| 4628 | request. |
| 4629 | \param pModifyProfileFields - pointer to the connected profile fields |
| 4630 | changing which can cause reassoc |
| 4631 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4632 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4633 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4634 | QDF_STATUS sme_get_modify_profile_fields(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4635 | tCsrRoamModifyProfileFields * |
| 4636 | pModifyProfileFields) |
| 4637 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4638 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4639 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4640 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4641 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4642 | TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, |
| 4643 | 0)); |
| 4644 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4645 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4646 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4647 | status = |
| 4648 | csr_get_modify_profile_fields(pMac, sessionId, |
| 4649 | pModifyProfileFields); |
| 4650 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4651 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4652 | } |
| 4653 | sme_release_global_lock(&pMac->sme); |
| 4654 | } |
| 4655 | |
| 4656 | return status; |
| 4657 | } |
| 4658 | |
| 4659 | /* --------------------------------------------------------------------------- |
| 4660 | \fn sme_set_dhcp_till_power_active_flag |
| 4661 | \brief Sets/Clears DHCP related flag to disable/enable auto PS |
| 4662 | \param hal - The handle returned by mac_open. |
| 4663 | ---------------------------------------------------------------------------*/ |
| 4664 | void sme_set_dhcp_till_power_active_flag(tHalHandle hal, uint8_t flag) |
| 4665 | { |
| 4666 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 4667 | struct ps_global_info *ps_global_info = &mac->sme.ps_global_info; |
| 4668 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4669 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4670 | TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, |
| 4671 | flag)); |
| 4672 | /* Set/Clear the DHCP flag which will disable/enable auto PS */ |
| 4673 | ps_global_info->remain_in_power_active_till_dhcp = flag; |
| 4674 | } |
| 4675 | |
| 4676 | /* --------------------------------------------------------------------------- |
| 4677 | \fn sme_register11d_scan_done_callback |
| 4678 | \brief Register a routine of type csr_scan_completeCallback which is |
| 4679 | called whenever an 11d scan is done |
| 4680 | \param hHal - The handle returned by mac_open. |
| 4681 | \param callback - 11d scan complete routine to be registered |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4682 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4683 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4684 | QDF_STATUS sme_register11d_scan_done_callback(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4685 | csr_scan_completeCallback callback) |
| 4686 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4687 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4688 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4689 | |
| 4690 | pMac->scan.callback11dScanDone = callback; |
| 4691 | |
| 4692 | return status; |
| 4693 | } |
| 4694 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 4695 | /** |
| 4696 | * sme_deregister11d_scan_done_callback() - De-register scandone callback |
| 4697 | * @h_hal: Handler return by mac_open |
| 4698 | * |
| 4699 | * This function De-registers the scandone callback to SME |
| 4700 | * |
| 4701 | * Return: None |
| 4702 | */ |
| 4703 | void sme_deregister11d_scan_done_callback(tHalHandle h_hal) |
| 4704 | { |
| 4705 | tpAniSirGlobal pmac; |
| 4706 | |
| 4707 | if (!h_hal) { |
| 4708 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 4709 | FL("hHal is not valid")); |
| 4710 | return; |
| 4711 | } |
| 4712 | |
| 4713 | pmac = PMAC_STRUCT(h_hal); |
| 4714 | pmac->scan.callback11dScanDone = NULL; |
| 4715 | } |
| 4716 | |
| 4717 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4718 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 4719 | /** |
| 4720 | * sme_register_oem_data_rsp_callback() - Register a routine of |
| 4721 | * type send_oem_data_rsp_msg |
| 4722 | * @h_hal: Handle returned by mac_open. |
| 4723 | * @callback: Callback to send response |
| 4724 | * to oem application. |
| 4725 | * |
| 4726 | * sme_oem_data_rsp_callback is used to register sme_send_oem_data_rsp_msg |
| 4727 | * callback function. |
| 4728 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4729 | * Return: QDF_STATUS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4730 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4731 | QDF_STATUS sme_register_oem_data_rsp_callback(tHalHandle h_hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4732 | sme_send_oem_data_rsp_msg callback) |
| 4733 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4734 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4735 | tpAniSirGlobal pmac = PMAC_STRUCT(h_hal); |
| 4736 | |
Krishna Kumaar Natarajan | bbbf2ef | 2016-08-03 14:06:26 -0700 | [diff] [blame] | 4737 | pmac->sme.oem_data_rsp_callback = callback; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4738 | |
| 4739 | return status; |
| 4740 | |
| 4741 | } |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 4742 | |
| 4743 | /** |
| 4744 | * sme_deregister_oem_data_rsp_callback() - De-register OEM datarsp callback |
| 4745 | * @h_hal: Handler return by mac_open |
| 4746 | * This function De-registers the OEM data response callback to SME |
| 4747 | * |
| 4748 | * Return: None |
| 4749 | */ |
| 4750 | void sme_deregister_oem_data_rsp_callback(tHalHandle h_hal) |
| 4751 | { |
| 4752 | tpAniSirGlobal pmac; |
| 4753 | |
| 4754 | if (!h_hal) { |
| 4755 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 4756 | FL("hHal is not valid")); |
| 4757 | return; |
| 4758 | } |
| 4759 | pmac = PMAC_STRUCT(h_hal); |
| 4760 | |
Krishna Kumaar Natarajan | bbbf2ef | 2016-08-03 14:06:26 -0700 | [diff] [blame] | 4761 | pmac->sme.oem_data_rsp_callback = NULL; |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 4762 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4763 | #endif |
| 4764 | |
| 4765 | /** |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4766 | * sme_oem_update_capability() - update UMAC's oem related capability. |
| 4767 | * @hal: Handle returned by mac_open |
| 4768 | * @oem_cap: pointer to oem_capability |
| 4769 | * |
| 4770 | * This function updates OEM capability to UMAC. Currently RTT |
| 4771 | * related capabilities are updated. More capabilities can be |
| 4772 | * added in future. |
| 4773 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4774 | * Return: QDF_STATUS |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4775 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4776 | QDF_STATUS sme_oem_update_capability(tHalHandle hal, |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4777 | struct sme_oem_capability *cap) |
| 4778 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4779 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4780 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 4781 | uint8_t *bytes; |
| 4782 | |
| 4783 | bytes = pmac->rrm.rrmSmeContext.rrmConfig.rm_capability; |
| 4784 | |
| 4785 | if (cap->ftm_rr) |
| 4786 | bytes[4] |= RM_CAP_FTM_RANGE_REPORT; |
| 4787 | if (cap->lci_capability) |
| 4788 | bytes[4] |= RM_CAP_CIVIC_LOC_MEASUREMENT; |
| 4789 | |
| 4790 | return status; |
| 4791 | } |
| 4792 | |
| 4793 | /** |
| 4794 | * sme_oem_get_capability() - get oem capability |
| 4795 | * @hal: Handle returned by mac_open |
| 4796 | * @oem_cap: pointer to oem_capability |
| 4797 | * |
| 4798 | * This function is used to get the OEM capability from UMAC. |
| 4799 | * Currently RTT related capabilities are received. More |
| 4800 | * capabilities can be added in future. |
| 4801 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4802 | * Return: QDF_STATUS |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4803 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4804 | QDF_STATUS sme_oem_get_capability(tHalHandle hal, |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4805 | struct sme_oem_capability *cap) |
| 4806 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4807 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4808 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 4809 | uint8_t *bytes; |
| 4810 | |
| 4811 | bytes = pmac->rrm.rrmSmeContext.rrmConfig.rm_capability; |
| 4812 | |
| 4813 | cap->ftm_rr = bytes[4] & RM_CAP_FTM_RANGE_REPORT; |
| 4814 | cap->lci_capability = bytes[4] & RM_CAP_CIVIC_LOC_MEASUREMENT; |
| 4815 | |
| 4816 | return status; |
| 4817 | } |
| 4818 | |
| 4819 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4820 | * sme_register_ftm_msg_processor() - registers hdd ftm message processor |
| 4821 | * function to MAC/SYS |
| 4822 | * |
| 4823 | * @hal: hal handle |
| 4824 | * @callback: hdd function that has to be registered |
| 4825 | * |
| 4826 | * Return: void |
| 4827 | */ |
| 4828 | void sme_register_ftm_msg_processor(tHalHandle hal, |
| 4829 | hdd_ftm_msg_processor callback) |
| 4830 | { |
| 4831 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 4832 | |
| 4833 | if (mac_ctx == NULL) { |
Naveen Rawat | cf68476 | 2016-06-27 15:30:24 -0700 | [diff] [blame] | 4834 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 4835 | FL("mac ctx is NULL")); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4836 | return; |
| 4837 | } |
Naveen Rawat | cf68476 | 2016-06-27 15:30:24 -0700 | [diff] [blame] | 4838 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4839 | mac_ctx->ftm_msg_processor_callback = callback; |
| 4840 | return; |
| 4841 | } |
| 4842 | |
| 4843 | /** |
| 4844 | * sme_wow_add_pattern() - add a wow pattern in fw |
| 4845 | * @hHal: handle returned by mac_open |
| 4846 | * @pattern: pointer to input pattern |
| 4847 | * |
| 4848 | * Add a pattern for Pattern Byte Matching in WoW mode. Firmware will |
| 4849 | * do a pattern match on these patterns when WoW is enabled during system |
| 4850 | * suspend. |
| 4851 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4852 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4853 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4854 | QDF_STATUS sme_wow_add_pattern(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4855 | struct wow_add_pattern *pattern, |
| 4856 | uint8_t session_id) |
| 4857 | { |
| 4858 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
| 4859 | struct wow_add_pattern *ptrn; |
| 4860 | tSirRetStatus ret_code = eSIR_SUCCESS; |
| 4861 | tSirMsgQ msg_q; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4862 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4863 | TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, session_id, |
| 4864 | 0)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4865 | ptrn = qdf_mem_malloc(sizeof(*ptrn)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4866 | if (NULL == ptrn) { |
| 4867 | sms_log(pMac, LOGP, |
| 4868 | FL("Fail to allocate memory for WoWLAN Add Bcast Pattern ")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4869 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4870 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4871 | (void)qdf_mem_copy(ptrn, pattern, sizeof(*ptrn)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4872 | |
| 4873 | msg_q.type = WMA_WOW_ADD_PTRN; |
| 4874 | msg_q.reserved = 0; |
| 4875 | msg_q.bodyptr = ptrn; |
| 4876 | msg_q.bodyval = 0; |
| 4877 | |
| 4878 | sms_log(pMac, LOG1, FL("Sending WMA_WOWL_ADD_BCAST_PTRN to HAL")); |
| 4879 | ret_code = wma_post_ctrl_msg(pMac, &msg_q); |
| 4880 | if (eSIR_SUCCESS != ret_code) { |
| 4881 | sms_log(pMac, LOGE, |
| 4882 | FL("Posting WMA_WOWL_ADD_BCAST_PTRN failed, reason=%X"), |
| 4883 | ret_code); |
| 4884 | } |
| 4885 | return ret_code; |
| 4886 | } |
| 4887 | |
| 4888 | /** |
| 4889 | * sme_wow_delete_pattern() - delete user configured wow pattern in target |
| 4890 | * @hHal: handle returned by mac_open. |
| 4891 | * @pattern: pointer to delete pattern parameter |
| 4892 | * @sessionId: session id |
| 4893 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4894 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4895 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4896 | QDF_STATUS sme_wow_delete_pattern(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4897 | struct wow_delete_pattern *pattern, uint8_t sessionId) |
| 4898 | { |
| 4899 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
| 4900 | struct wow_delete_pattern *delete_ptrn; |
| 4901 | tSirRetStatus ret_code = eSIR_SUCCESS; |
| 4902 | tSirMsgQ msg_q; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4903 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4904 | TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, |
| 4905 | 0)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4906 | delete_ptrn = qdf_mem_malloc(sizeof(*delete_ptrn)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4907 | if (NULL == delete_ptrn) { |
| 4908 | sms_log(pMac, LOGP, |
| 4909 | FL("Fail to allocate memory for WoWLAN Delete Bcast Pattern ")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4910 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4911 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4912 | (void)qdf_mem_copy(delete_ptrn, pattern, sizeof(*delete_ptrn)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4913 | msg_q.type = WMA_WOW_DEL_PTRN; |
| 4914 | msg_q.reserved = 0; |
| 4915 | msg_q.bodyptr = delete_ptrn; |
| 4916 | msg_q.bodyval = 0; |
| 4917 | |
| 4918 | sms_log(pMac, LOG1, FL("Sending WMA_WOWL_DEL_BCAST_PTRN")); |
| 4919 | |
| 4920 | ret_code = wma_post_ctrl_msg(pMac, &msg_q); |
| 4921 | if (eSIR_SUCCESS != ret_code) { |
| 4922 | sms_log(pMac, LOGE, |
| 4923 | FL("Posting WMA_WOWL_DEL_BCAST_PTRN failed, reason=%X"), |
| 4924 | ret_code); |
| 4925 | } |
| 4926 | return ret_code; |
| 4927 | } |
| 4928 | |
| 4929 | /** |
| 4930 | * sme_enter_wowl(): SME API exposed to HDD to request enabling of WOWL mode. |
| 4931 | * @hal_ctx - The handle returned by mac_open. |
| 4932 | * @enter_wowl_callback_routine - Callback routine provided by HDD. |
| 4933 | * Used for success/failure notification by SME |
| 4934 | * @enter_wowl_callback_context - A cookie passed by HDD, that is passed |
| 4935 | * back to HDD at the time of callback. |
| 4936 | * @wake_reason_ind_cb - Callback routine provided by HDD. |
| 4937 | * Used for Wake Reason Indication by SME |
| 4938 | * @wake_reason_ind_cb_ctx - A cookie passed by HDD, that is passed |
| 4939 | * back to HDD at the time of callback. |
| 4940 | * |
| 4941 | * WoWLAN works on top of BMPS mode. |
| 4942 | * If the device is not in BMPS mode, |
| 4943 | * SME will will cache the information that |
| 4944 | * WOWL has been enabled and attempt to put the device |
| 4945 | * in BMPS. On entry into BMPS, SME will enable the |
| 4946 | * WOWL mode. |
| 4947 | * Note 1: If we exit BMPS mode (someone requests full power), |
| 4948 | * we will NOT resume WOWL when we go back to BMPS again. |
| 4949 | * Request for full power (while in WOWL mode) means disable |
| 4950 | * WOWL and go to full power. |
| 4951 | * Note 2: Both UAPSD and WOWL work on top of BMPS. |
| 4952 | * On entry into BMPS, SME will give priority to UAPSD and |
| 4953 | * enable only UAPSD if both UAPSD and WOWL are required. |
| 4954 | * Currently there is no requirement or use case to support |
| 4955 | * UAPSD and WOWL at the same time. |
| 4956 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4957 | * Return: QDF_STATUS |
| 4958 | * QDF_STATUS_SUCCESS Device is already in WoWLAN mode |
| 4959 | * QDF_STATUS_E_FAILURE Device cannot enter WoWLAN mode. |
| 4960 | * QDF_STATUS_PMC_PENDING Request accepted. SME will enable |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4961 | * WOWL after BMPS mode is entered. |
| 4962 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4963 | QDF_STATUS sme_enter_wowl(tHalHandle hal_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4964 | void (*enter_wowl_callback_routine)(void |
| 4965 | *callback_context, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4966 | QDF_STATUS status), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4967 | void *enter_wowl_callback_context, |
| 4968 | #ifdef WLAN_WAKEUP_EVENTS |
| 4969 | void (*wakeIndicationCB)(void *callback_context, |
| 4970 | tpSirWakeReasonInd |
| 4971 | wake_reason_ind), |
| 4972 | void *wakeIndicationCBContext, |
| 4973 | #endif /* WLAN_WAKEUP_EVENTS */ |
| 4974 | tpSirSmeWowlEnterParams wowl_enter_params, |
| 4975 | uint8_t session_id) |
| 4976 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4977 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4978 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx); |
| 4979 | struct ps_global_info *ps_global_info = &mac_ctx->sme.ps_global_info; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4980 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4981 | TRACE_CODE_SME_RX_HDD_ENTER_WOWL, session_id, 0)); |
| 4982 | |
| 4983 | /* cache the WOWL information */ |
| 4984 | ps_global_info->ps_params[session_id].wowl_enter_params = |
| 4985 | *wowl_enter_params; |
| 4986 | ps_global_info->ps_params[session_id].enter_wowl_callback_routine = |
| 4987 | enter_wowl_callback_routine; |
| 4988 | ps_global_info->ps_params[session_id].enter_wowl_callback_context = |
| 4989 | enter_wowl_callback_context; |
| 4990 | #ifdef WLAN_WAKEUP_EVENTS |
| 4991 | /* Cache the Wake Reason Indication callback information */ |
| 4992 | ps_global_info->ps_params[session_id].wake_reason_ind_cb = |
| 4993 | wakeIndicationCB; |
| 4994 | ps_global_info->ps_params[session_id].wake_reason_ind_cb_ctx = |
| 4995 | wakeIndicationCBContext; |
| 4996 | #endif /* WLAN_WAKEUP_EVENTS */ |
| 4997 | |
| 4998 | status = sme_ps_process_command(mac_ctx, session_id, SME_PS_WOWL_ENTER); |
| 4999 | return status; |
| 5000 | } |
| 5001 | /** |
| 5002 | *sme_exit_wowl(): SME API exposed to HDD to request exit from WoWLAN mode. |
| 5003 | * @hal_ctx - The handle returned by mac_open. |
| 5004 | * @wowl_exit_params - Carries info on which smesession |
| 5005 | * wowl exit is requested. |
| 5006 | * |
| 5007 | * SME will initiate exit from WoWLAN mode and device will be |
| 5008 | * put in BMPS mode. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5009 | * Return QDF_STATUS |
| 5010 | * QDF_STATUS_E_FAILURE Device cannot exit WoWLAN mode. |
| 5011 | * QDF_STATUS_SUCCESS Request accepted to exit WoWLAN mode. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5012 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5013 | QDF_STATUS sme_exit_wowl(tHalHandle hal_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5014 | tpSirSmeWowlExitParams wowl_exit_params) |
| 5015 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5016 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5017 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx); |
| 5018 | uint8_t session_id; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5019 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5020 | TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0)); |
| 5021 | session_id = wowl_exit_params->sessionId; |
| 5022 | status = sme_ps_process_command(mac_ctx, session_id, SME_PS_WOWL_EXIT); |
| 5023 | return status; |
| 5024 | } |
| 5025 | |
| 5026 | /** |
| 5027 | * sme_roam_set_key() - To set encryption key. |
| 5028 | * @hal: hal global context |
| 5029 | * @session_id: session id |
| 5030 | * @set_key: pointer to a caller allocated object of tCsrSetContextInfo |
| 5031 | * @ptr_roam_id: Upon success return, this is the id caller can use to |
| 5032 | * identify the request in roamcallback |
| 5033 | * |
| 5034 | * This function should be called only when connected. This is an asynchronous |
| 5035 | * API. |
| 5036 | * |
| 5037 | * Return: Status of operation |
| 5038 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5039 | QDF_STATUS sme_roam_set_key(tHalHandle hal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5040 | tCsrRoamSetKey *set_key, uint32_t *ptr_roam_id) |
| 5041 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5042 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5043 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 5044 | uint32_t roam_id; |
| 5045 | uint32_t i; |
| 5046 | tCsrRoamSession *session = NULL; |
| 5047 | struct ps_global_info *ps_global_info = &mac_ctx->sme.ps_global_info; |
| 5048 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5049 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_HDD_SET_KEY, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5050 | session_id, 0)); |
| 5051 | if (set_key->keyLength > CSR_MAX_KEY_LEN) { |
| 5052 | sms_log(mac_ctx, LOGE, FL("Invalid key length %d"), |
| 5053 | set_key->keyLength); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5054 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5055 | } |
| 5056 | /*Once Setkey is done, we can go in BMPS */ |
| 5057 | if (set_key->keyLength) |
| 5058 | ps_global_info->remain_in_power_active_till_dhcp = false; |
| 5059 | |
| 5060 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5061 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5062 | return status; |
| 5063 | |
| 5064 | roam_id = GET_NEXT_ROAM_ID(&mac_ctx->roam); |
| 5065 | if (ptr_roam_id) |
| 5066 | *ptr_roam_id = roam_id; |
| 5067 | |
| 5068 | sms_log(mac_ctx, LOG2, FL("keyLength %d"), set_key->keyLength); |
| 5069 | for (i = 0; i < set_key->keyLength; i++) |
| 5070 | sms_log(mac_ctx, LOG2, FL("%02x"), set_key->Key[i]); |
| 5071 | |
| 5072 | sms_log(mac_ctx, LOG2, "\n session_id=%d roam_id=%d", session_id, |
| 5073 | roam_id); |
| 5074 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 5075 | if (!session) { |
| 5076 | sms_log(mac_ctx, LOGE, FL("session %d not found"), session_id); |
| 5077 | sme_release_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5078 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5079 | } |
| 5080 | if (CSR_IS_INFRA_AP(&session->connectedProfile) |
| 5081 | && set_key->keyDirection == eSIR_TX_DEFAULT) { |
| 5082 | if ((eCSR_ENCRYPT_TYPE_WEP40 == set_key->encType) |
| 5083 | || (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == |
| 5084 | set_key->encType)) { |
| 5085 | session->pCurRoamProfile->negotiatedUCEncryptionType = |
| 5086 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5087 | } |
| 5088 | if ((eCSR_ENCRYPT_TYPE_WEP104 == set_key->encType) |
| 5089 | || (eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == |
| 5090 | set_key->encType)) { |
| 5091 | session->pCurRoamProfile->negotiatedUCEncryptionType = |
| 5092 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5093 | } |
| 5094 | } |
| 5095 | status = csr_roam_set_key(mac_ctx, session_id, set_key, roam_id); |
| 5096 | sme_release_global_lock(&mac_ctx->sme); |
| 5097 | return status; |
| 5098 | } |
| 5099 | |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 5100 | /** |
| 5101 | * sme_roam_set_default_key_index - To set default wep key idx |
| 5102 | * @hal: pointer to hal handler |
| 5103 | * @session_id: session id |
| 5104 | * @default_idx: default wep key index |
| 5105 | * |
| 5106 | * This function prepares a message and post to WMA to set wep default |
| 5107 | * key index |
| 5108 | * |
| 5109 | * Return: Success:QDF_STATUS_SUCCESS Failure: Error value |
| 5110 | */ |
| 5111 | QDF_STATUS sme_roam_set_default_key_index(tHalHandle hal, uint8_t session_id, |
| 5112 | uint8_t default_idx) |
| 5113 | { |
| 5114 | cds_msg_t msg; |
| 5115 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 5116 | struct wep_update_default_key_idx *update_key; |
| 5117 | |
| 5118 | update_key = qdf_mem_malloc(sizeof(*update_key)); |
| 5119 | if (!update_key) { |
| 5120 | sms_log(mac_ctx, LOGE, |
| 5121 | FL("Failed to allocate memory for update key")); |
| 5122 | return QDF_STATUS_E_NOMEM; |
| 5123 | } |
| 5124 | |
| 5125 | update_key->session_id = session_id; |
| 5126 | update_key->default_idx = default_idx; |
| 5127 | |
| 5128 | msg.type = WMA_UPDATE_WEP_DEFAULT_KEY; |
| 5129 | msg.reserved = 0; |
| 5130 | msg.bodyptr = (void *)update_key; |
| 5131 | |
| 5132 | if (QDF_STATUS_SUCCESS != |
| 5133 | cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) { |
| 5134 | sms_log(mac_ctx, LOGE, |
| 5135 | FL("Failed to post WMA_UPDATE_WEP_DEFAULT_KEY to WMA")); |
| 5136 | qdf_mem_free(update_key); |
| 5137 | return QDF_STATUS_E_FAILURE; |
| 5138 | } |
| 5139 | |
| 5140 | return QDF_STATUS_SUCCESS; |
| 5141 | } |
| 5142 | |
| 5143 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5144 | /* --------------------------------------------------------------------------- |
| 5145 | \fn sme_get_rssi |
| 5146 | \brief a wrapper function that client calls to register a callback to get |
| 5147 | RSSI |
| 5148 | |
| 5149 | \param hHal - HAL handle for device |
| 5150 | \param callback - SME sends back the requested stats using the callback |
| 5151 | \param staId - The station ID for which the stats is requested for |
| 5152 | \param bssid - The bssid of the connected session |
| 5153 | \param lastRSSI - RSSI value at time of request. In case fw cannot provide |
| 5154 | RSSI, do not hold up but return this value. |
| 5155 | \param pContext - user context to be passed back along with the callback |
| 5156 | \param p_cds_context - cds context |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5157 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5158 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5159 | QDF_STATUS sme_get_rssi(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5160 | tCsrRssiCallback callback, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5161 | uint8_t staId, struct qdf_mac_addr bssId, int8_t lastRSSI, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5162 | void *pContext, void *p_cds_context) |
| 5163 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5164 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5165 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5166 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5167 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5168 | TRACE_CODE_SME_RX_HDD_GET_RSSI, NO_SESSION, 0)); |
| 5169 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5170 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5171 | status = csr_get_rssi(pMac, callback, |
| 5172 | staId, bssId, lastRSSI, |
| 5173 | pContext, p_cds_context); |
| 5174 | sme_release_global_lock(&pMac->sme); |
| 5175 | } |
| 5176 | return status; |
| 5177 | } |
| 5178 | |
| 5179 | /* --------------------------------------------------------------------------- |
| 5180 | \fn sme_get_snr |
| 5181 | \brief a wrapper function that client calls to register a callback to |
| 5182 | get SNR |
| 5183 | |
| 5184 | \param callback - SME sends back the requested stats using the callback |
| 5185 | \param staId - The station ID for which the stats is requested for |
| 5186 | \param pContext - user context to be passed back along with the callback |
| 5187 | \param p_cds_context - cds context |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5188 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5189 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5190 | QDF_STATUS sme_get_snr(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5191 | tCsrSnrCallback callback, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5192 | uint8_t staId, struct qdf_mac_addr bssId, void *pContext) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5193 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5194 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5195 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5196 | |
| 5197 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5198 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5199 | status = csr_get_snr(pMac, callback, staId, bssId, pContext); |
| 5200 | sme_release_global_lock(&pMac->sme); |
| 5201 | } |
| 5202 | return status; |
| 5203 | } |
| 5204 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5205 | /* --------------------------------------------------------------------------- |
| 5206 | \fn sme_get_statistics |
| 5207 | \brief a wrapper function that client calls to register a callback to get |
| 5208 | different PHY level statistics from CSR. |
| 5209 | |
| 5210 | \param requesterId - different client requesting for statistics, |
| 5211 | HDD, UMA/GAN etc |
| 5212 | \param statsMask - The different category/categories of stats requester |
| 5213 | is looking for |
| 5214 | \param callback - SME sends back the requested stats using the callback |
| 5215 | \param periodicity - If requester needs periodic update in millisec, 0 means |
| 5216 | it's an one time request |
| 5217 | \param cache - If requester is happy with cached stats |
| 5218 | \param staId - The station ID for which the stats is requested for |
| 5219 | \param pContext - user context to be passed back along with the callback |
| 5220 | \param sessionId - sme session interface |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5221 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5222 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5223 | QDF_STATUS sme_get_statistics(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5224 | eCsrStatsRequesterType requesterId, |
| 5225 | uint32_t statsMask, tCsrStatsCallback callback, |
| 5226 | uint32_t periodicity, bool cache, uint8_t staId, |
| 5227 | void *pContext, uint8_t sessionId) |
| 5228 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5229 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5230 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5231 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5232 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5233 | TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, |
| 5234 | periodicity)); |
| 5235 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5236 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5237 | status = |
| 5238 | csr_get_statistics(pMac, requesterId, statsMask, callback, |
| 5239 | periodicity, cache, staId, pContext, |
| 5240 | sessionId); |
| 5241 | sme_release_global_lock(&pMac->sme); |
| 5242 | } |
| 5243 | |
| 5244 | return status; |
| 5245 | |
| 5246 | } |
| 5247 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5248 | QDF_STATUS sme_get_link_status(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5249 | tCsrLinkStatusCallback callback, |
| 5250 | void *pContext, uint8_t sessionId) |
| 5251 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5252 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5253 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5254 | tAniGetLinkStatus *pMsg; |
| 5255 | cds_msg_t cds_message; |
| 5256 | |
| 5257 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5258 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5259 | pMsg = qdf_mem_malloc(sizeof(tAniGetLinkStatus)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5260 | if (NULL == pMsg) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5261 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5262 | "%s: Not able to allocate memory for link status", |
| 5263 | __func__); |
| 5264 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5265 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5266 | } |
| 5267 | |
| 5268 | pMsg->msgType = WMA_LINK_STATUS_GET_REQ; |
| 5269 | pMsg->msgLen = (uint16_t) sizeof(tAniGetLinkStatus); |
| 5270 | pMsg->sessionId = sessionId; |
| 5271 | pMac->sme.linkStatusContext = pContext; |
| 5272 | pMac->sme.linkStatusCallback = callback; |
| 5273 | |
| 5274 | cds_message.type = WMA_LINK_STATUS_GET_REQ; |
| 5275 | cds_message.bodyptr = pMsg; |
| 5276 | cds_message.reserved = 0; |
| 5277 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5278 | if (!QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5279 | (cds_mq_post_message(QDF_MODULE_ID_WMA, &cds_message))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5280 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5281 | "%s: Post LINK STATUS MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5282 | qdf_mem_free(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5283 | pMac->sme.linkStatusContext = NULL; |
| 5284 | pMac->sme.linkStatusCallback = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5285 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5286 | } |
| 5287 | |
| 5288 | sme_release_global_lock(&pMac->sme); |
| 5289 | } |
| 5290 | |
| 5291 | return status; |
| 5292 | } |
| 5293 | |
| 5294 | /* --------------------------------------------------------------------------- |
| 5295 | |
| 5296 | \fn sme_get_country_code |
| 5297 | |
| 5298 | \brief To return the current country code. If no country code is applied, |
| 5299 | default country code is used to fill the buffer. |
| 5300 | If 11d supported is turned off, an error is return and the last |
| 5301 | applied/default country code is used. |
| 5302 | This is a synchronous API. |
| 5303 | |
| 5304 | \param pBuf - pointer to a caller allocated buffer for returned country code. |
| 5305 | |
| 5306 | \param pbLen For input, this parameter indicates how big is the buffer. |
| 5307 | Upon return, this parameter has the number of bytes for |
| 5308 | country. If pBuf doesn't have enough space, this function |
| 5309 | returns fail status and this parameter contains the number |
| 5310 | that is needed. |
| 5311 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5312 | \return QDF_STATUS SUCCESS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5313 | |
| 5314 | FAILURE or RESOURCES The API finished and failed. |
| 5315 | |
| 5316 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5317 | QDF_STATUS sme_get_country_code(tHalHandle hHal, uint8_t *pBuf, uint8_t *pbLen) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5318 | { |
| 5319 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5320 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5321 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5322 | TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0)); |
| 5323 | |
| 5324 | return csr_get_country_code(pMac, pBuf, pbLen); |
| 5325 | } |
| 5326 | |
| 5327 | /** |
| 5328 | * sme_apply_channel_power_info_to_fw() - sends channel info to fw |
| 5329 | * @hHal: hal handle |
| 5330 | * |
| 5331 | * This function sends the channel power info to firmware |
| 5332 | * |
| 5333 | * Return: none |
| 5334 | */ |
| 5335 | void sme_apply_channel_power_info_to_fw(tHalHandle hHal) |
| 5336 | { |
| 5337 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5338 | |
| 5339 | csr_apply_channel_power_info_wrapper(pMac); |
| 5340 | } |
| 5341 | |
| 5342 | /* some support functions */ |
| 5343 | bool sme_is11d_supported(tHalHandle hHal) |
| 5344 | { |
| 5345 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5346 | |
| 5347 | return csr_is11d_supported(pMac); |
| 5348 | } |
| 5349 | |
| 5350 | bool sme_is11h_supported(tHalHandle hHal) |
| 5351 | { |
| 5352 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5353 | |
| 5354 | return csr_is11h_supported(pMac); |
| 5355 | } |
| 5356 | |
| 5357 | bool sme_is_wmm_supported(tHalHandle hHal) |
| 5358 | { |
| 5359 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5360 | |
| 5361 | return csr_is_wmm_supported(pMac); |
| 5362 | } |
| 5363 | |
| 5364 | /* --------------------------------------------------------------------------- |
| 5365 | |
| 5366 | \fn sme_change_country_code |
| 5367 | |
| 5368 | \brief Change Country code from upperlayer during WLAN driver operation. |
| 5369 | This is a synchronous API. |
| 5370 | |
| 5371 | \param hHal - The handle returned by mac_open. |
| 5372 | |
| 5373 | \param pCountry New Country Code String |
| 5374 | |
| 5375 | \param sendRegHint If we want to send reg hint to nl80211 |
| 5376 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5377 | \return QDF_STATUS SUCCESS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5378 | |
| 5379 | FAILURE or RESOURCES The API finished and failed. |
| 5380 | |
| 5381 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5382 | QDF_STATUS sme_change_country_code(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5383 | tSmeChangeCountryCallback callback, |
| 5384 | uint8_t *pCountry, |
| 5385 | void *pContext, |
| 5386 | void *p_cds_context, |
| 5387 | tAniBool countryFromUserSpace, |
| 5388 | tAniBool sendRegHint) |
| 5389 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5390 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5391 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5392 | cds_msg_t msg; |
| 5393 | tAniChangeCountryCodeReq *pMsg; |
| 5394 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5395 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5396 | TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, |
| 5397 | 0)); |
| 5398 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5399 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5400 | sms_log(pMac, LOG1, FL(" called")); |
| 5401 | |
| 5402 | if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) |
| 5403 | && (!pMac->roam.configParam. |
| 5404 | fSupplicantCountryCodeHasPriority)) { |
| 5405 | |
| 5406 | sms_log(pMac, LOGW, |
| 5407 | "Set Country Code Fail since the STA is associated and userspace does not have priority "); |
| 5408 | |
| 5409 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5410 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5411 | return status; |
| 5412 | } |
| 5413 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5414 | pMsg = qdf_mem_malloc(sizeof(tAniChangeCountryCodeReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5415 | if (NULL == pMsg) { |
| 5416 | sms_log(pMac, LOGE, |
| 5417 | " csrChangeCountryCode: failed to allocate mem for req"); |
| 5418 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5419 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5420 | } |
| 5421 | |
| 5422 | pMsg->msgType = eWNI_SME_CHANGE_COUNTRY_CODE; |
| 5423 | pMsg->msgLen = (uint16_t) sizeof(tAniChangeCountryCodeReq); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5424 | qdf_mem_copy(pMsg->countryCode, pCountry, 3); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5425 | pMsg->countryFromUserSpace = countryFromUserSpace; |
| 5426 | pMsg->sendRegHint = sendRegHint; |
| 5427 | pMsg->changeCCCallback = callback; |
| 5428 | pMsg->pDevContext = pContext; |
| 5429 | pMsg->p_cds_context = p_cds_context; |
| 5430 | |
| 5431 | msg.type = eWNI_SME_CHANGE_COUNTRY_CODE; |
| 5432 | msg.bodyptr = pMsg; |
| 5433 | msg.reserved = 0; |
| 5434 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5435 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5436 | cds_mq_post_message(CDS_MQ_ID_SME, &msg)) { |
| 5437 | sms_log(pMac, LOGE, |
| 5438 | " sme_change_country_code failed to post msg to self "); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5439 | qdf_mem_free((void *)pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5440 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5441 | } |
| 5442 | sms_log(pMac, LOG1, FL(" returned")); |
| 5443 | sme_release_global_lock(&pMac->sme); |
| 5444 | } |
| 5445 | |
| 5446 | return status; |
| 5447 | } |
| 5448 | |
| 5449 | /*-------------------------------------------------------------------------- |
| 5450 | |
| 5451 | \fn sme_generic_change_country_code |
| 5452 | |
| 5453 | \brief Change Country code from upperlayer during WLAN driver operation. |
| 5454 | This is a synchronous API. |
| 5455 | |
| 5456 | \param hHal - The handle returned by mac_open. |
| 5457 | |
| 5458 | \param pCountry New Country Code String |
| 5459 | |
| 5460 | \param reg_domain regulatory domain |
| 5461 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5462 | \return QDF_STATUS SUCCESS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5463 | |
| 5464 | FAILURE or RESOURCES The API finished and failed. |
| 5465 | |
| 5466 | -----------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5467 | QDF_STATUS sme_generic_change_country_code(tHalHandle hHal, |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 5468 | uint8_t *pCountry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5469 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5470 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5471 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5472 | cds_msg_t msg; |
| 5473 | tAniGenericChangeCountryCodeReq *pMsg; |
| 5474 | |
| 5475 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5476 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5477 | "%s: pMac is null", __func__); |
| 5478 | return status; |
| 5479 | } |
| 5480 | |
| 5481 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5482 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5483 | sms_log(pMac, LOG1, FL(" called")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5484 | pMsg = qdf_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5485 | |
| 5486 | if (NULL == pMsg) { |
| 5487 | sms_log(pMac, LOGE, |
| 5488 | " sme_generic_change_country_code: failed to allocate mem for req"); |
| 5489 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5490 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5491 | } |
| 5492 | |
| 5493 | pMsg->msgType = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE; |
| 5494 | pMsg->msgLen = |
| 5495 | (uint16_t) sizeof(tAniGenericChangeCountryCodeReq); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5496 | qdf_mem_copy(pMsg->countryCode, pCountry, 2); |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 5497 | pMsg->countryCode[2] = ' '; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5498 | |
| 5499 | msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE; |
| 5500 | msg.bodyptr = pMsg; |
| 5501 | msg.reserved = 0; |
| 5502 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5503 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5504 | cds_mq_post_message(CDS_MQ_ID_SME, &msg)) { |
| 5505 | sms_log(pMac, LOGE, |
| 5506 | "sme_generic_change_country_code failed to post msg to self"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5507 | qdf_mem_free(pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5508 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5509 | } |
| 5510 | sms_log(pMac, LOG1, FL(" returned")); |
| 5511 | sme_release_global_lock(&pMac->sme); |
| 5512 | } |
| 5513 | |
| 5514 | return status; |
| 5515 | } |
| 5516 | |
| 5517 | /* --------------------------------------------------------------------------- |
| 5518 | |
| 5519 | \fn sme_dhcp_start_ind |
| 5520 | |
| 5521 | \brief API to signal the FW about the DHCP Start event. |
| 5522 | |
| 5523 | \param hHal - HAL handle for device. |
| 5524 | |
| 5525 | \param device_mode - mode(AP,SAP etc) of the device. |
| 5526 | |
| 5527 | \param macAddr - MAC address of the adapter. |
| 5528 | |
| 5529 | \param sessionId - session ID. |
| 5530 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5531 | \return QDF_STATUS SUCCESS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5532 | |
| 5533 | FAILURE or RESOURCES The API finished and failed. |
| 5534 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5535 | QDF_STATUS sme_dhcp_start_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5536 | uint8_t device_mode, |
| 5537 | uint8_t *macAddr, uint8_t sessionId) |
| 5538 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5539 | QDF_STATUS status; |
| 5540 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5541 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5542 | cds_msg_t cds_message; |
| 5543 | tAniDHCPInd *pMsg; |
| 5544 | tCsrRoamSession *pSession; |
| 5545 | |
| 5546 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5547 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5548 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5549 | |
| 5550 | if (!pSession) { |
| 5551 | sms_log(pMac, LOGE, FL("session %d not found "), |
| 5552 | sessionId); |
| 5553 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5554 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5555 | } |
| 5556 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5557 | pMsg = (tAniDHCPInd *) qdf_mem_malloc(sizeof(tAniDHCPInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5558 | if (NULL == pMsg) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5559 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5560 | "%s: Not able to allocate memory for dhcp start", |
| 5561 | __func__); |
| 5562 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5563 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5564 | } |
| 5565 | pMsg->msgType = WMA_DHCP_START_IND; |
| 5566 | pMsg->msgLen = (uint16_t) sizeof(tAniDHCPInd); |
| 5567 | pMsg->device_mode = device_mode; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5568 | qdf_mem_copy(pMsg->adapterMacAddr.bytes, macAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5569 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 5570 | qdf_copy_macaddr(&pMsg->peerMacAddr, |
Srinivas Girigowda | 296105a | 2015-09-24 16:31:16 -0700 | [diff] [blame] | 5571 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5572 | |
| 5573 | cds_message.type = WMA_DHCP_START_IND; |
| 5574 | cds_message.bodyptr = pMsg; |
| 5575 | cds_message.reserved = 0; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 5576 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 5577 | sessionId, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5578 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 5579 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5580 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5581 | "%s: Post DHCP Start MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5582 | qdf_mem_free(pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5583 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5584 | } |
| 5585 | sme_release_global_lock(&pMac->sme); |
| 5586 | } |
| 5587 | return status; |
| 5588 | } |
| 5589 | |
| 5590 | /* --------------------------------------------------------------------------- |
| 5591 | \fn sme_dhcp_stop_ind |
| 5592 | |
| 5593 | \brief API to signal the FW about the DHCP complete event. |
| 5594 | |
| 5595 | \param hHal - HAL handle for device. |
| 5596 | |
| 5597 | \param device_mode - mode(AP, SAP etc) of the device. |
| 5598 | |
| 5599 | \param macAddr - MAC address of the adapter. |
| 5600 | |
| 5601 | \param sessionId - session ID. |
| 5602 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5603 | \return QDF_STATUS SUCCESS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5604 | FAILURE or RESOURCES The API finished and failed. |
| 5605 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5606 | QDF_STATUS sme_dhcp_stop_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5607 | uint8_t device_mode, |
| 5608 | uint8_t *macAddr, uint8_t sessionId) |
| 5609 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5610 | QDF_STATUS status; |
| 5611 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5612 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5613 | cds_msg_t cds_message; |
| 5614 | tAniDHCPInd *pMsg; |
| 5615 | tCsrRoamSession *pSession; |
| 5616 | |
| 5617 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5618 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5619 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5620 | |
| 5621 | if (!pSession) { |
| 5622 | sms_log(pMac, LOGE, FL("session %d not found "), |
| 5623 | sessionId); |
| 5624 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5625 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5626 | } |
| 5627 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5628 | pMsg = (tAniDHCPInd *) qdf_mem_malloc(sizeof(tAniDHCPInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5629 | if (NULL == pMsg) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5630 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5631 | "%s: Not able to allocate memory for dhcp stop", |
| 5632 | __func__); |
| 5633 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5634 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5635 | } |
| 5636 | |
| 5637 | pMsg->msgType = WMA_DHCP_STOP_IND; |
| 5638 | pMsg->msgLen = (uint16_t) sizeof(tAniDHCPInd); |
| 5639 | pMsg->device_mode = device_mode; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5640 | qdf_mem_copy(pMsg->adapterMacAddr.bytes, macAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5641 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 5642 | qdf_copy_macaddr(&pMsg->peerMacAddr, |
Srinivas Girigowda | 296105a | 2015-09-24 16:31:16 -0700 | [diff] [blame] | 5643 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5644 | |
| 5645 | cds_message.type = WMA_DHCP_STOP_IND; |
| 5646 | cds_message.bodyptr = pMsg; |
| 5647 | cds_message.reserved = 0; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 5648 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 5649 | sessionId, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5650 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 5651 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5652 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5653 | "%s: Post DHCP Stop MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5654 | qdf_mem_free(pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5655 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5656 | } |
| 5657 | |
| 5658 | sme_release_global_lock(&pMac->sme); |
| 5659 | } |
| 5660 | return status; |
| 5661 | } |
| 5662 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 5663 | /*--------------------------------------------------------------------------- |
| 5664 | |
| 5665 | \fn sme_TXFailMonitorStopInd |
| 5666 | |
| 5667 | \brief API to signal the FW to start monitoring TX failures |
| 5668 | |
| 5669 | \return QDF_STATUS SUCCESS. |
| 5670 | |
| 5671 | FAILURE or RESOURCES The API finished and failed. |
| 5672 | --------------------------------------------------------------------------*/ |
| 5673 | QDF_STATUS sme_tx_fail_monitor_start_stop_ind(tHalHandle hHal, uint8_t tx_fail_count, |
| 5674 | void *txFailIndCallback) |
| 5675 | { |
| 5676 | QDF_STATUS status; |
| 5677 | QDF_STATUS qdf_status; |
| 5678 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5679 | cds_msg_t cds_message; |
| 5680 | tAniTXFailMonitorInd *pMsg; |
| 5681 | |
| 5682 | status = sme_acquire_global_lock(&pMac->sme); |
| 5683 | if (QDF_STATUS_SUCCESS == status) { |
| 5684 | pMsg = (tAniTXFailMonitorInd *) |
| 5685 | qdf_mem_malloc(sizeof(tAniTXFailMonitorInd)); |
| 5686 | if (NULL == pMsg) { |
| 5687 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 5688 | "%s: Failed to allocate memory", __func__); |
| 5689 | sme_release_global_lock(&pMac->sme); |
| 5690 | return QDF_STATUS_E_NOMEM; |
| 5691 | } |
| 5692 | |
| 5693 | pMsg->msgType = WMA_TX_FAIL_MONITOR_IND; |
| 5694 | pMsg->msgLen = (uint16_t) sizeof(tAniTXFailMonitorInd); |
| 5695 | |
| 5696 | /* tx_fail_count = 0 should disable the Monitoring in FW */ |
| 5697 | pMsg->tx_fail_count = tx_fail_count; |
| 5698 | pMsg->txFailIndCallback = txFailIndCallback; |
| 5699 | |
| 5700 | cds_message.type = WMA_TX_FAIL_MONITOR_IND; |
| 5701 | cds_message.bodyptr = pMsg; |
| 5702 | cds_message.reserved = 0; |
| 5703 | |
| 5704 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 5705 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 5706 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 5707 | "%s: Post TX Fail monitor Start MSG fail", |
| 5708 | __func__); |
| 5709 | qdf_mem_free(pMsg); |
| 5710 | status = QDF_STATUS_E_FAILURE; |
| 5711 | } |
| 5712 | sme_release_global_lock(&pMac->sme); |
| 5713 | } |
| 5714 | return status; |
| 5715 | } |
| 5716 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5717 | /* --------------------------------------------------------------------------- |
| 5718 | \fn sme_set_cfg_privacy |
| 5719 | \brief API to set configure privacy parameters |
| 5720 | \param hHal - The handle returned by mac_open. |
| 5721 | \param pProfile - Pointer CSR Roam profile. |
| 5722 | \param fPrivacy - This parameter indicates status of privacy |
| 5723 | |
| 5724 | \return void |
| 5725 | ---------------------------------------------------------------------------*/ |
| 5726 | void sme_set_cfg_privacy(tHalHandle hHal, |
| 5727 | tCsrRoamProfile *pProfile, bool fPrivacy) |
| 5728 | { |
| 5729 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5730 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5731 | TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5732 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5733 | csr_set_cfg_privacy(pMac, pProfile, fPrivacy); |
| 5734 | sme_release_global_lock(&pMac->sme); |
| 5735 | } |
| 5736 | } |
| 5737 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5738 | /* --------------------------------------------------------------------------- |
| 5739 | \fn sme_neighbor_report_request |
| 5740 | \brief API to request neighbor report. |
| 5741 | \param hHal - The handle returned by mac_open. |
| 5742 | \param pRrmNeighborReq - Pointer to a caller allocated object of type |
| 5743 | tRrmNeighborReq. Caller owns the memory and is |
| 5744 | responsible for freeing it. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5745 | \return QDF_STATUS |
| 5746 | QDF_STATUS_E_FAILURE - failure |
| 5747 | QDF_STATUS_SUCCESS success |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5748 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5749 | QDF_STATUS sme_neighbor_report_request(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5750 | tpRrmNeighborReq pRrmNeighborReq, |
| 5751 | tpRrmNeighborRspCallbackInfo callbackInfo) |
| 5752 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5753 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5754 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5755 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5756 | TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, |
| 5757 | 0)); |
| 5758 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5759 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5760 | status = |
| 5761 | sme_rrm_neighbor_report_request(hHal, sessionId, |
| 5762 | pRrmNeighborReq, callbackInfo); |
| 5763 | sme_release_global_lock(&pMac->sme); |
| 5764 | } |
| 5765 | |
| 5766 | return status; |
| 5767 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5768 | |
| 5769 | void sms_log(tpAniSirGlobal pMac, uint32_t loglevel, const char *pString, ...) |
| 5770 | { |
| 5771 | #ifdef WLAN_DEBUG |
| 5772 | /* Verify against current log level */ |
| 5773 | if (loglevel > |
| 5774 | pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE(SIR_SMS_MODULE_ID)]) |
| 5775 | return; |
| 5776 | else { |
| 5777 | va_list marker; |
| 5778 | |
| 5779 | va_start(marker, pString); /* Initialize variable arguments. */ |
| 5780 | |
| 5781 | log_debug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker); |
| 5782 | |
| 5783 | va_end(marker); /* Reset variable arguments. */ |
| 5784 | } |
| 5785 | #endif |
| 5786 | } |
| 5787 | |
| 5788 | /* --------------------------------------------------------------------------- |
| 5789 | \fn sme_get_wcnss_wlan_compiled_version |
| 5790 | \brief This API returns the version of the WCNSS WLAN API with |
| 5791 | which the HOST driver was built |
| 5792 | \param hHal - The handle returned by mac_open. |
| 5793 | \param pVersion - Points to the Version structure to be filled |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5794 | \return QDF_STATUS |
| 5795 | QDF_STATUS_E_INVAL - failure |
| 5796 | QDF_STATUS_SUCCESS success |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5797 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5798 | QDF_STATUS sme_get_wcnss_wlan_compiled_version(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5799 | tSirVersionType *pVersion) |
| 5800 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5801 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5802 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5803 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5804 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5805 | if (pVersion != NULL) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5806 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5807 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5808 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5809 | |
| 5810 | sme_release_global_lock(&pMac->sme); |
| 5811 | } |
| 5812 | |
| 5813 | return status; |
| 5814 | } |
| 5815 | |
| 5816 | /* --------------------------------------------------------------------------- |
| 5817 | \fn sme_get_wcnss_wlan_reported_version |
| 5818 | \brief This API returns the version of the WCNSS WLAN API with |
| 5819 | which the WCNSS driver reports it was built |
| 5820 | \param hHal - The handle returned by mac_open. |
| 5821 | \param pVersion - Points to the Version structure to be filled |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5822 | \return QDF_STATUS |
| 5823 | QDF_STATUS_E_INVAL - failure |
| 5824 | QDF_STATUS_SUCCESS success |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5825 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5826 | QDF_STATUS sme_get_wcnss_wlan_reported_version(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5827 | tSirVersionType *pVersion) |
| 5828 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5829 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5830 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5831 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5832 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5833 | if (pVersion != NULL) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5834 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5835 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5836 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5837 | |
| 5838 | sme_release_global_lock(&pMac->sme); |
| 5839 | } |
| 5840 | |
| 5841 | return status; |
| 5842 | } |
| 5843 | |
| 5844 | /* --------------------------------------------------------------------------- |
| 5845 | \fn sme_get_wcnss_software_version |
| 5846 | \brief This API returns the version string of the WCNSS driver |
| 5847 | \param hHal - The handle returned by mac_open. |
| 5848 | \param pVersion - Points to the Version string buffer to be filled |
| 5849 | \param versionBufferSize - THe size of the Version string buffer |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5850 | \return QDF_STATUS |
| 5851 | QDF_STATUS_E_INVAL - failure |
| 5852 | QDF_STATUS_SUCCESS success |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5853 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5854 | QDF_STATUS sme_get_wcnss_software_version(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5855 | uint8_t *pVersion, |
| 5856 | uint32_t versionBufferSize) |
| 5857 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5858 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5859 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5860 | v_CONTEXT_t cds_context = cds_get_global_context(); |
| 5861 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5862 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5863 | if (pVersion != NULL) { |
| 5864 | status = |
| 5865 | wma_get_wcnss_software_version(cds_context, |
| 5866 | pVersion, |
| 5867 | versionBufferSize); |
| 5868 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5869 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5870 | } |
| 5871 | sme_release_global_lock(&pMac->sme); |
| 5872 | } |
| 5873 | |
| 5874 | return status; |
| 5875 | } |
| 5876 | |
| 5877 | /* --------------------------------------------------------------------------- |
| 5878 | \fn sme_get_wcnss_hardware_version |
| 5879 | \brief This API returns the version string of the WCNSS hardware |
| 5880 | \param hHal - The handle returned by mac_open. |
| 5881 | \param pVersion - Points to the Version string buffer to be filled |
| 5882 | \param versionBufferSize - THe size of the Version string buffer |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5883 | \return QDF_STATUS |
| 5884 | QDF_STATUS_E_INVAL - failure |
| 5885 | QDF_STATUS_SUCCESS success |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5886 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5887 | QDF_STATUS sme_get_wcnss_hardware_version(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5888 | uint8_t *pVersion, |
| 5889 | uint32_t versionBufferSize) |
| 5890 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5891 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5892 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5893 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5894 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5895 | if (pVersion != NULL) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5896 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5897 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5898 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5899 | |
| 5900 | sme_release_global_lock(&pMac->sme); |
| 5901 | } |
| 5902 | |
| 5903 | return status; |
| 5904 | } |
| 5905 | |
| 5906 | #ifdef FEATURE_WLAN_WAPI |
| 5907 | |
| 5908 | /* --------------------------------------------------------------------------- |
| 5909 | \fn sme_scan_get_bkid_candidate_list |
| 5910 | \brief a wrapper function to return the BKID candidate list |
| 5911 | \param pBkidList - caller allocated buffer point to an array of |
| 5912 | tBkidCandidateInfo |
| 5913 | \param pNumItems - pointer to a variable that has the number of |
| 5914 | tBkidCandidateInfo allocated when retruning, this is |
| 5915 | either the number needed or number of items put into |
| 5916 | pPmkidList |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5917 | \return QDF_STATUS - when fail, it usually means the buffer allocated is not |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5918 | big enough and pNumItems |
| 5919 | has the number of tBkidCandidateInfo. |
| 5920 | \Note: pNumItems is a number of tBkidCandidateInfo, |
| 5921 | not sizeof(tBkidCandidateInfo) * something |
| 5922 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5923 | QDF_STATUS sme_scan_get_bkid_candidate_list(tHalHandle hHal, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5924 | tBkidCandidateInfo *pBkidList, |
| 5925 | uint32_t *pNumItems) |
| 5926 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5927 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5928 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5929 | |
| 5930 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5931 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5932 | status = |
| 5933 | csr_scan_get_bkid_candidate_list(pMac, sessionId, pBkidList, |
| 5934 | pNumItems); |
| 5935 | sme_release_global_lock(&pMac->sme); |
| 5936 | } |
| 5937 | |
| 5938 | return status; |
| 5939 | } |
| 5940 | #endif /* FEATURE_WLAN_WAPI */ |
| 5941 | |
| 5942 | #ifdef FEATURE_OEM_DATA_SUPPORT |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5943 | /** |
| 5944 | * sme_oem_data_req() - send oem data request to WMA |
| 5945 | * @hal: HAL handle |
| 5946 | * @hdd_oem_req: OEM data request from HDD |
| 5947 | * |
| 5948 | * Return: QDF_STATUS |
| 5949 | */ |
Krishna Kumaar Natarajan | c1fa17d | 2016-08-03 14:19:20 -0700 | [diff] [blame] | 5950 | QDF_STATUS sme_oem_data_req(tHalHandle hal, struct oem_data_req *hdd_oem_req) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5951 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5952 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5953 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Krishna Kumaar Natarajan | c1fa17d | 2016-08-03 14:19:20 -0700 | [diff] [blame] | 5954 | struct oem_data_req *oem_data_req; |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5955 | void *wma_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5956 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5957 | sms_log(mac_ctx, LOG1, FL("enter")); |
| 5958 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 5959 | if (!wma_handle) { |
| 5960 | sms_log(mac_ctx, LOGE, FL("wma_handle is NULL")); |
| 5961 | return QDF_STATUS_E_FAILURE; |
| 5962 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5963 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5964 | oem_data_req = qdf_mem_malloc(sizeof(*oem_data_req)); |
| 5965 | if (!oem_data_req) { |
| 5966 | sms_log(mac_ctx, LOGE, FL("mem alloc failed")); |
| 5967 | return QDF_STATUS_E_NOMEM; |
| 5968 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5969 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5970 | oem_data_req->data_len = hdd_oem_req->data_len; |
| 5971 | oem_data_req->data = qdf_mem_malloc(oem_data_req->data_len); |
| 5972 | if (!oem_data_req->data) { |
| 5973 | sms_log(mac_ctx, LOGE, FL("mem alloc failed")); |
| 5974 | return QDF_STATUS_E_NOMEM; |
| 5975 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5976 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5977 | qdf_mem_copy(oem_data_req->data, hdd_oem_req->data, |
| 5978 | oem_data_req->data_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5979 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5980 | status = wma_start_oem_data_req(wma_handle, oem_data_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5981 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5982 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 5983 | sms_log(mac_ctx, LOGE, FL("Post oem data request msg fail")); |
| 5984 | } else { |
| 5985 | sms_log(mac_ctx, LOG1, |
| 5986 | FL("OEM request(length: %d) sent to WMA"), |
| 5987 | oem_data_req->data_len); |
| 5988 | } |
| 5989 | |
| 5990 | if (oem_data_req->data_len) |
| 5991 | qdf_mem_free(oem_data_req->data); |
| 5992 | qdf_mem_free(oem_data_req); |
| 5993 | |
| 5994 | sms_log(mac_ctx, LOG1, FL("exit")); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5995 | return status; |
| 5996 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5997 | #endif /*FEATURE_OEM_DATA_SUPPORT */ |
| 5998 | |
| 5999 | /*-------------------------------------------------------------------------- |
| 6000 | |
| 6001 | \brief sme_open_session() - Open a session for scan/roam operation. |
| 6002 | |
| 6003 | This is a synchronous API. |
| 6004 | |
| 6005 | \param hHal - The handle returned by mac_open. |
| 6006 | \param callback - A pointer to the function caller specifies for |
| 6007 | roam/connect status indication |
| 6008 | \param pContext - The context passed with callback |
| 6009 | \param pSelfMacAddr - Caller allocated memory filled with self MAC address |
| 6010 | (6 bytes) |
| 6011 | \param pbSessionId - pointer to a caller allocated buffer for returned session ID |
| 6012 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6013 | \return QDF_STATUS_SUCCESS - session is opened. sessionId returned. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6014 | |
| 6015 | Other status means SME is failed to open the session. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6016 | QDF_STATUS_E_RESOURCES - no more session available. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6017 | \sa |
| 6018 | |
| 6019 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6020 | QDF_STATUS sme_open_session(tHalHandle hHal, csr_roam_completeCallback callback, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6021 | void *pContext, |
| 6022 | uint8_t *pSelfMacAddr, uint8_t *pbSessionId, |
| 6023 | uint32_t type, uint32_t subType) |
| 6024 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6025 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6026 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6027 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6028 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, |
Peng Xu | 66162de | 2016-02-11 17:01:20 -0800 | [diff] [blame] | 6029 | "%s: type=%d, subType=%d addr:%pM", |
| 6030 | __func__, type, subType, pSelfMacAddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6031 | |
| 6032 | if (NULL == pbSessionId) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6033 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6034 | } else { |
| 6035 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6036 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Peng Xu | 66162de | 2016-02-11 17:01:20 -0800 | [diff] [blame] | 6037 | status = csr_roam_open_session(pMac, callback, pContext, |
| 6038 | pSelfMacAddr, |
| 6039 | pbSessionId, type, |
| 6040 | subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6041 | |
| 6042 | sme_release_global_lock(&pMac->sme); |
| 6043 | } |
| 6044 | } |
| 6045 | if (NULL != pbSessionId) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6046 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6047 | TRACE_CODE_SME_RX_HDD_OPEN_SESSION, |
| 6048 | *pbSessionId, 0)); |
| 6049 | |
| 6050 | return status; |
| 6051 | } |
| 6052 | |
| 6053 | /*-------------------------------------------------------------------------- |
| 6054 | |
| 6055 | \brief sme_close_session() - Open a session for scan/roam operation. |
| 6056 | |
| 6057 | This is a synchronous API. |
| 6058 | |
| 6059 | \param hHal - The handle returned by mac_open. |
| 6060 | |
| 6061 | \param sessionId - A previous opened session's ID. |
| 6062 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6063 | \return QDF_STATUS_SUCCESS - session is closed. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6064 | |
| 6065 | Other status means SME is failed to open the session. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6066 | QDF_STATUS_E_INVAL - session is not opened. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6067 | \sa |
| 6068 | |
| 6069 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6070 | QDF_STATUS sme_close_session(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6071 | csr_roamSessionCloseCallback callback, |
| 6072 | void *pContext) |
| 6073 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6074 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6075 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6076 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6077 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6078 | TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0)); |
| 6079 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6080 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6081 | status = csr_roam_close_session(pMac, sessionId, false, |
| 6082 | callback, pContext); |
| 6083 | |
| 6084 | sme_release_global_lock(&pMac->sme); |
| 6085 | } |
| 6086 | |
| 6087 | return status; |
| 6088 | } |
| 6089 | |
| 6090 | /* --------------------------------------------------------------------------- |
| 6091 | |
| 6092 | \fn sme_roam_update_apwpsie |
| 6093 | |
| 6094 | \brief To update AP's WPS IE. This function should be called after SME AP session is created |
| 6095 | This is an asynchronous API. |
| 6096 | |
| 6097 | \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs |
| 6098 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6099 | \return QDF_STATUS – SUCCESS – |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6100 | |
| 6101 | FAILURE or RESOURCES – The API finished and failed. |
| 6102 | |
| 6103 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6104 | QDF_STATUS sme_roam_update_apwpsie(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6105 | tSirAPWPSIEs *pAPWPSIES) |
| 6106 | { |
| 6107 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6108 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6109 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6110 | |
| 6111 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6112 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6113 | |
| 6114 | status = csr_roam_update_apwpsie(pMac, sessionId, pAPWPSIES); |
| 6115 | |
| 6116 | sme_release_global_lock(&pMac->sme); |
| 6117 | } |
| 6118 | |
| 6119 | return status; |
| 6120 | } |
| 6121 | |
| 6122 | /* --------------------------------------------------------------------------- |
| 6123 | |
| 6124 | \fn sme_roam_update_apwparsni_es |
| 6125 | |
| 6126 | \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created |
| 6127 | This is an asynchronous API. |
| 6128 | |
| 6129 | \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs |
| 6130 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6131 | \return QDF_STATUS – SUCCESS – |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6132 | |
| 6133 | FAILURE or RESOURCES – The API finished and failed. |
| 6134 | |
| 6135 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6136 | QDF_STATUS sme_roam_update_apwparsni_es(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6137 | tSirRSNie *pAPSirRSNie) |
| 6138 | { |
| 6139 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6140 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6141 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6142 | |
| 6143 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6144 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6145 | |
| 6146 | status = csr_roam_update_wparsni_es(pMac, sessionId, pAPSirRSNie); |
| 6147 | |
| 6148 | sme_release_global_lock(&pMac->sme); |
| 6149 | } |
| 6150 | |
| 6151 | return status; |
| 6152 | } |
| 6153 | |
| 6154 | /* --------------------------------------------------------------------------- |
| 6155 | |
| 6156 | \fn sme_change_mcc_beacon_interval |
| 6157 | |
| 6158 | \brief To update P2P-GO beaconInterval. This function should be called after |
| 6159 | disassociating all the station is done |
| 6160 | This is an asynchronous API. |
| 6161 | |
| 6162 | \param |
| 6163 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6164 | \return QDF_STATUS SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6165 | FAILURE or RESOURCES |
| 6166 | The API finished and failed. |
| 6167 | |
| 6168 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6169 | QDF_STATUS sme_change_mcc_beacon_interval(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6170 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6171 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6172 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6173 | |
| 6174 | sms_log(pMac, LOG1, FL("Update Beacon PARAMS ")); |
| 6175 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6176 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6177 | status = csr_send_chng_mcc_beacon_interval(pMac, sessionId); |
| 6178 | sme_release_global_lock(&pMac->sme); |
| 6179 | } |
| 6180 | return status; |
| 6181 | } |
| 6182 | |
| 6183 | /** |
| 6184 | * sme_set_host_offload(): API to set the host offload feature. |
| 6185 | * @hHal: The handle returned by mac_open. |
| 6186 | * @sessionId: Session Identifier |
| 6187 | * @request: Pointer to the offload request. |
| 6188 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6189 | * Return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6190 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6191 | QDF_STATUS sme_set_host_offload(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6192 | tpSirHostOffloadReq request) |
| 6193 | { |
| 6194 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6195 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6196 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6197 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6198 | TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0)); |
| 6199 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6200 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6201 | #ifdef WLAN_NS_OFFLOAD |
| 6202 | if (SIR_IPV6_NS_OFFLOAD == request->offloadType) { |
| 6203 | status = sme_set_ps_ns_offload(hHal, request, |
| 6204 | sessionId); |
| 6205 | } else |
| 6206 | #endif /* WLAN_NS_OFFLOAD */ |
| 6207 | { |
| 6208 | status = sme_set_ps_host_offload(hHal, request, |
| 6209 | sessionId); |
| 6210 | } |
| 6211 | sme_release_global_lock(&pMac->sme); |
| 6212 | } |
| 6213 | |
| 6214 | return status; |
| 6215 | } |
| 6216 | |
| 6217 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 6218 | /** |
| 6219 | * sme_set_gtk_offload(): API to set GTK offload information. |
| 6220 | * @hHal: The handle returned by mac_open. |
| 6221 | * @sessionId: Session Identifier |
| 6222 | * @pGtkOffload: Pointer to the GTK offload request.. |
| 6223 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6224 | * Return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6225 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6226 | QDF_STATUS sme_set_gtk_offload(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6227 | tpSirGtkOffloadParams pGtkOffload, |
| 6228 | uint8_t sessionId) |
| 6229 | { |
| 6230 | tpSirGtkOffloadParams request_buf; |
| 6231 | cds_msg_t msg; |
| 6232 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6233 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 6234 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6235 | QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6236 | "%s: KeyReplayCounter: %lld", __func__, |
| 6237 | pGtkOffload->ullKeyReplayCounter); |
| 6238 | |
| 6239 | if (NULL == pSession) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6240 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6241 | "%s: Session not found ", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6242 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6243 | } |
| 6244 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6245 | request_buf = qdf_mem_malloc(sizeof(*request_buf)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6246 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6247 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6248 | FL("Not able to allocate memory for GTK offload request")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6249 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6250 | } |
| 6251 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 6252 | qdf_copy_macaddr(&pGtkOffload->bssid, |
Srinivas Girigowda | 2213b1d | 2015-11-20 17:10:11 -0800 | [diff] [blame] | 6253 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6254 | |
| 6255 | *request_buf = *pGtkOffload; |
| 6256 | |
| 6257 | msg.type = WMA_GTK_OFFLOAD_REQ; |
| 6258 | msg.reserved = 0; |
| 6259 | msg.bodyptr = request_buf; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 6260 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 6261 | sessionId, msg.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6262 | if (!QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6263 | (cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6264 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6265 | FL("Not able to post SIR_HAL_SET_GTK_OFFLOAD message to HAL")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6266 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6267 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6268 | } |
| 6269 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6270 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6271 | } |
| 6272 | |
| 6273 | /** |
| 6274 | * sme_get_gtk_offload(): API to get GTK offload information |
| 6275 | * @hHal: The handle returned by mac_open. |
| 6276 | * @callback_routine: callback_routine. |
| 6277 | * @sessionId: Session Identifier. |
| 6278 | * callback_context: callback_context. |
| 6279 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6280 | * Return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6281 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6282 | QDF_STATUS sme_get_gtk_offload(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6283 | gtk_offload_get_info_callback callback_routine, |
| 6284 | void *callback_context, uint8_t session_id) |
| 6285 | { |
| 6286 | tpSirGtkOffloadGetInfoRspParams request_buf; |
| 6287 | cds_msg_t msg; |
| 6288 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6289 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, session_id); |
| 6290 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6291 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, "%s: Entered", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6292 | __func__); |
| 6293 | |
| 6294 | if (NULL == pSession) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6295 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 2213b1d | 2015-11-20 17:10:11 -0800 | [diff] [blame] | 6296 | "%s: Session not found", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6297 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6298 | } |
| 6299 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6300 | request_buf = qdf_mem_malloc(sizeof(*request_buf)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6301 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6302 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6303 | FL("Not able to allocate memory for Get GTK offload request")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6304 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6305 | } |
| 6306 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 6307 | qdf_copy_macaddr(&request_buf->bssid, |
Srinivas Girigowda | 2213b1d | 2015-11-20 17:10:11 -0800 | [diff] [blame] | 6308 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6309 | |
| 6310 | msg.type = WMA_GTK_OFFLOAD_GETINFO_REQ; |
| 6311 | msg.reserved = 0; |
| 6312 | msg.bodyptr = request_buf; |
| 6313 | |
| 6314 | /* Cache the Get GTK Offload callback information */ |
| 6315 | if (NULL != pMac->sme.gtk_offload_get_info_cb) { |
| 6316 | |
| 6317 | /* Do we need to check if the callback is in use? */ |
| 6318 | /* Because we are not sending the same message again |
| 6319 | * when it is pending, |
| 6320 | * the only case when the callback is not NULL is that |
| 6321 | * the previous message was timed out or failed. |
| 6322 | * So, it will be safe to set the callback in this case. |
| 6323 | */ |
| 6324 | } |
| 6325 | |
| 6326 | pMac->sme.gtk_offload_get_info_cb = callback_routine; |
| 6327 | pMac->sme.gtk_offload_get_info_cb_context = callback_context; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 6328 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 6329 | session_id, msg.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6330 | if (!QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6331 | (cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6332 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6333 | FL("Not able to post WMA_GTK_OFFLOAD_GETINFO_REQ message to WMA")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6334 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6335 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6336 | } |
| 6337 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6338 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6339 | } |
| 6340 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
| 6341 | |
| 6342 | /* --------------------------------------------------------------------------- |
| 6343 | \fn sme_set_keep_alive |
| 6344 | \brief API to set the Keep Alive feature. |
| 6345 | \param hHal - The handle returned by mac_open. |
| 6346 | \param request - Pointer to the Keep Alive request. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6347 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6348 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6349 | QDF_STATUS sme_set_keep_alive(tHalHandle hHal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6350 | tpSirKeepAliveReq request) |
| 6351 | { |
| 6352 | tpSirKeepAliveReq request_buf; |
| 6353 | cds_msg_t msg; |
| 6354 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6355 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, session_id); |
| 6356 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6357 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO_LOW, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6358 | FL("WMA_SET_KEEP_ALIVE message")); |
| 6359 | |
| 6360 | if (pSession == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6361 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6362 | FL("Session not Found")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6363 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6364 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6365 | request_buf = qdf_mem_malloc(sizeof(tSirKeepAliveReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6366 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6367 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6368 | FL("Not able to allocate memory for keep alive request")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6369 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6370 | } |
| 6371 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 6372 | qdf_copy_macaddr(&request->bssid, &pSession->connectedProfile.bssid); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6373 | qdf_mem_copy(request_buf, request, sizeof(tSirKeepAliveReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6374 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6375 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO_LOW, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6376 | "buff TP %d input TP %d ", request_buf->timePeriod, |
| 6377 | request->timePeriod); |
| 6378 | request_buf->sessionId = session_id; |
| 6379 | |
| 6380 | msg.type = WMA_SET_KEEP_ALIVE; |
| 6381 | msg.reserved = 0; |
| 6382 | msg.bodyptr = request_buf; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 6383 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 6384 | session_id, msg.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6385 | if (QDF_STATUS_SUCCESS != |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6386 | cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6387 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6388 | FL("Not able to post WMA_SET_KEEP_ALIVE message to WMA")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6389 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6390 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6391 | } |
| 6392 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6393 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6394 | } |
| 6395 | |
| 6396 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 6397 | /* --------------------------------------------------------------------------- |
| 6398 | \fn sme_set_preferred_network_list |
| 6399 | \brief API to set the Preferred Network List Offload feature. |
| 6400 | \param hHal - The handle returned by mac_open. |
| 6401 | \param request - Pointer to the offload request. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6402 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6403 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6404 | QDF_STATUS sme_set_preferred_network_list(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6405 | tpSirPNOScanReq request, |
| 6406 | uint8_t sessionId, |
| 6407 | void (*callback_routine)(void *callback_context, |
| 6408 | tSirPrefNetworkFoundInd |
| 6409 | *pPrefNetworkFoundInd), |
| 6410 | void *callback_context) |
| 6411 | { |
| 6412 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6413 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6414 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6415 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 6416 | TRACE_CODE_SME_RX_HDD_PREF_NET_LIST, |
| 6417 | sessionId, request->ucNetworksCount)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6418 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6419 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6420 | sme_set_ps_preferred_network_list(hHal, request, sessionId, |
| 6421 | callback_routine, callback_context); |
| 6422 | sme_release_global_lock(&pMac->sme); |
| 6423 | } |
| 6424 | |
| 6425 | return status; |
| 6426 | } |
| 6427 | |
| 6428 | #endif /* FEATURE_WLAN_SCAN_PNO */ |
| 6429 | |
| 6430 | /* --------------------------------------------------------------------------- |
| 6431 | \fn sme_abort_mac_scan |
| 6432 | \brief API to cancel MAC scan. |
| 6433 | \param hHal - The handle returned by mac_open. |
| 6434 | \param sessionId - sessionId on which we need to abort scan. |
| 6435 | \param reason - Reason to abort the scan. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6436 | \return QDF_STATUS |
| 6437 | QDF_STATUS_E_FAILURE - failure |
| 6438 | QDF_STATUS_SUCCESS success |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6439 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6440 | QDF_STATUS sme_abort_mac_scan(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6441 | eCsrAbortReason reason) |
| 6442 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6443 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6444 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6445 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6446 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6447 | TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0)); |
| 6448 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6449 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6450 | status = csr_scan_abort_mac_scan(pMac, sessionId, reason); |
| 6451 | |
| 6452 | sme_release_global_lock(&pMac->sme); |
| 6453 | } |
| 6454 | |
| 6455 | return status; |
| 6456 | } |
| 6457 | |
| 6458 | /* ---------------------------------------------------------------------------- |
| 6459 | \fn sme_get_operation_channel |
| 6460 | \brief API to get current channel on which STA is parked |
| 6461 | this function gives channel information only of infra station or IBSS station |
| 6462 | \param hHal, pointer to memory location and sessionId |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6463 | \returns QDF_STATUS_SUCCESS |
| 6464 | QDF_STATUS_E_FAILURE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6465 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6466 | QDF_STATUS sme_get_operation_channel(tHalHandle hHal, uint32_t *pChannel, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6467 | uint8_t sessionId) |
| 6468 | { |
| 6469 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6470 | tCsrRoamSession *pSession; |
| 6471 | |
| 6472 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 6473 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 6474 | |
| 6475 | if ((pSession->connectedProfile.BSSType == |
| 6476 | eCSR_BSS_TYPE_INFRASTRUCTURE) |
| 6477 | || (pSession->connectedProfile.BSSType == |
| 6478 | eCSR_BSS_TYPE_IBSS) |
| 6479 | || (pSession->connectedProfile.BSSType == |
| 6480 | eCSR_BSS_TYPE_INFRA_AP) |
| 6481 | || (pSession->connectedProfile.BSSType == |
| 6482 | eCSR_BSS_TYPE_START_IBSS)) { |
| 6483 | *pChannel = pSession->connectedProfile.operationChannel; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6484 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6485 | } |
| 6486 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6487 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6488 | } /* sme_get_operation_channel ends here */ |
| 6489 | |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 6490 | /** |
Selvaraj, Sridhar | 4577a9b | 2016-09-04 15:17:07 +0530 | [diff] [blame] | 6491 | * sme_register_p2p_ack_ind_callback() - p2p ack indication callback |
| 6492 | * @hal: hal pointer |
| 6493 | * @callback: callback pointer to be registered |
| 6494 | * |
| 6495 | * This function is used to register a callback to PE for p2p ack |
| 6496 | * indication |
| 6497 | * |
| 6498 | * Return: Success if msg is posted to PE else Failure. |
| 6499 | */ |
| 6500 | QDF_STATUS sme_register_p2p_ack_ind_callback(tHalHandle hal, |
| 6501 | sir_p2p_ack_ind_callback callback) |
| 6502 | { |
| 6503 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 6504 | struct sir_sme_p2p_ack_ind_cb_req *msg; |
| 6505 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 6506 | sms_log(mac_ctx, LOG1, FL(": ENTER")); |
| 6507 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 6508 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 6509 | msg = qdf_mem_malloc(sizeof(*msg)); |
| 6510 | if (NULL == msg) { |
| 6511 | sms_log(mac_ctx, LOGE, |
| 6512 | FL("Failed to allocate memory")); |
| 6513 | sme_release_global_lock(&mac_ctx->sme); |
| 6514 | return QDF_STATUS_E_NOMEM; |
| 6515 | } |
| 6516 | qdf_mem_zero(msg, sizeof(*msg)); |
| 6517 | msg->message_type = eWNI_SME_REGISTER_P2P_ACK_CB; |
| 6518 | msg->length = sizeof(*msg); |
| 6519 | |
| 6520 | msg->callback = callback; |
| 6521 | status = cds_send_mb_message_to_mac(msg); |
| 6522 | sme_release_global_lock(&mac_ctx->sme); |
| 6523 | return status; |
| 6524 | } |
| 6525 | return status; |
| 6526 | } |
| 6527 | |
| 6528 | /** |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 6529 | * sme_register_mgmt_frame_ind_callback() - Register a callback for |
| 6530 | * management frame indication to PE. |
| 6531 | * |
| 6532 | * @hal: hal pointer |
| 6533 | * @callback: callback pointer to be registered |
| 6534 | * |
| 6535 | * This function is used to register a callback for management |
| 6536 | * frame indication to PE. |
| 6537 | * |
| 6538 | * Return: Success if msg is posted to PE else Failure. |
| 6539 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6540 | QDF_STATUS sme_register_mgmt_frame_ind_callback(tHalHandle hal, |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 6541 | sir_mgmt_frame_ind_callback callback) |
| 6542 | { |
| 6543 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 6544 | struct sir_sme_mgmt_frame_cb_req *msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6545 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 6546 | |
| 6547 | sms_log(mac_ctx, LOG1, FL(": ENTER")); |
| 6548 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6549 | if (QDF_STATUS_SUCCESS == |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 6550 | sme_acquire_global_lock(&mac_ctx->sme)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6551 | msg = qdf_mem_malloc(sizeof(*msg)); |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 6552 | if (NULL == msg) { |
| 6553 | sms_log(mac_ctx, LOGE, |
| 6554 | FL("Not able to allocate memory for eWNI_SME_REGISTER_MGMT_FRAME_CB")); |
| 6555 | sme_release_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6556 | return QDF_STATUS_E_NOMEM; |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 6557 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6558 | qdf_mem_set(msg, sizeof(*msg), 0); |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 6559 | msg->message_type = eWNI_SME_REGISTER_MGMT_FRAME_CB; |
| 6560 | msg->length = sizeof(*msg); |
| 6561 | |
| 6562 | msg->callback = callback; |
| 6563 | status = cds_send_mb_message_to_mac(msg); |
| 6564 | sme_release_global_lock(&mac_ctx->sme); |
| 6565 | return status; |
| 6566 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6567 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 6568 | } |
| 6569 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6570 | /* --------------------------------------------------------------------------- |
| 6571 | |
| 6572 | \fn sme_RegisterMgtFrame |
| 6573 | |
| 6574 | \brief To register managment frame of specified type and subtype. |
| 6575 | \param frameType - type of the frame that needs to be passed to HDD. |
| 6576 | \param matchData - data which needs to be matched before passing frame |
| 6577 | to HDD. |
| 6578 | \param matchDataLen - Length of matched data. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6579 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6580 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6581 | QDF_STATUS sme_register_mgmt_frame(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6582 | uint16_t frameType, uint8_t *matchData, |
| 6583 | uint16_t matchLen) |
| 6584 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6585 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6586 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6587 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6588 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6589 | TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0)); |
| 6590 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6591 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6592 | tSirRegisterMgmtFrame *pMsg; |
| 6593 | uint16_t len; |
| 6594 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 6595 | |
| 6596 | if (!CSR_IS_SESSION_ANY(sessionId) && !pSession) { |
| 6597 | sms_log(pMac, LOGE, FL(" session %d not found "), |
| 6598 | sessionId); |
| 6599 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6600 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6601 | } |
| 6602 | |
| 6603 | if (!CSR_IS_SESSION_ANY(sessionId) && !pSession->sessionActive) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6604 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6605 | "%s Invalid Sessionid", __func__); |
| 6606 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6607 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6608 | } |
| 6609 | |
| 6610 | len = sizeof(tSirRegisterMgmtFrame) + matchLen; |
| 6611 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6612 | pMsg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6613 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6614 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6615 | else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6616 | qdf_mem_set(pMsg, len, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6617 | pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ; |
| 6618 | pMsg->length = len; |
| 6619 | pMsg->sessionId = sessionId; |
| 6620 | pMsg->registerFrame = true; |
| 6621 | pMsg->frameType = frameType; |
| 6622 | pMsg->matchLen = matchLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6623 | qdf_mem_copy(pMsg->matchData, matchData, matchLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6624 | status = cds_send_mb_message_to_mac(pMsg); |
| 6625 | } |
| 6626 | sme_release_global_lock(&pMac->sme); |
| 6627 | } |
| 6628 | return status; |
| 6629 | } |
| 6630 | |
| 6631 | /* --------------------------------------------------------------------------- |
| 6632 | |
| 6633 | \fn sme_DeregisterMgtFrame |
| 6634 | |
| 6635 | \brief To De-register managment frame of specified type and subtype. |
| 6636 | \param frameType - type of the frame that needs to be passed to HDD. |
| 6637 | \param matchData - data which needs to be matched before passing frame |
| 6638 | to HDD. |
| 6639 | \param matchDataLen - Length of matched data. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6640 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6641 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6642 | QDF_STATUS sme_deregister_mgmt_frame(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6643 | uint16_t frameType, uint8_t *matchData, |
| 6644 | uint16_t matchLen) |
| 6645 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6646 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6647 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6648 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6649 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6650 | TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, |
| 6651 | 0)); |
| 6652 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6653 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6654 | tSirRegisterMgmtFrame *pMsg; |
| 6655 | uint16_t len; |
| 6656 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 6657 | |
| 6658 | if (!CSR_IS_SESSION_ANY(sessionId) && !pSession) { |
| 6659 | sms_log(pMac, LOGE, FL(" session %d not found "), |
| 6660 | sessionId); |
| 6661 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6662 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6663 | } |
| 6664 | |
| 6665 | if (!CSR_IS_SESSION_ANY(sessionId) && !pSession->sessionActive) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6666 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6667 | "%s Invalid Sessionid", __func__); |
| 6668 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6669 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6670 | } |
| 6671 | |
| 6672 | len = sizeof(tSirRegisterMgmtFrame) + matchLen; |
| 6673 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6674 | pMsg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6675 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6676 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6677 | else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6678 | qdf_mem_set(pMsg, len, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6679 | pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ; |
| 6680 | pMsg->length = len; |
| 6681 | pMsg->registerFrame = false; |
| 6682 | pMsg->frameType = frameType; |
| 6683 | pMsg->matchLen = matchLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6684 | qdf_mem_copy(pMsg->matchData, matchData, matchLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6685 | status = cds_send_mb_message_to_mac(pMsg); |
| 6686 | } |
| 6687 | sme_release_global_lock(&pMac->sme); |
| 6688 | } |
| 6689 | return status; |
| 6690 | } |
| 6691 | |
| 6692 | /** |
| 6693 | * sme_remain_on_channel - API to request remain on channel for 'x' duration |
| 6694 | * |
| 6695 | * @hHal: pointer to MAC handle |
| 6696 | * @session_id: Session identifier |
| 6697 | * @channel: channel information |
| 6698 | * @duration: duration in ms |
| 6699 | * @callback: HDD registered callback to process reaminOnChannelRsp |
| 6700 | * @context: HDD Callback param |
| 6701 | * @scan_id: scan identifier |
| 6702 | * |
| 6703 | * This function process the roc request and generates scan identifier.s |
| 6704 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6705 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6706 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6707 | QDF_STATUS sme_remain_on_channel(tHalHandle hHal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6708 | uint8_t channel, uint32_t duration, |
| 6709 | remainOnChanCallback callback, |
| 6710 | void *pContext, uint8_t isP2PProbeReqAllowed, |
| 6711 | uint32_t *scan_id) |
| 6712 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6713 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6714 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hHal); |
| 6715 | uint32_t san_req_id, scan_count; |
| 6716 | struct ani_roc_req *roc_msg; |
| 6717 | cds_msg_t msg; |
| 6718 | |
| 6719 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6720 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6721 | TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, session_id, 0)); |
| 6722 | |
| 6723 | scan_count = csr_ll_count(&mac_ctx->sme.smeScanCmdActiveList); |
| 6724 | if (scan_count >= mac_ctx->scan.max_scan_count) { |
| 6725 | sms_log(mac_ctx, LOGE, FL("Max scan reached")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6726 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6727 | } |
| 6728 | |
| 6729 | wma_get_scan_id(&san_req_id); |
| 6730 | *scan_id = san_req_id; |
| 6731 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 6732 | |
| 6733 | sms_log(mac_ctx, LOG1, FL(" called")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6734 | roc_msg = qdf_mem_malloc(sizeof(struct ani_roc_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6735 | if (NULL == roc_msg) { |
| 6736 | sms_log(mac_ctx, LOGE, |
| 6737 | " scan_req: failed to allocate mem for msg"); |
| 6738 | sme_release_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6739 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6740 | } |
| 6741 | roc_msg->msg_type = eWNI_SME_ROC_CMD; |
| 6742 | roc_msg->msg_len = (uint16_t) sizeof(struct ani_roc_req); |
| 6743 | roc_msg->session_id = session_id; |
| 6744 | roc_msg->callback = callback; |
| 6745 | roc_msg->duration = duration; |
| 6746 | roc_msg->channel = channel; |
| 6747 | roc_msg->is_p2pprobe_allowed = isP2PProbeReqAllowed; |
| 6748 | roc_msg->ctx = pContext; |
| 6749 | roc_msg->scan_id = *scan_id; |
| 6750 | msg.type = eWNI_SME_ROC_CMD; |
| 6751 | msg.bodyptr = roc_msg; |
| 6752 | msg.reserved = 0; |
| 6753 | msg.bodyval = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6754 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6755 | cds_mq_post_message(CDS_MQ_ID_SME, &msg)) { |
| 6756 | sms_log(mac_ctx, LOGE, |
| 6757 | " sme_scan_req failed to post msg"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6758 | qdf_mem_free(roc_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6759 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6760 | } |
| 6761 | sme_release_global_lock(&mac_ctx->sme); |
| 6762 | return status; |
| 6763 | } |
| 6764 | |
| 6765 | /* --------------------------------------------------------------------------- |
| 6766 | \fn sme_report_probe_req |
| 6767 | \brief API to enable/disable forwarding of probeReq to apps in p2p. |
| 6768 | \param hHal - The handle returned by mac_open. |
| 6769 | \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6770 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6771 | ---------------------------------------------------------------------------*/ |
| 6772 | |
| 6773 | #ifndef WLAN_FEATURE_CONCURRENT_P2P |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6774 | QDF_STATUS sme_report_probe_req(tHalHandle hHal, uint8_t flag) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6775 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6776 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6777 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6778 | |
| 6779 | do { |
| 6780 | /* acquire the lock for the sme object */ |
| 6781 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6782 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6783 | /* call set in context */ |
| 6784 | pMac->p2pContext.probeReqForwarding = flag; |
| 6785 | /* release the lock for the sme object */ |
| 6786 | sme_release_global_lock(&pMac->sme); |
| 6787 | } |
| 6788 | } while (0); |
| 6789 | |
| 6790 | sms_log(pMac, LOGW, "exiting function %s", __func__); |
| 6791 | |
| 6792 | return status; |
| 6793 | } |
| 6794 | |
| 6795 | /* --------------------------------------------------------------------------- |
| 6796 | \fn sme_update_p2p_ie |
| 6797 | \brief API to set the P2p Ie in p2p context |
| 6798 | \param hHal - The handle returned by mac_open. |
| 6799 | \param p2pIe - Ptr to p2pIe from HDD. |
| 6800 | \param p2pIeLength: length of p2pIe |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6801 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6802 | ---------------------------------------------------------------------------*/ |
| 6803 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6804 | QDF_STATUS sme_update_p2p_ie(tHalHandle hHal, void *p2pIe, uint32_t p2pIeLength) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6805 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6806 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6807 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6808 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6809 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6810 | TRACE_CODE_SME_RX_HDD_UPDATE_P2P_IE, NO_SESSION, 0)); |
| 6811 | /* acquire the lock for the sme object */ |
| 6812 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6813 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6814 | if (NULL != pMac->p2pContext.probeRspIe) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6815 | qdf_mem_free(pMac->p2pContext.probeRspIe); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6816 | pMac->p2pContext.probeRspIeLength = 0; |
| 6817 | } |
| 6818 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6819 | pMac->p2pContext.probeRspIe = qdf_mem_malloc(p2pIeLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6820 | if (NULL == pMac->p2pContext.probeRspIe) { |
| 6821 | sms_log(pMac, LOGE, "%s: Unable to allocate P2P IE", |
| 6822 | __func__); |
| 6823 | pMac->p2pContext.probeRspIeLength = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6824 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6825 | } else { |
| 6826 | pMac->p2pContext.probeRspIeLength = p2pIeLength; |
| 6827 | |
| 6828 | sir_dump_buf(pMac, SIR_LIM_MODULE_ID, LOG2, |
| 6829 | pMac->p2pContext.probeRspIe, |
| 6830 | pMac->p2pContext.probeRspIeLength); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6831 | qdf_mem_copy((uint8_t *) pMac->p2pContext.probeRspIe, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6832 | p2pIe, p2pIeLength); |
| 6833 | } |
| 6834 | |
| 6835 | /* release the lock for the sme object */ |
| 6836 | sme_release_global_lock(&pMac->sme); |
| 6837 | } |
| 6838 | |
| 6839 | sms_log(pMac, LOG2, "exiting function %s", __func__); |
| 6840 | |
| 6841 | return status; |
| 6842 | } |
| 6843 | #endif |
| 6844 | |
| 6845 | /* --------------------------------------------------------------------------- |
| 6846 | \fn sme_send_action |
| 6847 | \brief API to send action frame from supplicant. |
| 6848 | \param hHal - The handle returned by mac_open. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6849 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6850 | ---------------------------------------------------------------------------*/ |
| 6851 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6852 | QDF_STATUS sme_send_action(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6853 | const uint8_t *pBuf, uint32_t len, |
| 6854 | uint16_t wait, bool noack, |
| 6855 | uint16_t channel_freq) |
| 6856 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6857 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6858 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6859 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6860 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6861 | TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0)); |
| 6862 | /* acquire the lock for the sme object */ |
| 6863 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6864 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6865 | p2p_send_action(hHal, sessionId, pBuf, len, wait, noack, |
| 6866 | channel_freq); |
| 6867 | /* release the lock for the sme object */ |
| 6868 | sme_release_global_lock(&pMac->sme); |
| 6869 | } |
| 6870 | |
| 6871 | sms_log(pMac, LOGW, "exiting function %s", __func__); |
| 6872 | |
| 6873 | return status; |
| 6874 | } |
| 6875 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6876 | QDF_STATUS sme_cancel_remain_on_channel(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6877 | uint8_t sessionId, uint32_t scan_id) |
| 6878 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6879 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6880 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6881 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6882 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6883 | TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, |
| 6884 | 0)); |
| 6885 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6886 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6887 | status = p2p_cancel_remain_on_channel(hHal, sessionId, scan_id); |
| 6888 | sme_release_global_lock(&pMac->sme); |
| 6889 | } |
| 6890 | return status; |
| 6891 | } |
| 6892 | |
| 6893 | /* Power Save Related */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6894 | QDF_STATUS sme_p2p_set_ps(tHalHandle hHal, tP2pPsConfig *data) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6895 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6896 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6897 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6898 | |
| 6899 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6900 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6901 | status = p2p_set_ps(hHal, data); |
| 6902 | sme_release_global_lock(&pMac->sme); |
| 6903 | } |
| 6904 | return status; |
| 6905 | } |
| 6906 | |
| 6907 | /* --------------------------------------------------------------------------- |
| 6908 | |
| 6909 | \fn sme_configure_rxp_filter |
| 6910 | |
| 6911 | \brief |
| 6912 | SME will pass this request to lower mac to set/reset the filter on RXP for |
| 6913 | multicast & broadcast traffic. |
| 6914 | |
| 6915 | \param |
| 6916 | |
| 6917 | hHal - The handle returned by mac_open. |
| 6918 | |
| 6919 | filterMask- Currently the API takes a 1 or 0 (set or reset) as filter. |
| 6920 | Basically to enable/disable the filter (to filter "all" mcbc traffic) based |
| 6921 | on this param. In future we can use this as a mask to set various types of |
| 6922 | filters as suggested below: |
| 6923 | FILTER_ALL_MULTICAST: |
| 6924 | FILTER_ALL_BROADCAST: |
| 6925 | FILTER_ALL_MULTICAST_BROADCAST: |
| 6926 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6927 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6928 | |
| 6929 | --------------------------------------------------------------------------- */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6930 | QDF_STATUS sme_configure_rxp_filter(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6931 | tpSirWlanSetRxpFilters wlanRxpFilterParam) |
| 6932 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6933 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 6934 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6935 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6936 | cds_msg_t cds_message; |
| 6937 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6938 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6939 | TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0)); |
| 6940 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6941 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6942 | /* serialize the req through MC thread */ |
| 6943 | cds_message.bodyptr = wlanRxpFilterParam; |
| 6944 | cds_message.type = WMA_CFG_RXP_FILTER_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 6945 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 6946 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6947 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 6948 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 6949 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6950 | } |
| 6951 | sme_release_global_lock(&pMac->sme); |
| 6952 | } |
| 6953 | return status; |
| 6954 | } |
| 6955 | |
| 6956 | /* --------------------------------------------------------------------------- |
| 6957 | |
| 6958 | \fn sme_configure_suspend_ind |
| 6959 | |
| 6960 | \brief |
| 6961 | SME will pass this request to lower mac to Indicate that the wlan needs to |
| 6962 | be suspended |
| 6963 | |
| 6964 | \param |
| 6965 | |
| 6966 | hHal - The handle returned by mac_open. |
| 6967 | |
| 6968 | wlanSuspendParam- Depicts the wlan suspend params |
| 6969 | |
| 6970 | csr_readyToSuspendCallback - Callback to be called when ready to suspend |
| 6971 | event is received. |
| 6972 | callback_context - Context associated with csr_readyToSuspendCallback. |
| 6973 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6974 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6975 | |
| 6976 | --------------------------------------------------------------------------- */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6977 | QDF_STATUS sme_configure_suspend_ind(tHalHandle hHal, |
Houston Hoffman | 7260ecb | 2015-10-05 18:43:07 -0700 | [diff] [blame] | 6978 | uint32_t conn_state_mask, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6979 | csr_readyToSuspendCallback callback, |
| 6980 | void *callback_context) |
| 6981 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6982 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 6983 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6984 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6985 | cds_msg_t cds_message; |
| 6986 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6987 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6988 | TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, |
| 6989 | 0)); |
| 6990 | |
| 6991 | pMac->readyToSuspendCallback = callback; |
| 6992 | pMac->readyToSuspendContext = callback_context; |
| 6993 | |
| 6994 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6995 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6996 | /* serialize the req through MC thread */ |
Houston Hoffman | 7260ecb | 2015-10-05 18:43:07 -0700 | [diff] [blame] | 6997 | cds_message.bodyval = conn_state_mask; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6998 | cds_message.type = WMA_WLAN_SUSPEND_IND; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 6999 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 7000 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7001 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 7002 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7003 | pMac->readyToSuspendCallback = NULL; |
| 7004 | pMac->readyToSuspendContext = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7005 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7006 | } |
| 7007 | sme_release_global_lock(&pMac->sme); |
| 7008 | } |
| 7009 | |
| 7010 | return status; |
| 7011 | } |
| 7012 | |
| 7013 | /* --------------------------------------------------------------------------- |
| 7014 | |
| 7015 | \fn sme_configure_resume_req |
| 7016 | |
| 7017 | \brief |
| 7018 | SME will pass this request to lower mac to Indicate that the wlan needs to |
| 7019 | be Resumed |
| 7020 | |
| 7021 | \param |
| 7022 | |
| 7023 | hHal - The handle returned by mac_open. |
| 7024 | |
| 7025 | wlanResumeParam- Depicts the wlan resume params |
| 7026 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7027 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7028 | |
| 7029 | --------------------------------------------------------------------------- */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7030 | QDF_STATUS sme_configure_resume_req(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7031 | tpSirWlanResumeParam wlanResumeParam) |
| 7032 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7033 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 7034 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7035 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7036 | cds_msg_t cds_message; |
| 7037 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7038 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7039 | TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, |
| 7040 | 0)); |
| 7041 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7042 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7043 | /* serialize the req through MC thread */ |
| 7044 | cds_message.bodyptr = wlanResumeParam; |
| 7045 | cds_message.type = WMA_WLAN_RESUME_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 7046 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 7047 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7048 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 7049 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 7050 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7051 | } |
| 7052 | sme_release_global_lock(&pMac->sme); |
| 7053 | } |
| 7054 | return status; |
| 7055 | } |
| 7056 | |
| 7057 | #ifdef WLAN_FEATURE_EXTWOW_SUPPORT |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 7058 | /** |
| 7059 | * sme_configure_ext_wow() - configure Extr WoW |
| 7060 | * @hHal - The handle returned by mac_open. |
| 7061 | * @wlanExtParams - Depicts the wlan Ext params. |
| 7062 | * @callback - ext_wow callback to be registered. |
| 7063 | * @callback_context - ext_wow callback context |
| 7064 | * |
| 7065 | * SME will pass this request to lower mac to configure Extr WoW |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7066 | * Return: QDF_STATUS |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 7067 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7068 | QDF_STATUS sme_configure_ext_wow(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7069 | tpSirExtWoWParams wlanExtParams, |
| 7070 | csr_readyToExtWoWCallback callback, |
| 7071 | void *callback_context) |
| 7072 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7073 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 7074 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7075 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7076 | cds_msg_t cds_message; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7077 | tpSirExtWoWParams MsgPtr = qdf_mem_malloc(sizeof(*MsgPtr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7078 | |
| 7079 | if (!MsgPtr) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7080 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7081 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7082 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7083 | TRACE_CODE_SME_RX_HDD_CONFIG_EXTWOW, NO_SESSION, 0)); |
| 7084 | |
| 7085 | pMac->readyToExtWoWCallback = callback; |
| 7086 | pMac->readyToExtWoWContext = callback_context; |
| 7087 | |
| 7088 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7089 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7090 | |
| 7091 | /* serialize the req through MC thread */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7092 | qdf_mem_copy(MsgPtr, wlanExtParams, sizeof(*MsgPtr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7093 | cds_message.bodyptr = MsgPtr; |
| 7094 | cds_message.type = WMA_WLAN_EXT_WOW; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7095 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 7096 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7097 | pMac->readyToExtWoWCallback = NULL; |
| 7098 | pMac->readyToExtWoWContext = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7099 | qdf_mem_free(MsgPtr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7100 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7101 | } |
| 7102 | sme_release_global_lock(&pMac->sme); |
| 7103 | } else { |
| 7104 | pMac->readyToExtWoWCallback = NULL; |
| 7105 | pMac->readyToExtWoWContext = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7106 | qdf_mem_free(MsgPtr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7107 | } |
| 7108 | |
| 7109 | return status; |
| 7110 | } |
| 7111 | |
| 7112 | /* --------------------------------------------------------------------------- |
| 7113 | |
| 7114 | \fn sme_configure_app_type1_params |
| 7115 | |
| 7116 | \brief |
| 7117 | SME will pass this request to lower mac to configure Indoor WoW parameters. |
| 7118 | |
| 7119 | \param |
| 7120 | |
| 7121 | hHal - The handle returned by mac_open. |
| 7122 | |
| 7123 | wlanAppType1Params- Depicts the wlan App Type 1(Indoor) params |
| 7124 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7125 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7126 | |
| 7127 | --------------------------------------------------------------------------- */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7128 | QDF_STATUS sme_configure_app_type1_params(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7129 | tpSirAppType1Params wlanAppType1Params) |
| 7130 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7131 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 7132 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7133 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7134 | cds_msg_t cds_message; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7135 | tpSirAppType1Params MsgPtr = qdf_mem_malloc(sizeof(*MsgPtr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7136 | |
| 7137 | if (!MsgPtr) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7138 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7139 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7140 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7141 | TRACE_CODE_SME_RX_HDD_CONFIG_APP_TYPE1, NO_SESSION, |
| 7142 | 0)); |
| 7143 | |
| 7144 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7145 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7146 | /* serialize the req through MC thread */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7147 | qdf_mem_copy(MsgPtr, wlanAppType1Params, sizeof(*MsgPtr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7148 | cds_message.bodyptr = MsgPtr; |
| 7149 | cds_message.type = WMA_WLAN_SET_APP_TYPE1_PARAMS; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7150 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 7151 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7152 | qdf_mem_free(MsgPtr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7153 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7154 | } |
| 7155 | sme_release_global_lock(&pMac->sme); |
| 7156 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7157 | qdf_mem_free(MsgPtr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7158 | } |
| 7159 | |
| 7160 | return status; |
| 7161 | } |
| 7162 | |
| 7163 | /* --------------------------------------------------------------------------- |
| 7164 | |
| 7165 | \fn sme_configure_app_type2_params |
| 7166 | |
| 7167 | \brief |
| 7168 | SME will pass this request to lower mac to configure Indoor WoW parameters. |
| 7169 | |
| 7170 | \param |
| 7171 | |
| 7172 | hHal - The handle returned by mac_open. |
| 7173 | |
| 7174 | wlanAppType2Params- Depicts the wlan App Type 2 (Outdoor) params |
| 7175 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7176 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7177 | |
| 7178 | --------------------------------------------------------------------------- */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7179 | QDF_STATUS sme_configure_app_type2_params(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7180 | tpSirAppType2Params wlanAppType2Params) |
| 7181 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7182 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 7183 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7184 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7185 | cds_msg_t cds_message; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7186 | tpSirAppType2Params MsgPtr = qdf_mem_malloc(sizeof(*MsgPtr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7187 | |
| 7188 | if (!MsgPtr) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7189 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7190 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7191 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7192 | TRACE_CODE_SME_RX_HDD_CONFIG_APP_TYPE2, NO_SESSION, |
| 7193 | 0)); |
| 7194 | |
| 7195 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7196 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7197 | /* serialize the req through MC thread */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7198 | qdf_mem_copy(MsgPtr, wlanAppType2Params, sizeof(*MsgPtr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7199 | cds_message.bodyptr = MsgPtr; |
| 7200 | cds_message.type = WMA_WLAN_SET_APP_TYPE2_PARAMS; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7201 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 7202 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7203 | qdf_mem_free(MsgPtr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7204 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7205 | } |
| 7206 | sme_release_global_lock(&pMac->sme); |
| 7207 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7208 | qdf_mem_free(MsgPtr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7209 | } |
| 7210 | |
| 7211 | return status; |
| 7212 | } |
| 7213 | #endif |
| 7214 | |
| 7215 | /* --------------------------------------------------------------------------- |
| 7216 | |
| 7217 | \fn sme_get_infra_session_id |
| 7218 | |
| 7219 | \brief To get the session ID for infra session, if connected |
| 7220 | This is a synchronous API. |
| 7221 | |
| 7222 | \param hHal - The handle returned by mac_open. |
| 7223 | |
| 7224 | \return sessionid, -1 if infra session is not connected |
| 7225 | |
| 7226 | -------------------------------------------------------------------------------*/ |
| 7227 | int8_t sme_get_infra_session_id(tHalHandle hHal) |
| 7228 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7229 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7230 | int8_t sessionid = -1; |
| 7231 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7232 | |
| 7233 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7234 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7235 | |
| 7236 | sessionid = csr_get_infra_session_id(pMac); |
| 7237 | |
| 7238 | sme_release_global_lock(&pMac->sme); |
| 7239 | } |
| 7240 | |
| 7241 | return sessionid; |
| 7242 | } |
| 7243 | |
| 7244 | /* --------------------------------------------------------------------------- |
| 7245 | |
| 7246 | \fn sme_get_infra_operation_channel |
| 7247 | |
| 7248 | \brief To get the operating channel for infra session, if connected |
| 7249 | This is a synchronous API. |
| 7250 | |
| 7251 | \param hHal - The handle returned by mac_open. |
| 7252 | \param sessionId - the sessionId returned by sme_open_session. |
| 7253 | |
| 7254 | \return operating channel, 0 if infra session is not connected |
| 7255 | |
| 7256 | -------------------------------------------------------------------------------*/ |
| 7257 | uint8_t sme_get_infra_operation_channel(tHalHandle hHal, uint8_t sessionId) |
| 7258 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7259 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7260 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7261 | uint8_t channel = 0; |
| 7262 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7263 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7264 | |
| 7265 | channel = csr_get_infra_operation_channel(pMac, sessionId); |
| 7266 | |
| 7267 | sme_release_global_lock(&pMac->sme); |
| 7268 | } |
| 7269 | |
| 7270 | return channel; |
| 7271 | } |
| 7272 | |
| 7273 | /* This routine will return poerating channel on which other BSS is operating to be used for concurrency mode. */ |
| 7274 | /* If other BSS is not up or not connected it will return 0 */ |
| 7275 | uint8_t sme_get_concurrent_operation_channel(tHalHandle hHal) |
| 7276 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7277 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7278 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7279 | uint8_t channel = 0; |
| 7280 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7281 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7282 | |
| 7283 | channel = csr_get_concurrent_operation_channel(pMac); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7284 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO_HIGH, "%s: " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7285 | " Other Concurrent Channel = %d", __func__, channel); |
| 7286 | sme_release_global_lock(&pMac->sme); |
| 7287 | } |
| 7288 | |
| 7289 | return channel; |
| 7290 | } |
| 7291 | |
| 7292 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 7293 | uint16_t sme_check_concurrent_channel_overlap(tHalHandle hHal, uint16_t sap_ch, |
| 7294 | eCsrPhyMode sapPhyMode, |
| 7295 | uint8_t cc_switch_mode) |
| 7296 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7297 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7298 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7299 | uint16_t channel = 0; |
| 7300 | |
| 7301 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7302 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7303 | channel = |
| 7304 | csr_check_concurrent_channel_overlap(pMac, sap_ch, sapPhyMode, |
| 7305 | cc_switch_mode); |
| 7306 | sme_release_global_lock(&pMac->sme); |
| 7307 | } |
| 7308 | |
| 7309 | return channel; |
| 7310 | } |
| 7311 | #endif |
| 7312 | |
| 7313 | #ifdef FEATURE_WLAN_SCAN_PNO |
Varun Reddy Yeturu | b43fda1 | 2015-09-10 18:16:21 -0700 | [diff] [blame] | 7314 | /** |
| 7315 | * sme_update_roam_pno_channel_prediction_config() - Update PNO config |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 7316 | * @csr_config: config from SME context |
Varun Reddy Yeturu | b43fda1 | 2015-09-10 18:16:21 -0700 | [diff] [blame] | 7317 | * @hal: Global Hal handle |
| 7318 | * @copy_from_to: Used to specify the source and destination |
| 7319 | * |
| 7320 | * Copy the PNO channel prediction configuration parameters from |
| 7321 | * SME context to MAC context or vice-versa |
| 7322 | * |
| 7323 | * Return: None |
| 7324 | */ |
| 7325 | void sme_update_roam_pno_channel_prediction_config( |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 7326 | tHalHandle hal, tCsrConfigParam *csr_config, |
Varun Reddy Yeturu | b43fda1 | 2015-09-10 18:16:21 -0700 | [diff] [blame] | 7327 | uint8_t copy_from_to) |
| 7328 | { |
| 7329 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 7330 | if (copy_from_to == SME_CONFIG_TO_ROAM_CONFIG) { |
| 7331 | mac_ctx->roam.configParam.pno_channel_prediction = |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 7332 | csr_config->pno_channel_prediction; |
Varun Reddy Yeturu | b43fda1 | 2015-09-10 18:16:21 -0700 | [diff] [blame] | 7333 | mac_ctx->roam.configParam.top_k_num_of_channels = |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 7334 | csr_config->top_k_num_of_channels; |
Varun Reddy Yeturu | b43fda1 | 2015-09-10 18:16:21 -0700 | [diff] [blame] | 7335 | mac_ctx->roam.configParam.stationary_thresh = |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 7336 | csr_config->stationary_thresh; |
Varun Reddy Yeturu | b43fda1 | 2015-09-10 18:16:21 -0700 | [diff] [blame] | 7337 | mac_ctx->roam.configParam.channel_prediction_full_scan = |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 7338 | csr_config->channel_prediction_full_scan; |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 7339 | mac_ctx->roam.configParam.pnoscan_adaptive_dwell_mode = |
| 7340 | csr_config->pnoscan_adaptive_dwell_mode; |
Varun Reddy Yeturu | b43fda1 | 2015-09-10 18:16:21 -0700 | [diff] [blame] | 7341 | } else if (copy_from_to == ROAM_CONFIG_TO_SME_CONFIG) { |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 7342 | csr_config->pno_channel_prediction = |
Varun Reddy Yeturu | b43fda1 | 2015-09-10 18:16:21 -0700 | [diff] [blame] | 7343 | mac_ctx->roam.configParam.pno_channel_prediction; |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 7344 | csr_config->top_k_num_of_channels = |
Varun Reddy Yeturu | b43fda1 | 2015-09-10 18:16:21 -0700 | [diff] [blame] | 7345 | mac_ctx->roam.configParam.top_k_num_of_channels; |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 7346 | csr_config->stationary_thresh = |
Varun Reddy Yeturu | b43fda1 | 2015-09-10 18:16:21 -0700 | [diff] [blame] | 7347 | mac_ctx->roam.configParam.stationary_thresh; |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 7348 | csr_config->channel_prediction_full_scan = |
Varun Reddy Yeturu | b43fda1 | 2015-09-10 18:16:21 -0700 | [diff] [blame] | 7349 | mac_ctx->roam.configParam.channel_prediction_full_scan; |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 7350 | csr_config->pnoscan_adaptive_dwell_mode = |
| 7351 | mac_ctx->roam.configParam.pnoscan_adaptive_dwell_mode; |
Varun Reddy Yeturu | b43fda1 | 2015-09-10 18:16:21 -0700 | [diff] [blame] | 7352 | } |
| 7353 | |
| 7354 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7355 | /****************************************************************************** |
| 7356 | * |
| 7357 | * Name: sme_preferred_network_found_ind |
| 7358 | * |
| 7359 | * Description: |
| 7360 | * Invoke Preferred Network Found Indication |
| 7361 | * |
| 7362 | * Parameters: |
| 7363 | * hHal - HAL handle for device |
| 7364 | * pMsg - found network description |
| 7365 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7366 | * Returns: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7367 | * |
| 7368 | ******************************************************************************/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7369 | QDF_STATUS sme_preferred_network_found_ind(tHalHandle hHal, void *pMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7370 | { |
| 7371 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7372 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7373 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = |
| 7374 | (tSirPrefNetworkFoundInd *) pMsg; |
| 7375 | uint8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1]; |
| 7376 | uint8_t ssIdLength = 0; |
| 7377 | |
| 7378 | if (NULL == pMsg) { |
| 7379 | sms_log(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7380 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7381 | } |
| 7382 | |
| 7383 | if (pMac->pnoOffload) { |
| 7384 | /* Call Preferred Network Found Indication callback routine. */ |
| 7385 | if (pMac->sme.pref_netw_found_cb != NULL) { |
| 7386 | pMac->sme.pref_netw_found_cb(pMac->sme. |
| 7387 | preferred_network_found_ind_cb_ctx, |
| 7388 | pPrefNetworkFoundInd); |
| 7389 | } |
| 7390 | return status; |
| 7391 | } |
| 7392 | |
| 7393 | if (pPrefNetworkFoundInd->ssId.length > 0) { |
| 7394 | ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH, |
| 7395 | pPrefNetworkFoundInd->ssId.length); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7396 | qdf_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7397 | ssIdLength); |
| 7398 | dumpSsId[ssIdLength] = 0; |
| 7399 | sms_log(pMac, LOG2, "%s:SSID=%s frame length %d", |
| 7400 | __func__, dumpSsId, pPrefNetworkFoundInd->frameLength); |
| 7401 | |
| 7402 | /* Flush scan results, So as to avoid indication/updation of |
| 7403 | * stale entries, which may not have aged out during APPS collapse |
| 7404 | */ |
| 7405 | sme_scan_flush_result(hHal); |
| 7406 | |
| 7407 | /* Save the frame to scan result */ |
| 7408 | if (pPrefNetworkFoundInd->mesgLen > |
| 7409 | sizeof(tSirPrefNetworkFoundInd)) { |
| 7410 | /* we may have a frame */ |
| 7411 | status = csr_scan_save_preferred_network_found(pMac, |
| 7412 | pPrefNetworkFoundInd); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7413 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7414 | sms_log(pMac, LOGE, |
| 7415 | FL(" fail to save preferred network")); |
| 7416 | } |
| 7417 | } else { |
| 7418 | sms_log(pMac, LOGE, |
| 7419 | FL(" not enough data length %d needed %zu"), |
| 7420 | pPrefNetworkFoundInd->mesgLen, |
| 7421 | sizeof(tSirPrefNetworkFoundInd)); |
| 7422 | } |
| 7423 | |
| 7424 | /* Call Preferred Netowrk Found Indication callback routine. */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7425 | if (QDF_IS_STATUS_SUCCESS(status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7426 | && (pMac->sme.pref_netw_found_cb != NULL)) { |
| 7427 | pMac->sme.pref_netw_found_cb(pMac->sme. |
| 7428 | preferred_network_found_ind_cb_ctx, |
| 7429 | pPrefNetworkFoundInd); |
| 7430 | } |
| 7431 | } else { |
| 7432 | sms_log(pMac, LOGE, "%s: callback failed - SSID is NULL", |
| 7433 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7434 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7435 | } |
| 7436 | |
| 7437 | return status; |
| 7438 | } |
| 7439 | |
| 7440 | #endif /* FEATURE_WLAN_SCAN_PNO */ |
| 7441 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 7442 | /** |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 7443 | * sme_set_tsfcb() - Set callback for TSF capture |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 7444 | * @h_hal: Handler return by mac_open |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 7445 | * @cb_fn: Callback function pointer |
| 7446 | * @db_ctx: Callback data |
| 7447 | * |
| 7448 | * Return: QDF_STATUS |
| 7449 | */ |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 7450 | QDF_STATUS sme_set_tsfcb(tHalHandle h_hal, |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 7451 | int (*cb_fn)(void *cb_ctx, struct stsf *ptsf), void *cb_ctx) |
| 7452 | { |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 7453 | tpAniSirGlobal mac = PMAC_STRUCT(h_hal); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 7454 | QDF_STATUS status; |
| 7455 | |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 7456 | status = sme_acquire_global_lock(&mac->sme); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 7457 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 7458 | mac->sme.get_tsf_cb = cb_fn; |
| 7459 | mac->sme.get_tsf_cxt = cb_ctx; |
| 7460 | sme_release_global_lock(&mac->sme); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 7461 | } |
| 7462 | return status; |
| 7463 | } |
| 7464 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 7465 | /** |
| 7466 | * sme_reset_tsfcb() - Reset callback for TSF capture |
| 7467 | * @h_hal: Handler return by mac_open |
| 7468 | * |
| 7469 | * This function reset the tsf capture callback to SME |
| 7470 | * |
| 7471 | * Return: QDF_STATUS |
| 7472 | */ |
| 7473 | QDF_STATUS sme_reset_tsfcb(tHalHandle h_hal) |
| 7474 | { |
| 7475 | tpAniSirGlobal mac; |
| 7476 | QDF_STATUS status; |
| 7477 | |
| 7478 | if (!h_hal) { |
| 7479 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7480 | FL("h_hal is not valid")); |
| 7481 | return QDF_STATUS_E_INVAL; |
| 7482 | } |
| 7483 | mac = PMAC_STRUCT(h_hal); |
| 7484 | |
| 7485 | status = sme_acquire_global_lock(&mac->sme); |
| 7486 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 7487 | mac->sme.get_tsf_cb = NULL; |
| 7488 | mac->sme.get_tsf_cxt = NULL; |
| 7489 | sme_release_global_lock(&mac->sme); |
| 7490 | } |
| 7491 | return status; |
| 7492 | } |
| 7493 | |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 7494 | #ifdef WLAN_FEATURE_TSF |
| 7495 | /* |
| 7496 | * sme_set_tsf_gpio() - set gpio pin that be toggled when capture tef |
| 7497 | * @h_hal: Handler return by mac_open |
| 7498 | * @pinvalue: gpio pin id |
| 7499 | * |
| 7500 | * Return: QDF_STATUS |
| 7501 | */ |
| 7502 | QDF_STATUS sme_set_tsf_gpio(tHalHandle h_hal, uint32_t pinvalue) |
| 7503 | { |
| 7504 | QDF_STATUS status; |
| 7505 | cds_msg_t tsf_msg = {0}; |
| 7506 | tpAniSirGlobal mac = PMAC_STRUCT(h_hal); |
| 7507 | |
| 7508 | status = sme_acquire_global_lock(&mac->sme); |
| 7509 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 7510 | tsf_msg.type = WMA_TSF_GPIO_PIN; |
| 7511 | tsf_msg.reserved = 0; |
| 7512 | tsf_msg.bodyval = pinvalue; |
| 7513 | |
| 7514 | status = cds_mq_post_message(CDS_MQ_ID_WMA, &tsf_msg); |
| 7515 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 7516 | sms_log(mac, LOGE, "Unable to post WMA_TSF_GPIO_PIN"); |
| 7517 | status = QDF_STATUS_E_FAILURE; |
| 7518 | } |
| 7519 | sme_release_global_lock(&mac->sme); |
| 7520 | } |
| 7521 | return status; |
| 7522 | } |
| 7523 | #endif |
| 7524 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7525 | QDF_STATUS sme_get_cfg_valid_channels(tHalHandle hHal, uint8_t *aValidChannels, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7526 | uint32_t *len) |
| 7527 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7528 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7529 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7530 | |
| 7531 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7532 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7533 | status = csr_get_cfg_valid_channels(pMac, aValidChannels, len); |
| 7534 | sme_release_global_lock(&pMac->sme); |
| 7535 | } |
| 7536 | |
| 7537 | return status; |
| 7538 | } |
| 7539 | |
| 7540 | /* --------------------------------------------------------------------------- |
| 7541 | |
| 7542 | \fn sme_handle_change_country_code |
| 7543 | |
| 7544 | \brief Change Country code, Reg Domain and channel list |
| 7545 | |
| 7546 | \details Country Code Priority |
| 7547 | If Supplicant country code is priority than 11d is disabled. |
| 7548 | If 11D is enabled, we update the country code after every scan. |
| 7549 | Hence when Supplicant country code is priority, we don't need 11D info. |
| 7550 | Country code from Supplicant is set as current courtry code. |
| 7551 | User can send reset command XX (instead of country code) to reset the |
| 7552 | country code to default values. |
| 7553 | If 11D is priority, |
| 7554 | Than Supplicant country code code is set to default code. But 11D code is set as current country code |
| 7555 | |
| 7556 | \param pMac - The handle returned by mac_open. |
| 7557 | \param pMsgBuf - MSG Buffer |
| 7558 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7559 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7560 | |
| 7561 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7562 | QDF_STATUS sme_handle_change_country_code(tpAniSirGlobal pMac, void *pMsgBuf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7563 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7564 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7565 | tAniChangeCountryCodeReq *pMsg; |
| 7566 | v_REGDOMAIN_t domainIdIoctl; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7567 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 7568 | static uint8_t default_country[CDS_COUNTRY_CODE_LEN + 1]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7569 | pMsg = (tAniChangeCountryCodeReq *) pMsgBuf; |
| 7570 | |
| 7571 | /* |
| 7572 | * if the reset Supplicant country code command is triggered, |
| 7573 | * enable 11D, reset the country code and return |
| 7574 | */ |
Kiran Kumar Lokere | ea85ee0 | 2016-08-26 18:09:20 -0700 | [diff] [blame] | 7575 | if (false == |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7576 | qdf_mem_cmp(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7577 | pMac->roam.configParam.Is11dSupportEnabled = |
| 7578 | pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 7579 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7580 | qdf_status = cds_read_default_country(default_country); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7581 | |
| 7582 | /* read the country code and use it */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7583 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7584 | qdf_mem_copy(pMsg->countryCode, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7585 | default_country, |
| 7586 | WNI_CFG_COUNTRY_CODE_LEN); |
| 7587 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7588 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7589 | return status; |
| 7590 | } |
| 7591 | /* |
| 7592 | * Update the 11d country to default country so that when |
| 7593 | * callback is received for this default country, driver will |
| 7594 | * not disable the 11d taking it as valid country by user. |
| 7595 | */ |
| 7596 | sms_log(pMac, LOG1, |
| 7597 | FL("Set default country code (%c%c) as invalid country received"), |
| 7598 | pMsg->countryCode[0], pMsg->countryCode[1]); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7599 | qdf_mem_copy(pMac->scan.countryCode11d, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7600 | pMsg->countryCode, |
| 7601 | WNI_CFG_COUNTRY_CODE_LEN); |
| 7602 | } else { |
| 7603 | /* if Supplicant country code has priority, disable 11d */ |
| 7604 | if (pMac->roam.configParam.fSupplicantCountryCodeHasPriority && |
| 7605 | pMsg->countryFromUserSpace) { |
| 7606 | pMac->roam.configParam.Is11dSupportEnabled = false; |
| 7607 | } |
| 7608 | } |
| 7609 | |
| 7610 | if (pMac->roam.configParam.Is11dSupportEnabled) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7611 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7612 | |
| 7613 | /* Set Current Country code and Current Regulatory domain */ |
| 7614 | status = csr_set_country_code(pMac, pMsg->countryCode); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7615 | if (QDF_STATUS_SUCCESS != status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7616 | /* Supplicant country code failed. So give 11D priority */ |
| 7617 | pMac->roam.configParam.Is11dSupportEnabled = |
| 7618 | pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 7619 | sms_log(pMac, LOGE, "Set Country Code Fail %d", status); |
| 7620 | return status; |
| 7621 | } |
| 7622 | |
| 7623 | /* overwrite the defualt country code */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7624 | qdf_mem_copy(pMac->scan.countryCodeDefault, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7625 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 7626 | |
| 7627 | /* Get Domain ID from country code */ |
| 7628 | status = csr_get_regulatory_domain_for_country(pMac, |
| 7629 | pMac->scan.countryCodeCurrent, |
| 7630 | (v_REGDOMAIN_t *) & |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 7631 | domainIdIoctl, |
| 7632 | SOURCE_QUERY); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7633 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7634 | sms_log(pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl); |
| 7635 | return status; |
| 7636 | } else if (REGDOMAIN_WORLD == domainIdIoctl) { |
| 7637 | /* Supplicant country code is invalid, so we are on world mode now. So |
| 7638 | give 11D chance to update */ |
| 7639 | pMac->roam.configParam.Is11dSupportEnabled = |
| 7640 | pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 7641 | sms_log(pMac, LOG1, FL("Country Code unrecognized by driver")); |
| 7642 | } |
| 7643 | |
| 7644 | status = wma_set_reg_domain(pMac, domainIdIoctl); |
| 7645 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7646 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7647 | sms_log(pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl); |
| 7648 | return status; |
| 7649 | } else { |
| 7650 | /* if 11d has priority, clear currentCountryBssid & countryCode11d to get */ |
| 7651 | /* set again if we find AP with 11d info during scan */ |
| 7652 | if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) { |
| 7653 | sms_log(pMac, LOGW, |
| 7654 | FL |
| 7655 | ("Clearing currentCountryBssid, countryCode11d")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7656 | qdf_mem_zero(&pMac->scan.currentCountryBssid, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7657 | sizeof(struct qdf_mac_addr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7658 | qdf_mem_zero(pMac->scan.countryCode11d, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7659 | sizeof(pMac->scan.countryCode11d)); |
| 7660 | } |
| 7661 | } |
| 7662 | |
| 7663 | if (pMsg->changeCCCallback) { |
| 7664 | ((tSmeChangeCountryCallback) (pMsg->changeCCCallback))((void *) |
| 7665 | pMsg-> |
| 7666 | pDevContext); |
| 7667 | } |
| 7668 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7669 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7670 | } |
| 7671 | |
| 7672 | /** |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 7673 | * sme_handle_generic_change_country_code() - handles country ch req |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7674 | * @mac_ctx: mac global context |
| 7675 | * @msg: request msg packet |
| 7676 | * |
| 7677 | * If Supplicant country code is priority than 11d is disabled. |
| 7678 | * If 11D is enabled, we update the country code after every scan. |
| 7679 | * Hence when Supplicant country code is priority, we don't need 11D info. |
| 7680 | * Country code from Supplicant is set as current country code. |
| 7681 | * |
| 7682 | * Return: status of operation |
| 7683 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7684 | QDF_STATUS |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 7685 | sme_handle_generic_change_country_code(tpAniSirGlobal mac_ctx, |
| 7686 | void *pMsgBuf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7687 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7688 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 7689 | v_REGDOMAIN_t reg_domain_id = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7690 | bool is_11d_country = false; |
| 7691 | bool supplicant_priority = |
| 7692 | mac_ctx->roam.configParam.fSupplicantCountryCodeHasPriority; |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 7693 | tAniGenericChangeCountryCodeReq *msg = pMsgBuf; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7694 | |
| 7695 | sms_log(mac_ctx, LOG1, FL(" called")); |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 7696 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7697 | if (memcmp(msg->countryCode, mac_ctx->scan.countryCode11d, |
| 7698 | CDS_COUNTRY_CODE_LEN) == 0) { |
| 7699 | is_11d_country = true; |
| 7700 | } |
| 7701 | /* Set the country code given by userspace when 11dOriginal is false |
| 7702 | * when 11doriginal is True,is_11d_country =0 and |
| 7703 | * fSupplicantCountryCodeHasPriority = 0, then revert the country code, |
| 7704 | * and return failure |
| 7705 | */ |
| 7706 | if (mac_ctx->roam.configParam.Is11dSupportEnabledOriginal == true |
| 7707 | && !is_11d_country && !supplicant_priority) { |
| 7708 | sms_log(mac_ctx, LOGW, |
| 7709 | FL("Incorrect country req, nullify this")); |
| 7710 | |
| 7711 | /* we have got a request for a country that should not have been |
| 7712 | * added since the STA is associated; nullify this request. If |
| 7713 | * both countryCode11d[0] and countryCode11d[1] are zero, revert |
| 7714 | * it to World domain to avoid from causing cfg80211 call trace. |
| 7715 | */ |
| 7716 | if ((mac_ctx->scan.countryCode11d[0] == 0) |
| 7717 | && (mac_ctx->scan.countryCode11d[1] == 0)) |
| 7718 | status = csr_get_regulatory_domain_for_country(mac_ctx, |
| 7719 | "00", (v_REGDOMAIN_t *) ®_domain_id, |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 7720 | SOURCE_11D); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7721 | else |
| 7722 | status = csr_get_regulatory_domain_for_country(mac_ctx, |
| 7723 | mac_ctx->scan.countryCode11d, |
| 7724 | (v_REGDOMAIN_t *) ®_domain_id, |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 7725 | SOURCE_11D); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7726 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7727 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7728 | } |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 7729 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7730 | /* if Supplicant country code has priority, disable 11d */ |
| 7731 | if (!is_11d_country && supplicant_priority) |
| 7732 | mac_ctx->roam.configParam.Is11dSupportEnabled = false; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7733 | qdf_mem_copy(mac_ctx->scan.countryCodeCurrent, msg->countryCode, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7734 | WNI_CFG_COUNTRY_CODE_LEN); |
| 7735 | status = wma_set_reg_domain(mac_ctx, reg_domain_id); |
| 7736 | if (false == is_11d_country) { |
| 7737 | /* overwrite the defualt country code */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7738 | qdf_mem_copy(mac_ctx->scan.countryCodeDefault, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7739 | mac_ctx->scan.countryCodeCurrent, |
| 7740 | WNI_CFG_COUNTRY_CODE_LEN); |
| 7741 | /* set to default domain ID */ |
| 7742 | mac_ctx->scan.domainIdDefault = mac_ctx->scan.domainIdCurrent; |
| 7743 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7744 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7745 | sms_log(mac_ctx, LOGE, FL("fail to set regId %d"), |
| 7746 | reg_domain_id); |
| 7747 | return status; |
| 7748 | } else { |
| 7749 | /* if 11d has priority, clear currentCountryBssid & |
| 7750 | * countryCode11d to get set again if we find AP with 11d info |
| 7751 | * during scan |
| 7752 | */ |
| 7753 | if (!supplicant_priority && (false == is_11d_country)) { |
| 7754 | sms_log(mac_ctx, LOGW, |
| 7755 | FL("Clearing currentCountryBssid, countryCode11d")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7756 | qdf_mem_zero(&mac_ctx->scan.currentCountryBssid, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7757 | sizeof(struct qdf_mac_addr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7758 | qdf_mem_zero(mac_ctx->scan.countryCode11d, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7759 | sizeof(mac_ctx->scan.countryCode11d)); |
| 7760 | } |
| 7761 | } |
| 7762 | /* get the channels based on new cc */ |
| 7763 | status = csr_get_channel_and_power_list(mac_ctx); |
| 7764 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7765 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7766 | sms_log(mac_ctx, LOGE, FL("fail to get Channels")); |
| 7767 | return status; |
| 7768 | } |
| 7769 | /* reset info based on new cc, and we are done */ |
| 7770 | csr_apply_channel_power_info_wrapper(mac_ctx); |
| 7771 | |
| 7772 | /* Country code Changed, Purge Only scan result |
| 7773 | * which does not have channel number belong to 11d |
| 7774 | * channel list |
| 7775 | */ |
| 7776 | csr_scan_filter_results(mac_ctx); |
| 7777 | /* Do active scans after the country is set by User hints or |
| 7778 | * Country IE |
| 7779 | */ |
| 7780 | mac_ctx->scan.curScanType = eSIR_ACTIVE_SCAN; |
| 7781 | sme_disconnect_connected_sessions(mac_ctx); |
| 7782 | sms_log(mac_ctx, LOG1, FL(" returned")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7783 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7784 | } |
| 7785 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7786 | static bool |
| 7787 | sme_search_in_base_ch_lst(tpAniSirGlobal mac_ctx, uint8_t curr_ch) |
| 7788 | { |
| 7789 | uint8_t i; |
| 7790 | tCsrChannel *ch_lst_info; |
| 7791 | ch_lst_info = &mac_ctx->scan.base_channels; |
| 7792 | for (i = 0; i < ch_lst_info->numChannels; i++) { |
| 7793 | if (ch_lst_info->channelList[i] == curr_ch) |
| 7794 | return true; |
| 7795 | } |
| 7796 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7797 | return false; |
| 7798 | } |
| 7799 | /** |
| 7800 | * sme_disconnect_connected_sessions() - Disconnect STA and P2P client session |
| 7801 | * if channel is not supported |
| 7802 | * @mac_ctx: mac global context |
| 7803 | * |
| 7804 | * If new country code does not support the channel on which STA/P2P client |
| 7805 | * is connetced, it sends the disconnect to the AP/P2P GO |
| 7806 | * |
| 7807 | * Return: void |
| 7808 | */ |
| 7809 | void sme_disconnect_connected_sessions(tpAniSirGlobal mac_ctx) |
| 7810 | { |
| 7811 | uint8_t session_id, found = false; |
| 7812 | uint8_t curr_ch; |
| 7813 | |
| 7814 | for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) { |
| 7815 | if (!csr_is_session_client_and_connected(mac_ctx, session_id)) |
| 7816 | continue; |
| 7817 | found = false; |
| 7818 | /* Session is connected.Check the channel */ |
| 7819 | curr_ch = csr_get_infra_operation_channel(mac_ctx, |
| 7820 | session_id); |
| 7821 | sms_log(mac_ctx, LOGW, |
| 7822 | FL("Current Operating channel : %d, session :%d"), |
| 7823 | curr_ch, session_id); |
| 7824 | found = sme_search_in_base_ch_lst(mac_ctx, curr_ch); |
| 7825 | if (!found) { |
| 7826 | sms_log(mac_ctx, LOGW, FL("Disconnect Session :%d"), |
| 7827 | session_id); |
| 7828 | csr_roam_disconnect(mac_ctx, session_id, |
| 7829 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 7830 | } |
| 7831 | } |
| 7832 | } |
| 7833 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7834 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7835 | QDF_STATUS sme_8023_multicast_list(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7836 | tpSirRcvFltMcAddrList pMulticastAddrs) |
| 7837 | { |
| 7838 | tpSirRcvFltMcAddrList request_buf; |
| 7839 | cds_msg_t msg; |
| 7840 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7841 | tCsrRoamSession *pSession = NULL; |
| 7842 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7843 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, "%s: " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7844 | "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__, |
| 7845 | pMulticastAddrs->ulMulticastAddrCnt, |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 7846 | pMulticastAddrs->multicastAddr[0].bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7847 | |
Ravi Joshi | 4f447cb | 2016-07-19 13:42:01 -0700 | [diff] [blame] | 7848 | /* Find the connected Infra / P2P_client connected session */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7849 | if (CSR_IS_SESSION_VALID(pMac, sessionId) && |
Ravi Joshi | 4f447cb | 2016-07-19 13:42:01 -0700 | [diff] [blame] | 7850 | (csr_is_conn_state_infra(pMac, sessionId) || |
| 7851 | csr_is_ndi_started(pMac, sessionId))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7852 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 7853 | } |
| 7854 | |
| 7855 | if (pSession == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7856 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_WARN, |
Srinivas Girigowda | f2599dd | 2015-11-16 18:20:46 -0800 | [diff] [blame] | 7857 | "%s: Unable to find the session Id: %d", __func__, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7858 | sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7859 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7860 | } |
| 7861 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7862 | request_buf = qdf_mem_malloc(sizeof(tSirRcvFltMcAddrList)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7863 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7864 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7865 | "%s: Not able to " |
| 7866 | "allocate memory for 8023 Multicast List request", |
| 7867 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7868 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7869 | } |
| 7870 | |
Ravi Joshi | 4f447cb | 2016-07-19 13:42:01 -0700 | [diff] [blame] | 7871 | if (!csr_is_conn_state_connected_infra(pMac, sessionId) && |
| 7872 | !csr_is_ndi_started(pMac, sessionId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7873 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Ravi Joshi | 4f447cb | 2016-07-19 13:42:01 -0700 | [diff] [blame] | 7874 | "%s: Request ignored, session %d is not connected or started", |
| 7875 | __func__, sessionId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7876 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7877 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7878 | } |
| 7879 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7880 | qdf_mem_copy(request_buf, pMulticastAddrs, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7881 | sizeof(tSirRcvFltMcAddrList)); |
| 7882 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 7883 | qdf_copy_macaddr(&request_buf->self_macaddr, &pSession->selfMacAddr); |
| 7884 | qdf_copy_macaddr(&request_buf->bssid, |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 7885 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7886 | |
| 7887 | msg.type = WMA_8023_MULTICAST_LIST_REQ; |
| 7888 | msg.reserved = 0; |
| 7889 | msg.bodyptr = request_buf; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 7890 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 7891 | sessionId, msg.type)); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7892 | if (QDF_STATUS_SUCCESS != cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7893 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7894 | "%s: Not able to " |
| 7895 | "post WMA_8023_MULTICAST_LIST message to WMA", |
| 7896 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7897 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7898 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7899 | } |
| 7900 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7901 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7902 | } |
| 7903 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7904 | QDF_STATUS sme_receive_filter_set_filter(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7905 | tpSirRcvPktFilterCfgType pRcvPktFilterCfg, |
| 7906 | uint8_t sessionId) |
| 7907 | { |
| 7908 | tpSirRcvPktFilterCfgType request_buf; |
| 7909 | int32_t allocSize; |
| 7910 | cds_msg_t msg; |
| 7911 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7912 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 7913 | uint8_t idx = 0; |
| 7914 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7915 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, "%s: filterType=%d, " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7916 | "filterId = %d", __func__, |
| 7917 | pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId); |
| 7918 | |
| 7919 | allocSize = sizeof(tSirRcvPktFilterCfgType); |
| 7920 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7921 | request_buf = qdf_mem_malloc(allocSize); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7922 | |
| 7923 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7924 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7925 | "%s: Not able to " |
| 7926 | "allocate memory for Receive Filter Set Filter request", |
| 7927 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7928 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7929 | } |
| 7930 | |
| 7931 | if (NULL == pSession) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7932 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7933 | "%s: Session Not found ", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7934 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7935 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7936 | } |
| 7937 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 7938 | qdf_copy_macaddr(&pRcvPktFilterCfg->self_macaddr, |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 7939 | &pSession->selfMacAddr); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 7940 | qdf_copy_macaddr(&pRcvPktFilterCfg->bssid, |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 7941 | &pSession->connectedProfile.bssid); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7942 | qdf_mem_copy(request_buf, pRcvPktFilterCfg, allocSize); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7943 | |
| 7944 | msg.type = WMA_RECEIVE_FILTER_SET_FILTER_REQ; |
| 7945 | msg.reserved = 0; |
| 7946 | msg.bodyptr = request_buf; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 7947 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 7948 | sessionId, msg.type)); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7949 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, "Pkt Flt Req : " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7950 | "FT %d FID %d ", |
| 7951 | request_buf->filterType, request_buf->filterId); |
| 7952 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7953 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, "Pkt Flt Req : " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7954 | "params %d CT %d", |
| 7955 | request_buf->numFieldParams, request_buf->coalesceTime); |
| 7956 | |
| 7957 | for (idx = 0; idx < request_buf->numFieldParams; idx++) { |
| 7958 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7959 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7960 | "Proto %d Comp Flag %d ", |
| 7961 | request_buf->paramsData[idx].protocolLayer, |
| 7962 | request_buf->paramsData[idx].cmpFlag); |
| 7963 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7964 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7965 | "Data Offset %d Data Len %d", |
| 7966 | request_buf->paramsData[idx].dataOffset, |
| 7967 | request_buf->paramsData[idx].dataLength); |
| 7968 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7969 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7970 | "CData: %d:%d:%d:%d:%d:%d", |
| 7971 | request_buf->paramsData[idx].compareData[0], |
| 7972 | request_buf->paramsData[idx].compareData[1], |
| 7973 | request_buf->paramsData[idx].compareData[2], |
| 7974 | request_buf->paramsData[idx].compareData[3], |
| 7975 | request_buf->paramsData[idx].compareData[4], |
| 7976 | request_buf->paramsData[idx].compareData[5]); |
| 7977 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7978 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7979 | "MData: %d:%d:%d:%d:%d:%d", |
| 7980 | request_buf->paramsData[idx].dataMask[0], |
| 7981 | request_buf->paramsData[idx].dataMask[1], |
| 7982 | request_buf->paramsData[idx].dataMask[2], |
| 7983 | request_buf->paramsData[idx].dataMask[3], |
| 7984 | request_buf->paramsData[idx].dataMask[4], |
| 7985 | request_buf->paramsData[idx].dataMask[5]); |
| 7986 | |
| 7987 | } |
| 7988 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7989 | if (QDF_STATUS_SUCCESS != cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7990 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7991 | "%s: Not able to post " |
| 7992 | "WMA_RECEIVE_FILTER_SET_FILTER message to WMA", |
| 7993 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7994 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7995 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7996 | } |
| 7997 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7998 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7999 | } |
| 8000 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8001 | QDF_STATUS sme_receive_filter_clear_filter(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8002 | tpSirRcvFltPktClearParam |
| 8003 | pRcvFltPktClearParam, uint8_t sessionId) |
| 8004 | { |
| 8005 | tpSirRcvFltPktClearParam request_buf; |
| 8006 | cds_msg_t msg; |
| 8007 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8008 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 8009 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8010 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, "%s: filterId = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8011 | __func__, pRcvFltPktClearParam->filterId); |
| 8012 | |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 8013 | if (NULL == pSession) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8014 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 8015 | "%s: Session Not found", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8016 | return QDF_STATUS_E_FAILURE; |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 8017 | } |
| 8018 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8019 | request_buf = qdf_mem_malloc(sizeof(tSirRcvFltPktClearParam)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8020 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8021 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8022 | "%s: Not able to allocate memory for Receive Filter " |
| 8023 | "Clear Filter request", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8024 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8025 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8026 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 8027 | qdf_copy_macaddr(&pRcvFltPktClearParam->self_macaddr, |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 8028 | &pSession->selfMacAddr); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 8029 | qdf_copy_macaddr(&pRcvFltPktClearParam->bssid, |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 8030 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8031 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8032 | qdf_mem_copy(request_buf, pRcvFltPktClearParam, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8033 | sizeof(tSirRcvFltPktClearParam)); |
| 8034 | |
| 8035 | msg.type = WMA_RECEIVE_FILTER_CLEAR_FILTER_REQ; |
| 8036 | msg.reserved = 0; |
| 8037 | msg.bodyptr = request_buf; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 8038 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 8039 | sessionId, msg.type)); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 8040 | if (QDF_STATUS_SUCCESS != cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8041 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8042 | "%s: Not able to post " |
| 8043 | "WMA_RECEIVE_FILTER_CLEAR_FILTER message to WMA", |
| 8044 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8045 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8046 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8047 | } |
| 8048 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8049 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8050 | } |
| 8051 | #endif /* WLAN_FEATURE_PACKET_FILTERING */ |
| 8052 | |
| 8053 | /* --------------------------------------------------------------------------- |
| 8054 | |
| 8055 | \fn sme_is_channel_valid |
| 8056 | |
| 8057 | \brief To check if the channel is valid for currently established domain |
| 8058 | This is a synchronous API. |
| 8059 | |
| 8060 | \param hHal - The handle returned by mac_open. |
| 8061 | \param channel - channel to verify |
| 8062 | |
| 8063 | \return true/false, true if channel is valid |
| 8064 | |
| 8065 | -------------------------------------------------------------------------------*/ |
| 8066 | bool sme_is_channel_valid(tHalHandle hHal, uint8_t channel) |
| 8067 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8068 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8069 | bool valid = false; |
| 8070 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8071 | |
| 8072 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8073 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8074 | |
| 8075 | valid = csr_roam_is_channel_valid(pMac, channel); |
| 8076 | |
| 8077 | sme_release_global_lock(&pMac->sme); |
| 8078 | } |
| 8079 | |
| 8080 | return valid; |
| 8081 | } |
| 8082 | |
| 8083 | /* --------------------------------------------------------------------------- |
| 8084 | \fn sme_set_freq_band |
| 8085 | \brief Used to set frequency band. |
| 8086 | \param hHal |
| 8087 | \param sessionId - Session Identifier |
| 8088 | \eBand band value to be configured |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8089 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8090 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8091 | QDF_STATUS sme_set_freq_band(tHalHandle hHal, uint8_t sessionId, eCsrBand eBand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8092 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8093 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8094 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8095 | |
| 8096 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8097 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8098 | status = csr_set_band(hHal, sessionId, eBand); |
| 8099 | sme_release_global_lock(&pMac->sme); |
| 8100 | } |
| 8101 | return status; |
| 8102 | } |
| 8103 | |
| 8104 | /* --------------------------------------------------------------------------- |
| 8105 | \fn sme_get_freq_band |
| 8106 | \brief Used to get the current band settings. |
| 8107 | \param hHal |
| 8108 | \pBand pointer to hold band value |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8109 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8110 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8111 | QDF_STATUS sme_get_freq_band(tHalHandle hHal, eCsrBand *pBand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8112 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8113 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8114 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8115 | |
| 8116 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8117 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8118 | *pBand = csr_get_current_band(hHal); |
| 8119 | sme_release_global_lock(&pMac->sme); |
| 8120 | } |
| 8121 | return status; |
| 8122 | } |
| 8123 | |
| 8124 | /* --------------------------------------------------------------------------- |
| 8125 | \fn sme_set_max_tx_power_per_band |
| 8126 | |
| 8127 | \brief Set the Maximum Transmit Power specific to band dynamically. |
| 8128 | Note: this setting will not persist over reboots. |
| 8129 | |
| 8130 | \param band |
| 8131 | \param power to set in dB |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8132 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8133 | |
| 8134 | ----------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8135 | QDF_STATUS sme_set_max_tx_power_per_band(eCsrBand band, int8_t dB) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8136 | { |
| 8137 | cds_msg_t msg; |
| 8138 | tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL; |
| 8139 | |
| 8140 | pMaxTxPowerPerBandParams = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8141 | qdf_mem_malloc(sizeof(tMaxTxPowerPerBandParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8142 | if (NULL == pMaxTxPowerPerBandParams) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8143 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8144 | "%s:Not able to allocate memory for pMaxTxPowerPerBandParams", |
| 8145 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8146 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8147 | } |
| 8148 | |
| 8149 | pMaxTxPowerPerBandParams->power = dB; |
| 8150 | pMaxTxPowerPerBandParams->bandInfo = band; |
| 8151 | |
| 8152 | msg.type = WMA_SET_MAX_TX_POWER_PER_BAND_REQ; |
| 8153 | msg.reserved = 0; |
| 8154 | msg.bodyptr = pMaxTxPowerPerBandParams; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 8155 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 8156 | NO_SESSION, msg.type)); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 8157 | if (QDF_STATUS_SUCCESS != cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8158 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8159 | "%s:Not able to post WMA_SET_MAX_TX_POWER_PER_BAND_REQ", |
| 8160 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8161 | qdf_mem_free(pMaxTxPowerPerBandParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8162 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8163 | } |
| 8164 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8165 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8166 | } |
| 8167 | |
| 8168 | /* --------------------------------------------------------------------------- |
| 8169 | |
| 8170 | \fn sme_set_max_tx_power |
| 8171 | |
| 8172 | \brief Set the Maximum Transmit Power dynamically. Note: this setting will |
| 8173 | not persist over reboots. |
| 8174 | |
| 8175 | \param hHal |
| 8176 | \param pBssid BSSID to set the power cap for |
| 8177 | \param pBssid pSelfMacAddress self MAC Address |
| 8178 | \param pBssid power to set in dB |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8179 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8180 | |
| 8181 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 8182 | QDF_STATUS sme_set_max_tx_power(tHalHandle hHal, struct qdf_mac_addr pBssid, |
| 8183 | struct qdf_mac_addr pSelfMacAddress, int8_t dB) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8184 | { |
| 8185 | cds_msg_t msg; |
| 8186 | tpMaxTxPowerParams pMaxTxParams = NULL; |
| 8187 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8188 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8189 | TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8190 | pMaxTxParams = qdf_mem_malloc(sizeof(tMaxTxPowerParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8191 | if (NULL == pMaxTxParams) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8192 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8193 | "%s: Not able to allocate memory for pMaxTxParams", |
| 8194 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8195 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8196 | } |
| 8197 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 8198 | qdf_copy_macaddr(&pMaxTxParams->bssId, &pBssid); |
| 8199 | qdf_copy_macaddr(&pMaxTxParams->selfStaMacAddr, &pSelfMacAddress); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8200 | pMaxTxParams->power = dB; |
| 8201 | |
| 8202 | msg.type = WMA_SET_MAX_TX_POWER_REQ; |
| 8203 | msg.reserved = 0; |
| 8204 | msg.bodyptr = pMaxTxParams; |
| 8205 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 8206 | if (QDF_STATUS_SUCCESS != cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8207 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8208 | "%s: Not able to post WMA_SET_MAX_TX_POWER_REQ message to WMA", |
| 8209 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8210 | qdf_mem_free(pMaxTxParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8211 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8212 | } |
| 8213 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8214 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8215 | } |
| 8216 | |
| 8217 | /* --------------------------------------------------------------------------- |
| 8218 | |
| 8219 | \fn sme_set_custom_mac_addr |
| 8220 | |
| 8221 | \brief Set the customer Mac Address. |
| 8222 | |
| 8223 | \param customMacAddr customer MAC Address |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8224 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8225 | |
| 8226 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8227 | QDF_STATUS sme_set_custom_mac_addr(tSirMacAddr customMacAddr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8228 | { |
| 8229 | cds_msg_t msg; |
| 8230 | tSirMacAddr *pBaseMacAddr; |
| 8231 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8232 | pBaseMacAddr = qdf_mem_malloc(sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8233 | if (NULL == pBaseMacAddr) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8234 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8235 | FL("Not able to allocate memory for pBaseMacAddr")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8236 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8237 | } |
| 8238 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8239 | qdf_mem_copy(*pBaseMacAddr, customMacAddr, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8240 | |
| 8241 | msg.type = SIR_HAL_SET_BASE_MACADDR_IND; |
| 8242 | msg.reserved = 0; |
| 8243 | msg.bodyptr = pBaseMacAddr; |
| 8244 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 8245 | if (QDF_STATUS_SUCCESS != cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8246 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8247 | FL |
| 8248 | ("Not able to post SIR_HAL_SET_BASE_MACADDR_IND message to WMA")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8249 | qdf_mem_free(pBaseMacAddr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8250 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8251 | } |
| 8252 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8253 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8254 | } |
| 8255 | |
| 8256 | /* ---------------------------------------------------------------------------- |
| 8257 | \fn sme_set_tx_power |
| 8258 | \brief Set Transmit Power dynamically. |
| 8259 | \param hHal |
| 8260 | \param sessionId Target Session ID |
| 8261 | \pBSSId BSSID |
| 8262 | \dev_mode dev_mode such as station, P2PGO, SAP |
| 8263 | \param dBm power to set |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8264 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8265 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8266 | QDF_STATUS sme_set_tx_power(tHalHandle hHal, uint8_t sessionId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 8267 | struct qdf_mac_addr pBSSId, |
| 8268 | enum tQDF_ADAPTER_MODE dev_mode, int dBm) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8269 | { |
| 8270 | cds_msg_t msg; |
| 8271 | tpMaxTxPowerParams pTxParams = NULL; |
| 8272 | int8_t power = (int8_t) dBm; |
| 8273 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8274 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8275 | TRACE_CODE_SME_RX_HDD_SET_TXPOW, sessionId, 0)); |
| 8276 | |
| 8277 | /* make sure there is no overflow */ |
| 8278 | if ((int)power != dBm) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8279 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8280 | "%s: error, invalid power = %d", __func__, dBm); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8281 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8282 | } |
| 8283 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8284 | pTxParams = qdf_mem_malloc(sizeof(tMaxTxPowerParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8285 | if (NULL == pTxParams) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8286 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8287 | "%s: Not able to allocate memory for pTxParams", |
| 8288 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8289 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8290 | } |
| 8291 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 8292 | qdf_copy_macaddr(&pTxParams->bssId, &pBSSId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8293 | pTxParams->power = power; /* unit is dBm */ |
| 8294 | pTxParams->dev_mode = dev_mode; |
| 8295 | msg.type = WMA_SET_TX_POWER_REQ; |
| 8296 | msg.reserved = 0; |
| 8297 | msg.bodyptr = pTxParams; |
| 8298 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 8299 | if (QDF_STATUS_SUCCESS != cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8300 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8301 | "%s: failed to post WMA_SET_TX_POWER_REQ to WMA", |
| 8302 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8303 | qdf_mem_free(pTxParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8304 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8305 | } |
| 8306 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8307 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8308 | } |
| 8309 | |
| 8310 | /* --------------------------------------------------------------------------- |
| 8311 | |
| 8312 | \fn sme_hide_ssid |
| 8313 | |
| 8314 | \brief hide/show SSID dynamically. Note: this setting will |
| 8315 | not persist over reboots. |
| 8316 | |
| 8317 | \param hHal |
| 8318 | \param sessionId |
| 8319 | \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8320 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8321 | |
| 8322 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8323 | QDF_STATUS sme_hide_ssid(tHalHandle hHal, uint8_t sessionId, uint8_t ssidHidden) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8324 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8325 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8326 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8327 | uint16_t len; |
| 8328 | |
| 8329 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8330 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8331 | tpSirUpdateParams pMsg; |
| 8332 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 8333 | |
| 8334 | if (!pSession) { |
| 8335 | sms_log(pMac, LOGE, FL(" session %d not found "), |
| 8336 | sessionId); |
| 8337 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8338 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8339 | } |
| 8340 | |
| 8341 | if (!pSession->sessionActive) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8342 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8343 | |
| 8344 | /* Create the message and send to lim */ |
| 8345 | len = sizeof(tSirUpdateParams); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8346 | pMsg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8347 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8348 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8349 | else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8350 | qdf_mem_set(pMsg, sizeof(tSirUpdateParams), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8351 | pMsg->messageType = eWNI_SME_HIDE_SSID_REQ; |
| 8352 | pMsg->length = len; |
| 8353 | /* Data starts from here */ |
| 8354 | pMsg->sessionId = sessionId; |
| 8355 | pMsg->ssidHidden = ssidHidden; |
| 8356 | status = cds_send_mb_message_to_mac(pMsg); |
| 8357 | } |
| 8358 | sme_release_global_lock(&pMac->sme); |
| 8359 | } |
| 8360 | return status; |
| 8361 | } |
| 8362 | |
| 8363 | /* --------------------------------------------------------------------------- |
| 8364 | |
| 8365 | \fn sme_set_tm_level |
| 8366 | \brief Set Thermal Mitigation Level to RIVA |
| 8367 | \param hHal - The handle returned by mac_open. |
| 8368 | \param newTMLevel - new Thermal Mitigation Level |
| 8369 | \param tmMode - Thermal Mitigation handle mode, default 0 |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8370 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8371 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8372 | QDF_STATUS sme_set_tm_level(tHalHandle hHal, uint16_t newTMLevel, uint16_t tmMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8373 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8374 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 8375 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8376 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8377 | cds_msg_t cds_message; |
| 8378 | tAniSetTmLevelReq *setTmLevelReq = NULL; |
| 8379 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8380 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8381 | TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0)); |
| 8382 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8383 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8384 | setTmLevelReq = |
| 8385 | (tAniSetTmLevelReq *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8386 | qdf_mem_malloc(sizeof(tAniSetTmLevelReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8387 | if (NULL == setTmLevelReq) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8388 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8389 | "%s: Not able to allocate memory for sme_set_tm_level", |
| 8390 | __func__); |
| 8391 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8392 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8393 | } |
| 8394 | |
| 8395 | setTmLevelReq->tmMode = tmMode; |
| 8396 | setTmLevelReq->newTmLevel = newTMLevel; |
| 8397 | |
| 8398 | /* serialize the req through MC thread */ |
| 8399 | cds_message.bodyptr = setTmLevelReq; |
| 8400 | cds_message.type = WMA_SET_TM_LEVEL_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 8401 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 8402 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8403 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 8404 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8405 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8406 | "%s: Post Set TM Level MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8407 | qdf_mem_free(setTmLevelReq); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8408 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8409 | } |
| 8410 | sme_release_global_lock(&pMac->sme); |
| 8411 | } |
| 8412 | return status; |
| 8413 | } |
| 8414 | |
| 8415 | /*--------------------------------------------------------------------------- |
| 8416 | |
| 8417 | \brief sme_feature_caps_exchange() - SME interface to exchange capabilities between |
| 8418 | Host and FW. |
| 8419 | |
| 8420 | \param hHal - HAL handle for device |
| 8421 | |
| 8422 | \return NONE |
| 8423 | |
| 8424 | ---------------------------------------------------------------------------*/ |
| 8425 | void sme_feature_caps_exchange(tHalHandle hHal) |
| 8426 | { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8427 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 8428 | (QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8429 | 0)); |
| 8430 | } |
| 8431 | |
| 8432 | /*--------------------------------------------------------------------------- |
| 8433 | |
| 8434 | \brief sme_disable_feature_capablity() - SME interface to disable Active mode offload capablity |
| 8435 | in Host. |
| 8436 | |
| 8437 | \param hHal - HAL handle for device |
| 8438 | |
| 8439 | \return NONE |
| 8440 | |
| 8441 | ---------------------------------------------------------------------------*/ |
| 8442 | void sme_disable_feature_capablity(uint8_t feature_index) |
| 8443 | { |
| 8444 | } |
| 8445 | |
| 8446 | /* --------------------------------------------------------------------------- |
| 8447 | \fn sme_reset_power_values_for5_g |
| 8448 | \brief Reset the power values for 5G band with default power values. |
| 8449 | \param hHal - HAL handle for device |
| 8450 | \- return NONE |
| 8451 | -------------------------------------------------------------------------*/ |
| 8452 | void sme_reset_power_values_for5_g(tHalHandle hHal) |
| 8453 | { |
| 8454 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8455 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8456 | TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0)); |
| 8457 | csr_save_channel_power_for_band(pMac, true); |
| 8458 | csr_apply_power2_current(pMac); /* Store the channel+power info in the global place: Cfg */ |
| 8459 | } |
| 8460 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8461 | /* --------------------------------------------------------------------------- |
| 8462 | \fn sme_update_roam_prefer5_g_hz |
| 8463 | \brief enable/disable Roam prefer 5G runtime option |
| 8464 | This function is called through dynamic setConfig callback function |
| 8465 | to configure the Roam prefer 5G runtime option |
| 8466 | \param hHal - HAL handle for device |
| 8467 | \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option |
| 8468 | \- return Success or failure |
| 8469 | -------------------------------------------------------------------------*/ |
| 8470 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8471 | QDF_STATUS sme_update_roam_prefer5_g_hz(tHalHandle hHal, bool nRoamPrefer5GHz) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8472 | { |
| 8473 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8474 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8475 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8476 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8477 | TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0)); |
| 8478 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8479 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8480 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8481 | "%s: gRoamPrefer5GHz is changed from %d to %d", |
| 8482 | __func__, pMac->roam.configParam.nRoamPrefer5GHz, |
| 8483 | nRoamPrefer5GHz); |
| 8484 | pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz; |
| 8485 | sme_release_global_lock(&pMac->sme); |
| 8486 | } |
| 8487 | |
| 8488 | return status; |
| 8489 | } |
| 8490 | |
| 8491 | /* --------------------------------------------------------------------------- |
| 8492 | \fn sme_set_roam_intra_band |
| 8493 | \brief enable/disable Intra band roaming |
| 8494 | This function is called through dynamic setConfig callback function |
| 8495 | to configure the intra band roaming |
| 8496 | \param hHal - HAL handle for device |
| 8497 | \param nRoamIntraBand Enable/Disable Intra band roaming |
| 8498 | \- return Success or failure |
| 8499 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8500 | QDF_STATUS sme_set_roam_intra_band(tHalHandle hHal, const bool nRoamIntraBand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8501 | { |
| 8502 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8503 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8504 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8505 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8506 | TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0)); |
| 8507 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8508 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8509 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8510 | "%s: gRoamIntraBand is changed from %d to %d", |
| 8511 | __func__, pMac->roam.configParam.nRoamIntraBand, |
| 8512 | nRoamIntraBand); |
| 8513 | pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand; |
| 8514 | sme_release_global_lock(&pMac->sme); |
| 8515 | } |
| 8516 | |
| 8517 | return status; |
| 8518 | } |
| 8519 | |
| 8520 | /* --------------------------------------------------------------------------- |
| 8521 | \fn sme_update_roam_scan_n_probes |
| 8522 | \brief function to update roam scan N probes |
| 8523 | This function is called through dynamic setConfig callback function |
| 8524 | to update roam scan N probes |
| 8525 | \param hHal - HAL handle for device |
| 8526 | \param sessionId - Session Identifier |
| 8527 | \param nProbes number of probe requests to be sent out |
| 8528 | \- return Success or failure |
| 8529 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8530 | QDF_STATUS sme_update_roam_scan_n_probes(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8531 | const uint8_t nProbes) |
| 8532 | { |
| 8533 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8534 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8535 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8536 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8537 | TRACE_CODE_SME_RX_HDD_UPDATE_ROAM_SCAN_N_PROBES, |
| 8538 | NO_SESSION, 0)); |
| 8539 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8540 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8541 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8542 | "%s: gRoamScanNProbes is changed from %d to %d", |
| 8543 | __func__, pMac->roam.configParam.nProbes, nProbes); |
| 8544 | pMac->roam.configParam.nProbes = nProbes; |
| 8545 | sme_release_global_lock(&pMac->sme); |
| 8546 | } |
| 8547 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 8548 | csr_roam_offload_scan(pMac, sessionId, |
| 8549 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 8550 | REASON_NPROBES_CHANGED); |
| 8551 | } |
| 8552 | return status; |
| 8553 | } |
| 8554 | |
| 8555 | /* --------------------------------------------------------------------------- |
| 8556 | \fn sme_update_roam_scan_home_away_time |
| 8557 | \brief function to update roam scan Home away time |
| 8558 | This function is called through dynamic setConfig callback function |
| 8559 | to update roam scan home away time |
| 8560 | \param hHal - HAL handle for device |
| 8561 | \param sessionId - Session Identifier |
| 8562 | \param nRoamScanAwayTime Scan home away time |
| 8563 | \param bSendOffloadCmd If true then send offload command to firmware |
| 8564 | If false then command is not sent to firmware |
| 8565 | \- return Success or failure |
| 8566 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8567 | QDF_STATUS sme_update_roam_scan_home_away_time(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8568 | uint8_t sessionId, |
| 8569 | const uint16_t nRoamScanHomeAwayTime, |
| 8570 | const bool bSendOffloadCmd) |
| 8571 | { |
| 8572 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8573 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8574 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8575 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8576 | TRACE_CODE_SME_RX_HDD_UPDATE_ROAM_SCAN_HOME_AWAY_TIME, |
| 8577 | NO_SESSION, 0)); |
| 8578 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8579 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8580 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8581 | "%s: gRoamScanHomeAwayTime is changed from %d to %d", |
| 8582 | __func__, |
| 8583 | pMac->roam.configParam.nRoamScanHomeAwayTime, |
| 8584 | nRoamScanHomeAwayTime); |
| 8585 | pMac->roam.configParam.nRoamScanHomeAwayTime = |
| 8586 | nRoamScanHomeAwayTime; |
| 8587 | sme_release_global_lock(&pMac->sme); |
| 8588 | } |
| 8589 | if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd) { |
| 8590 | csr_roam_offload_scan(pMac, sessionId, |
| 8591 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 8592 | REASON_HOME_AWAY_TIME_CHANGED); |
| 8593 | } |
| 8594 | return status; |
| 8595 | } |
| 8596 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 8597 | /** |
| 8598 | * sme_ext_change_channel()- function to post send ECSA |
| 8599 | * action frame to csr. |
| 8600 | * @hHal: Hal context |
| 8601 | * @channel: new channel to switch |
| 8602 | * @session_id: senssion it should be sent on. |
| 8603 | * |
| 8604 | * This function is called to post ECSA frame to csr. |
| 8605 | * |
| 8606 | * Return: success if msg is sent else return failure |
| 8607 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8608 | QDF_STATUS sme_ext_change_channel(tHalHandle h_hal, uint32_t channel, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 8609 | uint8_t session_id) |
| 8610 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8611 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 8612 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(h_hal); |
| 8613 | uint8_t channel_state; |
| 8614 | |
| 8615 | sms_log(mac_ctx, LOGE, FL(" Set Channel %d "), channel); |
| 8616 | channel_state = |
| 8617 | cds_get_channel_state(channel); |
| 8618 | |
| 8619 | if (CHANNEL_STATE_DISABLE == channel_state) { |
| 8620 | sms_log(mac_ctx, LOGE, FL(" Invalid channel %d "), channel); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8621 | return QDF_STATUS_E_INVAL; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 8622 | } |
| 8623 | |
| 8624 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 8625 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8626 | if (QDF_STATUS_SUCCESS == status) { |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 8627 | /* update the channel list to the firmware */ |
| 8628 | status = csr_send_ext_change_channel(mac_ctx, |
| 8629 | channel, session_id); |
| 8630 | sme_release_global_lock(&mac_ctx->sme); |
| 8631 | } |
| 8632 | |
| 8633 | return status; |
| 8634 | } |
| 8635 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8636 | /* --------------------------------------------------------------------------- |
| 8637 | \fn sme_get_roam_intra_band |
| 8638 | \brief get Intra band roaming |
| 8639 | \param hHal - HAL handle for device |
| 8640 | \- return Success or failure |
| 8641 | -------------------------------------------------------------------------*/ |
| 8642 | bool sme_get_roam_intra_band(tHalHandle hHal) |
| 8643 | { |
| 8644 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8645 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8646 | TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0)); |
| 8647 | return pMac->roam.configParam.nRoamIntraBand; |
| 8648 | } |
| 8649 | |
| 8650 | /* --------------------------------------------------------------------------- |
| 8651 | \fn sme_get_roam_scan_n_probes |
| 8652 | \brief get N Probes |
| 8653 | \param hHal - HAL handle for device |
| 8654 | \- return Success or failure |
| 8655 | -------------------------------------------------------------------------*/ |
| 8656 | uint8_t sme_get_roam_scan_n_probes(tHalHandle hHal) |
| 8657 | { |
| 8658 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8659 | return pMac->roam.configParam.nProbes; |
| 8660 | } |
| 8661 | |
| 8662 | /* --------------------------------------------------------------------------- |
| 8663 | \fn sme_get_roam_scan_home_away_time |
| 8664 | \brief get Roam scan home away time |
| 8665 | \param hHal - HAL handle for device |
| 8666 | \- return Success or failure |
| 8667 | -------------------------------------------------------------------------*/ |
| 8668 | uint16_t sme_get_roam_scan_home_away_time(tHalHandle hHal) |
| 8669 | { |
| 8670 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8671 | return pMac->roam.configParam.nRoamScanHomeAwayTime; |
| 8672 | } |
| 8673 | |
| 8674 | /* --------------------------------------------------------------------------- |
| 8675 | \fn sme_update_roam_rssi_diff |
| 8676 | \brief Update RoamRssiDiff |
| 8677 | This function is called through dynamic setConfig callback function |
| 8678 | to configure RoamRssiDiff |
| 8679 | Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125] |
| 8680 | \param hHal - HAL handle for device |
| 8681 | \param sessionId - Session Identifier |
| 8682 | \param RoamRssiDiff - minimum rssi difference between potential |
| 8683 | candidate and current AP. |
| 8684 | \- return Success or failure |
| 8685 | -------------------------------------------------------------------------*/ |
| 8686 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8687 | QDF_STATUS sme_update_roam_rssi_diff(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8688 | uint8_t RoamRssiDiff) |
| 8689 | { |
| 8690 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8691 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8692 | |
| 8693 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8694 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8695 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8696 | "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %s", |
| 8697 | RoamRssiDiff, |
| 8698 | pMac->roam.configParam.RoamRssiDiff, |
| 8699 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 8700 | neighborRoamInfo |
| 8701 | [sessionId]. |
| 8702 | neighborRoamState)); |
| 8703 | pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff; |
| 8704 | sme_release_global_lock(&pMac->sme); |
| 8705 | } |
| 8706 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 8707 | csr_roam_offload_scan(pMac, sessionId, |
| 8708 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 8709 | REASON_RSSI_DIFF_CHANGED); |
| 8710 | } |
| 8711 | return status; |
| 8712 | } |
| 8713 | |
| 8714 | /*-------------------------------------------------------------------------- |
| 8715 | \brief sme_update_fast_transition_enabled() - enable/disable Fast Transition |
| 8716 | support at runtime |
| 8717 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 8718 | isFastTransitionEnabled. |
| 8719 | This is a synchronous call |
| 8720 | \param hHal - The handle returned by mac_open. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8721 | \return QDF_STATUS_SUCCESS - SME update isFastTransitionEnabled config |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8722 | successfully. |
| 8723 | Other status means SME is failed to update isFastTransitionEnabled. |
| 8724 | \sa |
| 8725 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8726 | QDF_STATUS sme_update_fast_transition_enabled(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8727 | bool isFastTransitionEnabled) |
| 8728 | { |
| 8729 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8730 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8731 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8732 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8733 | TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, |
| 8734 | 0)); |
| 8735 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8736 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8737 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8738 | "%s: FastTransitionEnabled is changed from %d to %d", |
| 8739 | __func__, |
| 8740 | pMac->roam.configParam.isFastTransitionEnabled, |
| 8741 | isFastTransitionEnabled); |
| 8742 | pMac->roam.configParam.isFastTransitionEnabled = |
| 8743 | isFastTransitionEnabled; |
| 8744 | sme_release_global_lock(&pMac->sme); |
| 8745 | } |
| 8746 | |
| 8747 | return status; |
| 8748 | } |
| 8749 | |
| 8750 | /* --------------------------------------------------------------------------- |
| 8751 | \fn sme_update_wes_mode |
| 8752 | \brief Update WES Mode |
| 8753 | This function is called through dynamic setConfig callback function |
| 8754 | to configure isWESModeEnabled |
| 8755 | \param hHal - HAL handle for device |
| 8756 | \param isWESModeEnabled - WES mode |
| 8757 | \param sessionId - Session Identifier |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8758 | \return QDF_STATUS_SUCCESS - SME update isWESModeEnabled config successfully. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8759 | Other status means SME is failed to update isWESModeEnabled. |
| 8760 | -------------------------------------------------------------------------*/ |
| 8761 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8762 | QDF_STATUS sme_update_wes_mode(tHalHandle hHal, bool isWESModeEnabled, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8763 | uint8_t sessionId) |
| 8764 | { |
| 8765 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8766 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8767 | |
| 8768 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8769 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8770 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8771 | "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %s", |
| 8772 | isWESModeEnabled, |
| 8773 | pMac->roam.configParam.isWESModeEnabled, |
| 8774 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 8775 | neighborRoamInfo |
| 8776 | [sessionId]. |
| 8777 | neighborRoamState)); |
| 8778 | pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled; |
| 8779 | sme_release_global_lock(&pMac->sme); |
| 8780 | } |
| 8781 | |
| 8782 | return status; |
| 8783 | } |
| 8784 | |
| 8785 | /* --------------------------------------------------------------------------- |
| 8786 | \fn sme_set_roam_scan_control |
| 8787 | \brief Set roam scan control |
| 8788 | This function is called to set roam scan control |
| 8789 | if roam scan control is set to 0, roaming scan cache is cleared |
| 8790 | any value other than 0 is treated as invalid value |
| 8791 | \param hHal - HAL handle for device |
| 8792 | \param sessionId - Session Identifier |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8793 | \return QDF_STATUS_SUCCESS - SME update config successfully. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8794 | Other status means SME failure to update |
| 8795 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8796 | QDF_STATUS sme_set_roam_scan_control(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8797 | bool roamScanControl) |
| 8798 | { |
| 8799 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8800 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8801 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8802 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8803 | TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0)); |
| 8804 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8805 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8806 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8807 | "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %s", |
| 8808 | roamScanControl, |
| 8809 | pMac->roam.configParam.nRoamScanControl, |
| 8810 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 8811 | neighborRoamInfo |
| 8812 | [sessionId]. |
| 8813 | neighborRoamState)); |
| 8814 | pMac->roam.configParam.nRoamScanControl = roamScanControl; |
| 8815 | if (0 == roamScanControl) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8816 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8817 | "LFR runtime successfully cleared roam scan cache"); |
| 8818 | csr_flush_cfg_bg_scan_roam_channel_list(pMac, sessionId); |
| 8819 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 8820 | csr_roam_offload_scan(pMac, sessionId, |
| 8821 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 8822 | REASON_FLUSH_CHANNEL_LIST); |
| 8823 | } |
| 8824 | } |
| 8825 | sme_release_global_lock(&pMac->sme); |
| 8826 | } |
| 8827 | return status; |
| 8828 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8829 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8830 | /*-------------------------------------------------------------------------- |
| 8831 | \brief sme_update_is_fast_roam_ini_feature_enabled() - enable/disable LFR |
| 8832 | support at runtime |
| 8833 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 8834 | isFastRoamIniFeatureEnabled. |
| 8835 | This is a synchronous call |
| 8836 | \param hHal - The handle returned by mac_open. |
| 8837 | \param sessionId - Session Identifier |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8838 | \return QDF_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8839 | successfully. |
| 8840 | Other status means SME is failed to update isFastRoamIniFeatureEnabled. |
| 8841 | \sa |
| 8842 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8843 | QDF_STATUS sme_update_is_fast_roam_ini_feature_enabled |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8844 | (tHalHandle hHal, |
| 8845 | uint8_t sessionId, const bool isFastRoamIniFeatureEnabled) { |
| 8846 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8847 | |
| 8848 | if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == |
| 8849 | isFastRoamIniFeatureEnabled) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8850 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8851 | "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", |
| 8852 | __func__, |
| 8853 | pMac->roam.configParam.isFastRoamIniFeatureEnabled, |
| 8854 | isFastRoamIniFeatureEnabled); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8855 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8856 | } |
| 8857 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8858 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8859 | "%s: FastRoamEnabled is changed from %d to %d", __func__, |
| 8860 | pMac->roam.configParam.isFastRoamIniFeatureEnabled, |
| 8861 | isFastRoamIniFeatureEnabled); |
| 8862 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = |
| 8863 | isFastRoamIniFeatureEnabled; |
| 8864 | csr_neighbor_roam_update_fast_roaming_enabled(pMac, sessionId, |
| 8865 | isFastRoamIniFeatureEnabled); |
| 8866 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8867 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8868 | } |
| 8869 | |
| 8870 | /*-------------------------------------------------------------------------- |
| 8871 | \brief sme_update_is_mawc_ini_feature_enabled() - |
| 8872 | Enable/disable LFR MAWC support at runtime |
| 8873 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 8874 | isMAWCIniFeatureEnabled. |
| 8875 | This is a synchronous call |
| 8876 | \param hHal - The handle returned by mac_open. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8877 | \return QDF_STATUS_SUCCESS - SME update MAWCEnabled config successfully. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8878 | Other status means SME is failed to update MAWCEnabled. |
| 8879 | \sa |
| 8880 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8881 | QDF_STATUS sme_update_is_mawc_ini_feature_enabled(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8882 | const bool MAWCEnabled) |
| 8883 | { |
| 8884 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8885 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8886 | |
| 8887 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8888 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8889 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8890 | "%s: MAWCEnabled is changed from %d to %d", __func__, |
| 8891 | pMac->roam.configParam.MAWCEnabled, MAWCEnabled); |
| 8892 | pMac->roam.configParam.MAWCEnabled = MAWCEnabled; |
| 8893 | sme_release_global_lock(&pMac->sme); |
| 8894 | } |
| 8895 | |
| 8896 | return status; |
| 8897 | |
| 8898 | } |
| 8899 | |
| 8900 | /*-------------------------------------------------------------------------- |
| 8901 | \brief sme_stop_roaming() - Stop roaming for a given sessionId |
| 8902 | This is a synchronous call |
| 8903 | \param hHal - The handle returned by mac_open |
| 8904 | \param sessionId - Session Identifier |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8905 | \return QDF_STATUS_SUCCESS on success |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8906 | Other status on failure |
| 8907 | \sa |
| 8908 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8909 | QDF_STATUS sme_stop_roaming(tHalHandle hHal, uint8_t sessionId, uint8_t reason) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8910 | { |
| 8911 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8912 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8913 | |
| 8914 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8915 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8916 | csr_roam_offload_scan(pMac, sessionId, ROAM_SCAN_OFFLOAD_STOP, |
| 8917 | reason); |
| 8918 | sme_release_global_lock(&pMac->sme); |
| 8919 | } |
| 8920 | |
| 8921 | return status; |
| 8922 | } |
| 8923 | |
| 8924 | /*-------------------------------------------------------------------------- |
| 8925 | \brief sme_start_roaming() - Start roaming for a given sessionId |
| 8926 | This is a synchronous call |
| 8927 | \param hHal - The handle returned by mac_open |
| 8928 | \param sessionId - Session Identifier |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8929 | \return QDF_STATUS_SUCCESS on success |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8930 | Other status on failure |
| 8931 | \sa |
| 8932 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8933 | QDF_STATUS sme_start_roaming(tHalHandle hHal, uint8_t sessionId, uint8_t reason) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8934 | { |
| 8935 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8936 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8937 | |
| 8938 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8939 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8940 | csr_roam_offload_scan(pMac, sessionId, ROAM_SCAN_OFFLOAD_START, |
| 8941 | reason); |
| 8942 | sme_release_global_lock(&pMac->sme); |
| 8943 | } |
| 8944 | |
| 8945 | return status; |
| 8946 | } |
| 8947 | |
| 8948 | /*-------------------------------------------------------------------------- |
| 8949 | \brief sme_update_enable_fast_roam_in_concurrency() - enable/disable LFR if |
| 8950 | Concurrent session exists |
| 8951 | This is a synchronuous call |
| 8952 | \param hHal - The handle returned by mac_open. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8953 | \return QDF_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8954 | Other status means SME is failed |
| 8955 | \sa |
| 8956 | --------------------------------------------------------------------------*/ |
| 8957 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8958 | QDF_STATUS sme_update_enable_fast_roam_in_concurrency(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8959 | bool |
| 8960 | bFastRoamInConIniFeatureEnabled) |
| 8961 | { |
| 8962 | |
| 8963 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8964 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8965 | |
| 8966 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8967 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8968 | pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = |
| 8969 | bFastRoamInConIniFeatureEnabled; |
| 8970 | if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 8971 | pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = |
| 8972 | 0; |
| 8973 | } |
| 8974 | sme_release_global_lock(&pMac->sme); |
| 8975 | } |
| 8976 | |
| 8977 | return status; |
| 8978 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8979 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8980 | /*-------------------------------------------------------------------------- |
| 8981 | \brief sme_update_config_fw_rssi_monitoring() - enable/disable firmware RSSI |
| 8982 | Monitoring at runtime |
| 8983 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 8984 | fEnableFwRssiMonitoring. |
| 8985 | This is a synchronous call |
| 8986 | \param hHal - The handle returned by mac_open. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8987 | \return QDF_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8988 | config successfully. |
| 8989 | Other status means SME is failed to update fEnableFwRssiMonitoring. |
| 8990 | \sa |
| 8991 | --------------------------------------------------------------------------*/ |
| 8992 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8993 | QDF_STATUS sme_update_config_fw_rssi_monitoring(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8994 | bool fEnableFwRssiMonitoring) |
| 8995 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 8996 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8997 | |
| 8998 | if (sme_cfg_set_int (hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8999 | fEnableFwRssiMonitoring) == QDF_STATUS_E_FAILURE) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 9000 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9001 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9002 | "Could not pass on WNI_CFG_PS_RSSI_MONITOR to CFG"); |
| 9003 | } |
| 9004 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 9005 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9006 | } |
| 9007 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9008 | /* --------------------------------------------------------------------------- |
| 9009 | \fn sme_set_roam_opportunistic_scan_threshold_diff |
| 9010 | \brief Update Opportunistic Scan threshold diff |
| 9011 | This function is called through dynamic setConfig callback function |
| 9012 | to configure nOpportunisticThresholdDiff |
| 9013 | \param hHal - HAL handle for device |
| 9014 | \param sessionId - Session Identifier |
| 9015 | \param nOpportunisticThresholdDiff - Opportunistic Scan threshold diff |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9016 | \return QDF_STATUS_SUCCESS - SME update nOpportunisticThresholdDiff config |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9017 | successfully. |
| 9018 | else SME is failed to update nOpportunisticThresholdDiff. |
| 9019 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9020 | QDF_STATUS sme_set_roam_opportunistic_scan_threshold_diff(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9021 | uint8_t sessionId, |
| 9022 | const uint8_t |
| 9023 | nOpportunisticThresholdDiff) |
| 9024 | { |
| 9025 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9026 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9027 | |
| 9028 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9029 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 9030 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 9031 | nOpportunisticThresholdDiff, |
| 9032 | REASON_OPPORTUNISTIC_THRESH_DIFF_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9033 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9034 | pMac->roam.configParam.neighborRoamConfig. |
| 9035 | nOpportunisticThresholdDiff = |
| 9036 | nOpportunisticThresholdDiff; |
| 9037 | } |
| 9038 | sme_release_global_lock(&pMac->sme); |
| 9039 | } |
| 9040 | return status; |
| 9041 | } |
| 9042 | |
| 9043 | /*-------------------------------------------------------------------------- |
| 9044 | \fn sme_get_roam_opportunistic_scan_threshold_diff() |
| 9045 | \brief gets Opportunistic Scan threshold diff |
| 9046 | This is a synchronous call |
| 9047 | \param hHal - The handle returned by mac_open |
| 9048 | \return uint8_t - nOpportunisticThresholdDiff |
| 9049 | \sa |
| 9050 | --------------------------------------------------------------------------*/ |
| 9051 | uint8_t sme_get_roam_opportunistic_scan_threshold_diff(tHalHandle hHal) |
| 9052 | { |
| 9053 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9054 | return pMac->roam.configParam.neighborRoamConfig. |
| 9055 | nOpportunisticThresholdDiff; |
| 9056 | } |
| 9057 | |
| 9058 | /* --------------------------------------------------------------------------- |
| 9059 | \fn sme_set_roam_rescan_rssi_diff |
| 9060 | \brief Update roam rescan rssi diff |
| 9061 | This function is called through dynamic setConfig callback function |
| 9062 | to configure nRoamRescanRssiDiff |
| 9063 | \param hHal - HAL handle for device |
| 9064 | \param sessionId - Session Identifier |
| 9065 | \param nRoamRescanRssiDiff - roam rescan rssi diff |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9066 | \return QDF_STATUS_SUCCESS - SME update nRoamRescanRssiDiff config |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9067 | successfully. |
| 9068 | else SME is failed to update nRoamRescanRssiDiff. |
| 9069 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9070 | QDF_STATUS sme_set_roam_rescan_rssi_diff(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9071 | uint8_t sessionId, |
| 9072 | const uint8_t nRoamRescanRssiDiff) |
| 9073 | { |
| 9074 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9075 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9076 | |
| 9077 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9078 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 9079 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 9080 | nRoamRescanRssiDiff, |
| 9081 | REASON_ROAM_RESCAN_RSSI_DIFF_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9082 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9083 | pMac->roam.configParam.neighborRoamConfig. |
| 9084 | nRoamRescanRssiDiff = nRoamRescanRssiDiff; |
| 9085 | } |
| 9086 | sme_release_global_lock(&pMac->sme); |
| 9087 | } |
| 9088 | return status; |
| 9089 | } |
| 9090 | |
| 9091 | /*-------------------------------------------------------------------------- |
| 9092 | \fn sme_get_roam_rescan_rssi_diff |
| 9093 | \brief gets roam rescan rssi diff |
| 9094 | This is a synchronous call |
| 9095 | \param hHal - The handle returned by mac_open |
| 9096 | \return int8_t - nRoamRescanRssiDiff |
| 9097 | \sa |
| 9098 | --------------------------------------------------------------------------*/ |
| 9099 | uint8_t sme_get_roam_rescan_rssi_diff(tHalHandle hHal) |
| 9100 | { |
| 9101 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9102 | return pMac->roam.configParam.neighborRoamConfig.nRoamRescanRssiDiff; |
| 9103 | } |
| 9104 | |
| 9105 | /* --------------------------------------------------------------------------- |
| 9106 | \fn sme_set_roam_bmiss_first_bcnt |
| 9107 | \brief Update Roam count for first beacon miss |
| 9108 | This function is called through dynamic setConfig callback function |
| 9109 | to configure nRoamBmissFirstBcnt |
| 9110 | \param hHal - HAL handle for device |
| 9111 | \param sessionId - Session Identifier |
| 9112 | \param nRoamBmissFirstBcnt - Roam first bmiss count |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9113 | \return QDF_STATUS_SUCCESS - SME update nRoamBmissFirstBcnt |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9114 | successfully. |
| 9115 | else SME is failed to update nRoamBmissFirstBcnt |
| 9116 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9117 | QDF_STATUS sme_set_roam_bmiss_first_bcnt(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9118 | uint8_t sessionId, |
| 9119 | const uint8_t nRoamBmissFirstBcnt) |
| 9120 | { |
| 9121 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9122 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9123 | |
| 9124 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9125 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 9126 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 9127 | nRoamBmissFirstBcnt, |
| 9128 | REASON_ROAM_BMISS_FIRST_BCNT_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9129 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9130 | pMac->roam.configParam.neighborRoamConfig. |
| 9131 | nRoamBmissFirstBcnt = nRoamBmissFirstBcnt; |
| 9132 | } |
| 9133 | sme_release_global_lock(&pMac->sme); |
| 9134 | } |
| 9135 | return status; |
| 9136 | } |
| 9137 | |
| 9138 | /* --------------------------------------------------------------------------- |
| 9139 | \fn sme_get_roam_bmiss_first_bcnt |
| 9140 | \brief get neighbor roam beacon miss first count |
| 9141 | \param hHal - The handle returned by mac_open. |
| 9142 | \return uint8_t - neighbor roam beacon miss first count |
| 9143 | -------------------------------------------------------------------------*/ |
| 9144 | uint8_t sme_get_roam_bmiss_first_bcnt(tHalHandle hHal) |
| 9145 | { |
| 9146 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9147 | return pMac->roam.configParam.neighborRoamConfig.nRoamBmissFirstBcnt; |
| 9148 | } |
| 9149 | |
| 9150 | /* --------------------------------------------------------------------------- |
| 9151 | \fn sme_set_roam_bmiss_final_bcnt |
| 9152 | \brief Update Roam count for final beacon miss |
| 9153 | This function is called through dynamic setConfig callback function |
| 9154 | to configure nRoamBmissFinalBcnt |
| 9155 | \param hHal - HAL handle for device |
| 9156 | \param sessionId - Session Identifier |
| 9157 | \param nRoamBmissFinalBcnt - Roam final bmiss count |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9158 | \return QDF_STATUS_SUCCESS - SME update nRoamBmissFinalBcnt |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9159 | successfully. |
| 9160 | else SME is failed to update nRoamBmissFinalBcnt |
| 9161 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9162 | QDF_STATUS sme_set_roam_bmiss_final_bcnt(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9163 | uint8_t sessionId, |
| 9164 | const uint8_t nRoamBmissFinalBcnt) |
| 9165 | { |
| 9166 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9167 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9168 | |
| 9169 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9170 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 9171 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 9172 | nRoamBmissFinalBcnt, |
| 9173 | REASON_ROAM_BMISS_FINAL_BCNT_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9174 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9175 | pMac->roam.configParam.neighborRoamConfig. |
| 9176 | nRoamBmissFinalBcnt = nRoamBmissFinalBcnt; |
| 9177 | } |
| 9178 | sme_release_global_lock(&pMac->sme); |
| 9179 | } |
| 9180 | return status; |
| 9181 | } |
| 9182 | |
| 9183 | /*-------------------------------------------------------------------------- |
| 9184 | \fn sme_get_roam_bmiss_final_bcnt |
| 9185 | \brief gets Roam count for final beacon miss |
| 9186 | This is a synchronous call |
| 9187 | \param hHal - The handle returned by mac_open |
| 9188 | \return uint8_t - nRoamBmissFinalBcnt |
| 9189 | \sa |
| 9190 | --------------------------------------------------------------------------*/ |
| 9191 | uint8_t sme_get_roam_bmiss_final_bcnt(tHalHandle hHal) |
| 9192 | { |
| 9193 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9194 | return pMac->roam.configParam.neighborRoamConfig.nRoamBmissFinalBcnt; |
| 9195 | } |
| 9196 | |
| 9197 | /* --------------------------------------------------------------------------- |
| 9198 | \fn sme_set_roam_beacon_rssi_weight |
| 9199 | \brief Update Roam beacon rssi weight |
| 9200 | This function is called through dynamic setConfig callback function |
| 9201 | to configure nRoamBeaconRssiWeight |
| 9202 | \param hHal - HAL handle for device |
| 9203 | \param sessionId - Session Identifier |
| 9204 | \param nRoamBeaconRssiWeight - Roam beacon rssi weight |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9205 | \return QDF_STATUS_SUCCESS - SME update nRoamBeaconRssiWeight config |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9206 | successfully. |
| 9207 | else SME is failed to update nRoamBeaconRssiWeight |
| 9208 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9209 | QDF_STATUS sme_set_roam_beacon_rssi_weight(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9210 | uint8_t sessionId, |
| 9211 | const uint8_t nRoamBeaconRssiWeight) |
| 9212 | { |
| 9213 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9214 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9215 | |
| 9216 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9217 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 9218 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 9219 | nRoamBeaconRssiWeight, |
| 9220 | REASON_ROAM_BEACON_RSSI_WEIGHT_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9221 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9222 | pMac->roam.configParam.neighborRoamConfig. |
| 9223 | nRoamBeaconRssiWeight = nRoamBeaconRssiWeight; |
| 9224 | } |
| 9225 | sme_release_global_lock(&pMac->sme); |
| 9226 | } |
| 9227 | return status; |
| 9228 | } |
| 9229 | |
| 9230 | /*-------------------------------------------------------------------------- |
| 9231 | \fn sme_get_roam_beacon_rssi_weight |
| 9232 | \brief gets Roam beacon rssi weight |
| 9233 | This is a synchronous call |
| 9234 | \param hHal - The handle returned by mac_open |
| 9235 | \return uint8_t - nRoamBeaconRssiWeight |
| 9236 | \sa |
| 9237 | --------------------------------------------------------------------------*/ |
| 9238 | uint8_t sme_get_roam_beacon_rssi_weight(tHalHandle hHal) |
| 9239 | { |
| 9240 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9241 | return pMac->roam.configParam.neighborRoamConfig.nRoamBeaconRssiWeight; |
| 9242 | } |
| 9243 | |
| 9244 | /*-------------------------------------------------------------------------- |
| 9245 | \brief sme_set_neighbor_lookup_rssi_threshold() - update neighbor lookup |
| 9246 | rssi threshold |
| 9247 | This is a synchronous call |
| 9248 | \param hHal - The handle returned by mac_open. |
| 9249 | \param sessionId - Session Identifier |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9250 | \return QDF_STATUS_SUCCESS - SME update config successful. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9251 | Other status means SME is failed to update |
| 9252 | \sa |
| 9253 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9254 | QDF_STATUS sme_set_neighbor_lookup_rssi_threshold |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9255 | (tHalHandle hHal, uint8_t sessionId, uint8_t neighborLookupRssiThreshold) { |
| 9256 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9257 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9258 | |
| 9259 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9260 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 9261 | status = csr_neighbor_roam_update_config(pMac, |
| 9262 | sessionId, neighborLookupRssiThreshold, |
| 9263 | REASON_LOOKUP_THRESH_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9264 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9265 | pMac->roam.configParam.neighborRoamConfig. |
| 9266 | nNeighborLookupRssiThreshold = |
| 9267 | neighborLookupRssiThreshold; |
| 9268 | } |
| 9269 | sme_release_global_lock(&pMac->sme); |
| 9270 | } |
| 9271 | return status; |
| 9272 | } |
| 9273 | |
| 9274 | /*-------------------------------------------------------------------------- |
| 9275 | \brief sme_set_delay_before_vdev_stop() - update delay before VDEV_STOP |
| 9276 | This is a synchronous call |
| 9277 | \param hal - The handle returned by macOpen. |
| 9278 | \param session_id - Session Identifier |
| 9279 | \param delay_before_vdev_stop - value to be set |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9280 | \return QDF_STATUS_SUCCESS - SME update config successful. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9281 | Other status means SME is failed to update |
| 9282 | \sa |
| 9283 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9284 | QDF_STATUS sme_set_delay_before_vdev_stop(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9285 | uint8_t session_id, |
| 9286 | uint8_t delay_before_vdev_stop) |
| 9287 | { |
| 9288 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9289 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9290 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9291 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9292 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 9293 | QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9294 | FL("LFR param delay_before_vdev_stop changed from %d to %d"), |
| 9295 | pMac->roam.configParam.neighborRoamConfig. |
| 9296 | delay_before_vdev_stop, |
| 9297 | delay_before_vdev_stop); |
| 9298 | pMac->roam.neighborRoamInfo[session_id].cfgParams. |
| 9299 | delay_before_vdev_stop = delay_before_vdev_stop; |
| 9300 | pMac->roam.configParam.neighborRoamConfig. |
| 9301 | delay_before_vdev_stop = delay_before_vdev_stop; |
| 9302 | sme_release_global_lock(&pMac->sme); |
| 9303 | } |
| 9304 | return status; |
| 9305 | } |
| 9306 | |
| 9307 | /*-------------------------------------------------------------------------- |
| 9308 | \brief sme_get_neighbor_lookup_rssi_threshold() - get neighbor lookup |
| 9309 | rssi threshold |
| 9310 | This is a synchronous call |
| 9311 | \param hHal - The handle returned by mac_open. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9312 | \return QDF_STATUS_SUCCESS - SME update config successful. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9313 | Other status means SME is failed to update |
| 9314 | \sa |
| 9315 | --------------------------------------------------------------------------*/ |
| 9316 | uint8_t sme_get_neighbor_lookup_rssi_threshold(tHalHandle hHal) |
| 9317 | { |
| 9318 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9319 | return pMac->roam.configParam.neighborRoamConfig. |
| 9320 | nNeighborLookupRssiThreshold; |
| 9321 | } |
| 9322 | |
| 9323 | /*-------------------------------------------------------------------------- |
| 9324 | \brief sme_set_neighbor_scan_refresh_period() - set neighbor scan results |
| 9325 | refresh period |
| 9326 | This is a synchronous call |
| 9327 | \param hHal - The handle returned by mac_open. |
| 9328 | \param sessionId - Session Identifier |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9329 | \return QDF_STATUS_SUCCESS - SME update config successful. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9330 | Other status means SME is failed to update |
| 9331 | \sa |
| 9332 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9333 | QDF_STATUS sme_set_neighbor_scan_refresh_period |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9334 | (tHalHandle hHal, |
| 9335 | uint8_t sessionId, uint16_t neighborScanResultsRefreshPeriod) { |
| 9336 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9337 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9338 | tCsrNeighborRoamConfig *pNeighborRoamConfig = NULL; |
| 9339 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 9340 | |
| 9341 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9342 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9343 | pNeighborRoamConfig = |
| 9344 | &pMac->roam.configParam.neighborRoamConfig; |
| 9345 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9346 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9347 | "LFR runtime successfully set roam scan refresh period to %d- old value is %d - roam state is %s", |
| 9348 | neighborScanResultsRefreshPeriod, |
| 9349 | pMac->roam.configParam.neighborRoamConfig. |
| 9350 | nNeighborResultsRefreshPeriod, |
| 9351 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 9352 | neighborRoamInfo |
| 9353 | [sessionId]. |
| 9354 | neighborRoamState)); |
| 9355 | pNeighborRoamConfig->nNeighborResultsRefreshPeriod = |
| 9356 | neighborScanResultsRefreshPeriod; |
| 9357 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod = |
| 9358 | neighborScanResultsRefreshPeriod; |
| 9359 | |
| 9360 | sme_release_global_lock(&pMac->sme); |
| 9361 | } |
| 9362 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 9363 | csr_roam_offload_scan(pMac, sessionId, |
| 9364 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 9365 | REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED); |
| 9366 | } |
| 9367 | return status; |
| 9368 | } |
| 9369 | |
| 9370 | /*-------------------------------------------------------------------------- |
| 9371 | \brief sme_update_roam_scan_offload_enabled() - enable/disable roam scan |
| 9372 | offload feaure |
| 9373 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 9374 | gRoamScanOffloadEnabled. |
| 9375 | This is a synchronous call |
| 9376 | \param hHal - The handle returned by mac_open. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9377 | \return QDF_STATUS_SUCCESS - SME update config successfully. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9378 | Other status means SME is failed to update. |
| 9379 | \sa |
| 9380 | --------------------------------------------------------------------------*/ |
| 9381 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9382 | QDF_STATUS sme_update_roam_scan_offload_enabled(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9383 | bool nRoamScanOffloadEnabled) |
| 9384 | { |
| 9385 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9386 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9387 | |
| 9388 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9389 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9390 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9391 | FL |
| 9392 | ("gRoamScanOffloadEnabled is changed from %d to %d"), |
| 9393 | pMac->roam.configParam.isRoamOffloadScanEnabled, |
| 9394 | nRoamScanOffloadEnabled); |
| 9395 | pMac->roam.configParam.isRoamOffloadScanEnabled = |
| 9396 | nRoamScanOffloadEnabled; |
| 9397 | sme_release_global_lock(&pMac->sme); |
| 9398 | } |
| 9399 | |
| 9400 | return status; |
| 9401 | } |
| 9402 | |
| 9403 | /*-------------------------------------------------------------------------- |
| 9404 | \brief sme_get_neighbor_scan_refresh_period() - get neighbor scan results |
| 9405 | refresh period |
| 9406 | This is a synchronous call |
| 9407 | \param hHal - The handle returned by mac_open. |
| 9408 | \return uint16_t - Neighbor scan results refresh period value |
| 9409 | \sa |
| 9410 | --------------------------------------------------------------------------*/ |
| 9411 | uint16_t sme_get_neighbor_scan_refresh_period(tHalHandle hHal) |
| 9412 | { |
| 9413 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9414 | return pMac->roam.configParam.neighborRoamConfig. |
| 9415 | nNeighborResultsRefreshPeriod; |
| 9416 | } |
| 9417 | |
| 9418 | /*-------------------------------------------------------------------------- |
| 9419 | \brief sme_get_empty_scan_refresh_period() - get empty scan refresh period |
| 9420 | This is a synchronuous call |
| 9421 | \param hHal - The handle returned by mac_open. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9422 | \return QDF_STATUS_SUCCESS - SME update config successful. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9423 | Other status means SME is failed to update |
| 9424 | \sa |
| 9425 | --------------------------------------------------------------------------*/ |
| 9426 | uint16_t sme_get_empty_scan_refresh_period(tHalHandle hHal) |
| 9427 | { |
| 9428 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9429 | return pMac->roam.configParam.neighborRoamConfig. |
| 9430 | nEmptyScanRefreshPeriod; |
| 9431 | } |
| 9432 | |
| 9433 | /* --------------------------------------------------------------------------- |
| 9434 | \fn sme_update_empty_scan_refresh_period |
| 9435 | \brief Update nEmptyScanRefreshPeriod |
| 9436 | This function is called through dynamic setConfig callback function |
| 9437 | to configure nEmptyScanRefreshPeriod |
| 9438 | Usage: adb shell iwpriv wlan0 setConfig |
| 9439 | nEmptyScanRefreshPeriod=[0 .. 60] |
| 9440 | \param hHal - HAL handle for device |
| 9441 | \param sessionId - Session Identifier |
| 9442 | \param nEmptyScanRefreshPeriod - scan period following empty scan results. |
| 9443 | \- return Success or failure |
| 9444 | -------------------------------------------------------------------------*/ |
| 9445 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9446 | QDF_STATUS sme_update_empty_scan_refresh_period(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9447 | uint16_t nEmptyScanRefreshPeriod) |
| 9448 | { |
| 9449 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9450 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9451 | tCsrNeighborRoamConfig *pNeighborRoamConfig = NULL; |
| 9452 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 9453 | |
| 9454 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9455 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9456 | pNeighborRoamConfig = |
| 9457 | &pMac->roam.configParam.neighborRoamConfig; |
| 9458 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9459 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9460 | "LFR runtime successfully set roam scan period to %d -old value is %d - roam state is %s", |
| 9461 | nEmptyScanRefreshPeriod, |
| 9462 | pMac->roam.configParam.neighborRoamConfig. |
| 9463 | nEmptyScanRefreshPeriod, |
| 9464 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 9465 | neighborRoamInfo |
| 9466 | [sessionId]. |
| 9467 | neighborRoamState)); |
| 9468 | pNeighborRoamConfig->nEmptyScanRefreshPeriod = |
| 9469 | nEmptyScanRefreshPeriod; |
| 9470 | pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod = |
| 9471 | nEmptyScanRefreshPeriod; |
| 9472 | sme_release_global_lock(&pMac->sme); |
| 9473 | } |
| 9474 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 9475 | csr_roam_offload_scan(pMac, sessionId, |
| 9476 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 9477 | REASON_EMPTY_SCAN_REF_PERIOD_CHANGED); |
| 9478 | } |
| 9479 | return status; |
| 9480 | } |
| 9481 | |
| 9482 | /* --------------------------------------------------------------------------- |
| 9483 | \fn sme_set_neighbor_scan_min_chan_time |
| 9484 | \brief Update nNeighborScanMinChanTime |
| 9485 | This function is called through dynamic setConfig callback function |
| 9486 | to configure gNeighborScanChannelMinTime |
| 9487 | Usage: adb shell iwpriv wlan0 setConfig |
| 9488 | gNeighborScanChannelMinTime=[0 .. 60] |
| 9489 | \param hHal - HAL handle for device |
| 9490 | \param nNeighborScanMinChanTime - Channel minimum dwell time |
| 9491 | \param sessionId - Session Identifier |
| 9492 | \- return Success or failure |
| 9493 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9494 | QDF_STATUS sme_set_neighbor_scan_min_chan_time(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9495 | const uint16_t |
| 9496 | nNeighborScanMinChanTime, |
| 9497 | uint8_t sessionId) |
| 9498 | { |
| 9499 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9500 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9501 | |
| 9502 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9503 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9504 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9505 | "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %s", |
| 9506 | nNeighborScanMinChanTime, |
| 9507 | pMac->roam.configParam.neighborRoamConfig. |
| 9508 | nNeighborScanMinChanTime, |
| 9509 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 9510 | neighborRoamInfo |
| 9511 | [sessionId]. |
| 9512 | neighborRoamState)); |
| 9513 | |
| 9514 | pMac->roam.configParam.neighborRoamConfig. |
| 9515 | nNeighborScanMinChanTime = nNeighborScanMinChanTime; |
| 9516 | pMac->roam.neighborRoamInfo[sessionId].cfgParams. |
| 9517 | minChannelScanTime = nNeighborScanMinChanTime; |
| 9518 | sme_release_global_lock(&pMac->sme); |
| 9519 | } |
| 9520 | |
| 9521 | return status; |
| 9522 | } |
| 9523 | |
| 9524 | /* --------------------------------------------------------------------------- |
| 9525 | \fn sme_set_neighbor_scan_max_chan_time |
| 9526 | \brief Update nNeighborScanMaxChanTime |
| 9527 | This function is called through dynamic setConfig callback function |
| 9528 | to configure gNeighborScanChannelMaxTime |
| 9529 | Usage: adb shell iwpriv wlan0 setConfig |
| 9530 | gNeighborScanChannelMaxTime=[0 .. 60] |
| 9531 | \param hHal - HAL handle for device |
| 9532 | \param sessionId - Session Identifier |
| 9533 | \param nNeighborScanMinChanTime - Channel maximum dwell time |
| 9534 | \- return Success or failure |
| 9535 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9536 | QDF_STATUS sme_set_neighbor_scan_max_chan_time(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9537 | const uint16_t |
| 9538 | nNeighborScanMaxChanTime) |
| 9539 | { |
| 9540 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9541 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9542 | tCsrNeighborRoamConfig *pNeighborRoamConfig = NULL; |
| 9543 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 9544 | |
| 9545 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9546 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9547 | pNeighborRoamConfig = |
| 9548 | &pMac->roam.configParam.neighborRoamConfig; |
| 9549 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9550 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9551 | "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %s", |
| 9552 | nNeighborScanMaxChanTime, |
| 9553 | pMac->roam.configParam.neighborRoamConfig. |
| 9554 | nNeighborScanMaxChanTime, |
| 9555 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 9556 | neighborRoamInfo |
| 9557 | [sessionId]. |
| 9558 | neighborRoamState)); |
| 9559 | pNeighborRoamConfig->nNeighborScanMaxChanTime = |
| 9560 | nNeighborScanMaxChanTime; |
| 9561 | pNeighborRoamInfo->cfgParams.maxChannelScanTime = |
| 9562 | nNeighborScanMaxChanTime; |
| 9563 | sme_release_global_lock(&pMac->sme); |
| 9564 | } |
| 9565 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 9566 | csr_roam_offload_scan(pMac, sessionId, |
| 9567 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 9568 | REASON_SCAN_CH_TIME_CHANGED); |
| 9569 | } |
| 9570 | |
| 9571 | return status; |
| 9572 | } |
| 9573 | |
| 9574 | /* --------------------------------------------------------------------------- |
| 9575 | \fn sme_get_neighbor_scan_min_chan_time |
| 9576 | \brief get neighbor scan min channel time |
| 9577 | \param hHal - The handle returned by mac_open. |
| 9578 | \param sessionId - Session Identifier |
| 9579 | \return uint16_t - channel min time value |
| 9580 | -------------------------------------------------------------------------*/ |
| 9581 | uint16_t sme_get_neighbor_scan_min_chan_time(tHalHandle hHal, uint8_t sessionId) |
| 9582 | { |
| 9583 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9584 | return pMac->roam.neighborRoamInfo[sessionId].cfgParams. |
| 9585 | minChannelScanTime; |
| 9586 | } |
| 9587 | |
| 9588 | /* --------------------------------------------------------------------------- |
| 9589 | \fn sme_get_neighbor_roam_state |
| 9590 | \brief get neighbor roam state |
| 9591 | \param hHal - The handle returned by mac_open. |
| 9592 | \param sessionId - Session Identifier |
| 9593 | \return uint32_t - neighbor roam state |
| 9594 | -------------------------------------------------------------------------*/ |
| 9595 | uint32_t sme_get_neighbor_roam_state(tHalHandle hHal, uint8_t sessionId) |
| 9596 | { |
| 9597 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9598 | return pMac->roam.neighborRoamInfo[sessionId].neighborRoamState; |
| 9599 | } |
| 9600 | |
| 9601 | /* --------------------------------------------------------------------------- |
| 9602 | \fn sme_get_current_roam_state |
| 9603 | \brief get current roam state |
| 9604 | \param hHal - The handle returned by mac_open. |
| 9605 | \param sessionId - Session Identifier |
| 9606 | \return uint32_t - current roam state |
| 9607 | -------------------------------------------------------------------------*/ |
| 9608 | uint32_t sme_get_current_roam_state(tHalHandle hHal, uint8_t sessionId) |
| 9609 | { |
| 9610 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9611 | return pMac->roam.curState[sessionId]; |
| 9612 | } |
| 9613 | |
| 9614 | /* --------------------------------------------------------------------------- |
| 9615 | \fn sme_get_current_roam_sub_state |
| 9616 | \brief get neighbor roam sub state |
| 9617 | \param hHal - The handle returned by mac_open. |
| 9618 | \param sessionId - Session Identifier |
| 9619 | \return uint32_t - current roam sub state |
| 9620 | -------------------------------------------------------------------------*/ |
| 9621 | uint32_t sme_get_current_roam_sub_state(tHalHandle hHal, uint8_t sessionId) |
| 9622 | { |
| 9623 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9624 | return pMac->roam.curSubState[sessionId]; |
| 9625 | } |
| 9626 | |
| 9627 | /* --------------------------------------------------------------------------- |
| 9628 | \fn sme_get_lim_sme_state |
| 9629 | \brief get Lim Sme state |
| 9630 | \param hHal - The handle returned by mac_open. |
| 9631 | \return uint32_t - Lim Sme state |
| 9632 | -------------------------------------------------------------------------*/ |
| 9633 | uint32_t sme_get_lim_sme_state(tHalHandle hHal) |
| 9634 | { |
| 9635 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9636 | return pMac->lim.gLimSmeState; |
| 9637 | } |
| 9638 | |
| 9639 | /* --------------------------------------------------------------------------- |
| 9640 | \fn sme_get_lim_mlm_state |
| 9641 | \brief get Lim Mlm state |
| 9642 | \param hHal - The handle returned by mac_open. |
| 9643 | \return uint32_t - Lim Mlm state |
| 9644 | -------------------------------------------------------------------------*/ |
| 9645 | uint32_t sme_get_lim_mlm_state(tHalHandle hHal) |
| 9646 | { |
| 9647 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9648 | return pMac->lim.gLimMlmState; |
| 9649 | } |
| 9650 | |
| 9651 | /* --------------------------------------------------------------------------- |
| 9652 | \fn sme_is_lim_session_valid |
| 9653 | \brief is Lim session valid |
| 9654 | \param hHal - The handle returned by mac_open. |
| 9655 | \param sessionId - Session Identifier |
| 9656 | \return bool - true or false |
| 9657 | -------------------------------------------------------------------------*/ |
| 9658 | bool sme_is_lim_session_valid(tHalHandle hHal, uint8_t sessionId) |
| 9659 | { |
| 9660 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Hanumantha Reddy Pothula | 589fd70 | 2015-11-17 15:25:16 +0530 | [diff] [blame] | 9661 | |
| 9662 | if (sessionId > pMac->lim.maxBssId) |
| 9663 | return false; |
| 9664 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9665 | return pMac->lim.gpSession[sessionId].valid; |
| 9666 | } |
| 9667 | |
| 9668 | /* --------------------------------------------------------------------------- |
| 9669 | \fn sme_get_lim_sme_session_state |
| 9670 | \brief get Lim Sme session state |
| 9671 | \param hHal - The handle returned by mac_open. |
| 9672 | \param sessionId - Session Identifier |
| 9673 | \return uint32_t - Lim Sme session state |
| 9674 | -------------------------------------------------------------------------*/ |
| 9675 | uint32_t sme_get_lim_sme_session_state(tHalHandle hHal, uint8_t sessionId) |
| 9676 | { |
| 9677 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9678 | return pMac->lim.gpSession[sessionId].limSmeState; |
| 9679 | } |
| 9680 | |
| 9681 | /* --------------------------------------------------------------------------- |
| 9682 | \fn sme_get_lim_mlm_session_state |
| 9683 | \brief get Lim Mlm session state |
| 9684 | \param hHal - The handle returned by mac_open. |
| 9685 | \param sessionId - Session Identifier |
| 9686 | \return uint32_t - Lim Mlm session state |
| 9687 | -------------------------------------------------------------------------*/ |
| 9688 | uint32_t sme_get_lim_mlm_session_state(tHalHandle hHal, uint8_t sessionId) |
| 9689 | { |
| 9690 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9691 | return pMac->lim.gpSession[sessionId].limMlmState; |
| 9692 | } |
| 9693 | |
| 9694 | /* --------------------------------------------------------------------------- |
| 9695 | \fn sme_get_neighbor_scan_max_chan_time |
| 9696 | \brief get neighbor scan max channel time |
| 9697 | \param hHal - The handle returned by mac_open. |
| 9698 | \param sessionId - Session Identifier |
| 9699 | \return uint16_t - channel max time value |
| 9700 | -------------------------------------------------------------------------*/ |
| 9701 | uint16_t sme_get_neighbor_scan_max_chan_time(tHalHandle hHal, uint8_t sessionId) |
| 9702 | { |
| 9703 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9704 | return pMac->roam.neighborRoamInfo[sessionId].cfgParams. |
| 9705 | maxChannelScanTime; |
| 9706 | } |
| 9707 | |
| 9708 | /* --------------------------------------------------------------------------- |
| 9709 | \fn sme_set_neighbor_scan_period |
| 9710 | \brief Update nNeighborScanPeriod |
| 9711 | This function is called through dynamic setConfig callback function |
| 9712 | to configure nNeighborScanPeriod |
| 9713 | Usage: adb shell iwpriv wlan0 setConfig |
| 9714 | nNeighborScanPeriod=[0 .. 1000] |
| 9715 | \param hHal - HAL handle for device |
| 9716 | \param sessionId - Session Identifier |
| 9717 | \param nNeighborScanPeriod - neighbor scan period |
| 9718 | \- return Success or failure |
| 9719 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9720 | QDF_STATUS sme_set_neighbor_scan_period(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9721 | const uint16_t nNeighborScanPeriod) |
| 9722 | { |
| 9723 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9724 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9725 | tCsrNeighborRoamConfig *pNeighborRoamConfig = NULL; |
| 9726 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 9727 | |
| 9728 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9729 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9730 | pNeighborRoamConfig = |
| 9731 | &pMac->roam.configParam.neighborRoamConfig; |
| 9732 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9733 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9734 | "LFR runtime successfully set neighbor scan period to %d" |
| 9735 | " - old value is %d - roam state is %s", |
| 9736 | nNeighborScanPeriod, |
| 9737 | pMac->roam.configParam.neighborRoamConfig. |
| 9738 | nNeighborScanTimerPeriod, |
| 9739 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 9740 | neighborRoamInfo |
| 9741 | [sessionId]. |
| 9742 | neighborRoamState)); |
| 9743 | pNeighborRoamConfig->nNeighborScanTimerPeriod = |
| 9744 | nNeighborScanPeriod; |
| 9745 | pNeighborRoamInfo->cfgParams.neighborScanPeriod = |
| 9746 | nNeighborScanPeriod; |
| 9747 | sme_release_global_lock(&pMac->sme); |
| 9748 | } |
| 9749 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 9750 | csr_roam_offload_scan(pMac, sessionId, |
| 9751 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 9752 | REASON_SCAN_HOME_TIME_CHANGED); |
| 9753 | } |
| 9754 | |
| 9755 | return status; |
| 9756 | } |
| 9757 | |
| 9758 | /* --------------------------------------------------------------------------- |
| 9759 | \fn sme_get_neighbor_scan_period |
| 9760 | \brief get neighbor scan period |
| 9761 | \param hHal - The handle returned by mac_open. |
| 9762 | \param sessionId - Session Identifier |
| 9763 | \return uint16_t - neighbor scan period |
| 9764 | -------------------------------------------------------------------------*/ |
| 9765 | uint16_t sme_get_neighbor_scan_period(tHalHandle hHal, uint8_t sessionId) |
| 9766 | { |
| 9767 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9768 | return pMac->roam.neighborRoamInfo[sessionId].cfgParams. |
| 9769 | neighborScanPeriod; |
| 9770 | } |
| 9771 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9772 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9773 | |
| 9774 | /*-------------------------------------------------------------------------- |
| 9775 | \brief sme_get_roam_rssi_diff() - get Roam rssi diff |
| 9776 | This is a synchronous call |
| 9777 | \param hHal - The handle returned by mac_open. |
| 9778 | \return uint16_t - Rssi diff value |
| 9779 | \sa |
| 9780 | --------------------------------------------------------------------------*/ |
| 9781 | uint8_t sme_get_roam_rssi_diff(tHalHandle hHal) |
| 9782 | { |
| 9783 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9784 | return pMac->roam.configParam.RoamRssiDiff; |
| 9785 | } |
| 9786 | |
| 9787 | /** |
| 9788 | * sme_change_roam_scan_channel_list() - to change scan channel list |
| 9789 | * @hHal: pointer HAL handle returned by mac_open |
| 9790 | * @sessionId: sme session id |
| 9791 | * @pChannelList: Output channel list |
| 9792 | * @numChannels: Output number of channels |
| 9793 | * |
| 9794 | * This routine is called to Change roam scan channel list. |
| 9795 | * This is a synchronous call |
| 9796 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9797 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9798 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9799 | QDF_STATUS sme_change_roam_scan_channel_list(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9800 | uint8_t *pChannelList, |
| 9801 | uint8_t numChannels) |
| 9802 | { |
| 9803 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9804 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9805 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = |
| 9806 | &pMac->roam.neighborRoamInfo[sessionId]; |
| 9807 | uint8_t oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN * 2] = { 0 }; |
| 9808 | uint8_t newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN * 2] = { 0 }; |
| 9809 | uint8_t i = 0, j = 0; |
| 9810 | tCsrChannelInfo *chan_info; |
| 9811 | |
| 9812 | |
| 9813 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9814 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9815 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 9816 | csr_roam_offload_scan(pMac, sessionId, |
| 9817 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 9818 | REASON_CHANNEL_LIST_CHANGED); |
| 9819 | return status; |
| 9820 | } |
| 9821 | chan_info = &pNeighborRoamInfo->cfgParams.channelInfo; |
| 9822 | |
| 9823 | if (NULL != chan_info->ChannelList) { |
| 9824 | for (i = 0; i < chan_info->numOfChannels; i++) { |
| 9825 | if (j < sizeof(oldChannelList)) |
| 9826 | j += snprintf(oldChannelList + j, |
| 9827 | sizeof(oldChannelList) - |
| 9828 | j, "%d", |
| 9829 | chan_info->ChannelList[i]); |
| 9830 | else |
| 9831 | break; |
| 9832 | } |
| 9833 | } |
| 9834 | csr_flush_cfg_bg_scan_roam_channel_list(pMac, sessionId); |
| 9835 | csr_create_bg_scan_roam_channel_list(pMac, sessionId, pChannelList, |
| 9836 | numChannels); |
| 9837 | sme_set_roam_scan_control(hHal, sessionId, 1); |
| 9838 | if (NULL != chan_info->ChannelList) { |
| 9839 | j = 0; |
| 9840 | for (i = 0; i < chan_info->numOfChannels; i++) { |
| 9841 | if (j < sizeof(newChannelList)) |
| 9842 | j += snprintf(newChannelList + j, |
| 9843 | sizeof(newChannelList) - |
| 9844 | j, " %d", |
| 9845 | chan_info->ChannelList[i]); |
| 9846 | else |
| 9847 | break; |
| 9848 | } |
| 9849 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9850 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9851 | FL("LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d"), |
| 9852 | newChannelList, oldChannelList, |
| 9853 | pMac->roam.neighborRoamInfo[sessionId].neighborRoamState); |
| 9854 | sme_release_global_lock(&pMac->sme); |
| 9855 | |
| 9856 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 9857 | csr_roam_offload_scan(pMac, sessionId, |
| 9858 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 9859 | REASON_CHANNEL_LIST_CHANGED); |
| 9860 | return status; |
| 9861 | } |
| 9862 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9863 | /** |
| 9864 | * sme_get_roam_scan_channel_list() - To get roam scan channel list |
| 9865 | * @hHal: HAL pointer |
| 9866 | * @pChannelList: Output channel list |
| 9867 | * @pNumChannels: Output number of channels |
| 9868 | * @sessionId: Session Identifier |
| 9869 | * |
| 9870 | * To get roam scan channel list This is a synchronous call |
| 9871 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9872 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9873 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9874 | QDF_STATUS sme_get_roam_scan_channel_list(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9875 | uint8_t *pChannelList, uint8_t *pNumChannels, |
| 9876 | uint8_t sessionId) |
| 9877 | { |
| 9878 | int i = 0; |
| 9879 | uint8_t *pOutPtr = pChannelList; |
| 9880 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9881 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = |
| 9882 | &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9883 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9884 | |
| 9885 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9886 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9887 | return status; |
| 9888 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9889 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_WARN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9890 | FL("Roam Scan channel list is NOT yet initialized")); |
| 9891 | *pNumChannels = 0; |
| 9892 | sme_release_global_lock(&pMac->sme); |
| 9893 | return status; |
| 9894 | } |
| 9895 | |
| 9896 | *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; |
| 9897 | for (i = 0; i < (*pNumChannels); i++) { |
| 9898 | pOutPtr[i] = |
| 9899 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]; |
| 9900 | } |
| 9901 | pOutPtr[i] = '\0'; |
| 9902 | sme_release_global_lock(&pMac->sme); |
| 9903 | return status; |
| 9904 | } |
| 9905 | |
| 9906 | /*-------------------------------------------------------------------------- |
| 9907 | \brief sme_get_is_ese_feature_enabled() - get ESE feature enabled or not |
| 9908 | This is a synchronuous call |
| 9909 | \param hHal - The handle returned by mac_open. |
| 9910 | \return true (1) - if the ESE feature is enabled |
| 9911 | false (0) - if feature is disabled (compile or runtime) |
| 9912 | \sa |
| 9913 | --------------------------------------------------------------------------*/ |
| 9914 | bool sme_get_is_ese_feature_enabled(tHalHandle hHal) |
| 9915 | { |
| 9916 | #ifdef FEATURE_WLAN_ESE |
| 9917 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9918 | return csr_roam_is_ese_ini_feature_enabled(pMac); |
| 9919 | #else |
| 9920 | return false; |
| 9921 | #endif |
| 9922 | } |
| 9923 | |
| 9924 | /*-------------------------------------------------------------------------- |
| 9925 | \brief sme_get_wes_mode() - get WES Mode |
| 9926 | This is a synchronous call |
| 9927 | \param hHal - The handle returned by mac_open |
| 9928 | \return uint8_t - WES Mode Enabled(1)/Disabled(0) |
| 9929 | \sa |
| 9930 | --------------------------------------------------------------------------*/ |
| 9931 | bool sme_get_wes_mode(tHalHandle hHal) |
| 9932 | { |
| 9933 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9934 | return pMac->roam.configParam.isWESModeEnabled; |
| 9935 | } |
| 9936 | |
| 9937 | /*-------------------------------------------------------------------------- |
| 9938 | \brief sme_get_roam_scan_control() - get scan control |
| 9939 | This is a synchronous call |
| 9940 | \param hHal - The handle returned by mac_open. |
| 9941 | \return bool - Enabled(1)/Disabled(0) |
| 9942 | \sa |
| 9943 | --------------------------------------------------------------------------*/ |
| 9944 | bool sme_get_roam_scan_control(tHalHandle hHal) |
| 9945 | { |
| 9946 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9947 | return pMac->roam.configParam.nRoamScanControl; |
| 9948 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9949 | |
| 9950 | /*-------------------------------------------------------------------------- |
| 9951 | \brief sme_get_is_lfr_feature_enabled() - get LFR feature enabled or not |
| 9952 | This is a synchronuous call |
| 9953 | \param hHal - The handle returned by mac_open. |
| 9954 | \return true (1) - if the feature is enabled |
| 9955 | false (0) - if feature is disabled (compile or runtime) |
| 9956 | \sa |
| 9957 | --------------------------------------------------------------------------*/ |
| 9958 | bool sme_get_is_lfr_feature_enabled(tHalHandle hHal) |
| 9959 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9960 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9961 | return pMac->roam.configParam.isFastRoamIniFeatureEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9962 | } |
| 9963 | |
| 9964 | /*-------------------------------------------------------------------------- |
| 9965 | \brief sme_get_is_ft_feature_enabled() - get FT feature enabled or not |
| 9966 | This is a synchronuous call |
| 9967 | \param hHal - The handle returned by mac_open. |
| 9968 | \return true (1) - if the feature is enabled |
| 9969 | false (0) - if feature is disabled (compile or runtime) |
| 9970 | \sa |
| 9971 | --------------------------------------------------------------------------*/ |
| 9972 | bool sme_get_is_ft_feature_enabled(tHalHandle hHal) |
| 9973 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9974 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9975 | return pMac->roam.configParam.isFastTransitionEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9976 | } |
| 9977 | |
| 9978 | /* --------------------------------------------------------------------------- |
| 9979 | \fn sme_is_feature_supported_by_fw |
| 9980 | \brief Check if an feature is enabled by FW |
| 9981 | |
| 9982 | \param feattEnumValue - Enumeration value from placeHolderInCapBitmap |
| 9983 | \- return 1/0 (true/false) |
| 9984 | -------------------------------------------------------------------------*/ |
| 9985 | uint8_t sme_is_feature_supported_by_fw(uint8_t featEnumValue) |
| 9986 | { |
| 9987 | return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue); |
| 9988 | } |
| 9989 | |
| 9990 | #ifdef FEATURE_WLAN_TDLS |
| 9991 | |
| 9992 | /* --------------------------------------------------------------------------- |
| 9993 | \fn sme_send_tdls_link_establish_params |
| 9994 | \brief API to send TDLS Peer Link Establishment Parameters. |
| 9995 | |
| 9996 | \param peerMac - peer's Mac Adress. |
| 9997 | \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 9998 | \- return QDF_STATUS_SUCCES |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9999 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10000 | QDF_STATUS sme_send_tdls_link_establish_params(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10001 | uint8_t sessionId, |
| 10002 | const tSirMacAddr peerMac, |
| 10003 | tCsrTdlsLinkEstablishParams * |
| 10004 | tdlsLinkEstablishParams) |
| 10005 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10006 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10007 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10008 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10009 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 10010 | TRACE_CODE_SME_RX_HDD_TDLS_LINK_ESTABLISH_PARAM, |
| 10011 | sessionId, |
| 10012 | tdlsLinkEstablishParams->isOffChannelSupported)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10013 | status = sme_acquire_global_lock(&pMac->sme); |
| 10014 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10015 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10016 | status = csr_tdls_send_link_establish_params(hHal, sessionId, |
| 10017 | peerMac, tdlsLinkEstablishParams); |
| 10018 | sme_release_global_lock(&pMac->sme); |
| 10019 | } |
| 10020 | return status; |
| 10021 | } |
| 10022 | |
| 10023 | /* --------------------------------------------------------------------------- |
| 10024 | \fn sme_send_tdls_mgmt_frame |
| 10025 | \brief API to send TDLS management frames. |
| 10026 | |
| 10027 | \param peerMac - peer's Mac Adress. |
| 10028 | \param frame_type - Type of TDLS mgmt frame to be sent. |
| 10029 | \param dialog - dialog token used in the frame. |
| 10030 | \param status - status to be incuded in the frame. |
| 10031 | \param peerCapability - peer cpabilities |
| 10032 | \param buf - additional IEs to be included |
| 10033 | \param len - lenght of additional Ies |
| 10034 | \param responder - Tdls request type |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 10035 | \- return QDF_STATUS_SUCCES |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10036 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10037 | QDF_STATUS sme_send_tdls_mgmt_frame(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10038 | const tSirMacAddr peerMac, |
| 10039 | uint8_t frame_type, |
| 10040 | uint8_t dialog, uint16_t statusCode, |
| 10041 | uint32_t peerCapability, uint8_t *buf, |
| 10042 | uint8_t len, uint8_t responder) |
| 10043 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10044 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10045 | tCsrTdlsSendMgmt sendTdlsReq = { {0} }; |
| 10046 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10047 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10048 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 10049 | TRACE_CODE_SME_RX_HDD_TDLS_SEND_MGMT_FRAME, |
| 10050 | sessionId, statusCode)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10051 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10052 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10053 | qdf_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10054 | sendTdlsReq.frameType = frame_type; |
| 10055 | sendTdlsReq.buf = buf; |
| 10056 | sendTdlsReq.len = len; |
| 10057 | sendTdlsReq.dialog = dialog; |
| 10058 | sendTdlsReq.statusCode = statusCode; |
| 10059 | sendTdlsReq.responder = responder; |
| 10060 | sendTdlsReq.peerCapability = peerCapability; |
| 10061 | |
| 10062 | status = csr_tdls_send_mgmt_req(hHal, sessionId, &sendTdlsReq); |
| 10063 | |
| 10064 | sme_release_global_lock(&pMac->sme); |
| 10065 | } |
| 10066 | |
| 10067 | return status; |
| 10068 | |
| 10069 | } |
| 10070 | |
| 10071 | /* --------------------------------------------------------------------------- |
| 10072 | \fn sme_change_tdls_peer_sta |
| 10073 | \brief API to Update TDLS peer sta parameters. |
| 10074 | |
| 10075 | \param peerMac - peer's Mac Adress. |
| 10076 | \param staParams - Peer Station Parameters |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 10077 | \- return QDF_STATUS_SUCCES |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10078 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10079 | QDF_STATUS sme_change_tdls_peer_sta(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10080 | const tSirMacAddr peerMac, |
| 10081 | tCsrStaParams *pstaParams) |
| 10082 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10083 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10084 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10085 | |
| 10086 | if (NULL == pstaParams) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10087 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10088 | "%s :pstaParams is NULL", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10089 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10090 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10091 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 10092 | TRACE_CODE_SME_RX_HDD_TDLS_CHANGE_PEER_STA, |
| 10093 | sessionId, pstaParams->capability)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10094 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10095 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10096 | status = csr_tdls_change_peer_sta(hHal, sessionId, peerMac, |
| 10097 | pstaParams); |
| 10098 | |
| 10099 | sme_release_global_lock(&pMac->sme); |
| 10100 | } |
| 10101 | |
| 10102 | return status; |
| 10103 | |
| 10104 | } |
| 10105 | |
| 10106 | /* --------------------------------------------------------------------------- |
| 10107 | \fn sme_add_tdls_peer_sta |
| 10108 | \brief API to Add TDLS peer sta entry. |
| 10109 | |
| 10110 | \param peerMac - peer's Mac Adress. |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 10111 | \- return QDF_STATUS_SUCCES |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10112 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10113 | QDF_STATUS sme_add_tdls_peer_sta(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10114 | const tSirMacAddr peerMac) |
| 10115 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10116 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10117 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10118 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10119 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 10120 | TRACE_CODE_SME_RX_HDD_TDLS_ADD_PEER_STA, |
| 10121 | sessionId, 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10122 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10123 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10124 | status = csr_tdls_add_peer_sta(hHal, sessionId, peerMac); |
| 10125 | |
| 10126 | sme_release_global_lock(&pMac->sme); |
| 10127 | } |
| 10128 | |
| 10129 | return status; |
| 10130 | |
| 10131 | } |
| 10132 | |
| 10133 | /* --------------------------------------------------------------------------- |
| 10134 | \fn sme_delete_tdls_peer_sta |
| 10135 | \brief API to Delete TDLS peer sta entry. |
| 10136 | |
| 10137 | \param peerMac - peer's Mac Adress. |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 10138 | \- return QDF_STATUS_SUCCES |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10139 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10140 | QDF_STATUS sme_delete_tdls_peer_sta(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10141 | const tSirMacAddr peerMac) |
| 10142 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10143 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10144 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10145 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10146 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 10147 | TRACE_CODE_SME_RX_HDD_TDLS_DEL_PEER_STA, |
| 10148 | sessionId, 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10149 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10150 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10151 | status = csr_tdls_del_peer_sta(hHal, sessionId, peerMac); |
| 10152 | |
| 10153 | sme_release_global_lock(&pMac->sme); |
| 10154 | } |
| 10155 | |
| 10156 | return status; |
| 10157 | |
| 10158 | } |
| 10159 | |
| 10160 | /* --------------------------------------------------------------------------- |
| 10161 | \fn sme_set_tdls_power_save_prohibited |
| 10162 | \API to set/reset the is_tdls_power_save_prohibited. |
| 10163 | |
| 10164 | \- return void |
| 10165 | -------------------------------------------------------------------------*/ |
| 10166 | void sme_set_tdls_power_save_prohibited(tHalHandle hHal, uint32_t sessionId, |
| 10167 | bool val) |
| 10168 | { |
| 10169 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10170 | struct ps_global_info *ps_global_info = &pMac->sme.ps_global_info; |
| 10171 | struct ps_params *ps_param = &ps_global_info->ps_params[sessionId]; |
| 10172 | ps_param->is_tdls_power_save_prohibited = val; |
| 10173 | return; |
| 10174 | } |
| 10175 | |
| 10176 | /* --------------------------------------------------------------------------- |
| 10177 | \fn sme_update_fw_tdls_state |
| 10178 | |
| 10179 | \brief |
| 10180 | SME will send message to WMA to set TDLS state in f/w |
| 10181 | |
| 10182 | \param |
| 10183 | |
| 10184 | hHal - The handle returned by mac_open |
| 10185 | |
| 10186 | psmeTdlsParams - TDLS state info to update in f/w |
| 10187 | |
| 10188 | useSmeLock - Need to acquire SME Global Lock before state update or not |
| 10189 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10190 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10191 | --------------------------------------------------------------------------- */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10192 | QDF_STATUS sme_update_fw_tdls_state(tHalHandle hHal, void *psmeTdlsParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10193 | bool useSmeLock) |
| 10194 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10195 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10196 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10197 | tpAniSirGlobal pMac = NULL; |
| 10198 | cds_msg_t cds_message; |
| 10199 | |
Mukul Sharma | eae172c | 2016-09-03 13:40:46 +0530 | [diff] [blame] | 10200 | pMac = PMAC_STRUCT(hHal); |
| 10201 | if (NULL == pMac) { |
| 10202 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10203 | FL("pMac is Null")); |
| 10204 | return QDF_STATUS_E_FAILURE; |
| 10205 | } |
| 10206 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10207 | /* only acquire sme global lock before state update if asked to */ |
| 10208 | if (useSmeLock) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10209 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10210 | if (QDF_STATUS_SUCCESS != status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10211 | return status; |
| 10212 | } |
| 10213 | |
| 10214 | /* serialize the req through MC thread */ |
| 10215 | cds_message.bodyptr = psmeTdlsParams; |
| 10216 | cds_message.type = WMA_UPDATE_FW_TDLS_STATE; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10217 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 10218 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 10219 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10220 | |
| 10221 | /* release the lock if it was acquired */ |
| 10222 | if (useSmeLock) |
| 10223 | sme_release_global_lock(&pMac->sme); |
| 10224 | |
| 10225 | return status; |
| 10226 | } |
| 10227 | |
| 10228 | /** |
| 10229 | * sme_update_tdls_peer_state() - to update the state of TDLS peer |
| 10230 | * @hHal: The handle returned by mac_open |
| 10231 | * @peerStateParams: TDLS Peer state info to update in f/w |
| 10232 | * |
| 10233 | * SME will send message to WMA to set TDLS Peer state in f/w |
| 10234 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10235 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10236 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10237 | QDF_STATUS sme_update_tdls_peer_state(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10238 | tSmeTdlsPeerStateParams *peerStateParams) |
| 10239 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10240 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10241 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10242 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10243 | tTdlsPeerStateParams *pTdlsPeerStateParams = NULL; |
| 10244 | tTdlsPeerCapParams *peer_cap = NULL; |
| 10245 | cds_msg_t cds_message; |
| 10246 | uint8_t num; |
Kabilan Kannan | 44f6586 | 2016-06-28 23:46:51 -0700 | [diff] [blame] | 10247 | uint8_t peer_chan_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10248 | uint8_t chanId; |
| 10249 | uint8_t i; |
| 10250 | |
| 10251 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10252 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10253 | return status; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10254 | pTdlsPeerStateParams = qdf_mem_malloc(sizeof(*pTdlsPeerStateParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10255 | if (NULL == pTdlsPeerStateParams) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10256 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10257 | FL("failed to allocate mem for tdls peer state param")); |
| 10258 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10259 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10260 | } |
| 10261 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10262 | qdf_mem_zero(pTdlsPeerStateParams, sizeof(*pTdlsPeerStateParams)); |
| 10263 | qdf_mem_copy(&pTdlsPeerStateParams->peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10264 | &peerStateParams->peerMacAddr, sizeof(tSirMacAddr)); |
| 10265 | pTdlsPeerStateParams->vdevId = peerStateParams->vdevId; |
| 10266 | pTdlsPeerStateParams->peerState = peerStateParams->peerState; |
| 10267 | |
| 10268 | switch (peerStateParams->peerState) { |
| 10269 | case eSME_TDLS_PEER_STATE_PEERING: |
| 10270 | pTdlsPeerStateParams->peerState = |
| 10271 | WMA_TDLS_PEER_STATE_PEERING; |
| 10272 | break; |
| 10273 | |
| 10274 | case eSME_TDLS_PEER_STATE_CONNECTED: |
| 10275 | pTdlsPeerStateParams->peerState = |
| 10276 | WMA_TDLS_PEER_STATE_CONNECTED; |
| 10277 | break; |
| 10278 | |
| 10279 | case eSME_TDLS_PEER_STATE_TEARDOWN: |
| 10280 | pTdlsPeerStateParams->peerState = |
| 10281 | WMA_TDLS_PEER_STATE_TEARDOWN; |
| 10282 | break; |
| 10283 | |
Kabilan Kannan | 421714b | 2015-11-23 04:44:59 -0800 | [diff] [blame] | 10284 | case eSME_TDLS_PEER_ADD_MAC_ADDR: |
| 10285 | pTdlsPeerStateParams->peerState = WMA_TDLS_PEER_ADD_MAC_ADDR; |
| 10286 | break; |
| 10287 | |
| 10288 | case eSME_TDLS_PEER_REMOVE_MAC_ADDR: |
| 10289 | pTdlsPeerStateParams->peerState = WMA_TDLS_PEER_REMOVE_MAC_ADDR; |
| 10290 | break; |
| 10291 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10292 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10293 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10294 | FL("invalid peer state param (%d)"), |
| 10295 | peerStateParams->peerState); |
Kabilan Kannan | 44f6586 | 2016-06-28 23:46:51 -0700 | [diff] [blame] | 10296 | goto error_return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10297 | } |
| 10298 | peer_cap = &(pTdlsPeerStateParams->peerCap); |
| 10299 | peer_cap->isPeerResponder = |
| 10300 | peerStateParams->peerCap.isPeerResponder; |
| 10301 | peer_cap->peerUapsdQueue = |
| 10302 | peerStateParams->peerCap.peerUapsdQueue; |
| 10303 | peer_cap->peerMaxSp = |
| 10304 | peerStateParams->peerCap.peerMaxSp; |
| 10305 | peer_cap->peerBuffStaSupport = |
| 10306 | peerStateParams->peerCap.peerBuffStaSupport; |
| 10307 | peer_cap->peerOffChanSupport = |
| 10308 | peerStateParams->peerCap.peerOffChanSupport; |
| 10309 | peer_cap->peerCurrOperClass = |
| 10310 | peerStateParams->peerCap.peerCurrOperClass; |
| 10311 | peer_cap->selfCurrOperClass = |
| 10312 | peerStateParams->peerCap.selfCurrOperClass; |
| 10313 | |
| 10314 | num = 0; |
Kabilan Kannan | 44f6586 | 2016-06-28 23:46:51 -0700 | [diff] [blame] | 10315 | peer_chan_len = peerStateParams->peerCap.peerChanLen; |
| 10316 | |
| 10317 | if (peer_chan_len >= 0 && |
| 10318 | peer_chan_len <= SME_TDLS_MAX_SUPP_CHANNELS) { |
| 10319 | for (i = 0; i < peerStateParams->peerCap.peerChanLen; i++) { |
| 10320 | chanId = peerStateParams->peerCap.peerChan[i]; |
| 10321 | if (csr_roam_is_channel_valid(pMac, chanId) && |
| 10322 | !(cds_get_channel_state(chanId) == |
| 10323 | CHANNEL_STATE_DFS) && |
| 10324 | !cds_is_dsrc_channel(cds_chan_to_freq(chanId))) { |
| 10325 | peer_cap->peerChan[num].chanId = chanId; |
| 10326 | peer_cap->peerChan[num].pwr = |
| 10327 | csr_get_cfg_max_tx_power(pMac, chanId); |
| 10328 | peer_cap->peerChan[num].dfsSet = false; |
Archana Ramachandran | 63f64dd | 2016-04-28 15:13:35 -0700 | [diff] [blame] | 10329 | num++; |
Kabilan Kannan | 44f6586 | 2016-06-28 23:46:51 -0700 | [diff] [blame] | 10330 | } |
Archana Ramachandran | 63f64dd | 2016-04-28 15:13:35 -0700 | [diff] [blame] | 10331 | } |
Kabilan Kannan | 44f6586 | 2016-06-28 23:46:51 -0700 | [diff] [blame] | 10332 | } else { |
| 10333 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10334 | FL("invalid peer channel len (%d)"), |
| 10335 | peer_chan_len); |
| 10336 | goto error_return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10337 | } |
Kabilan Kannan | 44f6586 | 2016-06-28 23:46:51 -0700 | [diff] [blame] | 10338 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10339 | peer_cap->peerChanLen = num; |
| 10340 | peer_cap->peerOperClassLen = |
| 10341 | peerStateParams->peerCap.peerOperClassLen; |
| 10342 | for (i = 0; i < HAL_TDLS_MAX_SUPP_OPER_CLASSES; i++) { |
| 10343 | peer_cap->peerOperClass[i] = |
| 10344 | peerStateParams->peerCap.peerOperClass[i]; |
| 10345 | } |
| 10346 | |
| 10347 | peer_cap->prefOffChanNum = |
| 10348 | peerStateParams->peerCap.prefOffChanNum; |
| 10349 | peer_cap->prefOffChanBandwidth = |
| 10350 | peerStateParams->peerCap.prefOffChanBandwidth; |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 10351 | peer_cap->opClassForPrefOffChan = |
| 10352 | peerStateParams->peerCap.opClassForPrefOffChan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10353 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10354 | cds_message.type = WMA_UPDATE_TDLS_PEER_STATE; |
| 10355 | cds_message.reserved = 0; |
| 10356 | cds_message.bodyptr = pTdlsPeerStateParams; |
| 10357 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10358 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 10359 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Kabilan Kannan | 44f6586 | 2016-06-28 23:46:51 -0700 | [diff] [blame] | 10360 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10361 | FL("cds_mq_post_message failed ")); |
| 10362 | goto error_return; |
| 10363 | } else { |
| 10364 | goto success_return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10365 | } |
Kabilan Kannan | 44f6586 | 2016-06-28 23:46:51 -0700 | [diff] [blame] | 10366 | |
| 10367 | error_return: |
| 10368 | status = QDF_STATUS_E_FAILURE; |
| 10369 | qdf_mem_free(pTdlsPeerStateParams); |
| 10370 | success_return: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10371 | sme_release_global_lock(&pMac->sme); |
| 10372 | return status; |
| 10373 | } |
| 10374 | |
| 10375 | /** |
| 10376 | * sme_send_tdls_chan_switch_req() - send tdls channel switch request |
| 10377 | * @hal: UMAC handler |
| 10378 | * @ch_switch_params: Pointer to the chan switch parameter structure |
| 10379 | * |
| 10380 | * API to set tdls channel switch parameters. |
| 10381 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 10382 | * Return: QDF_STATUS_SUCCESS on success; another QDF_STATUS_** code otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10383 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10384 | QDF_STATUS sme_send_tdls_chan_switch_req(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10385 | sme_tdls_chan_switch_params *ch_switch_params) |
| 10386 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10387 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10388 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10389 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 10390 | tdls_chan_switch_params *chan_switch_params = NULL; |
| 10391 | cds_msg_t cds_message; |
| 10392 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10393 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 10394 | TRACE_CODE_SME_RX_HDD_TDLS_CHAN_SWITCH_REQ, |
| 10395 | NO_SESSION, ch_switch_params->tdls_off_channel)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10396 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10397 | if (QDF_STATUS_SUCCESS != status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10398 | return status; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10399 | chan_switch_params = qdf_mem_malloc(sizeof(*chan_switch_params)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10400 | if (NULL == chan_switch_params) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10401 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10402 | FL("fail to alloc mem for tdls chan switch param")); |
| 10403 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10404 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10405 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10406 | qdf_mem_zero(chan_switch_params, sizeof(*chan_switch_params)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10407 | |
| 10408 | switch (ch_switch_params->tdls_off_ch_mode) { |
| 10409 | case ENABLE_CHANSWITCH: |
| 10410 | chan_switch_params->tdls_sw_mode = WMA_TDLS_ENABLE_OFFCHANNEL; |
| 10411 | break; |
| 10412 | |
| 10413 | case DISABLE_CHANSWITCH: |
| 10414 | chan_switch_params->tdls_sw_mode = WMA_TDLS_DISABLE_OFFCHANNEL; |
| 10415 | break; |
| 10416 | |
| 10417 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10418 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10419 | FL("invalid off channel command (%d)"), |
| 10420 | ch_switch_params->tdls_off_ch_mode); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10421 | qdf_mem_free(chan_switch_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10422 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10423 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10424 | } |
| 10425 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10426 | qdf_mem_copy(&chan_switch_params->peer_mac_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10427 | &ch_switch_params->peer_mac_addr, sizeof(tSirMacAddr)); |
| 10428 | chan_switch_params->vdev_id = ch_switch_params->vdev_id; |
| 10429 | chan_switch_params->tdls_off_ch = ch_switch_params->tdls_off_channel; |
| 10430 | chan_switch_params->tdls_off_ch_bw_offset = |
| 10431 | ch_switch_params->tdls_off_ch_bw_offset; |
| 10432 | chan_switch_params->is_responder = ch_switch_params->is_responder; |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 10433 | chan_switch_params->oper_class = ch_switch_params->opclass; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10434 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10435 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10436 | FL("Country Code=%s, Req offset=%d, Selected Operate Class=%d"), |
| 10437 | mac->scan.countryCodeCurrent, |
| 10438 | chan_switch_params->tdls_off_ch_bw_offset, |
| 10439 | chan_switch_params->oper_class); |
| 10440 | |
| 10441 | cds_message.type = WMA_TDLS_SET_OFFCHAN_MODE; |
| 10442 | cds_message.reserved = 0; |
| 10443 | cds_message.bodyptr = chan_switch_params; |
| 10444 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10445 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 10446 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10447 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10448 | FL("Message Post failed status=%d"), |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10449 | qdf_status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10450 | qdf_mem_free(chan_switch_params); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10451 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10452 | } |
| 10453 | sme_release_global_lock(&mac->sme); |
| 10454 | return status; |
| 10455 | } |
| 10456 | #endif /* FEATURE_WLAN_TDLS */ |
| 10457 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10458 | QDF_STATUS sme_get_link_speed(tHalHandle hHal, tSirLinkSpeedInfo *lsReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10459 | void *plsContext, |
| 10460 | void (*pCallbackfn)(tSirLinkSpeedInfo *indParam, |
| 10461 | void *pContext)) |
| 10462 | { |
| 10463 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10464 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10465 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10466 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10467 | cds_msg_t cds_message; |
| 10468 | |
| 10469 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10470 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10471 | if ((NULL == pCallbackfn) && |
| 10472 | (NULL == pMac->sme.pLinkSpeedIndCb)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10473 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10474 | "%s: Indication Call back did not registered", |
| 10475 | __func__); |
| 10476 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10477 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10478 | } else if (NULL != pCallbackfn) { |
| 10479 | pMac->sme.pLinkSpeedCbContext = plsContext; |
| 10480 | pMac->sme.pLinkSpeedIndCb = pCallbackfn; |
| 10481 | } |
| 10482 | /* serialize the req through MC thread */ |
| 10483 | cds_message.bodyptr = lsReq; |
| 10484 | cds_message.type = WMA_GET_LINK_SPEED; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10485 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 10486 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10487 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10488 | "%s: Post Link Speed msg fail", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10489 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10490 | } |
| 10491 | sme_release_global_lock(&pMac->sme); |
| 10492 | } |
| 10493 | return status; |
| 10494 | } |
| 10495 | |
| 10496 | |
| 10497 | /* |
| 10498 | * SME API to enable/disable WLAN driver initiated SSR |
| 10499 | */ |
| 10500 | void sme_update_enable_ssr(tHalHandle hHal, bool enableSSR) |
| 10501 | { |
| 10502 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10503 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10504 | |
| 10505 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10506 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10507 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10508 | "SSR level is changed %d", enableSSR); |
| 10509 | /* not serializing this messsage, as this is only going |
| 10510 | * to set a variable in WMA/WDI |
| 10511 | */ |
| 10512 | WMA_SetEnableSSR(enableSSR); |
| 10513 | sme_release_global_lock(&pMac->sme); |
| 10514 | } |
| 10515 | return; |
| 10516 | } |
| 10517 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10518 | QDF_STATUS sme_check_ch_in_band(tpAniSirGlobal mac_ctx, uint8_t start_ch, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10519 | uint8_t ch_cnt) |
| 10520 | { |
| 10521 | uint8_t i; |
| 10522 | for (i = 0; i < ch_cnt; i++) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10523 | if (QDF_STATUS_SUCCESS != csr_is_valid_channel(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10524 | (start_ch + i*4))) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10525 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10526 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10527 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10528 | } |
| 10529 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10530 | /*convert the ini value to the ENUM used in csr and MAC for CB state*/ |
| 10531 | ePhyChanBondState sme_get_cb_phy_state_from_cb_ini_value(uint32_t cb_ini_value) |
| 10532 | { |
| 10533 | return csr_convert_cb_ini_value_to_phy_cb_state(cb_ini_value); |
| 10534 | } |
| 10535 | |
| 10536 | /*-------------------------------------------------------------------------- |
| 10537 | |
| 10538 | \brief sme_set_curr_device_mode() - Sets the current operating device mode. |
| 10539 | \param hHal - The handle returned by mac_open. |
| 10540 | \param currDeviceMode - Current operating device mode. |
| 10541 | --------------------------------------------------------------------------*/ |
| 10542 | |
Peng Xu | f5d60c8 | 2015-10-02 17:17:03 -0700 | [diff] [blame] | 10543 | void sme_set_curr_device_mode(tHalHandle hHal, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10544 | enum tQDF_ADAPTER_MODE currDeviceMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10545 | { |
| 10546 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10547 | pMac->sme.currDeviceMode = currDeviceMode; |
| 10548 | return; |
| 10549 | } |
| 10550 | |
| 10551 | /*-------------------------------------------------------------------------- |
| 10552 | \brief sme_handoff_request() - a wrapper function to Request a handoff |
| 10553 | from CSR. |
| 10554 | This is a synchronous call |
| 10555 | \param hHal - The handle returned by mac_open |
| 10556 | \param sessionId - Session Identifier |
| 10557 | \param pHandoffInfo - info provided by HDD with the handoff request (namely: |
| 10558 | BSSID, channel etc.) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10559 | \return QDF_STATUS_SUCCESS - SME passed the request to CSR successfully. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10560 | Other status means SME is failed to send the request. |
| 10561 | \sa |
| 10562 | --------------------------------------------------------------------------*/ |
| 10563 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10564 | QDF_STATUS sme_handoff_request(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10565 | uint8_t sessionId, |
| 10566 | tCsrHandoffRequest *pHandoffInfo) |
| 10567 | { |
| 10568 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10569 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10570 | |
| 10571 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10572 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10573 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10574 | "%s: invoked", __func__); |
| 10575 | status = csr_handoff_request(pMac, sessionId, pHandoffInfo); |
| 10576 | sme_release_global_lock(&pMac->sme); |
| 10577 | } |
| 10578 | |
| 10579 | return status; |
| 10580 | } |
| 10581 | |
| 10582 | #ifdef IPA_OFFLOAD |
| 10583 | /* --------------------------------------------------------------------------- |
| 10584 | \fn sme_ipa_offload_enable_disable |
| 10585 | \brief API to enable/disable IPA offload |
| 10586 | \param hal - The handle returned by macOpen. |
| 10587 | \param session_id - Session Identifier |
| 10588 | \param request - Pointer to the offload request. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10589 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10590 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10591 | QDF_STATUS sme_ipa_offload_enable_disable(tHalHandle hal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10592 | struct sir_ipa_offload_enable_disable *request) |
| 10593 | { |
| 10594 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10595 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10596 | struct sir_ipa_offload_enable_disable *request_buf; |
| 10597 | cds_msg_t msg; |
| 10598 | |
| 10599 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10600 | if (QDF_STATUS_SUCCESS == status) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10601 | request_buf = qdf_mem_malloc(sizeof(*request_buf)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10602 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10603 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10604 | FL("Not able to allocate memory for \ |
| 10605 | IPA_OFFLOAD_ENABLE_DISABLE")); |
| 10606 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10607 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10608 | } |
| 10609 | |
| 10610 | request_buf->offload_type = request->offload_type; |
| 10611 | request_buf->vdev_id = request->vdev_id; |
| 10612 | request_buf->enable = request->enable; |
| 10613 | |
| 10614 | msg.type = WMA_IPA_OFFLOAD_ENABLE_DISABLE; |
| 10615 | msg.reserved = 0; |
| 10616 | msg.bodyptr = request_buf; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10617 | if (!QDF_IS_STATUS_SUCCESS( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10618 | cds_mq_post_message(CDS_MQ_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10619 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10620 | FL("Not able to post WMA_IPA_OFFLOAD_\ |
| 10621 | ENABLE_DISABLE message to WMA")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10622 | qdf_mem_free(request_buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10623 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10624 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10625 | } |
| 10626 | |
| 10627 | sme_release_global_lock(&pMac->sme); |
| 10628 | } |
| 10629 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10630 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10631 | } |
| 10632 | #endif /* IPA_OFFLOAD */ |
| 10633 | |
| 10634 | /* |
| 10635 | * SME API to check if there is any infra station or |
| 10636 | * P2P client is connected |
| 10637 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10638 | QDF_STATUS sme_is_sta_p2p_client_connected(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10639 | { |
| 10640 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10641 | if (csr_is_infra_connected(pMac)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10642 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10643 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10644 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10645 | } |
| 10646 | |
| 10647 | #ifdef FEATURE_WLAN_LPHB |
| 10648 | /* --------------------------------------------------------------------------- |
| 10649 | \fn sme_lphb_config_req |
| 10650 | \API to make configuration LPHB within FW. |
| 10651 | \param hHal - The handle returned by mac_open |
| 10652 | \param lphdReq - LPHB request argument by client |
| 10653 | \param pCallbackfn - LPHB timeout notification callback function pointer |
| 10654 | \- return Configuration message posting status, SUCCESS or Fail |
| 10655 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10656 | QDF_STATUS sme_lphb_config_req |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10657 | (tHalHandle hHal, |
| 10658 | tSirLPHBReq *lphdReq, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10659 | void (*pCallbackfn)(void *pHddCtx, tSirLPHBInd * indParam) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10660 | ) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10661 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10662 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10663 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10664 | cds_msg_t cds_message; |
| 10665 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10666 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 10667 | TRACE_CODE_SME_RX_HDD_LPHB_CONFIG_REQ, |
| 10668 | NO_SESSION, lphdReq->cmd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10669 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10670 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10671 | if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) && |
| 10672 | (NULL == pCallbackfn) && (NULL == pMac->sme.pLphbIndCb)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10673 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10674 | "%s: Indication Call back did not registered", |
| 10675 | __func__); |
| 10676 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10677 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10678 | } else if (NULL != pCallbackfn) { |
| 10679 | pMac->sme.pLphbIndCb = pCallbackfn; |
| 10680 | } |
| 10681 | |
| 10682 | /* serialize the req through MC thread */ |
| 10683 | cds_message.bodyptr = lphdReq; |
| 10684 | cds_message.type = WMA_LPHB_CONF_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 10685 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 10686 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10687 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 10688 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10689 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10690 | "%s: Post Config LPHB MSG fail", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10691 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10692 | } |
| 10693 | sme_release_global_lock(&pMac->sme); |
| 10694 | } |
| 10695 | |
| 10696 | return status; |
| 10697 | } |
| 10698 | #endif /* FEATURE_WLAN_LPHB */ |
| 10699 | /*-------------------------------------------------------------------------- |
| 10700 | \brief sme_enable_disable_split_scan() - a wrapper function to set the split |
| 10701 | scan parameter. |
| 10702 | This is a synchronous call |
| 10703 | \param hHal - The handle returned by mac_open |
| 10704 | \return NONE. |
| 10705 | \sa |
| 10706 | --------------------------------------------------------------------------*/ |
| 10707 | void sme_enable_disable_split_scan(tHalHandle hHal, uint8_t nNumStaChan, |
| 10708 | uint8_t nNumP2PChan) |
| 10709 | { |
| 10710 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10711 | |
| 10712 | pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan; |
| 10713 | pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan; |
| 10714 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10715 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10716 | "%s: SCAN nNumStaChanCombinedConc : %d," |
| 10717 | "nNumP2PChanCombinedConc : %d ", |
| 10718 | __func__, nNumStaChan, nNumP2PChan); |
| 10719 | |
| 10720 | return; |
| 10721 | |
| 10722 | } |
| 10723 | |
| 10724 | /** |
| 10725 | * sme_add_periodic_tx_ptrn() - Add Periodic TX Pattern |
| 10726 | * @hal: global hal handle |
| 10727 | * @addPeriodicTxPtrnParams: request message |
| 10728 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10729 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10730 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10731 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10732 | sme_add_periodic_tx_ptrn(tHalHandle hal, |
| 10733 | struct sSirAddPeriodicTxPtrn *addPeriodicTxPtrnParams) |
| 10734 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10735 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10736 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 10737 | struct sSirAddPeriodicTxPtrn *req_msg; |
| 10738 | cds_msg_t msg; |
| 10739 | |
| 10740 | sms_log(mac, LOG1, FL("enter")); |
| 10741 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10742 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10743 | if (!req_msg) { |
| 10744 | sms_log(mac, LOGE, FL("memory allocation failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10745 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10746 | } |
| 10747 | |
| 10748 | *req_msg = *addPeriodicTxPtrnParams; |
| 10749 | |
| 10750 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10751 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10752 | sms_log(mac, LOGE, |
| 10753 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 10754 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10755 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10756 | return status; |
| 10757 | } |
| 10758 | |
| 10759 | /* Serialize the req through MC thread */ |
| 10760 | msg.bodyptr = req_msg; |
| 10761 | msg.type = WMA_ADD_PERIODIC_TX_PTRN_IND; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 10762 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 10763 | NO_SESSION, msg.type)); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10764 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10765 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10766 | sms_log(mac, LOGE, |
| 10767 | FL("cds_mq_post_message failed!(err=%d)"), |
| 10768 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10769 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10770 | } |
| 10771 | sme_release_global_lock(&mac->sme); |
| 10772 | return status; |
| 10773 | } |
| 10774 | |
| 10775 | /** |
| 10776 | * sme_del_periodic_tx_ptrn() - Delete Periodic TX Pattern |
| 10777 | * @hal: global hal handle |
| 10778 | * @delPeriodicTxPtrnParams: request message |
| 10779 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10780 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10781 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10782 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10783 | sme_del_periodic_tx_ptrn(tHalHandle hal, |
| 10784 | struct sSirDelPeriodicTxPtrn *delPeriodicTxPtrnParams) |
| 10785 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10786 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10787 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 10788 | struct sSirDelPeriodicTxPtrn *req_msg; |
| 10789 | cds_msg_t msg; |
| 10790 | |
| 10791 | sms_log(mac, LOG1, FL("enter")); |
| 10792 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10793 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10794 | if (!req_msg) { |
| 10795 | sms_log(mac, LOGE, FL("memory allocation failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10796 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10797 | } |
| 10798 | |
| 10799 | *req_msg = *delPeriodicTxPtrnParams; |
| 10800 | |
| 10801 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10802 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10803 | sms_log(mac, LOGE, |
| 10804 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 10805 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10806 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10807 | return status; |
| 10808 | } |
| 10809 | |
| 10810 | /* Serialize the req through MC thread */ |
| 10811 | msg.bodyptr = req_msg; |
| 10812 | msg.type = WMA_DEL_PERIODIC_TX_PTRN_IND; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 10813 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 10814 | NO_SESSION, msg.type)); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10815 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10816 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10817 | sms_log(mac, LOGE, |
| 10818 | FL("cds_mq_post_message failed!(err=%d)"), |
| 10819 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10820 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10821 | } |
| 10822 | sme_release_global_lock(&mac->sme); |
| 10823 | return status; |
| 10824 | } |
| 10825 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 10826 | /** |
| 10827 | * sme_enable_rmc() - enables RMC |
| 10828 | * @hHal : Pointer to global HAL handle |
| 10829 | * @sessionId : Session ID |
| 10830 | * |
| 10831 | * Return: QDF_STATUS |
| 10832 | */ |
| 10833 | QDF_STATUS sme_enable_rmc(tHalHandle hHal, uint32_t sessionId) |
| 10834 | { |
| 10835 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 10836 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10837 | cds_msg_t cds_message; |
| 10838 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 10839 | |
| 10840 | sms_log(pMac, LOG1, FL("enable RMC")); |
| 10841 | status = sme_acquire_global_lock(&pMac->sme); |
| 10842 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 10843 | cds_message.bodyptr = NULL; |
| 10844 | cds_message.type = WMA_RMC_ENABLE_IND; |
| 10845 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 10846 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 10847 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10848 | "%s: failed to post message to WMA", |
| 10849 | __func__); |
| 10850 | status = QDF_STATUS_E_FAILURE; |
| 10851 | } |
| 10852 | sme_release_global_lock(&pMac->sme); |
| 10853 | } |
| 10854 | return status; |
| 10855 | } |
| 10856 | |
| 10857 | /** |
| 10858 | * sme_disable_rmc() - disables RMC |
| 10859 | * @hHal : Pointer to global HAL handle |
| 10860 | * @sessionId : Session ID |
| 10861 | * |
| 10862 | * Return: QDF_STATUS |
| 10863 | */ |
| 10864 | QDF_STATUS sme_disable_rmc(tHalHandle hHal, uint32_t sessionId) |
| 10865 | { |
| 10866 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 10867 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10868 | cds_msg_t cds_message; |
| 10869 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 10870 | |
| 10871 | sms_log(pMac, LOG1, FL("disable RMC")); |
| 10872 | status = sme_acquire_global_lock(&pMac->sme); |
| 10873 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 10874 | cds_message.bodyptr = NULL; |
| 10875 | cds_message.type = WMA_RMC_DISABLE_IND; |
| 10876 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 10877 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 10878 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10879 | "%s: failed to post message to WMA", |
| 10880 | __func__); |
| 10881 | status = QDF_STATUS_E_FAILURE; |
| 10882 | } |
| 10883 | sme_release_global_lock(&pMac->sme); |
| 10884 | } |
| 10885 | return status; |
| 10886 | } |
| 10887 | |
| 10888 | /** |
| 10889 | * sme_send_rmc_action_period() - sends RMC action period param to target |
| 10890 | * @hHal : Pointer to global HAL handle |
| 10891 | * @sessionId : Session ID |
| 10892 | * |
| 10893 | * Return: QDF_STATUS |
| 10894 | */ |
| 10895 | QDF_STATUS sme_send_rmc_action_period(tHalHandle hHal, uint32_t sessionId) |
| 10896 | { |
| 10897 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10898 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 10899 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10900 | cds_msg_t cds_message; |
| 10901 | |
| 10902 | status = sme_acquire_global_lock(&pMac->sme); |
| 10903 | if (QDF_STATUS_SUCCESS == status) { |
| 10904 | cds_message.bodyptr = NULL; |
| 10905 | cds_message.type = WMA_RMC_ACTION_PERIOD_IND; |
| 10906 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 10907 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 10908 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10909 | "%s: failed to post message to WMA", |
| 10910 | __func__); |
| 10911 | status = QDF_STATUS_E_FAILURE; |
| 10912 | } |
| 10913 | sme_release_global_lock(&pMac->sme); |
| 10914 | } |
| 10915 | |
| 10916 | return status; |
| 10917 | } |
| 10918 | |
| 10919 | /** |
| 10920 | * sme_request_ibss_peer_info() - request ibss peer info |
| 10921 | * @hHal : Pointer to global HAL handle |
| 10922 | * @pUserData : Pointer to user data |
| 10923 | * @peerInfoCbk : Peer info callback |
| 10924 | * @allPeerInfoReqd : All peer info required or not |
| 10925 | * @staIdx : sta index |
| 10926 | * |
| 10927 | * Return: QDF_STATUS |
| 10928 | */ |
| 10929 | QDF_STATUS sme_request_ibss_peer_info(tHalHandle hHal, void *pUserData, |
| 10930 | pIbssPeerInfoCb peerInfoCbk, |
| 10931 | bool allPeerInfoReqd, uint8_t staIdx) |
| 10932 | { |
| 10933 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 10934 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
| 10935 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10936 | cds_msg_t cds_message; |
| 10937 | tSirIbssGetPeerInfoReqParams *pIbssInfoReqParams; |
| 10938 | |
| 10939 | status = sme_acquire_global_lock(&pMac->sme); |
| 10940 | if (QDF_STATUS_SUCCESS == status) { |
| 10941 | pMac->sme.peerInfoParams.peerInfoCbk = peerInfoCbk; |
| 10942 | pMac->sme.peerInfoParams.pUserData = pUserData; |
| 10943 | |
| 10944 | pIbssInfoReqParams = (tSirIbssGetPeerInfoReqParams *) |
| 10945 | qdf_mem_malloc(sizeof(tSirIbssGetPeerInfoReqParams)); |
| 10946 | if (NULL == pIbssInfoReqParams) { |
| 10947 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10948 | "%s: Not able to allocate memory for dhcp start", |
| 10949 | __func__); |
| 10950 | sme_release_global_lock(&pMac->sme); |
| 10951 | return QDF_STATUS_E_NOMEM; |
| 10952 | } |
| 10953 | pIbssInfoReqParams->allPeerInfoReqd = allPeerInfoReqd; |
| 10954 | pIbssInfoReqParams->staIdx = staIdx; |
| 10955 | |
| 10956 | cds_message.type = WMA_GET_IBSS_PEER_INFO_REQ; |
| 10957 | cds_message.bodyptr = pIbssInfoReqParams; |
| 10958 | cds_message.reserved = 0; |
| 10959 | |
| 10960 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 10961 | if (QDF_STATUS_SUCCESS != qdf_status) { |
| 10962 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10963 | "%s: Post WMA_GET_IBSS_PEER_INFO_REQ MSG failed", |
| 10964 | __func__); |
| 10965 | qdf_mem_free(pIbssInfoReqParams); |
| 10966 | qdf_status = QDF_STATUS_E_FAILURE; |
| 10967 | } |
| 10968 | sme_release_global_lock(&pMac->sme); |
| 10969 | } |
| 10970 | |
| 10971 | return qdf_status; |
| 10972 | } |
| 10973 | |
| 10974 | /* --------------------------------------------------------------------------- |
| 10975 | \fn sme_send_cesium_enable_ind |
| 10976 | \brief Used to send proprietary cesium enable indication to fw |
| 10977 | \param hHal |
| 10978 | \param sessionId |
| 10979 | \- return QDF_STATUS |
| 10980 | -------------------------------------------------------------------------*/ |
| 10981 | QDF_STATUS sme_send_cesium_enable_ind(tHalHandle hHal, uint32_t sessionId) |
| 10982 | { |
| 10983 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10984 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 10985 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10986 | cds_msg_t cds_message; |
| 10987 | |
| 10988 | status = sme_acquire_global_lock(&pMac->sme); |
| 10989 | if (QDF_STATUS_SUCCESS == status) { |
| 10990 | cds_message.bodyptr = NULL; |
| 10991 | cds_message.type = WMA_IBSS_CESIUM_ENABLE_IND; |
| 10992 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 10993 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 10994 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10995 | "%s: failed to post message to WMA", |
| 10996 | __func__); |
| 10997 | status = QDF_STATUS_E_FAILURE; |
| 10998 | } |
| 10999 | sme_release_global_lock(&pMac->sme); |
| 11000 | } |
| 11001 | |
| 11002 | return status; |
| 11003 | } |
| 11004 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11005 | void sme_get_command_q_status(tHalHandle hHal) |
| 11006 | { |
| 11007 | tSmeCmd *pTempCmd = NULL; |
| 11008 | tListElem *pEntry; |
| 11009 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11010 | |
| 11011 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11012 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11013 | "%s: pMac is NULL", __func__); |
| 11014 | return; |
| 11015 | } |
| 11016 | |
| 11017 | pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 11018 | if (pEntry) { |
| 11019 | pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 11020 | } |
| 11021 | sms_log(pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)", |
| 11022 | (pTempCmd) ? pTempCmd->command : eSmeNoCommand); |
| 11023 | if (pTempCmd) { |
| 11024 | if (eSmeCsrCommandMask & pTempCmd->command) { |
| 11025 | /* CSR command is stuck. See what the reason code is for that command */ |
| 11026 | dump_csr_command_info(pMac, pTempCmd); |
| 11027 | } |
| 11028 | } /* if(pTempCmd) */ |
| 11029 | |
| 11030 | sms_log(pMac, LOGE, "Currently smeCmdPendingList has %d commands", |
| 11031 | csr_ll_count(&pMac->sme.smeCmdPendingList)); |
| 11032 | |
| 11033 | sms_log(pMac, LOGE, "Currently roamCmdPendingList has %d commands", |
| 11034 | csr_ll_count(&pMac->roam.roamCmdPendingList)); |
| 11035 | |
| 11036 | return; |
| 11037 | } |
| 11038 | |
| 11039 | /** |
| 11040 | * sme_set_dot11p_config() - API to set the 802.11p config |
| 11041 | * @hHal: The handle returned by macOpen |
| 11042 | * @enable_dot11p: 802.11p config param |
| 11043 | */ |
| 11044 | void sme_set_dot11p_config(tHalHandle hHal, bool enable_dot11p) |
| 11045 | { |
| 11046 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11047 | pMac->enable_dot11p = enable_dot11p; |
| 11048 | } |
| 11049 | |
| 11050 | /** |
| 11051 | * copy_sir_ocb_config() - Performs deep copy of an OCB configuration |
| 11052 | * @src: the source configuration |
| 11053 | * |
| 11054 | * Return: pointer to the copied OCB configuration |
| 11055 | */ |
| 11056 | static struct sir_ocb_config *sme_copy_sir_ocb_config( |
| 11057 | struct sir_ocb_config *src) |
| 11058 | { |
| 11059 | struct sir_ocb_config *dst; |
| 11060 | uint32_t length; |
| 11061 | void *cursor; |
| 11062 | |
| 11063 | length = sizeof(*src) + |
| 11064 | src->channel_count * sizeof(*src->channels) + |
| 11065 | src->schedule_size * sizeof(*src->schedule) + |
| 11066 | src->dcc_ndl_chan_list_len + |
| 11067 | src->dcc_ndl_active_state_list_len; |
| 11068 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11069 | dst = qdf_mem_malloc(length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11070 | if (!dst) |
| 11071 | return NULL; |
| 11072 | |
| 11073 | *dst = *src; |
| 11074 | |
| 11075 | cursor = dst; |
| 11076 | cursor += sizeof(*dst); |
| 11077 | dst->channels = cursor; |
| 11078 | cursor += src->channel_count * sizeof(*src->channels); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11079 | qdf_mem_copy(dst->channels, src->channels, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11080 | src->channel_count * sizeof(*src->channels)); |
| 11081 | dst->schedule = cursor; |
| 11082 | cursor += src->schedule_size * sizeof(*src->schedule); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11083 | qdf_mem_copy(dst->schedule, src->schedule, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11084 | src->schedule_size * sizeof(*src->schedule)); |
| 11085 | dst->dcc_ndl_chan_list = cursor; |
| 11086 | cursor += src->dcc_ndl_chan_list_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11087 | qdf_mem_copy(dst->dcc_ndl_chan_list, src->dcc_ndl_chan_list, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11088 | src->dcc_ndl_chan_list_len); |
| 11089 | dst->dcc_ndl_active_state_list = cursor; |
| 11090 | cursor += src->dcc_ndl_active_state_list_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11091 | qdf_mem_copy(dst->dcc_ndl_active_state_list, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11092 | src->dcc_ndl_active_state_list, |
| 11093 | src->dcc_ndl_active_state_list_len); |
| 11094 | return dst; |
| 11095 | } |
| 11096 | |
| 11097 | /** |
| 11098 | * sme_ocb_set_config() - Set the OCB configuration |
| 11099 | * @hHal: reference to the HAL |
| 11100 | * @context: the context of the call |
| 11101 | * @callback: the callback to hdd |
| 11102 | * @config: the OCB configuration |
| 11103 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11104 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11105 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11106 | QDF_STATUS sme_ocb_set_config(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11107 | ocb_callback callback, |
| 11108 | struct sir_ocb_config *config) |
| 11109 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11110 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11111 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11112 | cds_msg_t msg = {0}; |
| 11113 | struct sir_ocb_config *msg_body; |
| 11114 | |
| 11115 | /* Lock the SME structure */ |
| 11116 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11117 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11118 | return status; |
| 11119 | |
| 11120 | /* |
| 11121 | * Check if there is a pending request and return an error if one |
| 11122 | * exists |
| 11123 | */ |
| 11124 | if (pMac->sme.ocb_set_config_callback) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11125 | status = QDF_STATUS_E_BUSY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11126 | goto end; |
| 11127 | } |
| 11128 | |
| 11129 | msg_body = sme_copy_sir_ocb_config(config); |
| 11130 | |
| 11131 | if (!msg_body) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11132 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11133 | goto end; |
| 11134 | } |
| 11135 | |
| 11136 | msg.type = WMA_OCB_SET_CONFIG_CMD; |
| 11137 | msg.bodyptr = msg_body; |
| 11138 | |
| 11139 | /* Set the request callback and context */ |
| 11140 | pMac->sme.ocb_set_config_callback = callback; |
| 11141 | pMac->sme.ocb_set_config_context = context; |
| 11142 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11143 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11144 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11145 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11146 | FL("Error posting message to WDA: %d"), status); |
| 11147 | pMac->sme.ocb_set_config_callback = callback; |
| 11148 | pMac->sme.ocb_set_config_context = context; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11149 | qdf_mem_free(msg_body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11150 | goto end; |
| 11151 | } |
| 11152 | |
| 11153 | end: |
| 11154 | sme_release_global_lock(&pMac->sme); |
| 11155 | |
| 11156 | return status; |
| 11157 | } |
| 11158 | |
| 11159 | /** |
| 11160 | * sme_ocb_set_utc_time() - Set the OCB UTC time |
| 11161 | * @hHal: reference to the HAL |
| 11162 | * @utc: the UTC time struct |
| 11163 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11164 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11165 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11166 | QDF_STATUS sme_ocb_set_utc_time(tHalHandle hHal, struct sir_ocb_utc *utc) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11167 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11168 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11169 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11170 | cds_msg_t msg = {0}; |
| 11171 | struct sir_ocb_utc *sme_utc; |
| 11172 | |
| 11173 | /* Lock the SME structure */ |
| 11174 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11175 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11176 | return status; |
| 11177 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11178 | sme_utc = qdf_mem_malloc(sizeof(*sme_utc)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11179 | if (!sme_utc) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11180 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11181 | FL("Malloc failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11182 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11183 | goto end; |
| 11184 | } |
| 11185 | *sme_utc = *utc; |
| 11186 | |
| 11187 | msg.type = WMA_OCB_SET_UTC_TIME_CMD; |
| 11188 | msg.reserved = 0; |
| 11189 | msg.bodyptr = sme_utc; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11190 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11191 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11192 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11193 | FL("Not able to post message to WDA")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11194 | qdf_mem_free(utc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11195 | goto end; |
| 11196 | } |
| 11197 | |
| 11198 | end: |
| 11199 | sme_release_global_lock(&pMac->sme); |
| 11200 | |
| 11201 | return status; |
| 11202 | } |
| 11203 | |
| 11204 | /** |
| 11205 | * sme_ocb_start_timing_advert() - Start sending timing advert frames |
| 11206 | * @hHal: reference to the HAL |
| 11207 | * @timing_advert: the timing advertisement struct |
| 11208 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11209 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11210 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11211 | QDF_STATUS sme_ocb_start_timing_advert(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11212 | struct sir_ocb_timing_advert *timing_advert) |
| 11213 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11214 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11215 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11216 | cds_msg_t msg = {0}; |
| 11217 | void *buf; |
| 11218 | struct sir_ocb_timing_advert *sme_timing_advert; |
| 11219 | |
| 11220 | /* Lock the SME structure */ |
| 11221 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11222 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11223 | return status; |
| 11224 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11225 | buf = qdf_mem_malloc(sizeof(*sme_timing_advert) + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11226 | timing_advert->template_length); |
| 11227 | if (!buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11228 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11229 | FL("Not able to allocate memory for start TA")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11230 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11231 | goto end; |
| 11232 | } |
| 11233 | |
| 11234 | sme_timing_advert = (struct sir_ocb_timing_advert *)buf; |
| 11235 | *sme_timing_advert = *timing_advert; |
| 11236 | sme_timing_advert->template_value = buf + sizeof(*sme_timing_advert); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11237 | qdf_mem_copy(sme_timing_advert->template_value, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11238 | timing_advert->template_value, timing_advert->template_length); |
| 11239 | |
| 11240 | msg.type = WMA_OCB_START_TIMING_ADVERT_CMD; |
| 11241 | msg.reserved = 0; |
| 11242 | msg.bodyptr = buf; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11243 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11244 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11245 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11246 | FL("Not able to post msg to WDA")); |
| 11247 | goto end; |
| 11248 | } |
| 11249 | |
| 11250 | end: |
| 11251 | sme_release_global_lock(&pMac->sme); |
| 11252 | |
| 11253 | return status; |
| 11254 | } |
| 11255 | |
| 11256 | /** |
| 11257 | * sme_ocb_stop_timing_advert() - Stop sending timing advert frames on a channel |
| 11258 | * @hHal: reference to the HAL |
| 11259 | * @timing_advert: the timing advertisement struct |
| 11260 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11261 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11262 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11263 | QDF_STATUS sme_ocb_stop_timing_advert(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11264 | struct sir_ocb_timing_advert *timing_advert) |
| 11265 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11266 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11267 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11268 | cds_msg_t msg = {0}; |
| 11269 | struct sir_ocb_timing_advert *sme_timing_advert; |
| 11270 | |
| 11271 | /* Lock the SME structure */ |
| 11272 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11273 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11274 | return status; |
| 11275 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11276 | sme_timing_advert = qdf_mem_malloc(sizeof(*timing_advert)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11277 | if (!sme_timing_advert) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11278 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11279 | FL("Not able to allocate memory for stop TA")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11280 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11281 | goto end; |
| 11282 | } |
| 11283 | *sme_timing_advert = *timing_advert; |
| 11284 | |
| 11285 | msg.type = WMA_OCB_STOP_TIMING_ADVERT_CMD; |
| 11286 | msg.reserved = 0; |
| 11287 | msg.bodyptr = sme_timing_advert; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11288 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11289 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11290 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11291 | FL("Not able to post msg to WDA")); |
| 11292 | goto end; |
| 11293 | } |
| 11294 | |
| 11295 | end: |
| 11296 | sme_release_global_lock(&pMac->sme); |
| 11297 | |
| 11298 | return status; |
| 11299 | } |
| 11300 | |
| 11301 | /** |
Naveen Rawat | b4d3762 | 2015-11-13 16:15:25 -0800 | [diff] [blame] | 11302 | * sme_ocb_gen_timing_advert_frame() - generate TA frame and populate the buffer |
| 11303 | * @hal_handle: reference to the HAL |
| 11304 | * @self_addr: the self MAC address |
| 11305 | * @buf: the buffer that will contain the frame |
| 11306 | * @timestamp_offset: return for the offset of the timestamp field |
| 11307 | * @time_value_offset: return for the time_value field in the TA IE |
| 11308 | * |
| 11309 | * Return: the length of the buffer. |
| 11310 | */ |
| 11311 | int sme_ocb_gen_timing_advert_frame(tHalHandle hal_handle, |
| 11312 | tSirMacAddr self_addr, uint8_t **buf, |
| 11313 | uint32_t *timestamp_offset, |
| 11314 | uint32_t *time_value_offset) |
| 11315 | { |
| 11316 | int template_length; |
| 11317 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
| 11318 | |
| 11319 | template_length = sch_gen_timing_advert_frame(mac_ctx, self_addr, buf, |
| 11320 | timestamp_offset, |
| 11321 | time_value_offset); |
| 11322 | return template_length; |
| 11323 | } |
| 11324 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11325 | * sme_ocb_get_tsf_timer() - Get the TSF timer value |
| 11326 | * @hHal: reference to the HAL |
| 11327 | * @context: the context of the call |
| 11328 | * @callback: the callback to hdd |
| 11329 | * @request: the TSF timer request |
| 11330 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11331 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11332 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11333 | QDF_STATUS sme_ocb_get_tsf_timer(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11334 | ocb_callback callback, |
| 11335 | struct sir_ocb_get_tsf_timer *request) |
| 11336 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11337 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11338 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11339 | cds_msg_t msg = {0}; |
| 11340 | struct sir_ocb_get_tsf_timer *msg_body; |
| 11341 | |
| 11342 | /* Lock the SME structure */ |
| 11343 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11344 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11345 | return status; |
| 11346 | |
| 11347 | /* Allocate memory for the WMI request, and copy the parameter */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11348 | msg_body = qdf_mem_malloc(sizeof(*msg_body)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11349 | if (!msg_body) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11350 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11351 | goto end; |
| 11352 | } |
| 11353 | *msg_body = *request; |
| 11354 | |
| 11355 | msg.type = WMA_OCB_GET_TSF_TIMER_CMD; |
| 11356 | msg.bodyptr = msg_body; |
| 11357 | |
| 11358 | /* Set the request callback and the context */ |
| 11359 | pMac->sme.ocb_get_tsf_timer_callback = callback; |
| 11360 | pMac->sme.ocb_get_tsf_timer_context = context; |
| 11361 | |
| 11362 | /* Post the message to WDA */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11363 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11364 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11365 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11366 | FL("Error posting message to WDA: %d"), status); |
| 11367 | pMac->sme.ocb_get_tsf_timer_callback = NULL; |
| 11368 | pMac->sme.ocb_get_tsf_timer_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11369 | qdf_mem_free(msg_body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11370 | goto end; |
| 11371 | } |
| 11372 | |
| 11373 | end: |
| 11374 | sme_release_global_lock(&pMac->sme); |
| 11375 | |
| 11376 | return status; |
| 11377 | } |
| 11378 | |
| 11379 | /** |
| 11380 | * sme_dcc_get_stats() - Get the DCC stats |
| 11381 | * @hHal: reference to the HAL |
| 11382 | * @context: the context of the call |
| 11383 | * @callback: the callback to hdd |
| 11384 | * @request: the get DCC stats request |
| 11385 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11386 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11387 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11388 | QDF_STATUS sme_dcc_get_stats(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11389 | ocb_callback callback, |
| 11390 | struct sir_dcc_get_stats *request) |
| 11391 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11392 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11393 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11394 | cds_msg_t msg = {0}; |
| 11395 | struct sir_dcc_get_stats *msg_body; |
| 11396 | |
| 11397 | /* Lock the SME structure */ |
| 11398 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11399 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11400 | return status; |
| 11401 | |
| 11402 | /* Allocate memory for the WMI request, and copy the parameter */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11403 | msg_body = qdf_mem_malloc(sizeof(*msg_body) + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11404 | request->request_array_len); |
| 11405 | if (!msg_body) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11406 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11407 | goto end; |
| 11408 | } |
| 11409 | *msg_body = *request; |
| 11410 | msg_body->request_array = (void *)msg_body + sizeof(*msg_body); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11411 | qdf_mem_copy(msg_body->request_array, request->request_array, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11412 | request->request_array_len); |
| 11413 | |
| 11414 | msg.type = WMA_DCC_GET_STATS_CMD; |
| 11415 | msg.bodyptr = msg_body; |
| 11416 | |
| 11417 | /* Set the request callback and context */ |
| 11418 | pMac->sme.dcc_get_stats_callback = callback; |
| 11419 | pMac->sme.dcc_get_stats_context = context; |
| 11420 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11421 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11422 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11423 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11424 | FL("Error posting message to WDA: %d"), status); |
| 11425 | pMac->sme.dcc_get_stats_callback = callback; |
| 11426 | pMac->sme.dcc_get_stats_context = context; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11427 | qdf_mem_free(msg_body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11428 | goto end; |
| 11429 | } |
| 11430 | |
| 11431 | end: |
| 11432 | sme_release_global_lock(&pMac->sme); |
| 11433 | |
| 11434 | return status; |
| 11435 | } |
| 11436 | |
| 11437 | /** |
| 11438 | * sme_dcc_clear_stats() - Clear the DCC stats |
| 11439 | * @hHal: reference to the HAL |
| 11440 | * @vdev_id: vdev id for OCB interface |
| 11441 | * @dcc_stats_bitmap: the entries in the stats to clear |
| 11442 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11443 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11444 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11445 | QDF_STATUS sme_dcc_clear_stats(tHalHandle hHal, uint32_t vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11446 | uint32_t dcc_stats_bitmap) |
| 11447 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11448 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11449 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11450 | cds_msg_t msg = {0}; |
| 11451 | struct sir_dcc_clear_stats *request; |
| 11452 | |
| 11453 | /* Lock the SME structure */ |
| 11454 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11455 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11456 | return status; |
| 11457 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11458 | request = qdf_mem_malloc(sizeof(struct sir_dcc_clear_stats)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11459 | if (!request) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11460 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11461 | FL("Not able to allocate memory")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11462 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11463 | goto end; |
| 11464 | } |
| 11465 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11466 | qdf_mem_zero(request, sizeof(*request)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11467 | request->vdev_id = vdev_id; |
| 11468 | request->dcc_stats_bitmap = dcc_stats_bitmap; |
| 11469 | |
| 11470 | msg.type = WMA_DCC_CLEAR_STATS_CMD; |
| 11471 | msg.bodyptr = request; |
| 11472 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11473 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11474 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11475 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11476 | FL("Not able to post msg to WDA")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11477 | qdf_mem_free(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11478 | goto end; |
| 11479 | } |
| 11480 | |
| 11481 | end: |
| 11482 | sme_release_global_lock(&pMac->sme); |
| 11483 | |
| 11484 | return status; |
| 11485 | } |
| 11486 | |
| 11487 | /** |
| 11488 | * sme_dcc_update_ndl() - Update the DCC settings |
| 11489 | * @hHal: reference to the HAL |
| 11490 | * @context: the context of the call |
| 11491 | * @callback: the callback to hdd |
| 11492 | * @request: the update DCC request |
| 11493 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11494 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11495 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11496 | QDF_STATUS sme_dcc_update_ndl(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11497 | ocb_callback callback, |
| 11498 | struct sir_dcc_update_ndl *request) |
| 11499 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11500 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11501 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11502 | cds_msg_t msg = {0}; |
| 11503 | struct sir_dcc_update_ndl *msg_body; |
| 11504 | |
| 11505 | /* Lock the SME structure */ |
| 11506 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11507 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11508 | return status; |
| 11509 | |
| 11510 | /* Allocate memory for the WMI request, and copy the parameter */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11511 | msg_body = qdf_mem_malloc(sizeof(*msg_body) + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11512 | request->dcc_ndl_chan_list_len + |
| 11513 | request->dcc_ndl_active_state_list_len); |
| 11514 | if (!msg_body) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11515 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11516 | FL("Failed to allocate memory")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11517 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11518 | goto end; |
| 11519 | } |
| 11520 | |
| 11521 | *msg_body = *request; |
| 11522 | |
| 11523 | msg_body->dcc_ndl_chan_list = (void *)msg_body + sizeof(*msg_body); |
| 11524 | msg_body->dcc_ndl_active_state_list = msg_body->dcc_ndl_chan_list + |
| 11525 | request->dcc_ndl_chan_list_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11526 | qdf_mem_copy(msg_body->dcc_ndl_chan_list, request->dcc_ndl_chan_list, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11527 | request->dcc_ndl_active_state_list_len); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11528 | qdf_mem_copy(msg_body->dcc_ndl_active_state_list, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11529 | request->dcc_ndl_active_state_list, |
| 11530 | request->dcc_ndl_active_state_list_len); |
| 11531 | |
| 11532 | msg.type = WMA_DCC_UPDATE_NDL_CMD; |
| 11533 | msg.bodyptr = msg_body; |
| 11534 | |
| 11535 | /* Set the request callback and the context */ |
| 11536 | pMac->sme.dcc_update_ndl_callback = callback; |
| 11537 | pMac->sme.dcc_update_ndl_context = context; |
| 11538 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11539 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11540 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11541 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11542 | FL("Error posting message to WDA: %d"), status); |
| 11543 | pMac->sme.dcc_update_ndl_callback = NULL; |
| 11544 | pMac->sme.dcc_update_ndl_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11545 | qdf_mem_free(msg_body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11546 | goto end; |
| 11547 | } |
| 11548 | |
| 11549 | end: |
| 11550 | sme_release_global_lock(&pMac->sme); |
| 11551 | |
| 11552 | return status; |
| 11553 | } |
| 11554 | |
| 11555 | /** |
| 11556 | * sme_register_for_dcc_stats_event() - Register for the periodic DCC stats |
| 11557 | * event |
| 11558 | * @hHal: reference to the HAL |
| 11559 | * @context: the context of the call |
| 11560 | * @callback: the callback to hdd |
| 11561 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11562 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11563 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11564 | QDF_STATUS sme_register_for_dcc_stats_event(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11565 | ocb_callback callback) |
| 11566 | { |
| 11567 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11568 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11569 | |
| 11570 | status = sme_acquire_global_lock(&pMac->sme); |
| 11571 | pMac->sme.dcc_stats_event_callback = callback; |
| 11572 | pMac->sme.dcc_stats_event_context = context; |
| 11573 | sme_release_global_lock(&pMac->sme); |
| 11574 | |
| 11575 | return 0; |
| 11576 | } |
| 11577 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 11578 | /** |
| 11579 | * sme_deregister_for_dcc_stats_event() - De-Register for the periodic DCC stats |
| 11580 | * event |
| 11581 | * @h_hal: Hal Handle |
| 11582 | * |
| 11583 | * This function de-registers the DCC perioc stats callback |
| 11584 | * |
| 11585 | * Return: QDF_STATUS Enumeration |
| 11586 | */ |
| 11587 | QDF_STATUS sme_deregister_for_dcc_stats_event(tHalHandle h_hal) |
| 11588 | { |
| 11589 | tpAniSirGlobal mac; |
| 11590 | QDF_STATUS status; |
| 11591 | |
| 11592 | if (!h_hal) { |
| 11593 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11594 | FL("h_hal is not valid")); |
| 11595 | return QDF_STATUS_E_INVAL; |
| 11596 | } |
| 11597 | mac = PMAC_STRUCT(h_hal); |
| 11598 | |
| 11599 | status = sme_acquire_global_lock(&mac->sme); |
| 11600 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 11601 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11602 | FL("Failed to acquire global lock")); |
| 11603 | return status; |
| 11604 | } |
| 11605 | mac->sme.dcc_stats_event_callback = NULL; |
| 11606 | mac->sme.dcc_stats_event_context = NULL; |
| 11607 | sme_release_global_lock(&mac->sme); |
| 11608 | |
| 11609 | return status; |
| 11610 | } |
| 11611 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11612 | void sme_get_recovery_stats(tHalHandle hHal) |
| 11613 | { |
| 11614 | uint8_t i; |
| 11615 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11616 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11617 | "Self Recovery Stats"); |
| 11618 | for (i = 0; i < MAX_ACTIVE_CMD_STATS; i++) { |
| 11619 | if (eSmeNoCommand != |
| 11620 | g_self_recovery_stats.activeCmdStats[i].command) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11621 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11622 | "timestamp %llu: command 0x%0X: reason %d: session %d", |
| 11623 | g_self_recovery_stats.activeCmdStats[i]. |
| 11624 | timestamp, |
| 11625 | g_self_recovery_stats.activeCmdStats[i].command, |
| 11626 | g_self_recovery_stats.activeCmdStats[i].reason, |
| 11627 | g_self_recovery_stats.activeCmdStats[i]. |
| 11628 | sessionId); |
| 11629 | } |
| 11630 | } |
| 11631 | } |
| 11632 | |
| 11633 | /** |
| 11634 | * sme_save_active_cmd_stats() - To save active command stats |
| 11635 | * @hHal: HAL context |
| 11636 | * |
| 11637 | * This routine is to save active command stats |
| 11638 | * |
| 11639 | * Return: None |
| 11640 | */ |
| 11641 | void sme_save_active_cmd_stats(tHalHandle hHal) |
| 11642 | { |
| 11643 | tSmeCmd *pTempCmd = NULL; |
| 11644 | tListElem *pEntry; |
| 11645 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11646 | uint8_t statidx = 0; |
| 11647 | tActiveCmdStats *actv_cmd_stat = NULL; |
| 11648 | |
| 11649 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11650 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11651 | FL("pMac is NULL")); |
| 11652 | return; |
| 11653 | } |
| 11654 | |
| 11655 | pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 11656 | if (pEntry) |
| 11657 | pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 11658 | |
| 11659 | if (!pTempCmd) |
| 11660 | return; |
| 11661 | |
| 11662 | if (eSmeCsrCommandMask & pTempCmd->command) { |
| 11663 | statidx = g_self_recovery_stats.cmdStatsIndx; |
| 11664 | actv_cmd_stat = &g_self_recovery_stats.activeCmdStats[statidx]; |
| 11665 | actv_cmd_stat->command = pTempCmd->command; |
| 11666 | actv_cmd_stat->sessionId = pTempCmd->sessionId; |
| 11667 | actv_cmd_stat->timestamp = cds_get_monotonic_boottime(); |
| 11668 | if (eSmeCommandRoam == pTempCmd->command) |
| 11669 | actv_cmd_stat->reason = pTempCmd->u.roamCmd.roamReason; |
| 11670 | else if (eSmeCommandScan == pTempCmd->command) |
| 11671 | actv_cmd_stat->reason = pTempCmd->u.scanCmd.reason; |
| 11672 | else |
| 11673 | actv_cmd_stat->reason = 0xFF; |
| 11674 | |
| 11675 | g_self_recovery_stats.cmdStatsIndx = |
| 11676 | ((g_self_recovery_stats.cmdStatsIndx + 1) & |
| 11677 | (MAX_ACTIVE_CMD_STATS - 1)); |
| 11678 | } |
| 11679 | return; |
| 11680 | } |
| 11681 | |
| 11682 | void active_list_cmd_timeout_handle(void *userData) |
| 11683 | { |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 11684 | tHalHandle hal = (tHalHandle)userData; |
| 11685 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Kapil Gupta | 63ddab2 | 2016-08-09 16:41:24 +0530 | [diff] [blame] | 11686 | tListElem *entry; |
| 11687 | tSmeCmd *temp_cmd = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11688 | |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 11689 | if (NULL == mac_ctx) { |
| 11690 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11691 | "%s: mac_ctx is null", __func__); |
| 11692 | return; |
| 11693 | } |
| 11694 | /* Return if no cmd pending in active list as |
| 11695 | * in this case we should not be here. |
| 11696 | */ |
| 11697 | if (0 == csr_ll_count(&mac_ctx->sme.smeCmdActiveList)) |
| 11698 | return; |
| 11699 | sms_log(mac_ctx, LOGE, |
| 11700 | FL("Active List command timeout Cmd List Count %d"), |
| 11701 | csr_ll_count(&mac_ctx->sme.smeCmdActiveList)); |
| 11702 | sme_get_command_q_status(hal); |
| 11703 | |
| 11704 | if (mac_ctx->roam.configParam.enable_fatal_event) |
| 11705 | cds_flush_logs(WLAN_LOG_TYPE_FATAL, |
| 11706 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 11707 | WLAN_LOG_REASON_SME_COMMAND_STUCK, |
| 11708 | false, |
| 11709 | mac_ctx->sme.enableSelfRecovery ? true : false); |
| 11710 | else |
| 11711 | qdf_trace_dump_all(mac_ctx, 0, 0, 500, 0); |
| 11712 | |
Kapil Gupta | 63ddab2 | 2016-08-09 16:41:24 +0530 | [diff] [blame] | 11713 | entry = csr_ll_peek_head(&mac_ctx->sme.smeCmdActiveList, |
| 11714 | LL_ACCESS_LOCK); |
| 11715 | if (entry) |
| 11716 | temp_cmd = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 11717 | /* Ignore if ROC took more than 120 sec */ |
| 11718 | if (temp_cmd && (eSmeCommandRemainOnChannel == temp_cmd->command)) |
| 11719 | return; |
| 11720 | |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 11721 | if (mac_ctx->sme.enableSelfRecovery) { |
| 11722 | sme_save_active_cmd_stats(hal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11723 | cds_trigger_recovery(); |
| 11724 | } else { |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 11725 | if (!mac_ctx->roam.configParam.enable_fatal_event && |
| 11726 | !(cds_is_load_or_unload_in_progress() || |
| 11727 | cds_is_driver_recovering())) |
| 11728 | QDF_BUG(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11729 | } |
| 11730 | } |
| 11731 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11732 | QDF_STATUS sme_notify_modem_power_state(tHalHandle hHal, uint32_t value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11733 | { |
| 11734 | cds_msg_t msg; |
| 11735 | tpSirModemPowerStateInd request_buf; |
| 11736 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11737 | |
| 11738 | if (NULL == pMac) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11739 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11740 | } |
| 11741 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11742 | request_buf = qdf_mem_malloc(sizeof(tSirModemPowerStateInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11743 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11744 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11745 | "%s: Not able to allocate memory for MODEM POWER STATE IND", |
| 11746 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11747 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11748 | } |
| 11749 | |
| 11750 | request_buf->param = value; |
| 11751 | |
| 11752 | msg.type = WMA_MODEM_POWER_STATE_IND; |
| 11753 | msg.reserved = 0; |
| 11754 | msg.bodyptr = request_buf; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11755 | if (!QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11756 | (cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11757 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11758 | "%s: Not able to post WMA_MODEM_POWER_STATE_IND message" |
| 11759 | " to WMA", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11760 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11761 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11762 | } |
| 11763 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11764 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11765 | } |
| 11766 | |
| 11767 | #ifdef QCA_HT_2040_COEX |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11768 | QDF_STATUS sme_notify_ht2040_mode(tHalHandle hHal, uint16_t staId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11769 | struct qdf_mac_addr macAddrSTA, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11770 | uint8_t sessionId, |
| 11771 | uint8_t channel_type) |
| 11772 | { |
| 11773 | cds_msg_t msg; |
| 11774 | tUpdateVHTOpMode *pHtOpMode = NULL; |
| 11775 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11776 | |
| 11777 | if (NULL == pMac) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11778 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11779 | } |
| 11780 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11781 | pHtOpMode = qdf_mem_malloc(sizeof(tUpdateVHTOpMode)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11782 | if (NULL == pHtOpMode) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11783 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11784 | "%s: Not able to allocate memory for setting OP mode", |
| 11785 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11786 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11787 | } |
| 11788 | |
| 11789 | switch (channel_type) { |
| 11790 | case eHT_CHAN_HT20: |
| 11791 | pHtOpMode->opMode = eHT_CHANNEL_WIDTH_20MHZ; |
| 11792 | break; |
| 11793 | |
| 11794 | case eHT_CHAN_HT40MINUS: |
| 11795 | case eHT_CHAN_HT40PLUS: |
| 11796 | pHtOpMode->opMode = eHT_CHANNEL_WIDTH_40MHZ; |
| 11797 | break; |
| 11798 | |
| 11799 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11800 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11801 | "%s: Invalid OP mode", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11802 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11803 | } |
| 11804 | |
| 11805 | pHtOpMode->staId = staId, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11806 | qdf_mem_copy(pHtOpMode->peer_mac, macAddrSTA.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11807 | sizeof(tSirMacAddr)); |
| 11808 | pHtOpMode->smesessionId = sessionId; |
| 11809 | |
| 11810 | msg.type = WMA_UPDATE_OP_MODE; |
| 11811 | msg.reserved = 0; |
| 11812 | msg.bodyptr = pHtOpMode; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11813 | if (!QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11814 | (cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11815 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11816 | "%s: Not able to post WMA_UPDATE_OP_MODE message" |
| 11817 | " to WMA", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11818 | qdf_mem_free(pHtOpMode); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11819 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11820 | } |
| 11821 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11822 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11823 | "%s: Notifed FW about OP mode: %d for staId=%d", |
| 11824 | __func__, pHtOpMode->opMode, staId); |
| 11825 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11826 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11827 | } |
| 11828 | |
| 11829 | /* --------------------------------------------------------------------------- |
| 11830 | |
| 11831 | \fn sme_set_ht2040_mode |
| 11832 | |
| 11833 | \brief To update HT Operation beacon IE. |
| 11834 | |
| 11835 | \param |
| 11836 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11837 | \return QDF_STATUS SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11838 | FAILURE or RESOURCES |
| 11839 | The API finished and failed. |
| 11840 | |
| 11841 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11842 | QDF_STATUS sme_set_ht2040_mode(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11843 | uint8_t channel_type, bool obssEnabled) |
| 11844 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11845 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11846 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11847 | ePhyChanBondState cbMode; |
| 11848 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11849 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11850 | "%s: Update HT operation beacon IE, channel_type=%d", |
| 11851 | __func__, channel_type); |
| 11852 | |
| 11853 | switch (channel_type) { |
| 11854 | case eHT_CHAN_HT20: |
| 11855 | cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
| 11856 | break; |
| 11857 | case eHT_CHAN_HT40MINUS: |
| 11858 | cbMode = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 11859 | break; |
| 11860 | case eHT_CHAN_HT40PLUS: |
| 11861 | cbMode = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 11862 | break; |
| 11863 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11864 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11865 | "%s:Error!!! Invalid HT20/40 mode !", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11866 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11867 | } |
| 11868 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11869 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11870 | status = csr_set_ht2040_mode(pMac, sessionId, |
| 11871 | cbMode, obssEnabled); |
| 11872 | sme_release_global_lock(&pMac->sme); |
| 11873 | } |
| 11874 | return status; |
| 11875 | } |
| 11876 | |
| 11877 | /* --------------------------------------------------------------------------- |
| 11878 | |
| 11879 | \fn sme_set_phy_cb_mode24_g |
| 11880 | |
| 11881 | \brief Changes PHY channel bonding mode |
| 11882 | |
| 11883 | \param hHal - The handle returned by mac_open. |
| 11884 | |
| 11885 | \param cbMode new channel bonding mode which is to set |
| 11886 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11887 | \return QDF_STATUS SUCCESS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11888 | |
| 11889 | -------------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11890 | QDF_STATUS sme_set_phy_cb_mode24_g(tHalHandle hHal, ePhyChanBondState phyCBMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11891 | { |
| 11892 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11893 | |
| 11894 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11895 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11896 | "%s: invalid context", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11897 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11898 | } |
| 11899 | |
| 11900 | pMac->roam.configParam.channelBondingMode24GHz = phyCBMode; |
| 11901 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11902 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11903 | } |
| 11904 | #endif |
| 11905 | |
| 11906 | /* |
| 11907 | * SME API to enable/disable idle mode powersave |
| 11908 | * This should be called only if powersave offload |
| 11909 | * is enabled |
| 11910 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11911 | QDF_STATUS sme_set_idle_powersave_config(void *cds_context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11912 | tHalHandle hHal, uint32_t value) |
| 11913 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11914 | void *wmaContext = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11915 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11916 | |
| 11917 | if (NULL == wmaContext) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11918 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11919 | "%s: wmaContext is NULL", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11920 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11921 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11922 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11923 | " Idle Ps Set Value %d", value); |
| 11924 | |
| 11925 | pMac->imps_enabled = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11926 | if (QDF_STATUS_SUCCESS != wma_set_idle_ps_config(wmaContext, value)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11927 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11928 | " Failed to Set Idle Ps Value %d", value); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11929 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11930 | } |
| 11931 | if (value) |
| 11932 | pMac->imps_enabled = true; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11933 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11934 | } |
| 11935 | |
| 11936 | int16_t sme_get_ht_config(tHalHandle hHal, uint8_t session_id, uint16_t ht_capab) |
| 11937 | { |
| 11938 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11939 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, session_id); |
| 11940 | |
| 11941 | if (NULL == pSession) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11942 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11943 | "%s: pSession is NULL", __func__); |
| 11944 | return -EIO; |
| 11945 | } |
| 11946 | switch (ht_capab) { |
| 11947 | case WNI_CFG_HT_CAP_INFO_ADVANCE_CODING: |
| 11948 | return pSession->htConfig.ht_rx_ldpc; |
| 11949 | case WNI_CFG_HT_CAP_INFO_TX_STBC: |
| 11950 | return pSession->htConfig.ht_tx_stbc; |
| 11951 | case WNI_CFG_HT_CAP_INFO_RX_STBC: |
| 11952 | return pSession->htConfig.ht_rx_stbc; |
| 11953 | case WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ: |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 11954 | return pSession->htConfig.ht_sgi20; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11955 | case WNI_CFG_HT_CAP_INFO_SHORT_GI_40MHZ: |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 11956 | return pSession->htConfig.ht_sgi40; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11957 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11958 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11959 | "invalid ht capability"); |
| 11960 | return -EIO; |
| 11961 | } |
| 11962 | } |
| 11963 | |
| 11964 | int sme_update_ht_config(tHalHandle hHal, uint8_t sessionId, uint16_t htCapab, |
| 11965 | int value) |
| 11966 | { |
| 11967 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11968 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 11969 | |
| 11970 | if (NULL == pSession) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11971 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11972 | "%s: pSession is NULL", __func__); |
| 11973 | return -EIO; |
| 11974 | } |
| 11975 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11976 | if (QDF_STATUS_SUCCESS != wma_set_htconfig(sessionId, htCapab, value)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11977 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11978 | "Failed to set ht capability in target"); |
| 11979 | return -EIO; |
| 11980 | } |
| 11981 | |
| 11982 | switch (htCapab) { |
| 11983 | case WNI_CFG_HT_CAP_INFO_ADVANCE_CODING: |
| 11984 | pSession->htConfig.ht_rx_ldpc = value; |
| 11985 | break; |
| 11986 | case WNI_CFG_HT_CAP_INFO_TX_STBC: |
| 11987 | pSession->htConfig.ht_tx_stbc = value; |
| 11988 | break; |
| 11989 | case WNI_CFG_HT_CAP_INFO_RX_STBC: |
| 11990 | pSession->htConfig.ht_rx_stbc = value; |
| 11991 | break; |
| 11992 | case WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ: |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 11993 | pSession->htConfig.ht_sgi20 = value; |
| 11994 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11995 | case WNI_CFG_HT_CAP_INFO_SHORT_GI_40MHZ: |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 11996 | pSession->htConfig.ht_sgi40 = value; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11997 | break; |
| 11998 | } |
| 11999 | |
| 12000 | return 0; |
| 12001 | } |
| 12002 | |
| 12003 | #define HT20_SHORT_GI_MCS7_RATE 722 |
| 12004 | /* --------------------------------------------------------------------------- |
| 12005 | \fn sme_send_rate_update_ind |
| 12006 | \brief API to Update rate |
| 12007 | \param hHal - The handle returned by mac_open |
| 12008 | \param rateUpdateParams - Pointer to rate update params |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12009 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12010 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12011 | QDF_STATUS sme_send_rate_update_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12012 | tSirRateUpdateInd *rateUpdateParams) |
| 12013 | { |
| 12014 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12015 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12016 | cds_msg_t msg; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12017 | tSirRateUpdateInd *rate_upd = qdf_mem_malloc(sizeof(tSirRateUpdateInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12018 | |
| 12019 | if (rate_upd == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12020 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12021 | "Rate update struct alloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12022 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12023 | } |
| 12024 | *rate_upd = *rateUpdateParams; |
| 12025 | |
| 12026 | if (rate_upd->mcastDataRate24GHz == HT20_SHORT_GI_MCS7_RATE) |
| 12027 | rate_upd->mcastDataRate24GHzTxFlag = |
| 12028 | eHAL_TX_RATE_HT20 | eHAL_TX_RATE_SGI; |
| 12029 | else if (rate_upd->reliableMcastDataRate == |
| 12030 | HT20_SHORT_GI_MCS7_RATE) |
| 12031 | rate_upd->reliableMcastDataRateTxFlag = |
| 12032 | eHAL_TX_RATE_HT20 | eHAL_TX_RATE_SGI; |
| 12033 | |
| 12034 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12035 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12036 | msg.type = WMA_RATE_UPDATE_IND; |
| 12037 | msg.bodyptr = rate_upd; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 12038 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 12039 | NO_SESSION, msg.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12040 | if (!QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 12041 | (cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12042 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12043 | "%s: Not able " |
| 12044 | "to post WMA_SET_RMC_RATE_IND to WMA!", |
| 12045 | __func__); |
| 12046 | |
| 12047 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12048 | qdf_mem_free(rate_upd); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12049 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12050 | } |
| 12051 | |
| 12052 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12053 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12054 | } |
| 12055 | |
| 12056 | return status; |
| 12057 | } |
| 12058 | |
| 12059 | /** |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 12060 | * sme_update_access_policy_vendor_ie() - update vendor ie and access policy. |
| 12061 | * @hal: Pointer to the mac context |
| 12062 | * @session_id: sme session id |
| 12063 | * @vendor_ie: vendor ie |
| 12064 | * @access_policy: vendor ie access policy |
| 12065 | * |
| 12066 | * This function updates the vendor ie and access policy to lim. |
| 12067 | * |
| 12068 | * Return: success or failure. |
| 12069 | */ |
| 12070 | QDF_STATUS sme_update_access_policy_vendor_ie(tHalHandle hal, |
| 12071 | uint8_t session_id, uint8_t *vendor_ie, int access_policy) |
| 12072 | { |
| 12073 | struct sme_update_access_policy_vendor_ie *msg; |
| 12074 | uint16_t msg_len; |
| 12075 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 12076 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 12077 | |
| 12078 | msg_len = sizeof(*msg); |
| 12079 | |
| 12080 | msg = qdf_mem_malloc(msg_len); |
| 12081 | if (!msg) { |
| 12082 | sms_log(mac, LOGE, |
| 12083 | "failed to allocate memory for sme_update_access_policy_vendor_ie"); |
| 12084 | return QDF_STATUS_E_FAILURE; |
| 12085 | } |
| 12086 | |
| 12087 | qdf_mem_set(msg, msg_len, 0); |
| 12088 | msg->msg_type = (uint16_t)eWNI_SME_UPDATE_ACCESS_POLICY_VENDOR_IE; |
| 12089 | msg->length = (uint16_t)msg_len; |
| 12090 | |
| 12091 | qdf_mem_copy(&msg->ie[0], vendor_ie, sizeof(msg->ie)); |
| 12092 | |
| 12093 | msg->sme_session_id = session_id; |
| 12094 | msg->access_policy = access_policy; |
| 12095 | |
| 12096 | sms_log(mac, LOG1, "sme_session_id %hu, access_policy %d", session_id, |
| 12097 | access_policy); |
| 12098 | |
| 12099 | status = cds_send_mb_message_to_mac(msg); |
| 12100 | |
| 12101 | return status; |
| 12102 | } |
| 12103 | |
| 12104 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12105 | * sme_get_reg_info() - To get registration info |
| 12106 | * @hHal: HAL context |
| 12107 | * @chanId: channel id |
| 12108 | * @regInfo1: first reg info to fill |
| 12109 | * @regInfo2: second reg info to fill |
| 12110 | * |
| 12111 | * This routine will give you reg info |
| 12112 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12113 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12114 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12115 | QDF_STATUS sme_get_reg_info(tHalHandle hHal, uint8_t chanId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12116 | uint32_t *regInfo1, uint32_t *regInfo2) |
| 12117 | { |
| 12118 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12119 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12120 | uint8_t i; |
| 12121 | bool found = false; |
| 12122 | |
| 12123 | status = sme_acquire_global_lock(&pMac->sme); |
| 12124 | *regInfo1 = 0; |
| 12125 | *regInfo2 = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12126 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12127 | return status; |
| 12128 | |
| 12129 | for (i = 0; i < WNI_CFG_VALID_CHANNEL_LIST_LEN; i++) { |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 12130 | if (pMac->scan.defaultPowerTable[i].chan_num == chanId) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12131 | SME_SET_CHANNEL_REG_POWER(*regInfo1, |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 12132 | pMac->scan.defaultPowerTable[i].power); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12133 | |
| 12134 | SME_SET_CHANNEL_MAX_TX_POWER(*regInfo2, |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 12135 | pMac->scan.defaultPowerTable[i].power); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12136 | found = true; |
| 12137 | break; |
| 12138 | } |
| 12139 | } |
| 12140 | if (!found) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12141 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12142 | |
| 12143 | sme_release_global_lock(&pMac->sme); |
| 12144 | return status; |
| 12145 | } |
| 12146 | |
| 12147 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 12148 | /* --------------------------------------------------------------------------- |
| 12149 | \fn sme_auto_shutdown_cb |
| 12150 | \brief Used to plug in callback function for receiving auto shutdown evt |
| 12151 | \param hHal |
| 12152 | \param pCallbackfn : callback function pointer should be plugged in |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12153 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12154 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12155 | QDF_STATUS sme_set_auto_shutdown_cb(tHalHandle hHal, void (*pCallbackfn)(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12156 | ) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12157 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12158 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12159 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12160 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12161 | "%s: Plug in Auto shutdown event callback", __func__); |
| 12162 | |
| 12163 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12164 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12165 | if (NULL != pCallbackfn) { |
| 12166 | pMac->sme.pAutoShutdownNotificationCb = pCallbackfn; |
| 12167 | } |
| 12168 | sme_release_global_lock(&pMac->sme); |
| 12169 | } |
| 12170 | |
| 12171 | return status; |
| 12172 | } |
| 12173 | |
| 12174 | /* --------------------------------------------------------------------------- |
| 12175 | \fn sme_set_auto_shutdown_timer |
| 12176 | \API to set auto shutdown timer value in FW. |
| 12177 | \param hHal - The handle returned by mac_open |
| 12178 | \param timer_val - The auto shutdown timer value to be set |
| 12179 | \- return Configuration message posting status, SUCCESS or Fail |
| 12180 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12181 | QDF_STATUS sme_set_auto_shutdown_timer(tHalHandle hHal, uint32_t timer_val) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12182 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12183 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12184 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12185 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12186 | tSirAutoShutdownCmdParams *auto_sh_cmd; |
| 12187 | cds_msg_t cds_message; |
| 12188 | |
| 12189 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12190 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12191 | auto_sh_cmd = (tSirAutoShutdownCmdParams *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12192 | qdf_mem_malloc(sizeof(tSirAutoShutdownCmdParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12193 | if (auto_sh_cmd == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12194 | QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12195 | "%s Request Buffer Alloc Fail", __func__); |
| 12196 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12197 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12198 | } |
| 12199 | |
| 12200 | auto_sh_cmd->timer_val = timer_val; |
| 12201 | |
| 12202 | /* serialize the req through MC thread */ |
| 12203 | cds_message.bodyptr = auto_sh_cmd; |
| 12204 | cds_message.type = WMA_SET_AUTO_SHUTDOWN_TIMER_REQ; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12205 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 12206 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12207 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12208 | "%s: Post Auto shutdown MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12209 | qdf_mem_free(auto_sh_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12210 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12211 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12212 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12213 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12214 | "%s: Posted Auto shutdown MSG", __func__); |
| 12215 | sme_release_global_lock(&pMac->sme); |
| 12216 | } |
| 12217 | |
| 12218 | return status; |
| 12219 | } |
| 12220 | #endif |
| 12221 | |
| 12222 | #ifdef FEATURE_WLAN_CH_AVOID |
| 12223 | /* --------------------------------------------------------------------------- |
| 12224 | \fn sme_add_ch_avoid_callback |
| 12225 | \brief Used to plug in callback function |
| 12226 | Which notify channel may not be used with SAP or P2PGO mode. |
| 12227 | Notification come from FW. |
| 12228 | \param hHal |
| 12229 | \param pCallbackfn : callback function pointer should be plugged in |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12230 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12231 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12232 | QDF_STATUS sme_add_ch_avoid_callback |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12233 | (tHalHandle hHal, void (*pCallbackfn)(void *pAdapter, void *indParam) |
| 12234 | ) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12235 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12236 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12237 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12238 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12239 | "%s: Plug in CH AVOID CB", __func__); |
| 12240 | |
| 12241 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12242 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12243 | if (NULL != pCallbackfn) { |
| 12244 | pMac->sme.pChAvoidNotificationCb = pCallbackfn; |
| 12245 | } |
| 12246 | sme_release_global_lock(&pMac->sme); |
| 12247 | } |
| 12248 | |
| 12249 | return status; |
| 12250 | } |
| 12251 | |
| 12252 | /* --------------------------------------------------------------------------- |
| 12253 | \fn sme_ch_avoid_update_req |
| 12254 | \API to request channel avoidance update from FW. |
| 12255 | \param hHal - The handle returned by mac_open |
| 12256 | \param update_type - The udpate_type parameter of this request call |
| 12257 | \- return Configuration message posting status, SUCCESS or Fail |
| 12258 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12259 | QDF_STATUS sme_ch_avoid_update_req(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12260 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12261 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12262 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12263 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12264 | tSirChAvoidUpdateReq *cauReq; |
| 12265 | cds_msg_t cds_message; |
| 12266 | |
| 12267 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12268 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12269 | cauReq = (tSirChAvoidUpdateReq *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12270 | qdf_mem_malloc(sizeof(tSirChAvoidUpdateReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12271 | if (NULL == cauReq) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12272 | QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12273 | "%s Request Buffer Alloc Fail", __func__); |
| 12274 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12275 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12276 | } |
| 12277 | |
| 12278 | cauReq->reserved_param = 0; |
| 12279 | |
| 12280 | /* serialize the req through MC thread */ |
| 12281 | cds_message.bodyptr = cauReq; |
| 12282 | cds_message.type = WMA_CH_AVOID_UPDATE_REQ; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12283 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 12284 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12285 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12286 | "%s: Post Ch Avoid Update MSG fail", |
| 12287 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12288 | qdf_mem_free(cauReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12289 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12290 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12291 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12292 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12293 | "%s: Posted Ch Avoid Update MSG", __func__); |
| 12294 | sme_release_global_lock(&pMac->sme); |
| 12295 | } |
| 12296 | |
| 12297 | return status; |
| 12298 | } |
| 12299 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 12300 | |
| 12301 | /** |
| 12302 | * sme_set_miracast() - Function to set miracast value to UMAC |
| 12303 | * @hal: Handle returned by macOpen |
| 12304 | * @filter_type: 0-Disabled, 1-Source, 2-sink |
| 12305 | * |
| 12306 | * This function passes down the value of miracast set by |
| 12307 | * framework to UMAC |
| 12308 | * |
| 12309 | * Return: Configuration message posting status, SUCCESS or Fail |
| 12310 | * |
| 12311 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12312 | QDF_STATUS sme_set_miracast(tHalHandle hal, uint8_t filter_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12313 | { |
| 12314 | cds_msg_t msg; |
| 12315 | uint32_t *val; |
| 12316 | tpAniSirGlobal mac_ptr = PMAC_STRUCT(hal); |
| 12317 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12318 | val = qdf_mem_malloc(sizeof(*val)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12319 | if (NULL == val || NULL == mac_ptr) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12320 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12321 | "%s: Invalid pointer", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12322 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12323 | } |
| 12324 | |
| 12325 | *val = filter_type; |
| 12326 | |
| 12327 | msg.type = SIR_HAL_SET_MIRACAST; |
| 12328 | msg.reserved = 0; |
| 12329 | msg.bodyptr = val; |
| 12330 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12331 | if (!QDF_IS_STATUS_SUCCESS( |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 12332 | cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12333 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12334 | "%s: Not able to post WDA_SET_MAS_ENABLE_DISABLE to WMA!", |
| 12335 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12336 | qdf_mem_free(val); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12337 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12338 | } |
| 12339 | |
| 12340 | mac_ptr->sme.miracast_value = filter_type; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12341 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12342 | } |
| 12343 | |
| 12344 | /** |
| 12345 | * sme_set_mas() - Function to set MAS value to UMAC |
| 12346 | * @val: 1-Enable, 0-Disable |
| 12347 | * |
| 12348 | * This function passes down the value of MAS to the UMAC. A |
| 12349 | * value of 1 will enable MAS and a value of 0 will disable MAS |
| 12350 | * |
| 12351 | * Return: Configuration message posting status, SUCCESS or Fail |
| 12352 | * |
| 12353 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12354 | QDF_STATUS sme_set_mas(uint32_t val) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12355 | { |
| 12356 | cds_msg_t msg; |
| 12357 | uint32_t *ptr_val; |
| 12358 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12359 | ptr_val = qdf_mem_malloc(sizeof(*ptr_val)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12360 | if (NULL == ptr_val) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12361 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12362 | "%s: could not allocate ptr_val", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12363 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12364 | } |
| 12365 | |
| 12366 | *ptr_val = val; |
| 12367 | |
| 12368 | msg.type = SIR_HAL_SET_MAS; |
| 12369 | msg.reserved = 0; |
| 12370 | msg.bodyptr = ptr_val; |
| 12371 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12372 | if (!QDF_IS_STATUS_SUCCESS( |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 12373 | cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12374 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12375 | "%s: Not able to post WDA_SET_MAS_ENABLE_DISABLE to WMA!", |
| 12376 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12377 | qdf_mem_free(ptr_val); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12378 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12379 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12380 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12381 | } |
| 12382 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 12383 | /** |
| 12384 | * sme_roam_channel_change_req() - Channel change to new target channel |
| 12385 | * @hHal: handle returned by mac_open |
| 12386 | * @bssid: mac address of BSS |
| 12387 | * @ch_params: target channel information |
| 12388 | * @profile: CSR profile |
| 12389 | * |
| 12390 | * API to Indicate Channel change to new target channel |
| 12391 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12392 | * Return: QDF_STATUS |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 12393 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12394 | QDF_STATUS sme_roam_channel_change_req(tHalHandle hHal, |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 12395 | struct qdf_mac_addr bssid, |
| 12396 | struct ch_params_s *ch_params, |
| 12397 | tCsrRoamProfile *profile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12398 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12399 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12400 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12401 | |
| 12402 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12403 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12404 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 12405 | status = csr_roam_channel_change_req(pMac, bssid, ch_params, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12406 | profile); |
| 12407 | sme_release_global_lock(&pMac->sme); |
| 12408 | } |
| 12409 | return status; |
| 12410 | } |
| 12411 | |
| 12412 | /* ------------------------------------------------------------------------- |
| 12413 | \fn sme_process_channel_change_resp |
| 12414 | \brief API to Indicate Channel change response message to SAP. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12415 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12416 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12417 | QDF_STATUS sme_process_channel_change_resp(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12418 | uint16_t msg_type, void *pMsgBuf) |
| 12419 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12420 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12421 | tCsrRoamInfo proam_info = { 0 }; |
| 12422 | eCsrRoamResult roamResult; |
| 12423 | tpSwitchChannelParams pChnlParams = (tpSwitchChannelParams) pMsgBuf; |
| 12424 | uint32_t SessionId = pChnlParams->peSessionId; |
| 12425 | |
| 12426 | proam_info.channelChangeRespEvent = |
| 12427 | (tSirChanChangeResponse *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12428 | qdf_mem_malloc(sizeof(tSirChanChangeResponse)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12429 | if (NULL == proam_info.channelChangeRespEvent) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12430 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12431 | sms_log(pMac, LOGE, |
| 12432 | "Channel Change Event Allocation Failed: %d\n", status); |
| 12433 | return status; |
| 12434 | } |
| 12435 | if (msg_type == eWNI_SME_CHANNEL_CHANGE_RSP) { |
| 12436 | proam_info.channelChangeRespEvent->sessionId = SessionId; |
| 12437 | proam_info.channelChangeRespEvent->newChannelNumber = |
| 12438 | pChnlParams->channelNumber; |
| 12439 | proam_info.channelChangeRespEvent->secondaryChannelOffset = |
| 12440 | pChnlParams->ch_width; |
| 12441 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12442 | if (pChnlParams->status == QDF_STATUS_SUCCESS) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12443 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO_MED, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12444 | "sapdfs: Received success eWNI_SME_CHANNEL_CHANGE_RSP for sessionId[%d]", |
| 12445 | SessionId); |
| 12446 | proam_info.channelChangeRespEvent->channelChangeStatus = |
| 12447 | 1; |
| 12448 | roamResult = eCSR_ROAM_RESULT_CHANNEL_CHANGE_SUCCESS; |
| 12449 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12450 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO_MED, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12451 | "sapdfs: Received failure eWNI_SME_CHANNEL_CHANGE_RSP for sessionId[%d]", |
| 12452 | SessionId); |
| 12453 | proam_info.channelChangeRespEvent->channelChangeStatus = |
| 12454 | 0; |
| 12455 | roamResult = eCSR_ROAM_RESULT_CHANNEL_CHANGE_FAILURE; |
| 12456 | } |
| 12457 | |
| 12458 | csr_roam_call_callback(pMac, SessionId, &proam_info, 0, |
| 12459 | eCSR_ROAM_SET_CHANNEL_RSP, roamResult); |
| 12460 | |
| 12461 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12462 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12463 | sms_log(pMac, LOGE, "Invalid Channel Change Resp Message: %d\n", |
| 12464 | status); |
| 12465 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12466 | qdf_mem_free(proam_info.channelChangeRespEvent); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12467 | |
| 12468 | return status; |
| 12469 | } |
| 12470 | |
| 12471 | /* ------------------------------------------------------------------------- |
| 12472 | \fn sme_roam_start_beacon_req |
| 12473 | \brief API to Indicate LIM to start Beacon Tx |
| 12474 | \after SAP CAC Wait is completed. |
| 12475 | \param hHal - The handle returned by mac_open |
| 12476 | \param sessionId - session ID |
| 12477 | \param dfsCacWaitStatus - CAC WAIT status flag |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12478 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12479 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 12480 | QDF_STATUS sme_roam_start_beacon_req(tHalHandle hHal, struct qdf_mac_addr bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12481 | uint8_t dfsCacWaitStatus) |
| 12482 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12483 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12484 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12485 | status = sme_acquire_global_lock(&pMac->sme); |
| 12486 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12487 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12488 | status = csr_roam_start_beacon_req(pMac, bssid, dfsCacWaitStatus); |
| 12489 | sme_release_global_lock(&pMac->sme); |
| 12490 | } |
| 12491 | return status; |
| 12492 | } |
| 12493 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 12494 | /** |
| 12495 | * sme_roam_csa_ie_request() - request CSA IE transmission from PE |
| 12496 | * @hHal: handle returned by mac_open |
| 12497 | * @bssid: SAP bssid |
| 12498 | * @targetChannel: target channel information |
| 12499 | * @csaIeReqd: CSA IE Request |
| 12500 | * @ch_params: channel information |
| 12501 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12502 | * Return: QDF_STATUS |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 12503 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 12504 | QDF_STATUS sme_roam_csa_ie_request(tHalHandle hHal, struct qdf_mac_addr bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12505 | uint8_t targetChannel, uint8_t csaIeReqd, |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 12506 | struct ch_params_s *ch_params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12507 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12508 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12509 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12510 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12511 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 12512 | status = csr_roam_send_chan_sw_ie_request(pMac, bssid, |
| 12513 | targetChannel, csaIeReqd, ch_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12514 | sme_release_global_lock(&pMac->sme); |
| 12515 | } |
| 12516 | return status; |
| 12517 | } |
| 12518 | |
| 12519 | /* --------------------------------------------------------------------------- |
| 12520 | \fn sme_init_thermal_info |
| 12521 | \brief SME API to initialize the thermal mitigation parameters |
| 12522 | \param hHal |
| 12523 | \param thermalParam : thermal mitigation parameters |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12524 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12525 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12526 | QDF_STATUS sme_init_thermal_info(tHalHandle hHal, tSmeThermalParams thermalParam) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12527 | { |
| 12528 | t_thermal_mgmt *pWmaParam; |
| 12529 | cds_msg_t msg; |
| 12530 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12531 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12532 | pWmaParam = (t_thermal_mgmt *) qdf_mem_malloc(sizeof(t_thermal_mgmt)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12533 | if (NULL == pWmaParam) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12534 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12535 | "%s: could not allocate tThermalMgmt", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12536 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12537 | } |
| 12538 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12539 | qdf_mem_zero((void *)pWmaParam, sizeof(t_thermal_mgmt)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12540 | |
| 12541 | pWmaParam->thermalMgmtEnabled = thermalParam.smeThermalMgmtEnabled; |
| 12542 | pWmaParam->throttlePeriod = thermalParam.smeThrottlePeriod; |
Poddar, Siddarth | 8390502 | 2016-04-16 17:56:08 -0700 | [diff] [blame] | 12543 | |
| 12544 | pWmaParam->throttle_duty_cycle_tbl[0] = |
| 12545 | thermalParam.sme_throttle_duty_cycle_tbl[0]; |
| 12546 | pWmaParam->throttle_duty_cycle_tbl[1] = |
| 12547 | thermalParam.sme_throttle_duty_cycle_tbl[1]; |
| 12548 | pWmaParam->throttle_duty_cycle_tbl[2] = |
| 12549 | thermalParam.sme_throttle_duty_cycle_tbl[2]; |
| 12550 | pWmaParam->throttle_duty_cycle_tbl[3] = |
| 12551 | thermalParam.sme_throttle_duty_cycle_tbl[3]; |
| 12552 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12553 | pWmaParam->thermalLevels[0].minTempThreshold = |
| 12554 | thermalParam.smeThermalLevels[0].smeMinTempThreshold; |
| 12555 | pWmaParam->thermalLevels[0].maxTempThreshold = |
| 12556 | thermalParam.smeThermalLevels[0].smeMaxTempThreshold; |
| 12557 | pWmaParam->thermalLevels[1].minTempThreshold = |
| 12558 | thermalParam.smeThermalLevels[1].smeMinTempThreshold; |
| 12559 | pWmaParam->thermalLevels[1].maxTempThreshold = |
| 12560 | thermalParam.smeThermalLevels[1].smeMaxTempThreshold; |
| 12561 | pWmaParam->thermalLevels[2].minTempThreshold = |
| 12562 | thermalParam.smeThermalLevels[2].smeMinTempThreshold; |
| 12563 | pWmaParam->thermalLevels[2].maxTempThreshold = |
| 12564 | thermalParam.smeThermalLevels[2].smeMaxTempThreshold; |
| 12565 | pWmaParam->thermalLevels[3].minTempThreshold = |
| 12566 | thermalParam.smeThermalLevels[3].smeMinTempThreshold; |
| 12567 | pWmaParam->thermalLevels[3].maxTempThreshold = |
| 12568 | thermalParam.smeThermalLevels[3].smeMaxTempThreshold; |
| 12569 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12570 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12571 | msg.type = WMA_INIT_THERMAL_INFO_CMD; |
| 12572 | msg.bodyptr = pWmaParam; |
| 12573 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12574 | if (!QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 12575 | (cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12576 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12577 | "%s: Not able to post WMA_SET_THERMAL_INFO_CMD to WMA!", |
| 12578 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12579 | qdf_mem_free(pWmaParam); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12580 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12581 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12582 | } |
| 12583 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12584 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12585 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12586 | qdf_mem_free(pWmaParam); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12587 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12588 | } |
| 12589 | |
| 12590 | /** |
| 12591 | * sme_add_set_thermal_level_callback() - Plug in set thermal level callback |
| 12592 | * @hal: Handle returned by macOpen |
| 12593 | * @callback: sme_set_thermal_level_callback |
| 12594 | * |
| 12595 | * Plug in set thermal level callback |
| 12596 | * |
| 12597 | * Return: none |
| 12598 | */ |
| 12599 | void sme_add_set_thermal_level_callback(tHalHandle hal, |
| 12600 | sme_set_thermal_level_callback callback) |
| 12601 | { |
| 12602 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
| 12603 | |
| 12604 | pMac->sme.set_thermal_level_cb = callback; |
| 12605 | } |
| 12606 | |
| 12607 | /** |
| 12608 | * sme_set_thermal_level() - SME API to set the thermal mitigation level |
| 12609 | * @hal: Handler to HAL |
| 12610 | * @level: Thermal mitigation level |
| 12611 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12612 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12613 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12614 | QDF_STATUS sme_set_thermal_level(tHalHandle hal, uint8_t level) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12615 | { |
| 12616 | cds_msg_t msg; |
| 12617 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12618 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12619 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12620 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12621 | qdf_mem_set(&msg, sizeof(msg), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12622 | msg.type = WMA_SET_THERMAL_LEVEL; |
| 12623 | msg.bodyval = level; |
| 12624 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 12625 | qdf_status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12626 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12627 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12628 | "%s: Not able to post WMA_SET_THERMAL_LEVEL to WMA!", |
| 12629 | __func__); |
| 12630 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12631 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12632 | } |
| 12633 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12634 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12635 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12636 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12637 | } |
| 12638 | |
| 12639 | /* --------------------------------------------------------------------------- |
| 12640 | \fn sme_txpower_limit |
| 12641 | \brief SME API to set txpower limits |
| 12642 | \param hHal |
| 12643 | \param psmetx : power limits for 2g/5g |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12644 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12645 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12646 | QDF_STATUS sme_txpower_limit(tHalHandle hHal, tSirTxPowerLimit *psmetx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12647 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12648 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12649 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12650 | cds_msg_t cds_message; |
| 12651 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 12652 | tSirTxPowerLimit *tx_power_limit; |
| 12653 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12654 | tx_power_limit = qdf_mem_malloc(sizeof(*tx_power_limit)); |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 12655 | if (!tx_power_limit) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12656 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 12657 | "%s: Memory allocation for TxPowerLimit failed!", |
| 12658 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12659 | return QDF_STATUS_E_FAILURE; |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 12660 | } |
| 12661 | |
| 12662 | *tx_power_limit = *psmetx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12663 | |
| 12664 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12665 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12666 | cds_message.type = WMA_TX_POWER_LIMIT; |
| 12667 | cds_message.reserved = 0; |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 12668 | cds_message.bodyptr = tx_power_limit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12669 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12670 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 12671 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12672 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12673 | "%s: not able to post WMA_TX_POWER_LIMIT", |
| 12674 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12675 | status = QDF_STATUS_E_FAILURE; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12676 | qdf_mem_free(tx_power_limit); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12677 | } |
| 12678 | sme_release_global_lock(&pMac->sme); |
| 12679 | } |
| 12680 | return status; |
| 12681 | } |
| 12682 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12683 | QDF_STATUS sme_update_connect_debug(tHalHandle hHal, uint32_t set_value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12684 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12685 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12686 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12687 | pMac->fEnableDebugLog = set_value; |
| 12688 | return status; |
| 12689 | } |
| 12690 | |
| 12691 | /* --------------------------------------------------------------------------- |
| 12692 | \fn sme_ap_disable_intra_bss_fwd |
| 12693 | |
| 12694 | \brief |
| 12695 | SME will send message to WMA to set Intra BSS in txrx |
| 12696 | |
| 12697 | \param |
| 12698 | |
| 12699 | hHal - The handle returned by mac_open |
| 12700 | |
| 12701 | sessionId - session id ( vdev id) |
| 12702 | |
| 12703 | disablefwd - bool value that indicate disable intrabss fwd disable |
| 12704 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12705 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12706 | --------------------------------------------------------------------------- */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12707 | QDF_STATUS sme_ap_disable_intra_bss_fwd(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12708 | bool disablefwd) |
| 12709 | { |
| 12710 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12711 | int status = QDF_STATUS_SUCCESS; |
| 12712 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12713 | cds_msg_t cds_message; |
| 12714 | tpDisableIntraBssFwd pSapDisableIntraFwd = NULL; |
| 12715 | |
| 12716 | /* Prepare the request to send to SME. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12717 | pSapDisableIntraFwd = qdf_mem_malloc(sizeof(tDisableIntraBssFwd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12718 | if (NULL == pSapDisableIntraFwd) { |
| 12719 | sms_log(pMac, LOGP, "Memory Allocation Failure!!! %s", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12720 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12721 | } |
| 12722 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12723 | qdf_mem_zero(pSapDisableIntraFwd, sizeof(tDisableIntraBssFwd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12724 | |
| 12725 | pSapDisableIntraFwd->sessionId = sessionId; |
| 12726 | pSapDisableIntraFwd->disableintrabssfwd = disablefwd; |
| 12727 | |
| 12728 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12729 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12730 | /* serialize the req through MC thread */ |
| 12731 | cds_message.bodyptr = pSapDisableIntraFwd; |
| 12732 | cds_message.type = WMA_SET_SAP_INTRABSS_DIS; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12733 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 12734 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 12735 | status = QDF_STATUS_E_FAILURE; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12736 | qdf_mem_free(pSapDisableIntraFwd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12737 | } |
| 12738 | sme_release_global_lock(&pMac->sme); |
| 12739 | } |
| 12740 | return status; |
| 12741 | } |
| 12742 | |
| 12743 | #ifdef WLAN_FEATURE_STATS_EXT |
| 12744 | |
| 12745 | /****************************************************************************** |
| 12746 | \fn sme_stats_ext_register_callback |
| 12747 | |
| 12748 | \brief |
| 12749 | a function called to register the callback that send vendor event for stats |
| 12750 | ext |
| 12751 | |
| 12752 | \param callback - callback to be registered |
| 12753 | ******************************************************************************/ |
| 12754 | void sme_stats_ext_register_callback(tHalHandle hHal, StatsExtCallback callback) |
| 12755 | { |
| 12756 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12757 | |
| 12758 | pMac->sme.StatsExtCallback = callback; |
| 12759 | } |
| 12760 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 12761 | /** |
| 12762 | * sme_stats_ext_deregister_callback() - De-register ext stats callback |
| 12763 | * @h_hal: Hal Handle |
| 12764 | * |
| 12765 | * This function is called to de initialize the HDD NAN feature. Currently |
| 12766 | * the only operation required is to de-register a callback with SME. |
| 12767 | * |
| 12768 | * Return: None |
| 12769 | */ |
| 12770 | void sme_stats_ext_deregister_callback(tHalHandle h_hal) |
| 12771 | { |
| 12772 | tpAniSirGlobal pmac; |
| 12773 | |
| 12774 | if (!h_hal) { |
| 12775 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12776 | FL("hHal is not valid")); |
| 12777 | return; |
| 12778 | } |
| 12779 | |
| 12780 | pmac = PMAC_STRUCT(h_hal); |
| 12781 | pmac->sme.StatsExtCallback = NULL; |
| 12782 | } |
| 12783 | |
| 12784 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12785 | /****************************************************************************** |
| 12786 | \fn sme_stats_ext_request |
| 12787 | |
| 12788 | \brief |
| 12789 | a function called when HDD receives STATS EXT vendor command from userspace |
| 12790 | |
| 12791 | \param sessionID - vdevID for the stats ext request |
| 12792 | |
| 12793 | \param input - Stats Ext Request structure ptr |
| 12794 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12795 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12796 | ******************************************************************************/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12797 | QDF_STATUS sme_stats_ext_request(uint8_t session_id, tpStatsExtRequestReq input) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12798 | { |
| 12799 | cds_msg_t msg; |
| 12800 | tpStatsExtRequest data; |
| 12801 | size_t data_len; |
| 12802 | |
| 12803 | data_len = sizeof(tStatsExtRequest) + input->request_data_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12804 | data = qdf_mem_malloc(data_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12805 | |
| 12806 | if (data == NULL) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12807 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12808 | } |
| 12809 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12810 | qdf_mem_zero(data, data_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12811 | data->vdev_id = session_id; |
| 12812 | data->request_data_len = input->request_data_len; |
| 12813 | if (input->request_data_len) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12814 | qdf_mem_copy(data->request_data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12815 | input->request_data, input->request_data_len); |
| 12816 | } |
| 12817 | |
| 12818 | msg.type = WMA_STATS_EXT_REQUEST; |
| 12819 | msg.reserved = 0; |
| 12820 | msg.bodyptr = data; |
| 12821 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 12822 | if (QDF_STATUS_SUCCESS != cds_mq_post_message(QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12823 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12824 | "%s: Not able to post WMA_STATS_EXT_REQUEST message to WMA", |
| 12825 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12826 | qdf_mem_free(data); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12827 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12828 | } |
| 12829 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12830 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12831 | } |
| 12832 | |
| 12833 | /****************************************************************************** |
| 12834 | \fn sme_stats_ext_event |
| 12835 | |
| 12836 | \brief |
| 12837 | a callback function called when SME received eWNI_SME_STATS_EXT_EVENT |
| 12838 | response from WMA |
| 12839 | |
| 12840 | \param hHal - HAL handle for device |
| 12841 | \param pMsg - Message body passed from WMA; includes NAN header |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12842 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12843 | ******************************************************************************/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12844 | QDF_STATUS sme_stats_ext_event(tHalHandle hHal, void *pMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12845 | { |
| 12846 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12847 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12848 | |
| 12849 | if (NULL == pMsg) { |
| 12850 | sms_log(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12851 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12852 | } else { |
| 12853 | sms_log(pMac, LOG2, "SME: entering %s", __func__); |
| 12854 | |
| 12855 | if (pMac->sme.StatsExtCallback) { |
| 12856 | pMac->sme.StatsExtCallback(pMac->hHdd, |
| 12857 | (tpStatsExtEvent) pMsg); |
| 12858 | } |
| 12859 | } |
| 12860 | |
| 12861 | return status; |
| 12862 | } |
| 12863 | |
| 12864 | #endif |
| 12865 | |
| 12866 | /* --------------------------------------------------------------------------- |
| 12867 | \fn sme_update_dfs_scan_mode |
| 12868 | \brief Update DFS roam scan mode |
| 12869 | This function is called through dynamic setConfig callback function |
| 12870 | to configure allowDFSChannelRoam. |
| 12871 | \param hHal - HAL handle for device |
| 12872 | \param sessionId - Session Identifier |
| 12873 | \param allowDFSChannelRoam - DFS roaming scan mode 0 (disable), |
| 12874 | 1 (passive), 2 (active) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12875 | \return QDF_STATUS_SUCCESS - SME update DFS roaming scan config |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12876 | successfully. |
| 12877 | Other status means SME failed to update DFS roaming scan config. |
| 12878 | \sa |
| 12879 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12880 | QDF_STATUS sme_update_dfs_scan_mode(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12881 | uint8_t allowDFSChannelRoam) |
| 12882 | { |
| 12883 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12884 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12885 | |
| 12886 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12887 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12888 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12889 | "LFR runtime successfully set AllowDFSChannelRoam Mode to " |
| 12890 | "%d - old value is %d - roam state is %s", |
| 12891 | allowDFSChannelRoam, |
| 12892 | pMac->roam.configParam.allowDFSChannelRoam, |
| 12893 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 12894 | neighborRoamInfo |
| 12895 | [sessionId]. |
| 12896 | neighborRoamState)); |
| 12897 | pMac->roam.configParam.allowDFSChannelRoam = |
| 12898 | allowDFSChannelRoam; |
| 12899 | sme_release_global_lock(&pMac->sme); |
| 12900 | } |
| 12901 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 12902 | csr_roam_offload_scan(pMac, sessionId, |
| 12903 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 12904 | REASON_ROAM_DFS_SCAN_MODE_CHANGED); |
| 12905 | } |
| 12906 | |
| 12907 | return status; |
| 12908 | } |
| 12909 | |
| 12910 | /*-------------------------------------------------------------------------- |
| 12911 | \brief sme_get_dfs_scan_mode() - get DFS roam scan mode |
| 12912 | This is a synchronous call |
| 12913 | \param hHal - The handle returned by mac_open. |
| 12914 | \return DFS roaming scan mode 0 (disable), 1 (passive), 2 (active) |
| 12915 | \sa |
| 12916 | --------------------------------------------------------------------------*/ |
| 12917 | uint8_t sme_get_dfs_scan_mode(tHalHandle hHal) |
| 12918 | { |
| 12919 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12920 | return pMac->roam.configParam.allowDFSChannelRoam; |
| 12921 | } |
| 12922 | |
| 12923 | /*---------------------------------------------------------------------------- |
| 12924 | \fn sme_modify_add_ie |
| 12925 | \brief This function sends msg to updates the additional IE buffers in PE |
| 12926 | \param hHal - global structure |
| 12927 | \param pModifyIE - pointer to tModifyIE structure |
| 12928 | \param updateType - type of buffer |
| 12929 | \- return Success or failure |
| 12930 | -----------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12931 | QDF_STATUS sme_modify_add_ie(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12932 | tSirModifyIE *pModifyIE, eUpdateIEsType updateType) |
| 12933 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12934 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12935 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12936 | status = sme_acquire_global_lock(&pMac->sme); |
| 12937 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12938 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12939 | status = csr_roam_modify_add_ies(pMac, pModifyIE, updateType); |
| 12940 | sme_release_global_lock(&pMac->sme); |
| 12941 | } |
| 12942 | return status; |
| 12943 | } |
| 12944 | |
| 12945 | /*---------------------------------------------------------------------------- |
| 12946 | \fn sme_update_add_ie |
| 12947 | \brief This function sends msg to updates the additional IE buffers in PE |
| 12948 | \param hHal - global structure |
| 12949 | \param pUpdateIE - pointer to structure tUpdateIE |
| 12950 | \param updateType - type of buffer |
| 12951 | \- return Success or failure |
| 12952 | -----------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12953 | QDF_STATUS sme_update_add_ie(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12954 | tSirUpdateIE *pUpdateIE, eUpdateIEsType updateType) |
| 12955 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12956 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12957 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12958 | status = sme_acquire_global_lock(&pMac->sme); |
| 12959 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12960 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12961 | status = csr_roam_update_add_ies(pMac, pUpdateIE, updateType); |
| 12962 | sme_release_global_lock(&pMac->sme); |
| 12963 | } |
| 12964 | return status; |
| 12965 | } |
| 12966 | |
| 12967 | /* --------------------------------------------------------------------------- |
| 12968 | \fn sme_sta_in_middle_of_roaming |
| 12969 | \brief This function returns true if STA is in the middle of roaming state |
| 12970 | \param hHal - HAL handle for device |
| 12971 | \param sessionId - Session Identifier |
| 12972 | \- return true or false |
| 12973 | -------------------------------------------------------------------------*/ |
| 12974 | bool sme_sta_in_middle_of_roaming(tHalHandle hHal, uint8_t sessionId) |
| 12975 | { |
| 12976 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12977 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12978 | bool ret = false; |
| 12979 | |
| 12980 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12981 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12982 | ret = csr_neighbor_middle_of_roaming(hHal, sessionId); |
| 12983 | sme_release_global_lock(&pMac->sme); |
| 12984 | } |
| 12985 | return ret; |
| 12986 | } |
| 12987 | |
| 12988 | |
| 12989 | /** |
| 12990 | * sme_update_dsc_pto_up_mapping() |
| 12991 | * @hHal: HAL context |
| 12992 | * @dscpmapping: pointer to DSCP mapping structure |
| 12993 | * @sessionId: SME session id |
| 12994 | * |
| 12995 | * This routine is called to update dscp mapping |
| 12996 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12997 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12998 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12999 | QDF_STATUS sme_update_dsc_pto_up_mapping(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13000 | sme_QosWmmUpType *dscpmapping, |
| 13001 | uint8_t sessionId) |
| 13002 | { |
| 13003 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13004 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13005 | uint8_t i, j, peSessionId; |
| 13006 | tCsrRoamSession *pCsrSession = NULL; |
| 13007 | tpPESession pSession = NULL; |
| 13008 | |
| 13009 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13010 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13011 | return status; |
| 13012 | pCsrSession = CSR_GET_SESSION(pMac, sessionId); |
| 13013 | if (pCsrSession == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13014 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13015 | FL("Session lookup fails for CSR session")); |
| 13016 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13017 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13018 | } |
| 13019 | if (!CSR_IS_SESSION_VALID(pMac, sessionId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13020 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13021 | FL("Invalid session Id %u"), sessionId); |
| 13022 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13023 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13024 | } |
| 13025 | |
| 13026 | pSession = pe_find_session_by_bssid(pMac, |
| 13027 | pCsrSession->connectedProfile.bssid.bytes, |
| 13028 | &peSessionId); |
| 13029 | |
| 13030 | if (pSession == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13031 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13032 | FL(" Session lookup fails for BSSID")); |
| 13033 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13034 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13035 | } |
| 13036 | |
| 13037 | if (!pSession->QosMapSet.present) { |
Anurag Chouhan | 05d124f | 2016-09-03 16:21:50 +0530 | [diff] [blame] | 13038 | hdd_notice("QOS Mapping IE not present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13039 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13040 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13041 | } |
| 13042 | for (i = 0; i < SME_QOS_WMM_UP_MAX; i++) { |
| 13043 | for (j = pSession->QosMapSet.dscp_range[i][0]; |
| 13044 | j <= pSession->QosMapSet.dscp_range[i][1]; |
| 13045 | j++) { |
| 13046 | if ((pSession->QosMapSet.dscp_range[i][0] == 255) |
| 13047 | && (pSession->QosMapSet.dscp_range[i][1] == |
| 13048 | 255)) { |
| 13049 | dscpmapping[j] = 0; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13050 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 13051 | QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13052 | FL("User Priority %d isn't used"), i); |
| 13053 | break; |
| 13054 | } else { |
| 13055 | dscpmapping[j] = i; |
| 13056 | } |
| 13057 | } |
| 13058 | } |
| 13059 | for (i = 0; i < pSession->QosMapSet.num_dscp_exceptions; i++) |
| 13060 | if (pSession->QosMapSet.dscp_exceptions[i][0] != 255) |
| 13061 | dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0]] = |
| 13062 | pSession->QosMapSet.dscp_exceptions[i][1]; |
| 13063 | |
| 13064 | sme_release_global_lock(&pMac->sme); |
| 13065 | return status; |
| 13066 | } |
| 13067 | |
| 13068 | /* --------------------------------------------------------------------------- |
| 13069 | \fn sme_abort_roam_scan |
| 13070 | \brief API to abort current roam scan cycle by roam scan offload module. |
| 13071 | \param hHal - The handle returned by mac_open. |
| 13072 | \param sessionId - Session Identifier |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13073 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13074 | ---------------------------------------------------------------------------*/ |
| 13075 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13076 | QDF_STATUS sme_abort_roam_scan(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13077 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13078 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13079 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13080 | |
| 13081 | sms_log(pMac, LOGW, "entering function %s", __func__); |
| 13082 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 13083 | /* acquire the lock for the sme object */ |
| 13084 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13085 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13086 | csr_roam_offload_scan(pMac, sessionId, |
| 13087 | ROAM_SCAN_OFFLOAD_ABORT_SCAN, |
| 13088 | REASON_ROAM_ABORT_ROAM_SCAN); |
| 13089 | /* release the lock for the sme object */ |
| 13090 | sme_release_global_lock(&pMac->sme); |
| 13091 | } |
| 13092 | } |
| 13093 | |
| 13094 | return status; |
| 13095 | } |
| 13096 | |
| 13097 | #ifdef FEATURE_WLAN_EXTSCAN |
| 13098 | /** |
| 13099 | * sme_get_valid_channels_by_band() - to fetch valid channels filtered by band |
| 13100 | * @hHal: HAL context |
| 13101 | * @wifiBand: RF band information |
| 13102 | * @aValidChannels: output array to store channel info |
| 13103 | * @pNumChannels: output number of channels |
| 13104 | * |
| 13105 | * SME API to fetch all valid channels filtered by band |
| 13106 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13107 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13108 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13109 | QDF_STATUS sme_get_valid_channels_by_band(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13110 | uint8_t wifiBand, |
| 13111 | uint32_t *aValidChannels, |
| 13112 | uint8_t *pNumChannels) |
| 13113 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13114 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13115 | uint8_t chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; |
| 13116 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13117 | uint8_t numChannels = 0; |
| 13118 | uint8_t i = 0; |
| 13119 | uint32_t totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 13120 | |
| 13121 | if (!aValidChannels || !pNumChannels) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13122 | sms_log(pMac, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13123 | FL("Output channel list/NumChannels is NULL")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13124 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13125 | } |
| 13126 | |
| 13127 | if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13128 | sms_log(pMac, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13129 | FL("Invalid wifiBand (%d)"), wifiBand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13130 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13131 | } |
| 13132 | |
| 13133 | status = sme_get_cfg_valid_channels(hHal, &chanList[0], |
| 13134 | &totValidChannels); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13135 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13136 | sms_log(pMac, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13137 | FL("Fail to get valid channel list (err=%d)"), status); |
| 13138 | return status; |
| 13139 | } |
| 13140 | |
| 13141 | switch (wifiBand) { |
| 13142 | case WIFI_BAND_UNSPECIFIED: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13143 | sms_log(pMac, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13144 | FL("Unspec Band, return all (%d) valid channels"), |
| 13145 | totValidChannels); |
| 13146 | numChannels = totValidChannels; |
| 13147 | for (i = 0; i < totValidChannels; i++) { |
| 13148 | aValidChannels[i] = cds_chan_to_freq(chanList[i]); |
| 13149 | } |
| 13150 | break; |
| 13151 | |
| 13152 | case WIFI_BAND_BG: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13153 | sms_log(pMac, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13154 | FL("WIFI_BAND_BG (2.4 GHz)")); |
| 13155 | for (i = 0; i < totValidChannels; i++) { |
| 13156 | if (CDS_IS_CHANNEL_24GHZ(chanList[i])) { |
| 13157 | aValidChannels[numChannels++] = |
| 13158 | cds_chan_to_freq(chanList[i]); |
| 13159 | } |
| 13160 | } |
| 13161 | break; |
| 13162 | |
| 13163 | case WIFI_BAND_A: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13164 | sms_log(pMac, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13165 | FL("WIFI_BAND_A (5 GHz without DFS)")); |
| 13166 | for (i = 0; i < totValidChannels; i++) { |
| 13167 | if (CDS_IS_CHANNEL_5GHZ(chanList[i]) && |
| 13168 | !CDS_IS_DFS_CH(chanList[i])) { |
| 13169 | aValidChannels[numChannels++] = |
| 13170 | cds_chan_to_freq(chanList[i]); |
| 13171 | } |
| 13172 | } |
| 13173 | break; |
| 13174 | |
| 13175 | case WIFI_BAND_ABG: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13176 | sms_log(pMac, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13177 | FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)")); |
| 13178 | for (i = 0; i < totValidChannels; i++) { |
| 13179 | if ((CDS_IS_CHANNEL_24GHZ(chanList[i]) || |
| 13180 | CDS_IS_CHANNEL_5GHZ(chanList[i])) && |
| 13181 | !CDS_IS_DFS_CH(chanList[i])) { |
| 13182 | aValidChannels[numChannels++] = |
| 13183 | cds_chan_to_freq(chanList[i]); |
| 13184 | } |
| 13185 | } |
| 13186 | break; |
| 13187 | |
| 13188 | case WIFI_BAND_A_DFS_ONLY: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13189 | sms_log(pMac, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13190 | FL("WIFI_BAND_A_DFS (5 GHz DFS only)")); |
| 13191 | for (i = 0; i < totValidChannels; i++) { |
| 13192 | if (CDS_IS_CHANNEL_5GHZ(chanList[i]) && |
| 13193 | CDS_IS_DFS_CH(chanList[i])) { |
| 13194 | aValidChannels[numChannels++] = |
| 13195 | cds_chan_to_freq(chanList[i]); |
| 13196 | } |
| 13197 | } |
| 13198 | break; |
| 13199 | |
| 13200 | case WIFI_BAND_A_WITH_DFS: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13201 | sms_log(pMac, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13202 | FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)")); |
| 13203 | for (i = 0; i < totValidChannels; i++) { |
| 13204 | if (CDS_IS_CHANNEL_5GHZ(chanList[i])) { |
| 13205 | aValidChannels[numChannels++] = |
| 13206 | cds_chan_to_freq(chanList[i]); |
| 13207 | } |
| 13208 | } |
| 13209 | break; |
| 13210 | |
| 13211 | case WIFI_BAND_ABG_WITH_DFS: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13212 | sms_log(pMac, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13213 | FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz+5 GHz with DFS)")); |
| 13214 | for (i = 0; i < totValidChannels; i++) { |
| 13215 | if (CDS_IS_CHANNEL_24GHZ(chanList[i]) || |
| 13216 | CDS_IS_CHANNEL_5GHZ(chanList[i])) { |
| 13217 | aValidChannels[numChannels++] = |
| 13218 | cds_chan_to_freq(chanList[i]); |
| 13219 | } |
| 13220 | } |
| 13221 | break; |
| 13222 | |
| 13223 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13224 | sms_log(pMac, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13225 | FL("Unknown wifiBand (%d))"), wifiBand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13226 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13227 | break; |
| 13228 | } |
| 13229 | *pNumChannels = numChannels; |
| 13230 | |
| 13231 | return status; |
| 13232 | } |
| 13233 | |
| 13234 | /* --------------------------------------------------------------------------- |
| 13235 | \fn sme_ext_scan_get_capabilities |
| 13236 | \brief SME API to fetch extscan capabilities |
| 13237 | \param hHal |
| 13238 | \param pReq: extscan capabilities structure |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13239 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13240 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13241 | QDF_STATUS sme_ext_scan_get_capabilities(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13242 | tSirGetExtScanCapabilitiesReqParams * |
| 13243 | pReq) |
| 13244 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13245 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13246 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13247 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13248 | cds_msg_t cds_message; |
| 13249 | |
| 13250 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13251 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13252 | /* Serialize the req through MC thread */ |
| 13253 | cds_message.bodyptr = pReq; |
| 13254 | cds_message.type = WMA_EXTSCAN_GET_CAPABILITIES_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 13255 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 13256 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13257 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13258 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 13259 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13260 | |
| 13261 | sme_release_global_lock(&pMac->sme); |
| 13262 | } |
| 13263 | return status; |
| 13264 | } |
| 13265 | |
| 13266 | /* --------------------------------------------------------------------------- |
| 13267 | \fn sme_ext_scan_start |
| 13268 | \brief SME API to issue extscan start |
| 13269 | \param hHal |
| 13270 | \param pStartCmd: extscan start structure |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13271 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13272 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13273 | QDF_STATUS sme_ext_scan_start(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13274 | tSirWifiScanCmdReqParams *pStartCmd) |
| 13275 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13276 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13277 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13278 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13279 | cds_msg_t cds_message; |
| 13280 | |
| 13281 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13282 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13283 | /* Serialize the req through MC thread */ |
| 13284 | cds_message.bodyptr = pStartCmd; |
| 13285 | cds_message.type = WMA_EXTSCAN_START_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 13286 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 13287 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13288 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13289 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 13290 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13291 | |
| 13292 | sme_release_global_lock(&pMac->sme); |
| 13293 | } |
| 13294 | return status; |
| 13295 | } |
| 13296 | |
| 13297 | /* --------------------------------------------------------------------------- |
| 13298 | \fn sme_ext_scan_stop |
| 13299 | \brief SME API to issue extscan stop |
| 13300 | \param hHal |
| 13301 | \param pStopReq: extscan stop structure |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13302 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13303 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13304 | QDF_STATUS sme_ext_scan_stop(tHalHandle hHal, tSirExtScanStopReqParams *pStopReq) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13305 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13306 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13307 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13308 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13309 | cds_msg_t cds_message; |
| 13310 | |
| 13311 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13312 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13313 | /* Serialize the req through MC thread */ |
| 13314 | cds_message.bodyptr = pStopReq; |
| 13315 | cds_message.type = WMA_EXTSCAN_STOP_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 13316 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 13317 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13318 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13319 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 13320 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13321 | sme_release_global_lock(&pMac->sme); |
| 13322 | } |
| 13323 | return status; |
| 13324 | } |
| 13325 | |
| 13326 | /* --------------------------------------------------------------------------- |
| 13327 | \fn sme_set_bss_hotlist |
| 13328 | \brief SME API to set BSSID hotlist |
| 13329 | \param hHal |
| 13330 | \param pSetHotListReq: extscan set hotlist structure |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13331 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13332 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13333 | QDF_STATUS sme_set_bss_hotlist(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13334 | tSirExtScanSetBssidHotListReqParams * |
| 13335 | pSetHotListReq) |
| 13336 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13337 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13338 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13339 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13340 | cds_msg_t cds_message; |
| 13341 | |
| 13342 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13343 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13344 | /* Serialize the req through MC thread */ |
| 13345 | cds_message.bodyptr = pSetHotListReq; |
| 13346 | cds_message.type = WMA_EXTSCAN_SET_BSSID_HOTLIST_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 13347 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 13348 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13349 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13350 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 13351 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13352 | |
| 13353 | sme_release_global_lock(&pMac->sme); |
| 13354 | } |
| 13355 | return status; |
| 13356 | } |
| 13357 | |
| 13358 | /* --------------------------------------------------------------------------- |
| 13359 | \fn sme_reset_bss_hotlist |
| 13360 | \brief SME API to reset BSSID hotlist |
| 13361 | \param hHal |
| 13362 | \param pSetHotListReq: extscan set hotlist structure |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13363 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13364 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13365 | QDF_STATUS sme_reset_bss_hotlist(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13366 | tSirExtScanResetBssidHotlistReqParams * |
| 13367 | pResetReq) |
| 13368 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13369 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13370 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13371 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13372 | cds_msg_t cds_message; |
| 13373 | |
| 13374 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13375 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13376 | /* Serialize the req through MC thread */ |
| 13377 | cds_message.bodyptr = pResetReq; |
| 13378 | cds_message.type = WMA_EXTSCAN_RESET_BSSID_HOTLIST_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 13379 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 13380 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13381 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13382 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 13383 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13384 | |
| 13385 | sme_release_global_lock(&pMac->sme); |
| 13386 | } |
| 13387 | return status; |
| 13388 | } |
| 13389 | |
Manikandan Mohan | 80dea79 | 2016-04-28 16:36:48 -0700 | [diff] [blame] | 13390 | /** |
| 13391 | * sme_send_wisa_params(): Pass WISA mode to WMA |
| 13392 | * @hal: HAL context |
| 13393 | * @wisa_params: pointer to WISA params struct |
| 13394 | * @sessionId: SME session id |
| 13395 | * |
| 13396 | * Pass WISA params to WMA |
| 13397 | * |
| 13398 | * Return: QDF_STATUS |
| 13399 | */ |
| 13400 | QDF_STATUS sme_set_wisa_params(tHalHandle hal, |
| 13401 | struct sir_wisa_params *wisa_params) |
| 13402 | { |
| 13403 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13404 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 13405 | cds_msg_t cds_message; |
| 13406 | struct sir_wisa_params *cds_msg_wisa_params; |
| 13407 | |
| 13408 | cds_msg_wisa_params = qdf_mem_malloc(sizeof(struct sir_wisa_params)); |
| 13409 | if (!cds_msg_wisa_params) |
| 13410 | return QDF_STATUS_E_NOMEM; |
| 13411 | |
| 13412 | *cds_msg_wisa_params = *wisa_params; |
| 13413 | status = sme_acquire_global_lock(&mac->sme); |
| 13414 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 13415 | cds_message.bodyptr = cds_msg_wisa_params; |
| 13416 | cds_message.type = WMA_SET_WISA_PARAMS; |
| 13417 | status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13418 | sme_release_global_lock(&mac->sme); |
| 13419 | } |
| 13420 | return status; |
| 13421 | } |
| 13422 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13423 | /* --------------------------------------------------------------------------- |
| 13424 | \fn sme_set_significant_change |
| 13425 | \brief SME API to set significant change |
| 13426 | \param hHal |
| 13427 | \param pSetSignificantChangeReq: extscan set significant change structure |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13428 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13429 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13430 | QDF_STATUS sme_set_significant_change(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13431 | tSirExtScanSetSigChangeReqParams * |
| 13432 | pSetSignificantChangeReq) |
| 13433 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13434 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13435 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13436 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13437 | cds_msg_t cds_message; |
| 13438 | |
| 13439 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13440 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13441 | /* Serialize the req through MC thread */ |
| 13442 | cds_message.bodyptr = pSetSignificantChangeReq; |
| 13443 | cds_message.type = WMA_EXTSCAN_SET_SIGNF_CHANGE_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 13444 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 13445 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13446 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13447 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 13448 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13449 | |
| 13450 | sme_release_global_lock(&pMac->sme); |
| 13451 | } |
| 13452 | return status; |
| 13453 | } |
| 13454 | |
| 13455 | /* --------------------------------------------------------------------------- |
| 13456 | \fn sme_reset_significant_change |
| 13457 | \brief SME API to reset significant change |
| 13458 | \param hHal |
| 13459 | \param pResetReq: extscan reset significant change structure |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13460 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13461 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13462 | QDF_STATUS sme_reset_significant_change(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13463 | tSirExtScanResetSignificantChangeReqParams |
| 13464 | *pResetReq) |
| 13465 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13466 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13467 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13468 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13469 | cds_msg_t cds_message; |
| 13470 | |
| 13471 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13472 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13473 | /* Serialize the req through MC thread */ |
| 13474 | cds_message.bodyptr = pResetReq; |
| 13475 | cds_message.type = WMA_EXTSCAN_RESET_SIGNF_CHANGE_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 13476 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 13477 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13478 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13479 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 13480 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13481 | |
| 13482 | sme_release_global_lock(&pMac->sme); |
| 13483 | } |
| 13484 | return status; |
| 13485 | } |
| 13486 | |
| 13487 | /* --------------------------------------------------------------------------- |
| 13488 | \fn sme_get_cached_results |
| 13489 | \brief SME API to get cached results |
| 13490 | \param hHal |
| 13491 | \param pCachedResultsReq: extscan get cached results structure |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13492 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13493 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13494 | QDF_STATUS sme_get_cached_results(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13495 | tSirExtScanGetCachedResultsReqParams * |
| 13496 | pCachedResultsReq) |
| 13497 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13498 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13499 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13500 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13501 | cds_msg_t cds_message; |
| 13502 | |
| 13503 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13504 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13505 | /* Serialize the req through MC thread */ |
| 13506 | cds_message.bodyptr = pCachedResultsReq; |
| 13507 | cds_message.type = WMA_EXTSCAN_GET_CACHED_RESULTS_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 13508 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 13509 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13510 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13511 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 13512 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13513 | |
| 13514 | sme_release_global_lock(&pMac->sme); |
| 13515 | } |
| 13516 | return status; |
| 13517 | } |
| 13518 | |
| 13519 | /** |
| 13520 | * sme_set_epno_list() - set epno network list |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 13521 | * @hal: global hal handle |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13522 | * @input: request message |
| 13523 | * |
| 13524 | * This function constructs the cds message and fill in message type, |
| 13525 | * bodyptr with %input and posts it to WDA queue. |
| 13526 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 13527 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13528 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13529 | QDF_STATUS sme_set_epno_list(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13530 | struct wifi_epno_params *input) |
| 13531 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13532 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13533 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 13534 | cds_msg_t cds_message; |
| 13535 | struct wifi_epno_params *req_msg; |
| 13536 | int len, i; |
| 13537 | |
| 13538 | sms_log(mac, LOG1, FL("enter")); |
| 13539 | len = sizeof(*req_msg) + |
| 13540 | (input->num_networks * sizeof(struct wifi_epno_network)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13541 | req_msg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13542 | if (!req_msg) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13543 | sms_log(mac, LOGE, FL("qdf_mem_malloc failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13544 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13545 | } |
| 13546 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13547 | qdf_mem_zero(req_msg, len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13548 | req_msg->num_networks = input->num_networks; |
| 13549 | req_msg->request_id = input->request_id; |
| 13550 | req_msg->session_id = input->session_id; |
| 13551 | for (i = 0; i < req_msg->num_networks; i++) { |
| 13552 | req_msg->networks[i].rssi_threshold = |
| 13553 | input->networks[i].rssi_threshold; |
| 13554 | req_msg->networks[i].flags = input->networks[i].flags; |
| 13555 | req_msg->networks[i].auth_bit_field = |
| 13556 | input->networks[i].auth_bit_field; |
| 13557 | req_msg->networks[i].ssid.length = |
| 13558 | input->networks[i].ssid.length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13559 | qdf_mem_copy(req_msg->networks[i].ssid.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13560 | input->networks[i].ssid.ssId, |
| 13561 | req_msg->networks[i].ssid.length); |
| 13562 | } |
| 13563 | |
| 13564 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13565 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13566 | sms_log(mac, LOGE, |
| 13567 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 13568 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13569 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13570 | return status; |
| 13571 | } |
| 13572 | |
| 13573 | /* Serialize the req through MC thread */ |
| 13574 | cds_message.bodyptr = req_msg; |
| 13575 | cds_message.type = WMA_SET_EPNO_LIST_REQ; |
| 13576 | status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13577 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13578 | sms_log(mac, LOGE, |
| 13579 | FL("cds_mq_post_message failed!(err=%d)"), |
| 13580 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13581 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13582 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13583 | } |
| 13584 | sme_release_global_lock(&mac->sme); |
| 13585 | return status; |
| 13586 | } |
| 13587 | |
| 13588 | /** |
| 13589 | * sme_set_passpoint_list() - set passpoint network list |
| 13590 | * @hal: global hal handle |
| 13591 | * @input: request message |
| 13592 | * |
| 13593 | * This function constructs the cds message and fill in message type, |
| 13594 | * bodyptr with @input and posts it to WDA queue. |
| 13595 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 13596 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13597 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13598 | QDF_STATUS sme_set_passpoint_list(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13599 | struct wifi_passpoint_req *input) |
| 13600 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13601 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13602 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 13603 | cds_msg_t cds_message; |
| 13604 | struct wifi_passpoint_req *req_msg; |
| 13605 | int len, i; |
| 13606 | |
| 13607 | sms_log(mac, LOG1, FL("enter")); |
| 13608 | len = sizeof(*req_msg) + |
| 13609 | (input->num_networks * sizeof(struct wifi_passpoint_network)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13610 | req_msg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13611 | if (!req_msg) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13612 | sms_log(mac, LOGE, FL("qdf_mem_malloc failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13613 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13614 | } |
| 13615 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13616 | qdf_mem_zero(req_msg, len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13617 | req_msg->num_networks = input->num_networks; |
| 13618 | req_msg->request_id = input->request_id; |
| 13619 | req_msg->session_id = input->session_id; |
| 13620 | for (i = 0; i < req_msg->num_networks; i++) { |
| 13621 | req_msg->networks[i].id = |
| 13622 | input->networks[i].id; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13623 | qdf_mem_copy(req_msg->networks[i].realm, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13624 | input->networks[i].realm, |
| 13625 | strlen(input->networks[i].realm) + 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13626 | qdf_mem_copy(req_msg->networks[i].plmn, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13627 | input->networks[i].plmn, |
| 13628 | SIR_PASSPOINT_PLMN_LEN); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13629 | qdf_mem_copy(req_msg->networks[i].roaming_consortium_ids, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13630 | input->networks[i].roaming_consortium_ids, |
| 13631 | sizeof(req_msg->networks[i].roaming_consortium_ids)); |
| 13632 | } |
| 13633 | |
| 13634 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13635 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13636 | sms_log(mac, LOGE, |
| 13637 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 13638 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13639 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13640 | return status; |
| 13641 | } |
| 13642 | |
| 13643 | /* Serialize the req through MC thread */ |
| 13644 | cds_message.bodyptr = req_msg; |
| 13645 | cds_message.type = WMA_SET_PASSPOINT_LIST_REQ; |
| 13646 | status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13647 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13648 | sms_log(mac, LOGE, |
| 13649 | FL("cds_mq_post_message failed!(err=%d)"), |
| 13650 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13651 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13652 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13653 | } |
| 13654 | sme_release_global_lock(&mac->sme); |
| 13655 | return status; |
| 13656 | } |
| 13657 | |
| 13658 | /** |
| 13659 | * sme_reset_passpoint_list() - reset passpoint network list |
| 13660 | * @hHal: global hal handle |
| 13661 | * @input: request message |
| 13662 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 13663 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13664 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13665 | QDF_STATUS sme_reset_passpoint_list(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13666 | struct wifi_passpoint_req *input) |
| 13667 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13668 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13669 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 13670 | cds_msg_t cds_message; |
| 13671 | struct wifi_passpoint_req *req_msg; |
| 13672 | |
| 13673 | sms_log(mac, LOG1, FL("enter")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13674 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13675 | if (!req_msg) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13676 | sms_log(mac, LOGE, FL("qdf_mem_malloc failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13677 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13678 | } |
| 13679 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13680 | qdf_mem_zero(req_msg, sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13681 | req_msg->request_id = input->request_id; |
| 13682 | req_msg->session_id = input->session_id; |
| 13683 | |
| 13684 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13685 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13686 | sms_log(mac, LOGE, |
| 13687 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 13688 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13689 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13690 | return status; |
| 13691 | } |
| 13692 | |
| 13693 | /* Serialize the req through MC thread */ |
| 13694 | cds_message.bodyptr = req_msg; |
| 13695 | cds_message.type = WMA_RESET_PASSPOINT_LIST_REQ; |
| 13696 | status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13697 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13698 | sms_log(mac, LOGE, |
| 13699 | FL("cds_mq_post_message failed!(err=%d)"), |
| 13700 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13701 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13702 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13703 | } |
| 13704 | sme_release_global_lock(&mac->sme); |
| 13705 | return status; |
| 13706 | } |
| 13707 | |
| 13708 | /** |
| 13709 | * sme_set_ssid_hotlist() - Set the SSID hotlist |
| 13710 | * @hal: SME handle |
| 13711 | * @request: set ssid hotlist request |
| 13712 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 13713 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13714 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13715 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13716 | sme_set_ssid_hotlist(tHalHandle hal, |
| 13717 | struct sir_set_ssid_hotlist_request *request) |
| 13718 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13719 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13720 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 13721 | cds_msg_t cds_message; |
| 13722 | struct sir_set_ssid_hotlist_request *set_req; |
| 13723 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13724 | set_req = qdf_mem_malloc(sizeof(*set_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13725 | if (!set_req) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13726 | sms_log(mac, LOGE, FL("qdf_mem_malloc failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13727 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13728 | } |
| 13729 | |
| 13730 | *set_req = *request; |
| 13731 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13732 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13733 | /* Serialize the req through MC thread */ |
| 13734 | cds_message.bodyptr = set_req; |
| 13735 | cds_message.type = WMA_EXTSCAN_SET_SSID_HOTLIST_REQ; |
| 13736 | status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13737 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13738 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13739 | qdf_mem_free(set_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13740 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13741 | } |
| 13742 | } else { |
| 13743 | sms_log(mac, LOGE, |
| 13744 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 13745 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13746 | qdf_mem_free(set_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13747 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13748 | } |
| 13749 | return status; |
| 13750 | } |
| 13751 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13752 | QDF_STATUS sme_ext_scan_register_callback(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13753 | void (*pExtScanIndCb)(void *, |
| 13754 | const uint16_t, |
| 13755 | void *)) |
| 13756 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13757 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13758 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13759 | |
| 13760 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13761 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13762 | pMac->sme.pExtScanIndCb = pExtScanIndCb; |
| 13763 | sme_release_global_lock(&pMac->sme); |
| 13764 | } |
| 13765 | return status; |
| 13766 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13767 | #endif /* FEATURE_WLAN_EXTSCAN */ |
| 13768 | |
| 13769 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 13770 | |
| 13771 | /* --------------------------------------------------------------------------- |
| 13772 | \fn sme_ll_stats_clear_req |
| 13773 | \brief SME API to clear Link Layer Statistics |
| 13774 | \param hHal |
| 13775 | \param pclearStatsReq: Link Layer clear stats request params structure |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13776 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13777 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13778 | QDF_STATUS sme_ll_stats_clear_req(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13779 | tSirLLStatsClearReq *pclearStatsReq) |
| 13780 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13781 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13782 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13783 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13784 | cds_msg_t cds_message; |
| 13785 | tSirLLStatsClearReq *clear_stats_req; |
| 13786 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13787 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13788 | "staId = %u", pclearStatsReq->staId); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13789 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13790 | "statsClearReqMask = 0x%X", |
| 13791 | pclearStatsReq->statsClearReqMask); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13792 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13793 | "stopReq = %u", pclearStatsReq->stopReq); |
| 13794 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13795 | clear_stats_req = qdf_mem_malloc(sizeof(*clear_stats_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13796 | |
| 13797 | if (!clear_stats_req) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13798 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13799 | "%s: Not able to allocate memory for WMA_LL_STATS_CLEAR_REQ", |
| 13800 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13801 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13802 | } |
| 13803 | |
| 13804 | *clear_stats_req = *pclearStatsReq; |
| 13805 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13806 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13807 | /* Serialize the req through MC thread */ |
| 13808 | cds_message.bodyptr = clear_stats_req; |
| 13809 | cds_message.type = WMA_LINK_LAYER_STATS_CLEAR_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 13810 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 13811 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13812 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13813 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13814 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13815 | "%s: not able to post WMA_LL_STATS_CLEAR_REQ", |
| 13816 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13817 | qdf_mem_free(clear_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13818 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13819 | } |
| 13820 | sme_release_global_lock(&pMac->sme); |
| 13821 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13822 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, "%s: " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13823 | "sme_acquire_global_lock error", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13824 | qdf_mem_free(clear_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13825 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13826 | } |
| 13827 | |
| 13828 | return status; |
| 13829 | } |
| 13830 | |
| 13831 | /* --------------------------------------------------------------------------- |
| 13832 | \fn sme_ll_stats_set_req |
| 13833 | \brief SME API to set the Link Layer Statistics |
| 13834 | \param hHal |
| 13835 | \param psetStatsReq: Link Layer set stats request params structure |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13836 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13837 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13838 | QDF_STATUS sme_ll_stats_set_req(tHalHandle hHal, tSirLLStatsSetReq *psetStatsReq) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13839 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13840 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13841 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13842 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13843 | cds_msg_t cds_message; |
| 13844 | tSirLLStatsSetReq *set_stats_req; |
| 13845 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13846 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13847 | "%s: MPDU Size = %u", __func__, |
| 13848 | psetStatsReq->mpduSizeThreshold); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13849 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13850 | " Aggressive Stats Collections = %u", |
| 13851 | psetStatsReq->aggressiveStatisticsGathering); |
| 13852 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13853 | set_stats_req = qdf_mem_malloc(sizeof(*set_stats_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13854 | |
| 13855 | if (!set_stats_req) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13856 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13857 | "%s: Not able to allocate memory for WMA_LL_STATS_SET_REQ", |
| 13858 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13859 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13860 | } |
| 13861 | |
| 13862 | *set_stats_req = *psetStatsReq; |
| 13863 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13864 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13865 | /* Serialize the req through MC thread */ |
| 13866 | cds_message.bodyptr = set_stats_req; |
| 13867 | cds_message.type = WMA_LINK_LAYER_STATS_SET_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 13868 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 13869 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13870 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13871 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13872 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13873 | "%s: not able to post WMA_LL_STATS_SET_REQ", |
| 13874 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13875 | qdf_mem_free(set_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13876 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13877 | } |
| 13878 | sme_release_global_lock(&pMac->sme); |
| 13879 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13880 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, "%s: " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13881 | "sme_acquire_global_lock error", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13882 | qdf_mem_free(set_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13883 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13884 | } |
| 13885 | |
| 13886 | return status; |
| 13887 | } |
| 13888 | |
| 13889 | /* --------------------------------------------------------------------------- |
| 13890 | \fn sme_ll_stats_get_req |
| 13891 | \brief SME API to get the Link Layer Statistics |
| 13892 | \param hHal |
| 13893 | \param pgetStatsReq: Link Layer get stats request params structure |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13894 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13895 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13896 | QDF_STATUS sme_ll_stats_get_req(tHalHandle hHal, tSirLLStatsGetReq *pgetStatsReq) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13897 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13898 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13899 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13900 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13901 | cds_msg_t cds_message; |
| 13902 | tSirLLStatsGetReq *get_stats_req; |
| 13903 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13904 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13905 | "reqId = %u", pgetStatsReq->reqId); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13906 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13907 | "staId = %u", pgetStatsReq->staId); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13908 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13909 | "Stats Type = %u", pgetStatsReq->paramIdMask); |
| 13910 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13911 | get_stats_req = qdf_mem_malloc(sizeof(*get_stats_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13912 | |
| 13913 | if (!get_stats_req) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13914 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13915 | "%s: Not able to allocate memory for WMA_LL_STATS_GET_REQ", |
| 13916 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13917 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13918 | } |
| 13919 | |
| 13920 | *get_stats_req = *pgetStatsReq; |
| 13921 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13922 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13923 | /* Serialize the req through MC thread */ |
| 13924 | cds_message.bodyptr = get_stats_req; |
| 13925 | cds_message.type = WMA_LINK_LAYER_STATS_GET_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 13926 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 13927 | NO_SESSION, cds_message.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13928 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 13929 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13930 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13931 | "%s: not able to post WMA_LL_STATS_GET_REQ", |
| 13932 | __func__); |
| 13933 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13934 | qdf_mem_free(get_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13935 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13936 | |
| 13937 | } |
| 13938 | sme_release_global_lock(&pMac->sme); |
| 13939 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13940 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, "%s: " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13941 | "sme_acquire_global_lock error", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13942 | qdf_mem_free(get_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13943 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13944 | } |
| 13945 | |
| 13946 | return status; |
| 13947 | } |
| 13948 | |
| 13949 | /* --------------------------------------------------------------------------- |
| 13950 | \fn sme_set_link_layer_stats_ind_cb |
| 13951 | \brief SME API to trigger the stats are available after get request |
| 13952 | \param hHal |
| 13953 | \param callback_routine - HDD callback which needs to be invoked after |
| 13954 | getting status notification from FW |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13955 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13956 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13957 | QDF_STATUS sme_set_link_layer_stats_ind_cb |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13958 | (tHalHandle hHal, |
| 13959 | void (*callback_routine)(void *callbackCtx, int indType, void *pRsp) |
| 13960 | ) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13961 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13962 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 13963 | |
| 13964 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13965 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13966 | pMac->sme.pLinkLayerStatsIndCallback = callback_routine; |
| 13967 | sme_release_global_lock(&pMac->sme); |
| 13968 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13969 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, "%s: " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13970 | "sme_acquire_global_lock error", __func__); |
| 13971 | } |
| 13972 | |
| 13973 | return status; |
| 13974 | } |
| 13975 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 13976 | /** |
| 13977 | * sme_reset_link_layer_stats_ind_cb() - SME API to reset link layer stats |
| 13978 | * indication |
| 13979 | * @h_hal: Hal Handle |
| 13980 | * |
| 13981 | * This function reset's the link layer stats indication |
| 13982 | * |
| 13983 | * Return: QDF_STATUS Enumeration |
| 13984 | */ |
| 13985 | |
| 13986 | QDF_STATUS sme_reset_link_layer_stats_ind_cb(tHalHandle h_hal) |
| 13987 | { |
| 13988 | QDF_STATUS status; |
| 13989 | tpAniSirGlobal pmac; |
| 13990 | |
| 13991 | if (!h_hal) { |
| 13992 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13993 | FL("hHal is not valid")); |
| 13994 | return QDF_STATUS_E_INVAL; |
| 13995 | } |
| 13996 | pmac = PMAC_STRUCT(h_hal); |
| 13997 | |
| 13998 | status = sme_acquire_global_lock(&pmac->sme); |
| 13999 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 14000 | pmac->sme.pLinkLayerStatsIndCallback = NULL; |
| 14001 | sme_release_global_lock(&pmac->sme); |
| 14002 | } else { |
| 14003 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, "%s: sme_acquire_global_lock error", |
| 14004 | __func__); |
| 14005 | } |
| 14006 | |
| 14007 | return status; |
| 14008 | } |
| 14009 | |
| 14010 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14011 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 14012 | |
| 14013 | /** |
| 14014 | * sme_fw_mem_dump_register_cb() - Register fw memory dump callback |
| 14015 | * |
| 14016 | * @hal - MAC global handle |
| 14017 | * @callback_routine - callback routine from HDD |
| 14018 | * |
| 14019 | * This API is invoked by HDD to register its callback in SME |
| 14020 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14021 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14022 | */ |
| 14023 | #ifdef WLAN_FEATURE_MEMDUMP |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14024 | QDF_STATUS sme_fw_mem_dump_register_cb(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14025 | void (*callback_routine)(void *cb_context, |
| 14026 | struct fw_dump_rsp *rsp)) |
| 14027 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14028 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14029 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 14030 | |
| 14031 | status = sme_acquire_global_lock(&pmac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14032 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14033 | pmac->sme.fw_dump_callback = callback_routine; |
| 14034 | sme_release_global_lock(&pmac->sme); |
| 14035 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14036 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14037 | FL("sme_acquire_global_lock error")); |
| 14038 | } |
| 14039 | |
| 14040 | return status; |
| 14041 | } |
| 14042 | #else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14043 | QDF_STATUS sme_fw_mem_dump_register_cb(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14044 | void (*callback_routine)(void *cb_context, |
| 14045 | struct fw_dump_rsp *rsp)) |
| 14046 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14047 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14048 | } |
| 14049 | #endif /* WLAN_FEATURE_MEMDUMP */ |
| 14050 | |
| 14051 | /** |
| 14052 | * sme_fw_mem_dump_unregister_cb() - Unregister fw memory dump callback |
| 14053 | * |
| 14054 | * @hHal - MAC global handle |
| 14055 | * |
| 14056 | * This API is invoked by HDD to unregister its callback in SME |
| 14057 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14058 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14059 | */ |
| 14060 | #ifdef WLAN_FEATURE_MEMDUMP |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14061 | QDF_STATUS sme_fw_mem_dump_unregister_cb(tHalHandle hal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14062 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14063 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14064 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 14065 | |
| 14066 | status = sme_acquire_global_lock(&pmac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14067 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14068 | pmac->sme.fw_dump_callback = NULL; |
| 14069 | sme_release_global_lock(&pmac->sme); |
| 14070 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14071 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14072 | FL("sme_acquire_global_lock error")); |
| 14073 | } |
| 14074 | |
| 14075 | return status; |
| 14076 | } |
| 14077 | #else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14078 | QDF_STATUS sme_fw_mem_dump_unregister_cb(tHalHandle hal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14079 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14080 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14081 | } |
| 14082 | #endif /* WLAN_FEATURE_MEMDUMP */ |
| 14083 | |
| 14084 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 14085 | /*-------------------------------------------------------------------------- |
| 14086 | \brief sme_update_roam_offload_enabled() - enable/disable roam offload feaure |
| 14087 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 14088 | \param hHal - The handle returned by mac_open. |
| 14089 | \param nRoamOffloadEnabled - The bool to update with |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14090 | \return QDF_STATUS_SUCCESS - SME update config successfully. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14091 | Other status means SME is failed to update. |
| 14092 | \sa |
| 14093 | --------------------------------------------------------------------------*/ |
| 14094 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14095 | QDF_STATUS sme_update_roam_offload_enabled(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14096 | bool nRoamOffloadEnabled) |
| 14097 | { |
| 14098 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14099 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14100 | |
| 14101 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14102 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14103 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14104 | "%s: LFR3:gRoamOffloadEnabled is changed from %d to %d", |
| 14105 | __func__, pMac->roam.configParam.isRoamOffloadEnabled, |
| 14106 | nRoamOffloadEnabled); |
| 14107 | pMac->roam.configParam.isRoamOffloadEnabled = |
| 14108 | nRoamOffloadEnabled; |
| 14109 | sme_release_global_lock(&pMac->sme); |
| 14110 | } |
| 14111 | |
| 14112 | return status; |
| 14113 | } |
| 14114 | |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 14115 | /** |
| 14116 | * sme_update_roam_key_mgmt_offload_enabled() - enable/disable key mgmt offload |
| 14117 | * This is a synchronous call |
| 14118 | * @hal_ctx: The handle returned by mac_open. |
| 14119 | * @session_id: Session Identifier |
| 14120 | * @key_mgmt_offload_enabled: key mgmt enable/disable flag |
| 14121 | * @okc_enabled: Opportunistic key caching enable/disable flag |
| 14122 | * Return: QDF_STATUS_SUCCESS - SME updated config successfully. |
| 14123 | * Other status means SME is failed to update. |
| 14124 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14125 | |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 14126 | QDF_STATUS sme_update_roam_key_mgmt_offload_enabled(tHalHandle hal_ctx, |
| 14127 | uint8_t session_id, |
| 14128 | bool key_mgmt_offload_enabled, |
| 14129 | bool okc_enabled) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14130 | { |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 14131 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14132 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14133 | |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 14134 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14135 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 14136 | if (CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14137 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 14138 | "%s: LFR3: key_mgmt_offload_enabled changed to %d", |
| 14139 | __func__, key_mgmt_offload_enabled); |
| 14140 | status = csr_roam_set_key_mgmt_offload(mac_ctx, |
| 14141 | session_id, |
| 14142 | key_mgmt_offload_enabled, |
| 14143 | okc_enabled); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14144 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14145 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14146 | } |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 14147 | sme_release_global_lock(&mac_ctx->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14148 | } |
| 14149 | |
| 14150 | return status; |
| 14151 | } |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 14152 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14153 | |
| 14154 | /* --------------------------------------------------------------------------- |
| 14155 | \fn sme_get_temperature |
| 14156 | \brief SME API to get the pdev temperature |
| 14157 | \param hHal |
| 14158 | \param temperature context |
| 14159 | \param pCallbackfn: callback fn with response (temperature) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14160 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14161 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14162 | QDF_STATUS sme_get_temperature(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14163 | void *tempContext, |
| 14164 | void (*pCallbackfn)(int temperature, |
| 14165 | void *pContext)) |
| 14166 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14167 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 14168 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14169 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 14170 | cds_msg_t cds_message; |
| 14171 | |
| 14172 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14173 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14174 | if ((NULL == pCallbackfn) && |
| 14175 | (NULL == pMac->sme.pGetTemperatureCb)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14176 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14177 | FL |
| 14178 | ("Indication Call back did not registered")); |
| 14179 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14180 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14181 | } else if (NULL != pCallbackfn) { |
| 14182 | pMac->sme.pTemperatureCbContext = tempContext; |
| 14183 | pMac->sme.pGetTemperatureCb = pCallbackfn; |
| 14184 | } |
| 14185 | /* serialize the req through MC thread */ |
| 14186 | cds_message.bodyptr = NULL; |
| 14187 | cds_message.type = WMA_GET_TEMPERATURE_REQ; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14188 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 14189 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14190 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14191 | FL("Post Get Temperature msg fail")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14192 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14193 | } |
| 14194 | sme_release_global_lock(&pMac->sme); |
| 14195 | } |
| 14196 | return status; |
| 14197 | } |
| 14198 | |
| 14199 | /* --------------------------------------------------------------------------- |
| 14200 | \fn sme_set_scanning_mac_oui |
| 14201 | \brief SME API to set scanning mac oui |
| 14202 | \param hHal |
| 14203 | \param pScanMacOui: Scanning Mac Oui (input 3 bytes) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14204 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14205 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14206 | QDF_STATUS sme_set_scanning_mac_oui(tHalHandle hHal, tSirScanMacOui *pScanMacOui) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14207 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14208 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 14209 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14210 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 14211 | cds_msg_t cds_message; |
| 14212 | |
| 14213 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14214 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14215 | /* Serialize the req through MC thread */ |
| 14216 | cds_message.bodyptr = pScanMacOui; |
| 14217 | cds_message.type = WMA_SET_SCAN_MAC_OUI_REQ; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14218 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 14219 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14220 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14221 | FL("Msg post Set Scan Mac OUI failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14222 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14223 | } |
| 14224 | sme_release_global_lock(&pMac->sme); |
| 14225 | } |
| 14226 | return status; |
| 14227 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14228 | |
| 14229 | #ifdef DHCP_SERVER_OFFLOAD |
| 14230 | /* --------------------------------------------------------------------------- |
| 14231 | \fn sme_set_dhcp_srv_offload |
| 14232 | \brief SME API to set DHCP server offload info |
| 14233 | \param hHal |
| 14234 | \param pDhcpSrvInfo : DHCP server offload info struct |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14235 | \- return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14236 | -------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14237 | QDF_STATUS sme_set_dhcp_srv_offload(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14238 | tSirDhcpSrvOffloadInfo *pDhcpSrvInfo) |
| 14239 | { |
| 14240 | cds_msg_t cds_message; |
| 14241 | tSirDhcpSrvOffloadInfo *pSmeDhcpSrvInfo; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14242 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14243 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 14244 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14245 | pSmeDhcpSrvInfo = qdf_mem_malloc(sizeof(*pSmeDhcpSrvInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14246 | |
| 14247 | if (!pSmeDhcpSrvInfo) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14248 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14249 | "%s: Not able to allocate memory for WMA_SET_DHCP_SERVER_OFFLOAD_CMD", |
| 14250 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14251 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14252 | } |
| 14253 | |
| 14254 | *pSmeDhcpSrvInfo = *pDhcpSrvInfo; |
| 14255 | |
| 14256 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14257 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14258 | /* serialize the req through MC thread */ |
| 14259 | cds_message.type = WMA_SET_DHCP_SERVER_OFFLOAD_CMD; |
| 14260 | cds_message.bodyptr = pSmeDhcpSrvInfo; |
| 14261 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14262 | if (!QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 14263 | (cds_mq_post_message(QDF_MODULE_ID_WMA, &cds_message))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14264 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14265 | "%s: Not able to post WMA_SET_DHCP_SERVER_OFFLOAD_CMD to WMA!", |
| 14266 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14267 | qdf_mem_free(pSmeDhcpSrvInfo); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14268 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14269 | } |
| 14270 | sme_release_global_lock(&pMac->sme); |
| 14271 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14272 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14273 | "%s: sme_acquire_global_lock error!", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14274 | qdf_mem_free(pSmeDhcpSrvInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14275 | } |
| 14276 | |
| 14277 | return status; |
| 14278 | } |
| 14279 | #endif /* DHCP_SERVER_OFFLOAD */ |
| 14280 | |
| 14281 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
| 14282 | /* --------------------------------------------------------------------------- |
| 14283 | \fn sme_set_led_flashing |
| 14284 | \brief API to set the Led flashing parameters. |
| 14285 | \param hHal - The handle returned by mac_open. |
| 14286 | \param x0, x1 - led flashing parameters |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14287 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14288 | ---------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14289 | QDF_STATUS sme_set_led_flashing(tHalHandle hHal, uint8_t type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14290 | uint32_t x0, uint32_t x1) |
| 14291 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14292 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 14293 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14294 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 14295 | cds_msg_t cds_message; |
| 14296 | tSirLedFlashingReq *ledflashing; |
| 14297 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14298 | ledflashing = qdf_mem_malloc(sizeof(*ledflashing)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14299 | if (!ledflashing) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14300 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14301 | FL |
| 14302 | ("Not able to allocate memory for WMA_LED_TIMING_REQ")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14303 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14304 | } |
| 14305 | |
| 14306 | ledflashing->pattern_id = type; |
| 14307 | ledflashing->led_x0 = x0; |
| 14308 | ledflashing->led_x1 = x1; |
| 14309 | |
| 14310 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14311 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14312 | /* Serialize the req through MC thread */ |
| 14313 | cds_message.bodyptr = ledflashing; |
| 14314 | cds_message.type = WMA_LED_FLASHING_REQ; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14315 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 14316 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 14317 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14318 | sme_release_global_lock(&pMac->sme); |
| 14319 | } |
| 14320 | return status; |
| 14321 | } |
| 14322 | #endif |
| 14323 | |
| 14324 | /** |
| 14325 | * sme_handle_dfS_chan_scan() - handle DFS channel configuration |
| 14326 | * @h_hal: corestack handler |
| 14327 | * @dfs_flag: flag indicating dfs channel enable/disable |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14328 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14329 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14330 | QDF_STATUS sme_handle_dfs_chan_scan(tHalHandle h_hal, uint8_t dfs_flag) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14331 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14332 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14333 | tpAniSirGlobal mac = PMAC_STRUCT(h_hal); |
| 14334 | |
| 14335 | status = sme_acquire_global_lock(&mac->sme); |
| 14336 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14337 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14338 | |
| 14339 | mac->scan.fEnableDFSChnlScan = dfs_flag; |
| 14340 | |
| 14341 | /* update the channel list to the firmware */ |
| 14342 | status = csr_update_channel_list(mac); |
| 14343 | |
| 14344 | sme_release_global_lock(&mac->sme); |
| 14345 | } |
| 14346 | |
| 14347 | return status; |
| 14348 | } |
| 14349 | |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 14350 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 14351 | /** |
| 14352 | * sme_validate_sap_channel_switch() - validate target channel switch w.r.t |
| 14353 | * concurreny rules set to avoid channel interference. |
| 14354 | * @hal - Hal context |
| 14355 | * @sap_ch - channel to switch |
| 14356 | * @sap_phy_mode - phy mode of SAP |
| 14357 | * @cc_switch_mode - concurreny switch mode |
| 14358 | * @session_id - sme session id. |
| 14359 | * |
| 14360 | * Return: true if there is no channel interference else return false |
| 14361 | */ |
| 14362 | bool sme_validate_sap_channel_switch(tHalHandle hal, |
| 14363 | uint16_t sap_ch, eCsrPhyMode sap_phy_mode, uint8_t cc_switch_mode, |
| 14364 | uint8_t session_id) |
| 14365 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14366 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 14367 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 14368 | tCsrRoamSession *session = CSR_GET_SESSION(mac, session_id); |
| 14369 | uint16_t intf_channel = 0; |
| 14370 | |
| 14371 | if (!session) |
| 14372 | return false; |
| 14373 | |
| 14374 | session->ch_switch_in_progress = true; |
| 14375 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14376 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 14377 | intf_channel = csr_check_concurrent_channel_overlap(mac, sap_ch, |
| 14378 | sap_phy_mode, |
| 14379 | cc_switch_mode); |
| 14380 | sme_release_global_lock(&mac->sme); |
| 14381 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14382 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 14383 | FL("sme_acquire_global_lock error!")); |
| 14384 | session->ch_switch_in_progress = false; |
| 14385 | return false; |
| 14386 | } |
| 14387 | |
| 14388 | session->ch_switch_in_progress = false; |
| 14389 | return (intf_channel == 0) ? true : false; |
| 14390 | } |
| 14391 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14392 | |
| 14393 | /** |
| 14394 | * sme_configure_stats_avg_factor() - function to config avg. stats factor |
| 14395 | * @hal: hal |
| 14396 | * @session_id: session ID |
| 14397 | * @stats_avg_factor: average stats factor |
| 14398 | * |
| 14399 | * This function configures the stats avg factor in firmware |
| 14400 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14401 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14402 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14403 | QDF_STATUS sme_configure_stats_avg_factor(tHalHandle hal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14404 | uint16_t stats_avg_factor) |
| 14405 | { |
| 14406 | cds_msg_t msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14407 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14408 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 14409 | struct sir_stats_avg_factor *stats_factor; |
| 14410 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14411 | stats_factor = qdf_mem_malloc(sizeof(*stats_factor)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14412 | |
| 14413 | if (!stats_factor) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14414 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14415 | "%s: Not able to allocate memory for SIR_HAL_CONFIG_STATS_FACTOR", |
| 14416 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14417 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14418 | } |
| 14419 | |
| 14420 | status = sme_acquire_global_lock(&mac->sme); |
| 14421 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14422 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14423 | |
| 14424 | stats_factor->vdev_id = session_id; |
| 14425 | stats_factor->stats_avg_factor = stats_avg_factor; |
| 14426 | |
| 14427 | /* serialize the req through MC thread */ |
| 14428 | msg.type = SIR_HAL_CONFIG_STATS_FACTOR; |
| 14429 | msg.bodyptr = stats_factor; |
| 14430 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14431 | if (!QDF_IS_STATUS_SUCCESS( |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 14432 | cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14433 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14434 | "%s: Not able to post SIR_HAL_CONFIG_STATS_FACTOR to WMA!", |
| 14435 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14436 | qdf_mem_free(stats_factor); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14437 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14438 | } |
| 14439 | sme_release_global_lock(&mac->sme); |
| 14440 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14441 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14442 | "%s: sme_acquire_global_lock error!", |
| 14443 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14444 | qdf_mem_free(stats_factor); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14445 | } |
| 14446 | |
| 14447 | return status; |
| 14448 | } |
| 14449 | |
| 14450 | /** |
| 14451 | * sme_configure_guard_time() - function to configure guard time |
| 14452 | * @hal: hal |
| 14453 | * @session_id: session id |
| 14454 | * @guard_time: guard time |
| 14455 | * |
| 14456 | * This function configures the guard time in firmware |
| 14457 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14458 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14459 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14460 | QDF_STATUS sme_configure_guard_time(tHalHandle hal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14461 | uint32_t guard_time) |
| 14462 | { |
| 14463 | cds_msg_t msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14464 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14465 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 14466 | struct sir_guard_time_request *g_time; |
| 14467 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14468 | g_time = qdf_mem_malloc(sizeof(*g_time)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14469 | |
| 14470 | if (!g_time) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14471 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14472 | "%s: Not able to allocate memory for SIR_HAL_CONFIG_GUARD_TIME", |
| 14473 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14474 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14475 | } |
| 14476 | |
| 14477 | status = sme_acquire_global_lock(&mac->sme); |
| 14478 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14479 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14480 | |
| 14481 | g_time->vdev_id = session_id; |
| 14482 | g_time->guard_time = guard_time; |
| 14483 | |
| 14484 | /* serialize the req through MC thread */ |
| 14485 | msg.type = SIR_HAL_CONFIG_GUARD_TIME; |
| 14486 | msg.bodyptr = g_time; |
| 14487 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14488 | if (!QDF_IS_STATUS_SUCCESS( |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 14489 | cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14490 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14491 | "%s: Not able to post SIR_HAL_CONFIG_GUARD_TIME to WMA!", |
| 14492 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14493 | qdf_mem_free(g_time); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14494 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14495 | } |
| 14496 | sme_release_global_lock(&mac->sme); |
| 14497 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14498 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14499 | "%s: sme_acquire_global_lock error!", |
| 14500 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14501 | qdf_mem_free(g_time); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14502 | } |
| 14503 | |
| 14504 | return status; |
| 14505 | } |
| 14506 | |
| 14507 | /** |
| 14508 | * sme_configure_modulated_dtim() - function to configure modulated dtim |
| 14509 | * @h_hal: SME API to enable/disable modulated DTIM instantaneously |
| 14510 | * @session_id: session ID |
| 14511 | * @modulated_dtim: modulated dtim value |
| 14512 | * |
| 14513 | * This function configures the modulated dtim in firmware |
| 14514 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14515 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14516 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14517 | QDF_STATUS sme_configure_modulated_dtim(tHalHandle h_hal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14518 | uint32_t modulated_dtim) |
| 14519 | { |
| 14520 | cds_msg_t msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14521 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14522 | tpAniSirGlobal mac = PMAC_STRUCT(h_hal); |
| 14523 | wma_cli_set_cmd_t *iwcmd; |
| 14524 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14525 | iwcmd = qdf_mem_malloc(sizeof(*iwcmd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14526 | if (NULL == iwcmd) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14527 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 14528 | QDF_TRACE_LEVEL_FATAL, |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 14529 | "%s: qdf_mem_malloc failed", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14530 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14531 | } |
| 14532 | |
| 14533 | status = sme_acquire_global_lock(&mac->sme); |
| 14534 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14535 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14536 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14537 | qdf_mem_zero((void *)iwcmd, sizeof(*iwcmd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14538 | iwcmd->param_value = modulated_dtim; |
| 14539 | iwcmd->param_vdev_id = session_id; |
| 14540 | iwcmd->param_id = GEN_PARAM_MODULATED_DTIM; |
| 14541 | iwcmd->param_vp_dev = GEN_CMD; |
| 14542 | msg.type = WMA_CLI_SET_CMD; |
| 14543 | msg.reserved = 0; |
| 14544 | msg.bodyptr = (void *)iwcmd; |
| 14545 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14546 | if (!QDF_IS_STATUS_SUCCESS( |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 14547 | cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14548 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14549 | "%s: Not able to post GEN_PARAM_DYNAMIC_DTIM to WMA!", |
| 14550 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14551 | qdf_mem_free(iwcmd); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14552 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14553 | } |
| 14554 | sme_release_global_lock(&mac->sme); |
| 14555 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14556 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14557 | "%s: sme_acquire_global_lock error!", |
| 14558 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14559 | qdf_mem_free(iwcmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14560 | } |
| 14561 | |
| 14562 | return status; |
| 14563 | } |
| 14564 | |
| 14565 | /* |
| 14566 | * sme_wifi_start_logger() - Send the start/stop logging command to WMA |
| 14567 | * to either start/stop logging |
| 14568 | * @hal: HAL context |
| 14569 | * @start_log: Structure containing the wifi start logger params |
| 14570 | * |
| 14571 | * This function sends the start/stop logging command to WMA |
| 14572 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14573 | * Return: QDF_STATUS_SUCCESS on successful posting |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14574 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14575 | QDF_STATUS sme_wifi_start_logger(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14576 | struct sir_wifi_start_log start_log) |
| 14577 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14578 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14579 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 14580 | cds_msg_t cds_message; |
| 14581 | struct sir_wifi_start_log *req_msg; |
| 14582 | uint32_t len; |
| 14583 | |
| 14584 | len = sizeof(*req_msg); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14585 | req_msg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14586 | if (!req_msg) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14587 | sms_log(mac, LOGE, FL("qdf_mem_malloc failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14588 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14589 | } |
| 14590 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14591 | qdf_mem_zero(req_msg, len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14592 | |
| 14593 | req_msg->verbose_level = start_log.verbose_level; |
| 14594 | req_msg->flag = start_log.flag; |
| 14595 | req_msg->ring_id = start_log.ring_id; |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 14596 | req_msg->ini_triggered = start_log.ini_triggered; |
| 14597 | req_msg->user_triggered = start_log.user_triggered; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14598 | |
| 14599 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14600 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14601 | sms_log(mac, LOGE, |
| 14602 | FL("sme_acquire_global_lock failed(status=%d)"), |
| 14603 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14604 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14605 | return status; |
| 14606 | } |
| 14607 | |
| 14608 | /* Serialize the req through MC thread */ |
| 14609 | cds_message.bodyptr = req_msg; |
| 14610 | cds_message.type = SIR_HAL_START_STOP_LOGGING; |
| 14611 | status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14612 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14613 | sms_log(mac, LOGE, |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14614 | FL("cds_mq_post_message failed!(err=%d)"), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14615 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14616 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14617 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14618 | } |
| 14619 | sme_release_global_lock(&mac->sme); |
| 14620 | |
| 14621 | return status; |
| 14622 | } |
| 14623 | |
| 14624 | /** |
| 14625 | * sme_neighbor_middle_of_roaming() - Function to know if |
| 14626 | * STA is in the middle of roaming states |
| 14627 | * @hal: Handle returned by macOpen |
| 14628 | * @sessionId: sessionId of the STA session |
| 14629 | * |
| 14630 | * This function is a wrapper to call |
| 14631 | * csr_neighbor_middle_of_roaming to know STA is in the |
| 14632 | * middle of roaming states |
| 14633 | * |
| 14634 | * Return: True or False |
| 14635 | * |
| 14636 | */ |
| 14637 | bool sme_neighbor_middle_of_roaming(tHalHandle hHal, uint8_t sessionId) |
| 14638 | { |
| 14639 | return csr_neighbor_middle_of_roaming(PMAC_STRUCT(hHal), sessionId); |
| 14640 | } |
| 14641 | |
| 14642 | /* |
| 14643 | * sme_send_flush_logs_cmd_to_fw() - Flush FW logs |
| 14644 | * @mac: MAC handle |
| 14645 | * |
| 14646 | * This function is used to send the command that will |
| 14647 | * be used to flush the logs in the firmware |
| 14648 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 14649 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14650 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14651 | QDF_STATUS sme_send_flush_logs_cmd_to_fw(tpAniSirGlobal mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14652 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14653 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14654 | cds_msg_t message; |
| 14655 | |
| 14656 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14657 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14658 | sms_log(mac, LOGE, |
| 14659 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 14660 | status); |
| 14661 | return status; |
| 14662 | } |
| 14663 | |
| 14664 | /* Serialize the req through MC thread */ |
| 14665 | message.bodyptr = NULL; |
| 14666 | message.type = SIR_HAL_FLUSH_LOG_TO_FW; |
| 14667 | status = cds_mq_post_message(CDS_MQ_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14668 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14669 | sms_log(mac, LOGE, |
| 14670 | FL("cds_mq_post_message failed!(err=%d)"), |
| 14671 | status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14672 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14673 | } |
| 14674 | sme_release_global_lock(&mac->sme); |
| 14675 | return status; |
| 14676 | } |
| 14677 | |
| 14678 | /** |
| 14679 | * sme_enable_uapsd_for_ac() - enable uapsd for access catagory requerst to WMA |
| 14680 | * @cds_ctx: cds context |
| 14681 | * @sta_id: station id |
| 14682 | * @ac: access catagory |
| 14683 | * @tid: tid value |
| 14684 | * @pri: user priority |
| 14685 | * @srvc_int: service interval |
| 14686 | * @sus_int: suspend interval |
| 14687 | * @dir: tspec direction |
| 14688 | * @psb: PSB value |
| 14689 | * @sessionId: session id |
| 14690 | * @delay_interval: delay interval |
| 14691 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 14692 | * Return: QDF status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14693 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14694 | QDF_STATUS sme_enable_uapsd_for_ac(void *cds_ctx, uint8_t sta_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14695 | sme_ac_enum_type ac, uint8_t tid, |
| 14696 | uint8_t pri, uint32_t srvc_int, |
| 14697 | uint32_t sus_int, |
| 14698 | sme_tspec_dir_type dir, |
| 14699 | uint8_t psb, uint32_t sessionId, |
| 14700 | uint32_t delay_interval) |
| 14701 | { |
| 14702 | void *wma_handle; |
| 14703 | t_wma_trigger_uapsd_params uapsd_params; |
| 14704 | enum uapsd_ac access_category; |
| 14705 | |
| 14706 | if (!psb) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14707 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14708 | "No need to configure auto trigger:psb is 0"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14709 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14710 | } |
| 14711 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 14712 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14713 | if (!wma_handle) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14714 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14715 | "wma_handle is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14716 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14717 | } |
| 14718 | |
| 14719 | switch (ac) { |
| 14720 | case SME_AC_BK: |
| 14721 | access_category = UAPSD_BK; |
| 14722 | break; |
| 14723 | case SME_AC_BE: |
| 14724 | access_category = UAPSD_BE; |
| 14725 | break; |
| 14726 | case SME_AC_VI: |
| 14727 | access_category = UAPSD_VI; |
| 14728 | break; |
| 14729 | case SME_AC_VO: |
| 14730 | access_category = UAPSD_VO; |
| 14731 | break; |
| 14732 | default: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14733 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14734 | } |
| 14735 | |
| 14736 | uapsd_params.wmm_ac = access_category; |
| 14737 | uapsd_params.user_priority = pri; |
| 14738 | uapsd_params.service_interval = srvc_int; |
| 14739 | uapsd_params.delay_interval = delay_interval; |
| 14740 | uapsd_params.suspend_interval = sus_int; |
| 14741 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14742 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14743 | wma_trigger_uapsd_params(wma_handle, sessionId, &uapsd_params)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14744 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14745 | "Failed to Trigger Uapsd params for sessionId %d", |
| 14746 | sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14747 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14748 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14749 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14750 | } |
| 14751 | |
| 14752 | /** |
| 14753 | * sme_disable_uapsd_for_ac() - disable uapsed access catagory request to WMA |
| 14754 | * @cds_ctx: cds context |
| 14755 | * @sta_id: station id |
| 14756 | * @ac: access catagory |
| 14757 | * @sessionId: session id |
| 14758 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 14759 | * Return: QDF status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14760 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14761 | QDF_STATUS sme_disable_uapsd_for_ac(void *cds_ctx, uint8_t sta_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14762 | sme_ac_enum_type ac, |
| 14763 | uint32_t sessionId) |
| 14764 | { |
| 14765 | void *wma_handle; |
| 14766 | enum uapsd_ac access_category; |
| 14767 | |
| 14768 | switch (ac) { |
| 14769 | case SME_AC_BK: |
| 14770 | access_category = UAPSD_BK; |
| 14771 | break; |
| 14772 | case SME_AC_BE: |
| 14773 | access_category = UAPSD_BE; |
| 14774 | break; |
| 14775 | case SME_AC_VI: |
| 14776 | access_category = UAPSD_VI; |
| 14777 | break; |
| 14778 | case SME_AC_VO: |
| 14779 | access_category = UAPSD_VO; |
| 14780 | break; |
| 14781 | default: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14782 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14783 | } |
| 14784 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 14785 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14786 | if (!wma_handle) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14787 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14788 | "wma handle is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14789 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14790 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14791 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14792 | wma_disable_uapsd_per_ac(wma_handle, sessionId, access_category)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14793 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14794 | "Failed to disable uapsd for ac %d for sessionId %d", |
| 14795 | ac, sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14796 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14797 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14798 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14799 | } |
| 14800 | |
| 14801 | /** |
| 14802 | * sme_update_nss() - SME API to change the number for spatial streams |
| 14803 | * (1 or 2) |
| 14804 | * @hal: Handle returned by mac open |
| 14805 | * @nss: Number of spatial streams |
| 14806 | * |
| 14807 | * This function is used to update the number of spatial streams supported. |
| 14808 | * |
| 14809 | * Return: Success upon successfully changing nss else failure |
| 14810 | * |
| 14811 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14812 | QDF_STATUS sme_update_nss(tHalHandle h_hal, uint8_t nss) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14813 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14814 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14815 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(h_hal); |
| 14816 | uint32_t i, value = 0; |
| 14817 | union { |
| 14818 | uint16_t cfg_value16; |
| 14819 | tSirMacHTCapabilityInfo ht_cap_info; |
| 14820 | } uHTCapabilityInfo; |
| 14821 | tCsrRoamSession *csr_session; |
| 14822 | |
| 14823 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 14824 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14825 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14826 | mac_ctx->roam.configParam.enable2x2 = (nss == 1) ? 0 : 1; |
| 14827 | |
| 14828 | /* get the HT capability info*/ |
| 14829 | sme_cfg_get_int(mac_ctx, WNI_CFG_HT_CAP_INFO, &value); |
| 14830 | uHTCapabilityInfo.cfg_value16 = (0xFFFF & value); |
| 14831 | |
| 14832 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 14833 | if (CSR_IS_SESSION_VALID(mac_ctx, i)) { |
| 14834 | csr_session = &mac_ctx->roam.roamSession[i]; |
| 14835 | csr_session->htConfig.ht_tx_stbc = |
| 14836 | uHTCapabilityInfo.ht_cap_info.txSTBC; |
| 14837 | } |
| 14838 | } |
| 14839 | |
| 14840 | sme_release_global_lock(&mac_ctx->sme); |
| 14841 | } |
| 14842 | return status; |
| 14843 | } |
| 14844 | |
| 14845 | /** |
Archana Ramachandran | 5041b25 | 2016-04-25 14:29:25 -0700 | [diff] [blame] | 14846 | * sme_update_user_configured_nss() - sets the nss based on user request |
| 14847 | * @hal: Pointer to HAL |
| 14848 | * @nss: number of streams |
| 14849 | * |
| 14850 | * Return: None |
| 14851 | */ |
| 14852 | void sme_update_user_configured_nss(tHalHandle hal, uint8_t nss) |
| 14853 | { |
| 14854 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14855 | |
| 14856 | mac_ctx->user_configured_nss = nss; |
| 14857 | } |
| 14858 | |
| 14859 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14860 | * sme_set_rssi_threshold_breached_cb() - set rssi threshold breached callback |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 14861 | * @h_hal: global hal handle |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14862 | * @cb: callback function pointer |
| 14863 | * |
| 14864 | * This function stores the rssi threshold breached callback function. |
| 14865 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14866 | * Return: QDF_STATUS enumeration. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14867 | */ |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 14868 | QDF_STATUS sme_set_rssi_threshold_breached_cb(tHalHandle h_hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14869 | void (*cb)(void *, struct rssi_breach_event *)) |
| 14870 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14871 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 14872 | tpAniSirGlobal mac; |
| 14873 | |
| 14874 | if (!h_hal) { |
| 14875 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14876 | FL("hHal is not valid")); |
| 14877 | return QDF_STATUS_E_INVAL; |
| 14878 | } |
| 14879 | mac = PMAC_STRUCT(h_hal); |
| 14880 | |
| 14881 | status = sme_acquire_global_lock(&mac->sme); |
| 14882 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 14883 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14884 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 14885 | status); |
| 14886 | return status; |
| 14887 | } |
| 14888 | |
| 14889 | mac->sme.rssi_threshold_breached_cb = cb; |
| 14890 | sme_release_global_lock(&mac->sme); |
| 14891 | return status; |
| 14892 | } |
| 14893 | |
| 14894 | /** |
| 14895 | * sme_set_rssi_threshold_breached_cb() - Reset rssi threshold breached callback |
| 14896 | * @hal: global hal handle |
| 14897 | * |
| 14898 | * This function de-registers the rssi threshold breached callback function. |
| 14899 | * |
| 14900 | * Return: QDF_STATUS enumeration. |
| 14901 | */ |
| 14902 | QDF_STATUS sme_reset_rssi_threshold_breached_cb(tHalHandle hal) |
| 14903 | { |
| 14904 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14905 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 14906 | |
| 14907 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14908 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14909 | sms_log(mac, LOGE, |
| 14910 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 14911 | status); |
| 14912 | return status; |
| 14913 | } |
| 14914 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 14915 | mac->sme.rssi_threshold_breached_cb = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14916 | sme_release_global_lock(&mac->sme); |
| 14917 | return status; |
| 14918 | } |
| 14919 | |
| 14920 | /** |
| 14921 | * sme_is_any_session_in_connected_state() - SME wrapper API to |
| 14922 | * check if any session is in connected state or not. |
| 14923 | * |
| 14924 | * @hal: Handle returned by mac open |
| 14925 | * |
| 14926 | * This function is used to check if any valid sme session is in |
| 14927 | * connected state or not. |
| 14928 | * |
| 14929 | * Return: true if any session is connected, else false. |
| 14930 | * |
| 14931 | */ |
| 14932 | bool sme_is_any_session_in_connected_state(tHalHandle h_hal) |
| 14933 | { |
| 14934 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(h_hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14935 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14936 | bool ret = false; |
| 14937 | |
| 14938 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14939 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14940 | ret = csr_is_any_session_in_connect_state(mac_ctx); |
| 14941 | sme_release_global_lock(&mac_ctx->sme); |
| 14942 | } |
| 14943 | return ret; |
| 14944 | } |
| 14945 | |
| 14946 | /** |
| 14947 | * sme_set_rssi_monitoring() - set rssi monitoring |
| 14948 | * @hal: global hal handle |
| 14949 | * @input: request message |
| 14950 | * |
| 14951 | * This function constructs the vos message and fill in message type, |
| 14952 | * bodyptr with @input and posts it to WDA queue. |
| 14953 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14954 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14955 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14956 | QDF_STATUS sme_set_rssi_monitoring(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14957 | struct rssi_monitor_req *input) |
| 14958 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14959 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14960 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 14961 | cds_msg_t cds_message; |
| 14962 | struct rssi_monitor_req *req_msg; |
| 14963 | |
| 14964 | sms_log(mac, LOG1, FL("enter")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14965 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14966 | if (!req_msg) { |
| 14967 | sms_log(mac, LOGE, FL("memory allocation failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14968 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14969 | } |
| 14970 | |
| 14971 | *req_msg = *input; |
| 14972 | |
| 14973 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14974 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14975 | sms_log(mac, LOGE, |
| 14976 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 14977 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14978 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14979 | return status; |
| 14980 | } |
| 14981 | |
| 14982 | /* Serialize the req through MC thread */ |
| 14983 | cds_message.bodyptr = req_msg; |
| 14984 | cds_message.type = WMA_SET_RSSI_MONITOR_REQ; |
| 14985 | status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14986 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14987 | sms_log(mac, LOGE, |
| 14988 | FL("cds_mq_post_message failed!(err=%d)"), |
| 14989 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14990 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14991 | } |
| 14992 | sme_release_global_lock(&mac->sme); |
| 14993 | |
| 14994 | return status; |
| 14995 | } |
| 14996 | |
| 14997 | /** |
| 14998 | * sme_fw_mem_dump() - Get FW memory dump |
| 14999 | * @hHal: hal handle |
| 15000 | * @recvd_req: received memory dump request. |
| 15001 | * |
| 15002 | * This API is invoked by HDD to indicate FW to start |
| 15003 | * dumping firmware memory. |
| 15004 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15005 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15006 | */ |
| 15007 | #ifdef WLAN_FEATURE_MEMDUMP |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15008 | QDF_STATUS sme_fw_mem_dump(tHalHandle hHal, void *recvd_req) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15009 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15010 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15011 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15012 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 15013 | cds_msg_t msg; |
| 15014 | struct fw_dump_req *send_req; |
| 15015 | struct fw_dump_seg_req seg_req; |
| 15016 | int loop; |
| 15017 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15018 | send_req = qdf_mem_malloc(sizeof(*send_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15019 | if (!send_req) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15020 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15021 | FL("Memory allocation failed for WDA_FW_MEM_DUMP")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15022 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15023 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15024 | qdf_mem_copy(send_req, recvd_req, sizeof(*send_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15025 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15026 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15027 | FL("request_id:%d num_seg:%d"), |
| 15028 | send_req->request_id, send_req->num_seg); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15029 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15030 | FL("Segment Information")); |
| 15031 | for (loop = 0; loop < send_req->num_seg; loop++) { |
| 15032 | seg_req = send_req->segment[loop]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15033 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15034 | FL("seg_number:%d"), loop); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15035 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15036 | FL("seg_id:%d start_addr_lo:0x%x start_addr_hi:0x%x"), |
| 15037 | seg_req.seg_id, seg_req.seg_start_addr_lo, |
| 15038 | seg_req.seg_start_addr_hi); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15039 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15040 | FL("seg_length:%d dst_addr_lo:0x%x dst_addr_hi:0x%x"), |
| 15041 | seg_req.seg_length, seg_req.dst_addr_lo, |
| 15042 | seg_req.dst_addr_hi); |
| 15043 | } |
| 15044 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15045 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15046 | msg.bodyptr = send_req; |
| 15047 | msg.type = WMA_FW_MEM_DUMP_REQ; |
| 15048 | msg.reserved = 0; |
| 15049 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 15050 | qdf_status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15051 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15052 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15053 | FL("Not able to post WMA_FW_MEM_DUMP")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15054 | qdf_mem_free(send_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15055 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15056 | } |
| 15057 | sme_release_global_lock(&pMac->sme); |
| 15058 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15059 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15060 | FL("Failed to acquire SME Global Lock")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15061 | qdf_mem_free(send_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15062 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15063 | } |
| 15064 | |
| 15065 | return status; |
| 15066 | } |
| 15067 | #else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15068 | QDF_STATUS sme_fw_mem_dump(tHalHandle hHal, void *recvd_req) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15069 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15070 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15071 | } |
| 15072 | #endif /* WLAN_FEATURE_MEMDUMP */ |
| 15073 | |
| 15074 | /* |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 15075 | * sme_pdev_set_pcl() - Send WMI_PDEV_SET_PCL_CMDID to the WMA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15076 | * @hal: Handle returned by macOpen |
| 15077 | * @msg: PCL channel list and length structure |
| 15078 | * |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 15079 | * Sends the command to WMA to send WMI_PDEV_SET_PCL_CMDID to FW |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15080 | * Return: QDF_STATUS_SUCCESS on successful posting |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15081 | */ |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 15082 | QDF_STATUS sme_pdev_set_pcl(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15083 | struct sir_pcl_list msg) |
| 15084 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15085 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15086 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 15087 | cds_msg_t cds_message; |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 15088 | struct wmi_pcl_chan_weights *req_msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15089 | uint32_t len, i; |
| 15090 | |
| 15091 | len = sizeof(*req_msg); |
| 15092 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15093 | req_msg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15094 | if (!req_msg) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15095 | sms_log(mac, LOGE, FL("qdf_mem_malloc failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15096 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15097 | } |
| 15098 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15099 | qdf_mem_zero(req_msg, len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15100 | |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 15101 | for (i = 0; i < msg.pcl_len; i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15102 | req_msg->pcl_list[i] = msg.pcl_list[i]; |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 15103 | req_msg->weight_list[i] = msg.weight_list[i]; |
| 15104 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15105 | |
| 15106 | req_msg->pcl_len = msg.pcl_len; |
| 15107 | |
| 15108 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15109 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15110 | sms_log(mac, LOGE, |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 15111 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 15112 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15113 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15114 | return status; |
| 15115 | } |
| 15116 | |
| 15117 | /* Serialize the req through MC thread */ |
| 15118 | cds_message.bodyptr = req_msg; |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 15119 | cds_message.type = SIR_HAL_PDEV_SET_PCL_TO_FW; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15120 | status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15121 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15122 | sms_log(mac, LOGE, |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 15123 | FL("cds_mq_post_message failed!(err=%d)"), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15124 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15125 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15126 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15127 | } |
| 15128 | sme_release_global_lock(&mac->sme); |
| 15129 | |
| 15130 | return status; |
| 15131 | } |
| 15132 | |
| 15133 | /* |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 15134 | * sme_pdev_set_hw_mode() - Send WMI_PDEV_SET_HW_MODE_CMDID to the WMA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15135 | * @hal: Handle returned by macOpen |
| 15136 | * @msg: HW mode structure containing hw mode and callback details |
| 15137 | * |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 15138 | * Sends the command to CSR to send WMI_PDEV_SET_HW_MODE_CMDID to FW |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15139 | * Return: QDF_STATUS_SUCCESS on successful posting |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15140 | */ |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 15141 | QDF_STATUS sme_pdev_set_hw_mode(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15142 | struct sir_hw_mode msg) |
| 15143 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15144 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15145 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 15146 | tSmeCmd *cmd = NULL; |
| 15147 | |
| 15148 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15149 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15150 | sms_log(mac, LOGE, FL("Failed to acquire lock")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15151 | return QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15152 | } |
| 15153 | |
| 15154 | cmd = sme_get_command_buffer(mac); |
| 15155 | if (!cmd) { |
| 15156 | sms_log(mac, LOGE, FL("Get command buffer failed")); |
| 15157 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15158 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15159 | } |
| 15160 | |
| 15161 | cmd->command = e_sme_command_set_hw_mode; |
| 15162 | cmd->u.set_hw_mode_cmd.hw_mode_index = msg.hw_mode_index; |
| 15163 | cmd->u.set_hw_mode_cmd.set_hw_mode_cb = msg.set_hw_mode_cb; |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 15164 | cmd->u.set_hw_mode_cmd.reason = msg.reason; |
| 15165 | cmd->u.set_hw_mode_cmd.session_id = msg.session_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15166 | |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 15167 | sms_log(mac, LOG1, |
| 15168 | FL("Queuing set hw mode to CSR, session:%d reason:%d"), |
| 15169 | cmd->u.set_hw_mode_cmd.session_id, |
| 15170 | cmd->u.set_hw_mode_cmd.reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15171 | csr_queue_sme_command(mac, cmd, false); |
| 15172 | |
| 15173 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15174 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15175 | } |
| 15176 | |
| 15177 | /** |
| 15178 | * sme_register_hw_mode_trans_cb() - HW mode transition callback registration |
| 15179 | * @hal: Handle returned by macOpen |
| 15180 | * @callback: HDD callback to be registered |
| 15181 | * |
| 15182 | * Registers the HDD callback with SME. This callback will be invoked when |
| 15183 | * HW mode transition event is received from the FW |
| 15184 | * |
| 15185 | * Return: None |
| 15186 | */ |
| 15187 | void sme_register_hw_mode_trans_cb(tHalHandle hal, |
| 15188 | hw_mode_transition_cb callback) |
| 15189 | { |
| 15190 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 15191 | |
| 15192 | mac->sme.sme_hw_mode_trans_cb = callback; |
| 15193 | sms_log(mac, LOG1, FL("HW mode transition callback registered")); |
| 15194 | } |
| 15195 | |
| 15196 | /** |
| 15197 | * sme_nss_update_request() - Send beacon templete update to FW with new |
| 15198 | * nss value |
| 15199 | * @hal: Handle returned by macOpen |
| 15200 | * @vdev_id: the session id |
| 15201 | * @new_nss: the new nss value |
| 15202 | * @cback: hdd callback |
| 15203 | * @next_action: next action to happen at policy mgr after beacon update |
| 15204 | * |
| 15205 | * Sends the command to CSR to send to PE |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15206 | * Return: QDF_STATUS_SUCCESS on successful posting |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15207 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15208 | QDF_STATUS sme_nss_update_request(tHalHandle hHal, uint32_t vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15209 | uint8_t new_nss, void *cback, uint8_t next_action, |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 15210 | void *hdd_context, |
| 15211 | enum sir_conn_update_reason reason) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15212 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15213 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15214 | tpAniSirGlobal mac = PMAC_STRUCT(hHal); |
| 15215 | tSmeCmd *cmd = NULL; |
| 15216 | |
| 15217 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15218 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15219 | cmd = sme_get_command_buffer(mac); |
| 15220 | if (!cmd) { |
| 15221 | sms_log(mac, LOGE, FL("Get command buffer failed")); |
| 15222 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15223 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15224 | } |
| 15225 | cmd->command = e_sme_command_nss_update; |
| 15226 | /* Sessionized modules may require this info */ |
| 15227 | cmd->sessionId = vdev_id; |
| 15228 | cmd->u.nss_update_cmd.new_nss = new_nss; |
| 15229 | cmd->u.nss_update_cmd.session_id = vdev_id; |
| 15230 | cmd->u.nss_update_cmd.nss_update_cb = cback; |
| 15231 | cmd->u.nss_update_cmd.context = hdd_context; |
| 15232 | cmd->u.nss_update_cmd.next_action = next_action; |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 15233 | cmd->u.nss_update_cmd.reason = reason; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15234 | |
| 15235 | sms_log(mac, LOG1, FL("Queuing e_sme_command_nss_update to CSR")); |
| 15236 | csr_queue_sme_command(mac, cmd, false); |
| 15237 | sme_release_global_lock(&mac->sme); |
| 15238 | } |
| 15239 | return status; |
| 15240 | } |
| 15241 | |
| 15242 | /** |
| 15243 | * sme_soc_set_dual_mac_config() - Set dual mac configurations |
| 15244 | * @hal: Handle returned by macOpen |
| 15245 | * @msg: Structure containing the dual mac config parameters |
| 15246 | * |
| 15247 | * Queues configuration information to CSR to configure |
| 15248 | * WLAN firmware for the dual MAC features |
| 15249 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15250 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15251 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15252 | QDF_STATUS sme_soc_set_dual_mac_config(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15253 | struct sir_dual_mac_config msg) |
| 15254 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15255 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15256 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 15257 | tSmeCmd *cmd; |
| 15258 | |
| 15259 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15260 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15261 | sms_log(mac, LOGE, FL("Failed to acquire lock")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15262 | return QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15263 | } |
| 15264 | |
| 15265 | cmd = sme_get_command_buffer(mac); |
| 15266 | if (!cmd) { |
| 15267 | sms_log(mac, LOGE, FL("Get command buffer failed")); |
| 15268 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15269 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15270 | } |
| 15271 | |
| 15272 | cmd->command = e_sme_command_set_dual_mac_config; |
| 15273 | cmd->u.set_dual_mac_cmd.scan_config = msg.scan_config; |
| 15274 | cmd->u.set_dual_mac_cmd.fw_mode_config = msg.fw_mode_config; |
| 15275 | cmd->u.set_dual_mac_cmd.set_dual_mac_cb = msg.set_dual_mac_cb; |
| 15276 | |
| 15277 | sms_log(mac, LOG1, |
| 15278 | FL("Queuing e_sme_command_set_dual_mac_config to CSR: %x %x"), |
| 15279 | cmd->u.set_dual_mac_cmd.scan_config, |
| 15280 | cmd->u.set_dual_mac_cmd.fw_mode_config); |
| 15281 | csr_queue_sme_command(mac, cmd, false); |
| 15282 | |
| 15283 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15284 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15285 | } |
| 15286 | |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 15287 | #ifdef FEATURE_LFR_SUBNET_DETECTION |
| 15288 | /** |
| 15289 | * sme_gateway_param_update() - to update gateway parameters with WMA |
| 15290 | * @Hal: hal handle |
| 15291 | * @gw_params: request parameters from HDD |
| 15292 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15293 | * Return: QDF_STATUS |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 15294 | * |
| 15295 | * This routine will update gateway parameters to WMA |
| 15296 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15297 | QDF_STATUS sme_gateway_param_update(tHalHandle Hal, |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 15298 | struct gateway_param_update_req *gw_params) |
| 15299 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15300 | QDF_STATUS qdf_status; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 15301 | cds_msg_t cds_message; |
| 15302 | struct gateway_param_update_req *request_buf; |
| 15303 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15304 | request_buf = qdf_mem_malloc(sizeof(*request_buf)); |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 15305 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15306 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 15307 | FL("Not able to allocate memory for gw param update request")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15308 | return QDF_STATUS_E_NOMEM; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 15309 | } |
| 15310 | |
| 15311 | *request_buf = *gw_params; |
| 15312 | |
| 15313 | cds_message.type = WMA_GW_PARAM_UPDATE_REQ; |
| 15314 | cds_message.reserved = 0; |
| 15315 | cds_message.bodyptr = request_buf; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15316 | qdf_status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 15317 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15318 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 15319 | FL("Not able to post WMA_GW_PARAM_UPDATE_REQ message to HAL")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15320 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15321 | return QDF_STATUS_E_FAILURE; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 15322 | } |
| 15323 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15324 | return QDF_STATUS_SUCCESS; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 15325 | } |
| 15326 | #endif /* FEATURE_LFR_SUBNET_DETECTION */ |
| 15327 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15328 | /** |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 15329 | * sme_soc_set_antenna_mode() - set antenna mode |
| 15330 | * @hal: Handle returned by macOpen |
| 15331 | * @msg: Structure containing the antenna mode parameters |
| 15332 | * |
| 15333 | * Send the command to CSR to send |
| 15334 | * WMI_SOC_SET_ANTENNA_MODE_CMDID to FW |
| 15335 | * |
| 15336 | * Return: QDF_STATUS |
| 15337 | */ |
| 15338 | QDF_STATUS sme_soc_set_antenna_mode(tHalHandle hal, |
| 15339 | struct sir_antenna_mode_param *msg) |
| 15340 | { |
| 15341 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15342 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 15343 | tSmeCmd *cmd; |
| 15344 | |
| 15345 | if (NULL == msg) { |
| 15346 | sms_log(mac, LOGE, FL("antenna mode mesg is NULL")); |
| 15347 | return QDF_STATUS_E_FAILURE; |
| 15348 | } |
| 15349 | |
| 15350 | status = sme_acquire_global_lock(&mac->sme); |
| 15351 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 15352 | sms_log(mac, LOGE, FL("Failed to acquire lock")); |
| 15353 | return QDF_STATUS_E_RESOURCES; |
| 15354 | } |
| 15355 | |
| 15356 | cmd = sme_get_command_buffer(mac); |
| 15357 | if (!cmd) { |
| 15358 | sme_release_global_lock(&mac->sme); |
| 15359 | sms_log(mac, LOGE, FL("Get command buffer failed")); |
| 15360 | return QDF_STATUS_E_NULL_VALUE; |
| 15361 | } |
| 15362 | |
| 15363 | cmd->command = e_sme_command_set_antenna_mode; |
| 15364 | cmd->u.set_antenna_mode_cmd = *msg; |
| 15365 | |
| 15366 | sms_log(mac, LOG1, |
| 15367 | FL("Queuing e_sme_command_set_antenna_mode to CSR: %d %d"), |
| 15368 | cmd->u.set_antenna_mode_cmd.num_rx_chains, |
| 15369 | cmd->u.set_antenna_mode_cmd.num_tx_chains); |
| 15370 | |
| 15371 | csr_queue_sme_command(mac, cmd, false); |
| 15372 | sme_release_global_lock(&mac->sme); |
| 15373 | |
| 15374 | return QDF_STATUS_SUCCESS; |
| 15375 | } |
| 15376 | |
| 15377 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15378 | * sme_set_peer_authorized() - call peer authorized callback |
| 15379 | * @peer_addr: peer mac address |
| 15380 | * @auth_cb: auth callback |
| 15381 | * @vdev_id: vdev id |
| 15382 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 15383 | * Return: QDF Status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15384 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15385 | QDF_STATUS sme_set_peer_authorized(uint8_t *peer_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15386 | sme_peer_authorized_fp auth_cb, |
| 15387 | uint32_t vdev_id) |
| 15388 | { |
| 15389 | void *wma_handle; |
| 15390 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 15391 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15392 | if (!wma_handle) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15393 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15394 | "wma handle is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15395 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15396 | } |
| 15397 | |
| 15398 | wma_set_peer_authorized_cb(wma_handle, auth_cb); |
| 15399 | return wma_set_peer_param(wma_handle, peer_addr, WMI_PEER_AUTHORIZE, |
| 15400 | 1, vdev_id); |
| 15401 | } |
| 15402 | |
| 15403 | /* |
Amar Singhal | 7c1e898 | 2016-05-19 15:08:09 -0700 | [diff] [blame] | 15404 | * sme_handle_set_fcc_channel() - set spec. tx power for non-fcc channel |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15405 | * @hal: HAL pointer |
Amar Singhal | 83a047a | 2016-05-19 15:56:11 -0700 | [diff] [blame] | 15406 | * @fcc_constraint: flag to enable/disable the constraint |
| 15407 | * @scan_pending: whether there is pending scan |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15408 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15409 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15410 | */ |
Amar Singhal | 83a047a | 2016-05-19 15:56:11 -0700 | [diff] [blame] | 15411 | QDF_STATUS sme_handle_set_fcc_channel(tHalHandle hal, bool fcc_constraint, |
| 15412 | bool scan_pending) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15413 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15414 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15415 | tpAniSirGlobal mac_ptr = PMAC_STRUCT(hal); |
| 15416 | |
| 15417 | status = sme_acquire_global_lock(&mac_ptr->sme); |
| 15418 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15419 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15420 | |
| 15421 | if (fcc_constraint != mac_ptr->scan.fcc_constraint) { |
| 15422 | mac_ptr->scan.fcc_constraint = fcc_constraint; |
Amar Singhal | 83a047a | 2016-05-19 15:56:11 -0700 | [diff] [blame] | 15423 | if (scan_pending) |
| 15424 | mac_ptr->scan.defer_update_channel_list = true; |
| 15425 | else |
| 15426 | status = csr_update_channel_list(mac_ptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15427 | /* update the channel list in firmware */ |
| 15428 | status = csr_update_channel_list(mac_ptr); |
| 15429 | } |
| 15430 | |
| 15431 | sme_release_global_lock(&mac_ptr->sme); |
| 15432 | } |
| 15433 | |
| 15434 | return status; |
| 15435 | } |
| 15436 | /** |
| 15437 | * sme_setdef_dot11mode() - Updates pMac with default dot11mode |
| 15438 | * @hal: Global MAC pointer |
| 15439 | * |
| 15440 | * Return: NULL. |
| 15441 | */ |
| 15442 | void sme_setdef_dot11mode(tHalHandle hal) |
| 15443 | { |
| 15444 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15445 | csr_set_default_dot11_mode(mac_ctx); |
| 15446 | } |
| 15447 | |
| 15448 | /** |
| 15449 | * sme_update_roam_scan_hi_rssi_scan_params() - update high rssi scan |
| 15450 | * params |
| 15451 | * @hal_handle - The handle returned by macOpen. |
| 15452 | * @session_id - Session Identifier |
| 15453 | * @notify_id - Identifies 1 of the 4 parameters to be modified |
| 15454 | * @val New value of the parameter |
| 15455 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15456 | * Return: QDF_STATUS - SME update config successful. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15457 | * Other status means SME failed to update |
| 15458 | */ |
| 15459 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15460 | QDF_STATUS sme_update_roam_scan_hi_rssi_scan_params(tHalHandle hal_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15461 | uint8_t session_id, |
| 15462 | uint32_t notify_id, |
| 15463 | int32_t val) |
| 15464 | { |
| 15465 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15466 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15467 | tCsrNeighborRoamConfig *nr_config = NULL; |
| 15468 | tpCsrNeighborRoamControlInfo nr_info = NULL; |
| 15469 | uint32_t reason = 0; |
| 15470 | |
| 15471 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15472 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15473 | nr_config = &mac_ctx->roam.configParam.neighborRoamConfig; |
| 15474 | nr_info = &mac_ctx->roam.neighborRoamInfo[session_id]; |
| 15475 | switch (notify_id) { |
| 15476 | case eCSR_HI_RSSI_SCAN_MAXCOUNT_ID: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15477 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15478 | "%s: gRoamScanHirssiMaxCount %d => %d", |
| 15479 | __func__, nr_config->nhi_rssi_scan_max_count, |
| 15480 | val); |
| 15481 | nr_config->nhi_rssi_scan_max_count = val; |
| 15482 | nr_info->cfgParams.hi_rssi_scan_max_count = val; |
| 15483 | reason = REASON_ROAM_SCAN_HI_RSSI_MAXCOUNT_CHANGED; |
| 15484 | break; |
| 15485 | |
| 15486 | case eCSR_HI_RSSI_SCAN_RSSI_DELTA_ID: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15487 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15488 | FL("gRoamScanHiRssiDelta %d => %d"), |
| 15489 | nr_config->nhi_rssi_scan_rssi_delta, |
| 15490 | val); |
| 15491 | nr_config->nhi_rssi_scan_rssi_delta = val; |
| 15492 | nr_info->cfgParams.hi_rssi_scan_rssi_delta = val; |
| 15493 | reason = REASON_ROAM_SCAN_HI_RSSI_DELTA_CHANGED; |
| 15494 | break; |
| 15495 | |
| 15496 | case eCSR_HI_RSSI_SCAN_DELAY_ID: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15497 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15498 | FL("gRoamScanHiRssiDelay %d => %d"), |
| 15499 | nr_config->nhi_rssi_scan_delay, |
| 15500 | val); |
| 15501 | nr_config->nhi_rssi_scan_delay = val; |
| 15502 | nr_info->cfgParams.hi_rssi_scan_delay = val; |
| 15503 | reason = REASON_ROAM_SCAN_HI_RSSI_DELAY_CHANGED; |
| 15504 | break; |
| 15505 | |
| 15506 | case eCSR_HI_RSSI_SCAN_RSSI_UB_ID: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15507 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15508 | FL("gRoamScanHiRssiUpperBound %d => %d"), |
| 15509 | nr_config->nhi_rssi_scan_rssi_ub, |
| 15510 | val); |
| 15511 | nr_config->nhi_rssi_scan_rssi_ub = val; |
| 15512 | nr_info->cfgParams.hi_rssi_scan_rssi_ub = val; |
| 15513 | reason = REASON_ROAM_SCAN_HI_RSSI_UB_CHANGED; |
| 15514 | break; |
| 15515 | |
| 15516 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15517 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15518 | FL("invalid parameter notify_id %d"), |
| 15519 | notify_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15520 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15521 | break; |
| 15522 | } |
| 15523 | sme_release_global_lock(&mac_ctx->sme); |
| 15524 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15525 | if (mac_ctx->roam.configParam.isRoamOffloadScanEnabled && |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15526 | status == QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15527 | csr_roam_offload_scan(mac_ctx, session_id, |
| 15528 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, reason); |
| 15529 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15530 | |
| 15531 | return status; |
| 15532 | } |
| 15533 | |
Krishna Kumaar Natarajan | 052c6e6 | 2015-09-28 15:32:55 -0700 | [diff] [blame] | 15534 | /** |
| 15535 | * sme_update_tgt_services() - update the target services config. |
| 15536 | * @hal: HAL pointer. |
| 15537 | * @cfg: wma_tgt_services parameters. |
| 15538 | * |
| 15539 | * update the target services config. |
| 15540 | * |
| 15541 | * Return: None. |
| 15542 | */ |
| 15543 | void sme_update_tgt_services(tHalHandle hal, struct wma_tgt_services *cfg) |
| 15544 | { |
| 15545 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15546 | |
| 15547 | mac_ctx->lteCoexAntShare = cfg->lte_coex_ant_share; |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 15548 | mac_ctx->per_band_chainmask_supp = cfg->per_band_chainmask_supp; |
Krishna Kumaar Natarajan | 052c6e6 | 2015-09-28 15:32:55 -0700 | [diff] [blame] | 15549 | mac_ctx->beacon_offload = cfg->beacon_offload; |
mukul sharma | 72c8b22 | 2015-09-04 17:02:01 +0530 | [diff] [blame] | 15550 | mac_ctx->pmf_offload = cfg->pmf_offload; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15551 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
mukul sharma | 72c8b22 | 2015-09-04 17:02:01 +0530 | [diff] [blame] | 15552 | FL("mac_ctx->pmf_offload: %d"), mac_ctx->pmf_offload); |
Krishna Kumaar Natarajan | 052c6e6 | 2015-09-28 15:32:55 -0700 | [diff] [blame] | 15553 | |
| 15554 | return; |
| 15555 | } |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 15556 | |
Chandrasekaran, Manishekar | 2859de4 | 2016-02-11 16:17:38 +0530 | [diff] [blame] | 15557 | /** |
| 15558 | * sme_is_session_id_valid() - Check if the session id is valid |
| 15559 | * @hal: Pointer to HAL |
| 15560 | * @session_id: Session id |
| 15561 | * |
| 15562 | * Checks if the session id is valid or not |
| 15563 | * |
| 15564 | * Return: True is the session id is valid, false otherwise |
| 15565 | */ |
| 15566 | bool sme_is_session_id_valid(tHalHandle hal, uint32_t session_id) |
| 15567 | { |
| 15568 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 15569 | if (!mac) { |
Chandrasekaran, Manishekar | d3cb477 | 2016-02-22 22:21:10 +0530 | [diff] [blame] | 15570 | /* Using QDF_TRACE since mac is not available for sms_log */ |
| 15571 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15572 | "%s: null mac pointer", __func__); |
Chandrasekaran, Manishekar | 2859de4 | 2016-02-11 16:17:38 +0530 | [diff] [blame] | 15573 | return false; |
| 15574 | } |
| 15575 | |
| 15576 | if (CSR_IS_SESSION_VALID(mac, session_id)) { |
| 15577 | return true; |
| 15578 | } else { |
| 15579 | sms_log(mac, LOGE, |
| 15580 | FL("invalid session id:%d"), session_id); |
| 15581 | return false; |
| 15582 | } |
| 15583 | } |
| 15584 | |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 15585 | #ifdef FEATURE_WLAN_TDLS |
| 15586 | |
| 15587 | /** |
| 15588 | * sme_get_opclass() - determine operating class |
| 15589 | * @hal: Pointer to HAL |
| 15590 | * @channel: channel id |
| 15591 | * @bw_offset: bandwidth offset |
| 15592 | * @opclass: pointer to operating class |
| 15593 | * |
| 15594 | * Function will determine operating class from regdm_get_opclass_from_channel |
| 15595 | * |
| 15596 | * Return: none |
| 15597 | */ |
| 15598 | void sme_get_opclass(tHalHandle hal, uint8_t channel, uint8_t bw_offset, |
| 15599 | uint8_t *opclass) |
| 15600 | { |
| 15601 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15602 | |
| 15603 | /* redgm opclass table contains opclass for 40MHz low primary, |
| 15604 | * 40MHz high primary and 20MHz. No support for 80MHz yet. So |
| 15605 | * first we will check if bit for 40MHz is set and if so find |
| 15606 | * matching opclass either with low primary or high primary |
| 15607 | * (a channel would never be in both) and then search for opclass |
| 15608 | * matching 20MHz, else for any BW. |
| 15609 | */ |
| 15610 | if (bw_offset & (1 << BW_40_OFFSET_BIT)) { |
Amar Singhal | 2299511 | 2016-01-22 10:42:33 -0800 | [diff] [blame] | 15611 | *opclass = cds_reg_dmn_get_opclass_from_channel( |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 15612 | mac_ctx->scan.countryCodeCurrent, |
| 15613 | channel, BW40_LOW_PRIMARY); |
| 15614 | if (!(*opclass)) { |
Amar Singhal | 2299511 | 2016-01-22 10:42:33 -0800 | [diff] [blame] | 15615 | *opclass = cds_reg_dmn_get_opclass_from_channel( |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 15616 | mac_ctx->scan.countryCodeCurrent, |
| 15617 | channel, BW40_HIGH_PRIMARY); |
| 15618 | } |
| 15619 | } else if (bw_offset & (1 << BW_20_OFFSET_BIT)) { |
Amar Singhal | 2299511 | 2016-01-22 10:42:33 -0800 | [diff] [blame] | 15620 | *opclass = cds_reg_dmn_get_opclass_from_channel( |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 15621 | mac_ctx->scan.countryCodeCurrent, |
| 15622 | channel, BW20); |
| 15623 | } else { |
Amar Singhal | 2299511 | 2016-01-22 10:42:33 -0800 | [diff] [blame] | 15624 | *opclass = cds_reg_dmn_get_opclass_from_channel( |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 15625 | mac_ctx->scan.countryCodeCurrent, |
| 15626 | channel, BWALL); |
| 15627 | } |
| 15628 | } |
| 15629 | #endif |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 15630 | |
| 15631 | #ifdef FEATURE_GREEN_AP |
| 15632 | /** |
| 15633 | * sme_send_egap_conf_params() - set the enhanced green ap configuration params |
| 15634 | * @enable: enable/disable the enhanced green ap feature |
| 15635 | * @inactivity_time: inactivity timeout value |
| 15636 | * @wait_time: wait timeout value |
| 15637 | * @flag: feature flag in bitmasp |
| 15638 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15639 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 15640 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15641 | QDF_STATUS sme_send_egap_conf_params(uint32_t enable, uint32_t inactivity_time, |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 15642 | uint32_t wait_time, uint32_t flags) |
| 15643 | { |
| 15644 | cds_msg_t message; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15645 | QDF_STATUS status; |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 15646 | struct egap_conf_params *egap_params; |
| 15647 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15648 | egap_params = qdf_mem_malloc(sizeof(*egap_params)); |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 15649 | if (NULL == egap_params) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15650 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 15651 | "%s: fail to alloc egap_params", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15652 | return QDF_STATUS_E_NOMEM; |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 15653 | } |
| 15654 | |
| 15655 | egap_params->enable = enable; |
| 15656 | egap_params->inactivity_time = inactivity_time; |
| 15657 | egap_params->wait_time = wait_time; |
| 15658 | egap_params->flags = flags; |
| 15659 | |
| 15660 | message.type = WMA_SET_EGAP_CONF_PARAMS; |
| 15661 | message.bodyptr = egap_params; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 15662 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15663 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 15664 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 15665 | "%s: Not able to post msg to WMA!", __func__); |
| 15666 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15667 | qdf_mem_free(egap_params); |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 15668 | } |
| 15669 | return status; |
| 15670 | } |
| 15671 | #endif |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 15672 | |
| 15673 | /** |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 15674 | * sme_set_fw_test() - set fw test |
| 15675 | * @fw_test: fw test param |
| 15676 | * |
| 15677 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 15678 | */ |
| 15679 | QDF_STATUS sme_set_fw_test(struct set_fwtest_params *fw_test) |
| 15680 | { |
| 15681 | void *wma_handle; |
| 15682 | |
| 15683 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 15684 | if (!wma_handle) { |
| 15685 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15686 | "wma handle is NULL"); |
| 15687 | return QDF_STATUS_E_FAILURE; |
| 15688 | } |
| 15689 | wma_process_fw_test_cmd(wma_handle, fw_test); |
| 15690 | return QDF_STATUS_SUCCESS; |
| 15691 | } |
| 15692 | |
| 15693 | /** |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 15694 | * sme_ht40_stop_obss_scan() - ht40 obss stop scan |
| 15695 | * @hal: mac handel |
| 15696 | * @vdev_id: vdev identifier |
| 15697 | * |
| 15698 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 15699 | */ |
| 15700 | QDF_STATUS sme_ht40_stop_obss_scan(tHalHandle hal, uint32_t vdev_id) |
| 15701 | { |
| 15702 | void *wma_handle; |
| 15703 | |
| 15704 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 15705 | if (!wma_handle) { |
| 15706 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15707 | "wma handle is NULL"); |
| 15708 | return QDF_STATUS_E_FAILURE; |
| 15709 | } |
| 15710 | wma_ht40_stop_obss_scan(wma_handle, vdev_id); |
| 15711 | return QDF_STATUS_SUCCESS; |
| 15712 | } |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 15713 | |
| 15714 | /** |
| 15715 | * sme_update_mimo_power_save() - Update MIMO power save |
| 15716 | * configuration |
| 15717 | * @hal: The handle returned by macOpen |
| 15718 | * @is_ht_smps_enabled: enable/disable ht smps |
| 15719 | * @ht_smps_mode: smps mode disabled/static/dynamic |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 15720 | * @send_smps_action: flag to send smps force mode command |
| 15721 | * to FW |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 15722 | * |
| 15723 | * Return: QDF_STATUS if SME update mimo power save |
| 15724 | * configuration sucsess else failue status |
| 15725 | */ |
| 15726 | QDF_STATUS sme_update_mimo_power_save(tHalHandle hal, |
| 15727 | uint8_t is_ht_smps_enabled, |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 15728 | uint8_t ht_smps_mode, |
| 15729 | bool send_smps_action) |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 15730 | { |
| 15731 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 15732 | |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 15733 | sms_log(mac_ctx, LOG1, |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 15734 | "SMPS enable: %d mode: %d send action: %d", |
| 15735 | is_ht_smps_enabled, ht_smps_mode, |
| 15736 | send_smps_action); |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 15737 | mac_ctx->roam.configParam.enableHtSmps = |
| 15738 | is_ht_smps_enabled; |
| 15739 | mac_ctx->roam.configParam.htSmps = ht_smps_mode; |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 15740 | mac_ctx->roam.configParam.send_smps_action = |
| 15741 | send_smps_action; |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 15742 | |
| 15743 | return QDF_STATUS_SUCCESS; |
| 15744 | } |
| 15745 | |
| 15746 | /** |
| 15747 | * sme_is_sta_smps_allowed() - check if the supported nss for |
| 15748 | * the session is greater than 1x1 to enable sta SMPS |
| 15749 | * @hal: The handle returned by macOpen |
| 15750 | * @session_id: session id |
| 15751 | * |
| 15752 | * Return: bool returns true if supported nss is greater than |
| 15753 | * 1x1 else false |
| 15754 | */ |
| 15755 | bool sme_is_sta_smps_allowed(tHalHandle hal, uint8_t session_id) |
| 15756 | { |
| 15757 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15758 | tCsrRoamSession *csr_session; |
| 15759 | |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 15760 | csr_session = CSR_GET_SESSION(mac_ctx, session_id); |
| 15761 | if (NULL == csr_session) { |
| 15762 | sms_log(mac_ctx, LOGE, |
Sreelakshmi Konamki | 58697e1 | 2016-05-25 17:30:18 +0530 | [diff] [blame] | 15763 | FL("SME session not valid: %d"), session_id); |
| 15764 | return false; |
| 15765 | } |
| 15766 | |
| 15767 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
| 15768 | sms_log(mac_ctx, LOGE, |
| 15769 | FL("CSR session not valid: %d"), session_id); |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 15770 | return false; |
| 15771 | } |
| 15772 | |
| 15773 | return (csr_session->supported_nss_1x1 == true) ? false : true; |
| 15774 | } |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 15775 | |
| 15776 | /** |
| 15777 | * sme_add_beacon_filter() - set the beacon filter configuration |
| 15778 | * @hal: The handle returned by macOpen |
| 15779 | * @session_id: session id |
| 15780 | * @ie_map: bitwise array of IEs |
| 15781 | * |
| 15782 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 15783 | */ |
| 15784 | QDF_STATUS sme_add_beacon_filter(tHalHandle hal, |
| 15785 | uint32_t session_id, |
| 15786 | uint32_t *ie_map) |
| 15787 | { |
| 15788 | cds_msg_t message; |
| 15789 | QDF_STATUS qdf_status; |
| 15790 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15791 | struct beacon_filter_param *filter_param; |
| 15792 | |
| 15793 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
| 15794 | sms_log(mac_ctx, LOGE, |
| 15795 | "CSR session not valid: %d", |
| 15796 | session_id); |
| 15797 | return QDF_STATUS_E_FAILURE; |
| 15798 | } |
| 15799 | |
| 15800 | filter_param = qdf_mem_malloc(sizeof(*filter_param)); |
| 15801 | if (NULL == filter_param) { |
| 15802 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15803 | "%s: fail to alloc filter_param", __func__); |
| 15804 | return QDF_STATUS_E_FAILURE; |
| 15805 | } |
| 15806 | |
| 15807 | filter_param->vdev_id = session_id; |
| 15808 | |
| 15809 | qdf_mem_copy(filter_param->ie_map, ie_map, |
| 15810 | BCN_FLT_MAX_ELEMS_IE_LIST * sizeof(uint32_t)); |
| 15811 | |
| 15812 | message.type = WMA_ADD_BCN_FILTER_CMDID; |
| 15813 | message.bodyptr = filter_param; |
| 15814 | qdf_status = cds_mq_post_message(QDF_MODULE_ID_WMA, |
| 15815 | &message); |
| 15816 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 15817 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15818 | "%s: Not able to post msg to WDA!", |
| 15819 | __func__); |
| 15820 | |
| 15821 | qdf_mem_free(filter_param); |
| 15822 | } |
| 15823 | return qdf_status; |
| 15824 | } |
| 15825 | |
| 15826 | /** |
| 15827 | * sme_remove_beacon_filter() - set the beacon filter configuration |
| 15828 | * @hal: The handle returned by macOpen |
| 15829 | * @session_id: session id |
| 15830 | * |
| 15831 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 15832 | */ |
| 15833 | QDF_STATUS sme_remove_beacon_filter(tHalHandle hal, uint32_t session_id) |
| 15834 | { |
| 15835 | cds_msg_t message; |
| 15836 | QDF_STATUS qdf_status; |
| 15837 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15838 | struct beacon_filter_param *filter_param; |
| 15839 | |
| 15840 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
| 15841 | sms_log(mac_ctx, LOGE, |
| 15842 | "CSR session not valid: %d", |
| 15843 | session_id); |
| 15844 | return QDF_STATUS_E_FAILURE; |
| 15845 | } |
| 15846 | |
| 15847 | filter_param = qdf_mem_malloc(sizeof(*filter_param)); |
| 15848 | if (NULL == filter_param) { |
| 15849 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15850 | "%s: fail to alloc filter_param", __func__); |
| 15851 | return QDF_STATUS_E_FAILURE; |
| 15852 | } |
| 15853 | |
| 15854 | filter_param->vdev_id = session_id; |
| 15855 | |
| 15856 | message.type = WMA_REMOVE_BCN_FILTER_CMDID; |
| 15857 | message.bodyptr = filter_param; |
| 15858 | qdf_status = cds_mq_post_message(QDF_MODULE_ID_WMA, |
| 15859 | &message); |
| 15860 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 15861 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15862 | "%s: Not able to post msg to WDA!", |
| 15863 | __func__); |
| 15864 | |
| 15865 | qdf_mem_free(filter_param); |
| 15866 | } |
| 15867 | return qdf_status; |
| 15868 | } |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 15869 | |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 15870 | /** |
Kondabattini, Ganesh | 3f2d02c | 2016-09-13 12:23:47 +0530 | [diff] [blame] | 15871 | * sme_send_disassoc_req_frame - send disassoc req |
| 15872 | * @hal: handler to hal |
| 15873 | * @session_id: session id |
| 15874 | * @peer_mac: peer mac address |
| 15875 | * @reason: reason for disassociation |
| 15876 | * wait_for_ack: wait for acknowledgment |
| 15877 | * |
| 15878 | * function to send disassoc request to lim |
| 15879 | * |
| 15880 | * return: none |
| 15881 | */ |
| 15882 | void sme_send_disassoc_req_frame(tHalHandle hal, uint8_t session_id, |
| 15883 | uint8_t *peer_mac, uint16_t reason, uint8_t wait_for_ack) |
| 15884 | { |
| 15885 | struct sme_send_disassoc_frm_req *msg; |
| 15886 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 15887 | A_UINT8 *buf; |
| 15888 | A_UINT16 tmp; |
| 15889 | |
| 15890 | msg = qdf_mem_malloc(sizeof(struct sme_send_disassoc_frm_req)); |
| 15891 | |
| 15892 | if (NULL == msg) |
| 15893 | qdf_status = QDF_STATUS_E_FAILURE; |
| 15894 | else |
| 15895 | qdf_status = QDF_STATUS_SUCCESS; |
| 15896 | |
| 15897 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 15898 | return; |
| 15899 | |
| 15900 | qdf_mem_set(msg, sizeof(struct sme_send_disassoc_frm_req), 0); |
| 15901 | msg->msg_type = (uint16_t) eWNI_SME_SEND_DISASSOC_FRAME; |
| 15902 | |
| 15903 | msg->length = (uint16_t) sizeof(struct sme_send_disassoc_frm_req); |
| 15904 | |
| 15905 | buf = &msg->session_id; |
| 15906 | |
| 15907 | /* session id */ |
| 15908 | *buf = (A_UINT8) session_id; |
| 15909 | buf += sizeof(A_UINT8); |
| 15910 | |
| 15911 | /* transaction id */ |
| 15912 | *buf = 0; |
| 15913 | *(buf + 1) = 0; |
| 15914 | buf += sizeof(A_UINT16); |
| 15915 | |
| 15916 | /* Set the peer MAC address before sending the message to LIM */ |
| 15917 | qdf_mem_copy(buf, peer_mac, QDF_MAC_ADDR_SIZE); |
| 15918 | |
| 15919 | buf += QDF_MAC_ADDR_SIZE; |
| 15920 | |
| 15921 | /* reasoncode */ |
| 15922 | tmp = (uint16_t) reason; |
| 15923 | qdf_mem_copy(buf, &tmp, sizeof(uint16_t)); |
| 15924 | buf += sizeof(uint16_t); |
| 15925 | |
| 15926 | *buf = wait_for_ack; |
| 15927 | buf += sizeof(uint8_t); |
| 15928 | |
| 15929 | qdf_status = cds_send_mb_message_to_mac(msg); |
| 15930 | |
| 15931 | if (qdf_status != QDF_STATUS_SUCCESS) |
| 15932 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15933 | FL("cds_send_mb_message Failed")); |
| 15934 | } |
| 15935 | |
| 15936 | /** |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 15937 | * sme_get_bpf_offload_capabilities() - Get length for BPF offload |
| 15938 | * @hal: Global HAL handle |
| 15939 | * This function constructs the cds message and fill in message type, |
| 15940 | * post the same to WDA. |
| 15941 | * Return: QDF_STATUS enumeration |
| 15942 | */ |
| 15943 | QDF_STATUS sme_get_bpf_offload_capabilities(tHalHandle hal) |
| 15944 | { |
| 15945 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15946 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15947 | cds_msg_t cds_msg; |
| 15948 | |
| 15949 | sms_log(mac_ctx, LOG1, FL("enter")); |
| 15950 | |
| 15951 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 15952 | if (QDF_STATUS_SUCCESS == status) { |
| 15953 | /* Serialize the req through MC thread */ |
| 15954 | cds_msg.bodyptr = NULL; |
| 15955 | cds_msg.type = WDA_BPF_GET_CAPABILITIES_REQ; |
| 15956 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &cds_msg); |
| 15957 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 15958 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15959 | FL("Post bpf get offload msg fail")); |
| 15960 | status = QDF_STATUS_E_FAILURE; |
| 15961 | } |
| 15962 | sme_release_global_lock(&mac_ctx->sme); |
| 15963 | } else { |
| 15964 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15965 | FL("sme_acquire_global_lock error")); |
| 15966 | } |
| 15967 | sms_log(mac_ctx, LOG1, FL("exit")); |
| 15968 | return status; |
| 15969 | } |
| 15970 | |
| 15971 | |
| 15972 | /** |
| 15973 | * sme_set_bpf_instructions() - Set BPF bpf filter instructions. |
| 15974 | * @hal: HAL handle |
| 15975 | * @bpf_set_offload: struct to set bpf filter instructions. |
| 15976 | * |
| 15977 | * Return: QDF_STATUS enumeration. |
| 15978 | */ |
| 15979 | QDF_STATUS sme_set_bpf_instructions(tHalHandle hal, |
| 15980 | struct sir_bpf_set_offload *req) |
| 15981 | { |
| 15982 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15983 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15984 | cds_msg_t cds_msg; |
| 15985 | struct sir_bpf_set_offload *set_offload; |
| 15986 | |
| 15987 | set_offload = qdf_mem_malloc(sizeof(*set_offload)); |
| 15988 | |
| 15989 | if (NULL == set_offload) { |
| 15990 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15991 | FL("Failed to alloc set_offload")); |
| 15992 | return QDF_STATUS_E_NOMEM; |
| 15993 | } |
| 15994 | |
| 15995 | set_offload->session_id = req->session_id; |
| 15996 | set_offload->filter_id = req->filter_id; |
| 15997 | set_offload->current_offset = req->current_offset; |
| 15998 | set_offload->total_length = req->total_length; |
Rajeev Kumar | e5a1682 | 2016-07-27 13:11:42 -0700 | [diff] [blame] | 15999 | set_offload->current_length = req->current_length; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 16000 | if (set_offload->total_length) { |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 16001 | set_offload->program = qdf_mem_malloc(sizeof(uint8_t) * |
| 16002 | req->current_length); |
Rajeev Kumar | 348ed99 | 2016-07-27 14:44:01 -0700 | [diff] [blame] | 16003 | if (NULL == set_offload->program) { |
| 16004 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 16005 | FL("Failed to alloc instruction memory")); |
| 16006 | qdf_mem_free(set_offload); |
| 16007 | return QDF_STATUS_E_NOMEM; |
| 16008 | } |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 16009 | qdf_mem_copy(set_offload->program, req->program, |
| 16010 | set_offload->current_length); |
| 16011 | } |
| 16012 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 16013 | if (QDF_STATUS_SUCCESS == status) { |
| 16014 | /* Serialize the req through MC thread */ |
| 16015 | cds_msg.bodyptr = set_offload; |
| 16016 | cds_msg.type = WDA_BPF_SET_INSTRUCTIONS_REQ; |
| 16017 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &cds_msg); |
| 16018 | |
| 16019 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 16020 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 16021 | FL("Post BPF set offload msg fail")); |
| 16022 | status = QDF_STATUS_E_FAILURE; |
| 16023 | if (set_offload->total_length) |
| 16024 | qdf_mem_free(set_offload->program); |
| 16025 | qdf_mem_free(set_offload); |
| 16026 | } |
| 16027 | sme_release_global_lock(&mac_ctx->sme); |
| 16028 | } else { |
| 16029 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 16030 | FL("sme_acquire_global_lock failed")); |
| 16031 | if (set_offload->total_length) |
| 16032 | qdf_mem_free(set_offload->program); |
| 16033 | qdf_mem_free(set_offload); |
| 16034 | } |
| 16035 | return status; |
| 16036 | } |
| 16037 | |
| 16038 | /** |
| 16039 | * sme_bpf_offload_register_callback() - Register get bpf offload callbacK |
| 16040 | * |
| 16041 | * @hal - MAC global handle |
| 16042 | * @callback_routine - callback routine from HDD |
| 16043 | * |
| 16044 | * This API is invoked by HDD to register its callback in SME |
| 16045 | * |
| 16046 | * Return: QDF_STATUS |
| 16047 | */ |
| 16048 | QDF_STATUS sme_bpf_offload_register_callback(tHalHandle hal, |
| 16049 | void (*pbpf_get_offload_cb)(void *context, |
| 16050 | struct sir_bpf_get_offload *)) |
| 16051 | { |
| 16052 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 16053 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 16054 | |
| 16055 | status = sme_acquire_global_lock(&mac->sme); |
| 16056 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 16057 | mac->sme.pbpf_get_offload_cb = pbpf_get_offload_cb; |
| 16058 | sme_release_global_lock(&mac->sme); |
| 16059 | } else { |
| 16060 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 16061 | FL("sme_acquire_global_lock failed")); |
| 16062 | } |
| 16063 | return status; |
| 16064 | } |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 16065 | |
| 16066 | /** |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 16067 | * sme_get_wni_dot11_mode() - return configured wni dot11mode |
| 16068 | * @hal: hal pointer |
| 16069 | * |
| 16070 | * Return: wni dot11 mode. |
| 16071 | */ |
| 16072 | uint32_t sme_get_wni_dot11_mode(tHalHandle hal) |
| 16073 | { |
| 16074 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16075 | |
| 16076 | return csr_translate_to_wni_cfg_dot11_mode(mac_ctx, |
| 16077 | mac_ctx->roam.configParam.uCfgDot11Mode); |
| 16078 | } |
| 16079 | |
| 16080 | /** |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 16081 | * sme_bpf_offload_deregister_callback() - Register get bpf offload callbacK |
| 16082 | * |
| 16083 | * @h_hal - MAC global handle |
| 16084 | * @callback_routine - callback routine from HDD |
| 16085 | * |
| 16086 | * This API is invoked by HDD to de-register its callback in SME |
| 16087 | * |
| 16088 | * Return: QDF_STATUS Enumeration |
| 16089 | */ |
| 16090 | QDF_STATUS sme_bpf_offload_deregister_callback(tHalHandle h_hal) |
| 16091 | { |
| 16092 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 16093 | tpAniSirGlobal mac; |
| 16094 | |
| 16095 | if (!h_hal) { |
| 16096 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 16097 | FL("hHal is not valid")); |
| 16098 | return QDF_STATUS_E_INVAL; |
| 16099 | } |
| 16100 | |
| 16101 | mac = PMAC_STRUCT(h_hal); |
| 16102 | |
| 16103 | status = sme_acquire_global_lock(&mac->sme); |
| 16104 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 16105 | mac->sme.pbpf_get_offload_cb = NULL; |
| 16106 | sme_release_global_lock(&mac->sme); |
| 16107 | } else { |
| 16108 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 16109 | FL("sme_acquire_global_lock failed")); |
| 16110 | } |
| 16111 | return status; |
| 16112 | } |
| 16113 | |
| 16114 | |
| 16115 | /** |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 16116 | * sme_create_mon_session() - post message to create PE session for monitormode |
| 16117 | * operation |
| 16118 | * @hal_handle: Handle to the HAL |
| 16119 | * @bssid: pointer to bssid |
| 16120 | * |
| 16121 | * Return: QDF_STATUS_SUCCESS on success, non-zero error code on failure. |
| 16122 | */ |
| 16123 | QDF_STATUS sme_create_mon_session(tHalHandle hal_handle, tSirMacAddr bss_id) |
| 16124 | { |
| 16125 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 16126 | struct sir_create_session *msg; |
| 16127 | |
| 16128 | msg = qdf_mem_malloc(sizeof(*msg)); |
| 16129 | if (NULL != msg) { |
| 16130 | msg->type = eWNI_SME_MON_INIT_SESSION; |
| 16131 | msg->msg_len = sizeof(*msg); |
| 16132 | qdf_mem_copy(msg->bss_id.bytes, bss_id, QDF_MAC_ADDR_SIZE); |
| 16133 | status = cds_send_mb_message_to_mac(msg); |
| 16134 | } |
| 16135 | return status; |
| 16136 | } |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 16137 | |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 16138 | /** |
| 16139 | * sme_set_adaptive_dwelltime_config() - Update Adaptive dwelltime configuration |
| 16140 | * @hal: The handle returned by macOpen |
| 16141 | * @params: adaptive_dwelltime_params config |
| 16142 | * |
| 16143 | * Return: QDF_STATUS if adaptive dwell time update |
| 16144 | * configuration sucsess else failure status |
| 16145 | */ |
| 16146 | QDF_STATUS sme_set_adaptive_dwelltime_config(tHalHandle hal, |
| 16147 | struct adaptive_dwelltime_params *params) |
| 16148 | { |
| 16149 | cds_msg_t message; |
| 16150 | QDF_STATUS status; |
| 16151 | struct adaptive_dwelltime_params *dwelltime_params; |
| 16152 | |
| 16153 | dwelltime_params = qdf_mem_malloc(sizeof(*dwelltime_params)); |
| 16154 | if (NULL == dwelltime_params) { |
| 16155 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 16156 | "%s: fail to alloc dwelltime_params", __func__); |
| 16157 | return QDF_STATUS_E_NOMEM; |
| 16158 | } |
| 16159 | |
| 16160 | dwelltime_params->is_enabled = params->is_enabled; |
| 16161 | dwelltime_params->dwelltime_mode = params->dwelltime_mode; |
| 16162 | dwelltime_params->lpf_weight = params->lpf_weight; |
| 16163 | dwelltime_params->passive_mon_intval = params->passive_mon_intval; |
| 16164 | dwelltime_params->wifi_act_threshold = params->wifi_act_threshold; |
| 16165 | |
| 16166 | message.type = WMA_SET_ADAPT_DWELLTIME_CONF_PARAMS; |
| 16167 | message.bodyptr = dwelltime_params; |
| 16168 | status = cds_mq_post_message(QDF_MODULE_ID_WMA, &message); |
| 16169 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 16170 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 16171 | "%s: Not able to post msg to WMA!", __func__); |
| 16172 | |
| 16173 | qdf_mem_free(dwelltime_params); |
| 16174 | } |
| 16175 | return status; |
| 16176 | } |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 16177 | /** |
| 16178 | * sme_set_pdev_ht_vht_ies() - sends the set pdev IE req |
| 16179 | * @hal: Pointer to HAL |
| 16180 | * @enable2x2: 1x1 or 2x2 mode. |
| 16181 | * |
| 16182 | * Sends the set pdev IE req with Nss value. |
| 16183 | * |
| 16184 | * Return: None |
| 16185 | */ |
| 16186 | void sme_set_pdev_ht_vht_ies(tHalHandle hal, bool enable2x2) |
| 16187 | { |
| 16188 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16189 | struct sir_set_ht_vht_cfg *ht_vht_cfg; |
| 16190 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 16191 | |
| 16192 | if (!mac_ctx->per_band_chainmask_supp) |
| 16193 | return; |
| 16194 | |
| 16195 | if (!((mac_ctx->roam.configParam.uCfgDot11Mode == |
| 16196 | eCSR_CFG_DOT11_MODE_AUTO) || |
| 16197 | (mac_ctx->roam.configParam.uCfgDot11Mode == |
| 16198 | eCSR_CFG_DOT11_MODE_11N) || |
| 16199 | (mac_ctx->roam.configParam.uCfgDot11Mode == |
| 16200 | eCSR_CFG_DOT11_MODE_11N_ONLY) || |
| 16201 | (mac_ctx->roam.configParam.uCfgDot11Mode == |
| 16202 | eCSR_CFG_DOT11_MODE_11AC) || |
| 16203 | (mac_ctx->roam.configParam.uCfgDot11Mode == |
| 16204 | eCSR_CFG_DOT11_MODE_11AC_ONLY))) |
| 16205 | return; |
| 16206 | |
| 16207 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 16208 | if (QDF_STATUS_SUCCESS == status) { |
| 16209 | ht_vht_cfg = qdf_mem_malloc(sizeof(*ht_vht_cfg)); |
| 16210 | if (NULL == ht_vht_cfg) { |
| 16211 | sms_log(mac_ctx, LOGE, |
| 16212 | "%s: mem alloc failed for ht_vht_cfg", |
| 16213 | __func__); |
| 16214 | sme_release_global_lock(&mac_ctx->sme); |
| 16215 | return; |
| 16216 | } |
| 16217 | |
| 16218 | ht_vht_cfg->pdev_id = 0; |
| 16219 | if (enable2x2) |
| 16220 | ht_vht_cfg->nss = 2; |
| 16221 | else |
| 16222 | ht_vht_cfg->nss = 1; |
| 16223 | ht_vht_cfg->dot11mode = |
| 16224 | (uint8_t)csr_translate_to_wni_cfg_dot11_mode(mac_ctx, |
| 16225 | mac_ctx->roam.configParam.uCfgDot11Mode); |
| 16226 | |
| 16227 | ht_vht_cfg->msg_type = eWNI_SME_PDEV_SET_HT_VHT_IE; |
| 16228 | ht_vht_cfg->len = sizeof(*ht_vht_cfg); |
| 16229 | sms_log(mac_ctx, LOG1, |
| 16230 | FL("SET_HT_VHT_IE with nss %d, dot11mode %d"), |
| 16231 | ht_vht_cfg->nss, |
| 16232 | ht_vht_cfg->dot11mode); |
| 16233 | status = cds_send_mb_message_to_mac(ht_vht_cfg); |
| 16234 | if (QDF_STATUS_SUCCESS != status) { |
| 16235 | sms_log(mac_ctx, LOGE, FL( |
| 16236 | "Send SME_PDEV_SET_HT_VHT_IE fail")); |
| 16237 | qdf_mem_free(ht_vht_cfg); |
| 16238 | } |
| 16239 | sme_release_global_lock(&mac_ctx->sme); |
| 16240 | } |
| 16241 | return; |
| 16242 | } |
| 16243 | |
| 16244 | /** |
| 16245 | * sme_update_vdev_type_nss() - sets the nss per vdev type |
| 16246 | * @hal: Pointer to HAL |
| 16247 | * @max_supp_nss: max_supported Nss |
| 16248 | * @band: 5G or 2.4G band |
| 16249 | * |
| 16250 | * Sets the per band Nss for each vdev type based on INI and configured |
| 16251 | * chain mask value. |
| 16252 | * |
| 16253 | * Return: None |
| 16254 | */ |
| 16255 | void sme_update_vdev_type_nss(tHalHandle hal, uint8_t max_supp_nss, |
| 16256 | uint32_t vdev_type_nss, eCsrBand band) |
| 16257 | { |
| 16258 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16259 | struct vdev_type_nss *vdev_nss; |
| 16260 | |
| 16261 | if (eCSR_BAND_5G == band) |
| 16262 | vdev_nss = &mac_ctx->vdev_type_nss_5g; |
| 16263 | else |
| 16264 | vdev_nss = &mac_ctx->vdev_type_nss_2g; |
| 16265 | |
| 16266 | vdev_nss->sta = QDF_MIN(max_supp_nss, CFG_STA_NSS(vdev_type_nss)); |
| 16267 | vdev_nss->sap = QDF_MIN(max_supp_nss, CFG_SAP_NSS(vdev_type_nss)); |
| 16268 | vdev_nss->p2p_go = QDF_MIN(max_supp_nss, |
| 16269 | CFG_P2P_GO_NSS(vdev_type_nss)); |
| 16270 | vdev_nss->p2p_cli = QDF_MIN(max_supp_nss, |
| 16271 | CFG_P2P_CLI_NSS(vdev_type_nss)); |
| 16272 | vdev_nss->p2p_dev = QDF_MIN(max_supp_nss, |
| 16273 | CFG_P2P_DEV_NSS(vdev_type_nss)); |
| 16274 | vdev_nss->ibss = QDF_MIN(max_supp_nss, CFG_IBSS_NSS(vdev_type_nss)); |
| 16275 | vdev_nss->tdls = QDF_MIN(max_supp_nss, CFG_TDLS_NSS(vdev_type_nss)); |
| 16276 | vdev_nss->ocb = QDF_MIN(max_supp_nss, CFG_OCB_NSS(vdev_type_nss)); |
| 16277 | |
| 16278 | sms_log(mac_ctx, LOG1, |
| 16279 | "band %d NSS:sta %d sap %d cli %d go %d dev %d ibss %d tdls %d ocb %d", |
| 16280 | band, vdev_nss->sta, vdev_nss->sap, vdev_nss->p2p_cli, |
| 16281 | vdev_nss->p2p_go, vdev_nss->p2p_dev, vdev_nss->ibss, |
| 16282 | vdev_nss->tdls, vdev_nss->ocb); |
| 16283 | } |
Peng Xu | 8fdaa49 | 2016-06-22 10:20:47 -0700 | [diff] [blame] | 16284 | |
| 16285 | /** |
| 16286 | * sme_register_p2p_lo_event() - Register for the p2p lo event |
| 16287 | * @hHal: reference to the HAL |
| 16288 | * @context: the context of the call |
| 16289 | * @callback: the callback to hdd |
| 16290 | * |
| 16291 | * This function registers the callback function for P2P listen |
| 16292 | * offload stop event. |
| 16293 | * |
| 16294 | * Return: none |
| 16295 | */ |
| 16296 | void sme_register_p2p_lo_event(tHalHandle hHal, void *context, |
| 16297 | p2p_lo_callback callback) |
| 16298 | { |
| 16299 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 16300 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 16301 | |
| 16302 | status = sme_acquire_global_lock(&pMac->sme); |
| 16303 | pMac->sme.p2p_lo_event_callback = callback; |
| 16304 | pMac->sme.p2p_lo_event_context = context; |
| 16305 | sme_release_global_lock(&pMac->sme); |
| 16306 | } |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 16307 | |
| 16308 | /** |
| 16309 | * sme_process_mac_pwr_dbg_cmd() - enable mac pwr debugging |
| 16310 | * @hal: The handle returned by macOpen |
| 16311 | * @session_id: session id |
| 16312 | * @dbg_args: args for mac pwr debug command |
| 16313 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 16314 | */ |
| 16315 | QDF_STATUS sme_process_mac_pwr_dbg_cmd(tHalHandle hal, uint32_t session_id, |
| 16316 | struct sir_mac_pwr_dbg_cmd* |
| 16317 | dbg_args) |
| 16318 | { |
| 16319 | cds_msg_t message; |
| 16320 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16321 | struct sir_mac_pwr_dbg_cmd *req; |
| 16322 | int i; |
| 16323 | |
| 16324 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
| 16325 | sms_log(mac_ctx, LOGE, |
| 16326 | "CSR session not valid: %d", |
| 16327 | session_id); |
| 16328 | return QDF_STATUS_E_FAILURE; |
| 16329 | } |
| 16330 | |
| 16331 | req = qdf_mem_malloc(sizeof(*req)); |
| 16332 | if (NULL == req) { |
| 16333 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 16334 | "%s: fail to alloc mac_pwr_dbg_args", __func__); |
| 16335 | return QDF_STATUS_E_FAILURE; |
| 16336 | } |
| 16337 | req->module_id = dbg_args->module_id; |
| 16338 | req->pdev_id = dbg_args->pdev_id; |
| 16339 | req->num_args = dbg_args->num_args; |
| 16340 | for (i = 0; i < req->num_args; i++) |
| 16341 | req->args[i] = dbg_args->args[i]; |
| 16342 | |
| 16343 | message.type = SIR_HAL_POWER_DBG_CMD; |
| 16344 | message.bodyptr = req; |
| 16345 | |
| 16346 | if (!QDF_IS_STATUS_SUCCESS(cds_mq_post_message |
| 16347 | (QDF_MODULE_ID_WMA, &message))) { |
| 16348 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 16349 | "%s: Not able to post msg to WDA!", |
| 16350 | __func__); |
| 16351 | qdf_mem_free(req); |
| 16352 | } |
| 16353 | return QDF_STATUS_SUCCESS; |
| 16354 | } |
Tushnim Bhattacharyya | f44a9d8 | 2016-07-05 10:52:06 -0700 | [diff] [blame] | 16355 | /** |
| 16356 | * sme_get_vdev_type_nss() - gets the nss per vdev type |
| 16357 | * @hal: Pointer to HAL |
| 16358 | * @dev_mode: connection type. |
| 16359 | * @nss2g: Pointer to the 2G Nss parameter. |
| 16360 | * @nss5g: Pointer to the 5G Nss parameter. |
| 16361 | * |
| 16362 | * Fills the 2G and 5G Nss values based on connection type. |
| 16363 | * |
| 16364 | * Return: None |
| 16365 | */ |
| 16366 | void sme_get_vdev_type_nss(tHalHandle hal, enum tQDF_ADAPTER_MODE dev_mode, |
| 16367 | uint8_t *nss_2g, uint8_t *nss_5g) |
| 16368 | { |
| 16369 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16370 | csr_get_vdev_type_nss(mac_ctx, dev_mode, nss_2g, nss_5g); |
| 16371 | } |