Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2018 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 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 28 | /* |
| 29 | * DOC: smeApi.c |
| 30 | * |
| 31 | * Definitions for SME APIs |
| 32 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 33 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 34 | /* Include Files */ |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 35 | #include <sir_common.h> |
| 36 | #include <ani_global.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 37 | #include "sme_api.h" |
| 38 | #include "csr_inside_api.h" |
| 39 | #include "sme_inside.h" |
| 40 | #include "csr_internal.h" |
| 41 | #include "wma_types.h" |
| 42 | #include "wma_if.h" |
Jeff Johnson | 6136fb9 | 2017-03-30 15:21:49 -0700 | [diff] [blame] | 43 | #include "wma_fips_api.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 44 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 45 | #include "sme_trace.h" |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 46 | #include "qdf_types.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 "cds_utils.h" |
| 49 | #include "sap_api.h" |
| 50 | #include "mac_trace.h" |
| 51 | #ifdef WLAN_FEATURE_NAN |
| 52 | #include "nan_api.h" |
| 53 | #endif |
Naveen Rawat | 3b6068c | 2016-04-14 19:01:06 -0700 | [diff] [blame] | 54 | #include "cds_regdomain.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 55 | #include "cfg_api.h" |
| 56 | #include "sme_power_save_api.h" |
| 57 | #include "wma.h" |
Naveen Rawat | b4d3762 | 2015-11-13 16:15:25 -0800 | [diff] [blame] | 58 | #include "sch_api.h" |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 59 | #include "sme_nan_datapath.h" |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 60 | #include "csr_api.h" |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 61 | #include "wlan_reg_services_api.h" |
Abhishek Singh | 158fe25 | 2017-03-23 11:09:34 +0530 | [diff] [blame] | 62 | #include <wlan_scan_ucfg_api.h> |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 63 | #include "wlan_reg_ucfg_api.h" |
Arif Hussain | ee67701 | 2017-01-26 17:50:13 -0800 | [diff] [blame] | 64 | #include "ol_txrx.h" |
Naveen Rawat | d2657be | 2017-10-10 14:31:23 -0700 | [diff] [blame] | 65 | #include "wifi_pos_api.h" |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 66 | #include "net/cfg80211.h" |
| 67 | #include <qca_vendor.h> |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 68 | #include <wlan_spectral_utils_api.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 69 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 70 | static tSelfRecoveryStats g_self_recovery_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 71 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 72 | static QDF_STATUS init_sme_cmd_list(tpAniSirGlobal pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 73 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 74 | static QDF_STATUS sme_handle_change_country_code(tpAniSirGlobal pMac, |
| 75 | void *pMsgBuf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 76 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 77 | static void sme_disconnect_connected_sessions(tpAniSirGlobal pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 78 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 79 | static QDF_STATUS sme_handle_generic_change_country_code(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 80 | void *pMsgBuf); |
| 81 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 82 | static QDF_STATUS sme_process_nss_update_resp(tpAniSirGlobal mac, uint8_t *msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 83 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 84 | #ifdef WLAN_FEATURE_11W |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 85 | QDF_STATUS sme_unprotected_mgmt_frm_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 86 | tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm); |
| 87 | #endif |
| 88 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 89 | /* Channel Change Response Indication Handler */ |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 90 | static QDF_STATUS sme_process_channel_change_resp(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 91 | uint16_t msg_type, void *pMsgBuf); |
| 92 | |
| 93 | /* Internal SME APIs */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 94 | QDF_STATUS sme_acquire_global_lock(tSmeStruct *psSme) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 95 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 96 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 97 | |
| 98 | if (psSme) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 99 | if (QDF_IS_STATUS_SUCCESS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 100 | (qdf_mutex_acquire(&psSme->lkSmeGlobalLock))) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 101 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | return status; |
| 105 | } |
| 106 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 107 | QDF_STATUS sme_release_global_lock(tSmeStruct *psSme) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 108 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 109 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 110 | |
| 111 | if (psSme) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 112 | if (QDF_IS_STATUS_SUCCESS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 113 | (qdf_mutex_release(&psSme->lkSmeGlobalLock))) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 114 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | return status; |
| 118 | } |
| 119 | |
Tushnim Bhattacharyya | 518e80f | 2017-08-30 17:35:33 -0700 | [diff] [blame] | 120 | tpAniSirGlobal sme_get_mac_context(void) |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 121 | { |
| 122 | tpAniSirGlobal mac_ctx; |
| 123 | tHalHandle h_hal; |
| 124 | |
| 125 | h_hal = cds_get_context(QDF_MODULE_ID_SME); |
| 126 | if (NULL == h_hal) { |
| 127 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
| 128 | FL("invalid h_hal")); |
| 129 | return NULL; |
| 130 | } |
| 131 | |
| 132 | mac_ctx = PMAC_STRUCT(h_hal); |
| 133 | if (NULL == mac_ctx) { |
| 134 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 135 | FL("Invalid MAC context")); |
| 136 | return NULL; |
| 137 | } |
| 138 | |
| 139 | return mac_ctx; |
| 140 | } |
| 141 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 142 | /** |
| 143 | * sme_process_set_hw_mode_resp() - Process set HW mode response |
| 144 | * @mac: Global MAC pointer |
| 145 | * @msg: HW mode response |
| 146 | * |
| 147 | * Processes the HW mode response and invokes the HDD callback |
| 148 | * to process further |
| 149 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 150 | 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] | 151 | { |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 152 | tListElem *entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 153 | tSmeCmd *command = NULL; |
| 154 | bool found; |
Tushnim Bhattacharyya | eab33dd | 2017-11-15 15:20:02 -0800 | [diff] [blame] | 155 | policy_mgr_pdev_set_hw_mode_cback callback = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 156 | struct sir_set_hw_mode_resp *param; |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 157 | enum sir_conn_update_reason reason; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 158 | struct csr_roam_session *session; |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 159 | uint32_t session_id; |
Sandeep Puligilla | 344d725 | 2017-09-15 16:23:33 -0700 | [diff] [blame] | 160 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 161 | param = (struct sir_set_hw_mode_resp *)msg; |
| 162 | if (!param) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 163 | sme_err("HW mode resp param is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 164 | /* Not returning. Need to check if active command list |
| 165 | * needs to be freed |
| 166 | */ |
| 167 | } |
| 168 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 169 | entry = csr_nonscan_active_ll_peek_head(mac, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 170 | if (!entry) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 171 | sme_err("No cmd found in active list"); |
Tushnim Bhattacharyya | 4a03db8 | 2017-11-10 17:58:28 -0800 | [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) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 177 | sme_err("Base address is NULL"); |
Tushnim Bhattacharyya | 4a03db8 | 2017-11-10 17:58:28 -0800 | [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) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 182 | sme_err("Command mismatch!"); |
Tushnim Bhattacharyya | 4a03db8 | 2017-11-10 17:58:28 -0800 | [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; |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 188 | session_id = command->u.set_hw_mode_cmd.session_id; |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 189 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 190 | sme_debug("reason: %d session: %d", |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 191 | command->u.set_hw_mode_cmd.reason, |
| 192 | command->u.set_hw_mode_cmd.session_id); |
| 193 | |
Chandrasekaran, Manishekar | 4dd215e | 2016-04-16 18:48:34 -0700 | [diff] [blame] | 194 | if (!callback) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 195 | sme_err("Callback does not exist"); |
Chandrasekaran, Manishekar | 4dd215e | 2016-04-16 18:48:34 -0700 | [diff] [blame] | 196 | goto end; |
| 197 | } |
| 198 | |
| 199 | if (!param) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 200 | sme_err("Callback failed since HW mode params is NULL"); |
Chandrasekaran, Manishekar | 4dd215e | 2016-04-16 18:48:34 -0700 | [diff] [blame] | 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, |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 212 | param->vdev_mac_map, |
Tushnim Bhattacharyya | eab33dd | 2017-11-15 15:20:02 -0800 | [diff] [blame] | 213 | command->u.set_hw_mode_cmd.next_action, |
| 214 | command->u.set_hw_mode_cmd.reason, |
| 215 | command->u.set_hw_mode_cmd.session_id, |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 216 | command->u.set_hw_mode_cmd.context); |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 217 | if (!CSR_IS_SESSION_VALID(mac, session_id)) { |
| 218 | sme_err("session %d is invalid", session_id); |
| 219 | goto end; |
| 220 | } |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 221 | session = CSR_GET_SESSION(mac, session_id); |
Chandrasekaran, Manishekar | 4dd215e | 2016-04-16 18:48:34 -0700 | [diff] [blame] | 222 | if (reason == SIR_UPDATE_REASON_HIDDEN_STA) { |
| 223 | /* In the case of hidden SSID, connection update |
| 224 | * (set hw mode) is done after the scan with reason |
| 225 | * code eCsrScanForSsid completes. The connect/failure |
| 226 | * needs to be handled after the response of set hw |
| 227 | * mode |
| 228 | */ |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 229 | if (param->status == SET_HW_MODE_STATUS_OK) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 230 | sme_debug("search for ssid success"); |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 231 | csr_scan_handle_search_for_ssid(mac, |
| 232 | session_id); |
| 233 | } else { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 234 | sme_debug("search for ssid failure"); |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 235 | csr_scan_handle_search_for_ssid_failure(mac, |
| 236 | session_id); |
| 237 | } |
Deepak Dhamdhere | 6f7fbbe | 2017-02-28 13:35:52 -0800 | [diff] [blame] | 238 | csr_saved_scan_cmd_free_fields(mac, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 239 | } |
| 240 | |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 241 | end: |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 242 | found = csr_nonscan_active_ll_remove_entry(mac, entry, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 243 | LL_ACCESS_LOCK); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 244 | if (found) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 245 | /* Now put this command back on the avilable command list */ |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 246 | csr_release_command(mac, command); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 247 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 248 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | /** |
| 252 | * sme_process_hw_mode_trans_ind() - Process HW mode transition indication |
| 253 | * @mac: Global MAC pointer |
| 254 | * @msg: HW mode transition response |
| 255 | * |
| 256 | * Processes the HW mode transition indication and invoke the HDD callback |
| 257 | * to process further |
| 258 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 259 | static QDF_STATUS sme_process_hw_mode_trans_ind(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 260 | uint8_t *msg) |
| 261 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 262 | struct sir_hw_mode_trans_ind *param; |
| 263 | |
| 264 | param = (struct sir_hw_mode_trans_ind *)msg; |
| 265 | if (!param) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 266 | sme_err("HW mode trans ind param is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 267 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 268 | } |
| 269 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 270 | policy_mgr_hw_mode_transition_cb(param->old_hw_mode_index, |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 271 | param->new_hw_mode_index, |
| 272 | param->num_vdev_mac_entries, |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 273 | param->vdev_mac_map, mac->psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 274 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 275 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 276 | } |
| 277 | |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 278 | /** |
| 279 | * free_sme_cmds() - This function frees memory allocated for SME commands |
| 280 | * @mac_ctx: Pointer to Global MAC structure |
| 281 | * |
| 282 | * This function frees memory allocated for SME commands |
| 283 | * |
| 284 | * @Return: void |
| 285 | */ |
| 286 | static void free_sme_cmds(tpAniSirGlobal mac_ctx) |
| 287 | { |
| 288 | uint32_t idx; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 289 | |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 290 | if (NULL == mac_ctx->sme.pSmeCmdBufAddr) |
| 291 | return; |
| 292 | |
| 293 | for (idx = 0; idx < mac_ctx->sme.totalSmeCmd; idx++) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 294 | qdf_mem_free(mac_ctx->sme.pSmeCmdBufAddr[idx]); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 295 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 296 | qdf_mem_free(mac_ctx->sme.pSmeCmdBufAddr); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 297 | mac_ctx->sme.pSmeCmdBufAddr = NULL; |
| 298 | } |
| 299 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 300 | static QDF_STATUS init_sme_cmd_list(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 301 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 302 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 303 | tSmeCmd *pCmd; |
| 304 | uint32_t cmd_idx; |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 305 | uint32_t sme_cmd_ptr_ary_sz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 306 | |
| 307 | pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND; |
| 308 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 309 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 310 | status = csr_ll_open(pMac->hHdd, &pMac->sme.smeCmdFreeList); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 311 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 312 | goto end; |
| 313 | |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 314 | /* following pointer contains array of pointers for tSmeCmd* */ |
| 315 | sme_cmd_ptr_ary_sz = sizeof(void *) * pMac->sme.totalSmeCmd; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 316 | pMac->sme.pSmeCmdBufAddr = qdf_mem_malloc(sme_cmd_ptr_ary_sz); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 317 | if (NULL == pMac->sme.pSmeCmdBufAddr) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 318 | status = QDF_STATUS_E_NOMEM; |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 319 | goto end; |
| 320 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 321 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 322 | status = QDF_STATUS_SUCCESS; |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 323 | for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++) { |
| 324 | /* |
| 325 | * Since total size of all commands together can be huge chunk |
| 326 | * of memory, allocate SME cmd individually. These SME CMDs are |
| 327 | * moved between pending and active queues. And these freeing of |
| 328 | * these queues just manipulates the list but does not actually |
| 329 | * frees SME CMD pointers. Hence store each SME CMD address in |
| 330 | * the array, sme.pSmeCmdBufAddr. This will later facilitate |
| 331 | * freeing up of all SME CMDs with just a for loop. |
| 332 | */ |
| 333 | pMac->sme.pSmeCmdBufAddr[cmd_idx] = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 334 | qdf_mem_malloc(sizeof(tSmeCmd)); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 335 | if (NULL == pMac->sme.pSmeCmdBufAddr[cmd_idx]) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 336 | status = QDF_STATUS_E_NOMEM; |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 337 | free_sme_cmds(pMac); |
| 338 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 339 | } |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 340 | pCmd = (tSmeCmd *)pMac->sme.pSmeCmdBufAddr[cmd_idx]; |
| 341 | csr_ll_insert_tail(&pMac->sme.smeCmdFreeList, |
| 342 | &pCmd->Link, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 343 | } |
| 344 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 345 | end: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 346 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 347 | sme_err("Failed to initialize sme command list: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 348 | |
| 349 | return status; |
| 350 | } |
| 351 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 352 | void sme_release_command(tpAniSirGlobal mac_ctx, tSmeCmd *sme_cmd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 353 | { |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 354 | sme_cmd->command = eSmeNoCommand; |
| 355 | csr_ll_insert_tail(&mac_ctx->sme.smeCmdFreeList, &sme_cmd->Link, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 356 | LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 357 | } |
| 358 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 359 | static QDF_STATUS free_sme_cmd_list(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 360 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 361 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 362 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 363 | csr_ll_close(&pMac->sme.smeCmdFreeList); |
| 364 | |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 365 | status = qdf_mutex_acquire(&pMac->sme.lkSmeGlobalLock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 366 | if (status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 367 | sme_err("Failed to acquire the lock status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 368 | goto done; |
| 369 | } |
| 370 | |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 371 | free_sme_cmds(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 372 | |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 373 | status = qdf_mutex_release(&pMac->sme.lkSmeGlobalLock); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 374 | if (status != QDF_STATUS_SUCCESS) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 375 | sme_err("Failed to release the lock status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 376 | done: |
| 377 | return status; |
| 378 | } |
| 379 | |
Jeff Johnson | 49c02f9 | 2016-10-07 10:29:09 -0700 | [diff] [blame] | 380 | static void dump_csr_command_info(tpAniSirGlobal pMac, tSmeCmd *pCmd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 381 | { |
| 382 | switch (pCmd->command) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 383 | case eSmeCommandRoam: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 384 | sme_debug("roam command reason is %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 385 | pCmd->u.roamCmd.roamReason); |
| 386 | break; |
| 387 | |
| 388 | case eSmeCommandWmStatusChange: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 389 | sme_debug("WMStatusChange command type is %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 390 | pCmd->u.wmStatusChangeCmd.Type); |
| 391 | break; |
| 392 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 393 | default: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 394 | sme_debug("default: Unhandled command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 395 | pCmd->command); |
| 396 | break; |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | tSmeCmd *sme_get_command_buffer(tpAniSirGlobal pMac) |
| 401 | { |
| 402 | tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL; |
| 403 | tListElem *pEntry; |
| 404 | static int sme_command_queue_full; |
| 405 | |
| 406 | pEntry = csr_ll_remove_head(&pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK); |
| 407 | |
| 408 | /* If we can get another MS Msg buffer, then we are ok. Just link */ |
| 409 | /* the entry onto the linked list. (We are using the linked list */ |
| 410 | /* to keep track of tfhe message buffers). */ |
| 411 | if (pEntry) { |
| 412 | pRetCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 413 | /* reset when free list is available */ |
| 414 | sme_command_queue_full = 0; |
| 415 | } else { |
| 416 | int idx = 1; |
| 417 | |
| 418 | /* Cannot change pRetCmd here since it needs to return later. */ |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 419 | pEntry = csr_nonscan_active_ll_peek_head(pMac, LL_ACCESS_LOCK); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 420 | if (pEntry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 421 | pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 422 | |
| 423 | sme_err("Out of command buffer.... command (0x%X) stuck", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 424 | (pTempCmd) ? pTempCmd->command : eSmeNoCommand); |
| 425 | if (pTempCmd) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 426 | if (eSmeCsrCommandMask & pTempCmd->command) |
| 427 | /* CSR command is stuck. See what the reason |
| 428 | * code is for that command |
| 429 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 430 | dump_csr_command_info(pMac, pTempCmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 431 | } /* if(pTempCmd) */ |
| 432 | |
| 433 | /* dump what is in the pending queue */ |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 434 | csr_nonscan_pending_ll_lock(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 435 | pEntry = |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 436 | csr_nonscan_pending_ll_peek_head(pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 437 | LL_ACCESS_NOLOCK); |
| 438 | while (pEntry && !sme_command_queue_full) { |
| 439 | pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 440 | /* Print only 1st five commands from pending queue. */ |
| 441 | if (idx <= 5) |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 442 | sme_err("Out of command buffer.... SME pending command #%d (0x%X)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 443 | idx, pTempCmd->command); |
| 444 | idx++; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 445 | if (eSmeCsrCommandMask & pTempCmd->command) |
| 446 | /* CSR command is stuck. See what the reason |
| 447 | * code is for that command |
| 448 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 449 | dump_csr_command_info(pMac, pTempCmd); |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 450 | pEntry = csr_nonscan_pending_ll_next(pMac, pEntry, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 451 | LL_ACCESS_NOLOCK); |
| 452 | } |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 453 | csr_nonscan_pending_ll_unlock(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 454 | |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 455 | if (pMac->roam.configParam.enable_fatal_event) |
| 456 | cds_flush_logs(WLAN_LOG_TYPE_FATAL, |
| 457 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 458 | WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF, |
| 459 | false, |
| 460 | pMac->sme.enableSelfRecovery ? true : false); |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 461 | else |
Anurag Chouhan | 4085ff7 | 2017-10-05 18:09:56 +0530 | [diff] [blame] | 462 | cds_trigger_recovery(QDF_GET_MSG_BUFF_FAILURE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 463 | } |
| 464 | |
| 465 | /* memset to zero */ |
| 466 | if (pRetCmd) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 467 | qdf_mem_set((uint8_t *)&pRetCmd->command, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 468 | sizeof(pRetCmd->command), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 469 | qdf_mem_set((uint8_t *)&pRetCmd->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 470 | sizeof(pRetCmd->sessionId), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 471 | qdf_mem_set((uint8_t *)&pRetCmd->u, sizeof(pRetCmd->u), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 472 | } |
| 473 | |
| 474 | return pRetCmd; |
| 475 | } |
| 476 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 477 | /** |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 478 | * sme_ser_handle_active_cmd() - handle command activation callback from |
| 479 | * new serialization module |
| 480 | * @cmd: pointer to new serialization command |
| 481 | * |
| 482 | * This API is to handle command activation callback from new serialization |
| 483 | * callback |
| 484 | * |
| 485 | * Return: QDF_STATUS_SUCCESS |
| 486 | */ |
| 487 | static |
| 488 | QDF_STATUS sme_ser_handle_active_cmd(struct wlan_serialization_command *cmd) |
| 489 | { |
| 490 | tSmeCmd *sme_cmd; |
| 491 | tHalHandle hal; |
| 492 | tpAniSirGlobal mac_ctx; |
| 493 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 494 | bool do_continue; |
| 495 | |
| 496 | if (!cmd) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 497 | sme_err("No serialization command found"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 498 | return QDF_STATUS_E_FAILURE; |
| 499 | } |
| 500 | |
| 501 | hal = cds_get_context(QDF_MODULE_ID_SME); |
| 502 | mac_ctx = PMAC_STRUCT(hal); |
| 503 | if (!mac_ctx) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 504 | sme_err("No mac_ctx found"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 505 | return QDF_STATUS_E_FAILURE; |
| 506 | } |
| 507 | sme_cmd = cmd->umac_cmd; |
| 508 | if (!sme_cmd) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 509 | sme_err("No SME command found"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 510 | return QDF_STATUS_E_FAILURE; |
| 511 | } |
| 512 | |
| 513 | switch (sme_cmd->command) { |
| 514 | case eSmeCommandRoam: |
| 515 | status = csr_roam_process_command(mac_ctx, sme_cmd); |
| 516 | break; |
| 517 | case eSmeCommandWmStatusChange: |
| 518 | csr_roam_process_wm_status_change_command(mac_ctx, |
| 519 | sme_cmd); |
| 520 | break; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 521 | /* |
| 522 | * Treat standby differently here because caller may not be able |
| 523 | * to handle the failure so we do our best here |
| 524 | */ |
| 525 | case eSmeCommandEnterStandby: |
| 526 | break; |
| 527 | case eSmeCommandAddTs: |
| 528 | case eSmeCommandDelTs: |
| 529 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 530 | do_continue = qos_process_command(mac_ctx, sme_cmd); |
| 531 | if (do_continue) |
| 532 | status = QDF_STATUS_E_FAILURE; |
| 533 | #endif |
| 534 | break; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 535 | case e_sme_command_set_hw_mode: |
| 536 | csr_process_set_hw_mode(mac_ctx, sme_cmd); |
| 537 | break; |
| 538 | case e_sme_command_nss_update: |
| 539 | csr_process_nss_update_req(mac_ctx, sme_cmd); |
| 540 | break; |
| 541 | case e_sme_command_set_dual_mac_config: |
| 542 | csr_process_set_dual_mac_config(mac_ctx, sme_cmd); |
| 543 | break; |
| 544 | case e_sme_command_set_antenna_mode: |
| 545 | csr_process_set_antenna_mode(mac_ctx, sme_cmd); |
| 546 | break; |
| 547 | default: |
| 548 | /* something is wrong */ |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 549 | sme_err("unknown command %d", sme_cmd->command); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 550 | status = QDF_STATUS_E_FAILURE; |
| 551 | break; |
| 552 | } |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 553 | return status; |
| 554 | } |
| 555 | |
| 556 | QDF_STATUS sme_ser_cmd_callback(void *buf, |
| 557 | enum wlan_serialization_cb_reason reason) |
| 558 | { |
| 559 | struct wlan_serialization_command *cmd = buf; |
| 560 | tHalHandle hal; |
| 561 | tpAniSirGlobal mac_ctx; |
| 562 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 563 | tSmeCmd *sme_cmd; |
| 564 | |
| 565 | hal = cds_get_context(QDF_MODULE_ID_SME); |
| 566 | mac_ctx = PMAC_STRUCT(hal); |
| 567 | if (!mac_ctx) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 568 | sme_err("mac_ctx is null"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 569 | return QDF_STATUS_E_FAILURE; |
| 570 | } |
| 571 | /* |
| 572 | * Do not acquire lock here as sme global lock is already acquired in |
| 573 | * caller or MC thread context |
| 574 | */ |
| 575 | if (!cmd) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 576 | sme_err("serialization command is null"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 577 | return QDF_STATUS_E_FAILURE; |
| 578 | } |
| 579 | |
| 580 | switch (reason) { |
| 581 | case WLAN_SER_CB_ACTIVATE_CMD: |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 582 | sme_debug("WLAN_SER_CB_ACTIVATE_CMD callback"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 583 | status = sme_ser_handle_active_cmd(cmd); |
| 584 | break; |
| 585 | case WLAN_SER_CB_CANCEL_CMD: |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 586 | sme_debug("WLAN_SER_CB_CANCEL_CMD callback"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 587 | break; |
| 588 | case WLAN_SER_CB_RELEASE_MEM_CMD: |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 589 | sme_debug("WLAN_SER_CB_RELEASE_MEM_CMD callback"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 590 | sme_cmd = cmd->umac_cmd; |
| 591 | csr_release_command_buffer(mac_ctx, sme_cmd); |
| 592 | break; |
| 593 | case WLAN_SER_CB_ACTIVE_CMD_TIMEOUT: |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 594 | sme_debug("WLAN_SER_CB_ACTIVE_CMD_TIMEOUT callback"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 595 | break; |
| 596 | default: |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 597 | sme_debug("STOP: unknown reason code"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 598 | return QDF_STATUS_E_FAILURE; |
| 599 | } |
| 600 | return status; |
| 601 | } |
| 602 | |
| 603 | /** |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 604 | * sme_get_sessionid_from_activelist() - gets session id |
| 605 | * @mac: mac context |
| 606 | * |
| 607 | * This function is used to get session id from sme command |
| 608 | * active list |
| 609 | * |
| 610 | * Return: returns session id |
| 611 | */ |
Jeff Johnson | 49c02f9 | 2016-10-07 10:29:09 -0700 | [diff] [blame] | 612 | static uint32_t sme_get_sessionid_from_activelist(tpAniSirGlobal mac) |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 613 | { |
| 614 | tListElem *entry; |
| 615 | tSmeCmd *command; |
| 616 | uint32_t session_id = CSR_SESSION_ID_INVALID; |
| 617 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 618 | entry = csr_nonscan_active_ll_peek_head(mac, LL_ACCESS_LOCK); |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 619 | if (entry) { |
| 620 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 621 | session_id = command->sessionId; |
| 622 | } |
| 623 | |
| 624 | return session_id; |
| 625 | } |
| 626 | |
| 627 | /** |
| 628 | * sme_state_info_dump() - prints state information of sme layer |
| 629 | * @buf: buffer pointer |
| 630 | * @size: size of buffer to be filled |
| 631 | * |
| 632 | * This function is used to dump state information of sme layer |
| 633 | * |
| 634 | * Return: None |
| 635 | */ |
| 636 | static void sme_state_info_dump(char **buf_ptr, uint16_t *size) |
| 637 | { |
| 638 | uint32_t session_id, active_session_id; |
| 639 | tHalHandle hal; |
| 640 | tpAniSirGlobal mac; |
| 641 | uint16_t len = 0; |
| 642 | char *buf = *buf_ptr; |
| 643 | eCsrConnectState connect_state; |
| 644 | |
| 645 | hal = cds_get_context(QDF_MODULE_ID_SME); |
| 646 | if (hal == NULL) { |
| 647 | QDF_ASSERT(0); |
| 648 | return; |
| 649 | } |
| 650 | |
| 651 | mac = PMAC_STRUCT(hal); |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 652 | |
| 653 | active_session_id = sme_get_sessionid_from_activelist(mac); |
| 654 | if (active_session_id != CSR_SESSION_ID_INVALID) { |
| 655 | len += qdf_scnprintf(buf + len, *size - len, |
| 656 | "\n active command sessionid %d", active_session_id); |
| 657 | } |
| 658 | |
| 659 | for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) { |
| 660 | if (CSR_IS_SESSION_VALID(mac, session_id)) { |
| 661 | connect_state = |
| 662 | mac->roam.roamSession[session_id].connectState; |
| 663 | if ((eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED == |
| 664 | connect_state) |
| 665 | || (eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED == |
| 666 | connect_state)) { |
| 667 | len += qdf_scnprintf(buf + len, *size - len, |
| 668 | "\n NeighborRoamState: %d", |
| 669 | mac->roam.neighborRoamInfo[session_id]. |
| 670 | neighborRoamState); |
| 671 | len += qdf_scnprintf(buf + len, *size - len, |
| 672 | "\n RoamState: %d", mac->roam. |
| 673 | curState[session_id]); |
| 674 | len += qdf_scnprintf(buf + len, *size - len, |
| 675 | "\n RoamSubState: %d", mac->roam. |
| 676 | curSubState[session_id]); |
| 677 | len += qdf_scnprintf(buf + len, *size - len, |
| 678 | "\n ConnectState: %d", |
| 679 | connect_state); |
| 680 | } |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | *size -= len; |
| 685 | *buf_ptr += len; |
| 686 | } |
| 687 | |
| 688 | /** |
| 689 | * sme_register_debug_callback() - registration function sme layer |
| 690 | * to print sme state information |
| 691 | * |
| 692 | * Return: None |
| 693 | */ |
| 694 | static void sme_register_debug_callback(void) |
| 695 | { |
| 696 | qdf_register_debug_callback(QDF_MODULE_ID_SME, &sme_state_info_dump); |
| 697 | } |
| 698 | |
| 699 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 700 | /* Global APIs */ |
| 701 | |
| 702 | /** |
| 703 | * sme_open() - Initialze all SME modules and put them at idle state |
| 704 | * @hHal: The handle returned by mac_open |
| 705 | * |
| 706 | * The function initializes each module inside SME, PMC, CSR, etc. Upon |
| 707 | * successfully return, all modules are at idle state ready to start. |
| 708 | * smeOpen must be called before any other SME APIs can be involved. |
| 709 | * smeOpen must be called after mac_open. |
| 710 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 711 | * Return: QDF_STATUS_SUCCESS - SME is successfully initialized. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 712 | * Other status means SME is failed to be initialized |
| 713 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 714 | QDF_STATUS sme_open(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 715 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 716 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 717 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 718 | |
| 719 | pMac->sme.state = SME_STATE_STOP; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 720 | pMac->sme.currDeviceMode = QDF_STA_MODE; |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 721 | if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_create( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 722 | &pMac->sme.lkSmeGlobalLock))) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 723 | sme_err("sme_open failed init lock"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 724 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 725 | } |
| 726 | status = csr_open(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 727 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 728 | sme_err("csr_open failed, status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 729 | return status; |
| 730 | } |
| 731 | |
| 732 | status = sme_ps_open(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 733 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 734 | sme_err("sme_ps_open failed with status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 735 | return status; |
| 736 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 737 | |
| 738 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 739 | status = sme_qos_open(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 740 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 741 | sme_err("Qos open, status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 742 | return status; |
| 743 | } |
| 744 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 745 | status = init_sme_cmd_list(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 746 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 747 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 748 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 749 | status = rrm_open(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 750 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 751 | sme_err("rrm_open failed, status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 752 | return status; |
| 753 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 754 | sme_trace_init(pMac); |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 755 | sme_register_debug_callback(); |
Krunal Soni | 3378790 | 2017-08-29 11:39:28 -0700 | [diff] [blame] | 756 | wlan_serialization_legacy_init_callback(); |
| 757 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 758 | return status; |
| 759 | } |
| 760 | |
| 761 | /* |
| 762 | * sme_init_chan_list, triggers channel setup based on country code. |
| 763 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 764 | QDF_STATUS sme_init_chan_list(tHalHandle hal, uint8_t *alpha2, |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 765 | enum country_src cc_src) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 766 | { |
| 767 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 768 | |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 769 | if ((cc_src == SOURCE_USERSPACE) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 770 | (pmac->roam.configParam.fSupplicantCountryCodeHasPriority)) { |
| 771 | pmac->roam.configParam.Is11dSupportEnabled = false; |
| 772 | } |
| 773 | |
| 774 | return csr_init_chan_list(pmac, alpha2); |
| 775 | } |
| 776 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 777 | /* |
| 778 | * sme_set11dinfo() - Set the 11d information about valid channels |
| 779 | * and there power using information from nvRAM |
| 780 | * This function is called only for AP. |
| 781 | * |
| 782 | * This is a synchronous call |
| 783 | * |
| 784 | * hHal - The handle returned by mac_open. |
| 785 | * pSmeConfigParams - a pointer to a caller allocated object of |
| 786 | * typedef struct _smeConfigParams. |
| 787 | * |
| 788 | * Return QDF_STATUS_SUCCESS - SME update the config parameters successfully. |
| 789 | * |
| 790 | * Other status means SME is failed to update the config parameters. |
| 791 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 792 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 793 | QDF_STATUS sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 794 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 795 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 796 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 797 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 798 | TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0)); |
| 799 | if (NULL == pSmeConfigParams) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 800 | sme_err("SME config params empty"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 801 | return status; |
| 802 | } |
| 803 | |
| 804 | status = csr_set_channels(hHal, &pSmeConfigParams->csrConfig); |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 805 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 806 | sme_err("csr_set_channels failed with status: %d", status); |
| 807 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 808 | return status; |
| 809 | } |
| 810 | |
| 811 | /** |
| 812 | * sme_set_scan_disable() - Dynamically enable/disable scan |
| 813 | * @h_hal: Handle to HAL |
| 814 | * |
| 815 | * This command gives the user an option to dynamically |
| 816 | * enable or disable scans. |
| 817 | * |
| 818 | * Return: None |
| 819 | */ |
| 820 | void sme_set_scan_disable(tHalHandle h_hal, int value) |
| 821 | { |
| 822 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(h_hal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 823 | |
Sandeep Puligilla | 24b7aa7 | 2017-10-13 18:05:14 -0700 | [diff] [blame] | 824 | sme_info("scan disable %d", value); |
Abhishek Singh | caebce0 | 2017-10-12 11:07:57 +0530 | [diff] [blame] | 825 | ucfg_scan_set_enable(mac_ctx->psoc, !value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 826 | } |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 827 | /* |
| 828 | * sme_get_soft_ap_domain() - Get the current regulatory domain of softAp. |
| 829 | * This is a synchronous call |
| 830 | * |
| 831 | * hHal - The handle returned by HostapdAdapter. |
| 832 | * v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp. |
| 833 | * Return QDF_STATUS_SUCCESS - SME successfully completed the request. |
| 834 | * Other status means, failed to get the current regulatory domain. |
| 835 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 836 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 837 | QDF_STATUS sme_get_soft_ap_domain(tHalHandle hHal, v_REGDOMAIN_t |
| 838 | *domainIdSoftAp) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 839 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 840 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 841 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 842 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 843 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 844 | TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, |
| 845 | NO_SESSION, 0)); |
| 846 | if (NULL == domainIdSoftAp) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 847 | sme_err("Uninitialized domain Id"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 848 | return status; |
| 849 | } |
| 850 | |
| 851 | *domainIdSoftAp = pMac->scan.domainIdCurrent; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 852 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 853 | |
| 854 | return status; |
| 855 | } |
| 856 | |
Krunal Soni | e353194 | 2016-04-12 17:43:53 -0700 | [diff] [blame] | 857 | /** |
| 858 | * sme_update_fine_time_measurement_capab() - Update the FTM capabitlies from |
| 859 | * incoming val |
| 860 | * @hal: Handle for Hal layer |
| 861 | * @val: New FTM capability value |
| 862 | * |
| 863 | * Return: None |
| 864 | */ |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 865 | void sme_update_fine_time_measurement_capab(tHalHandle hal, uint8_t session_id, |
| 866 | uint32_t val) |
Krunal Soni | e353194 | 2016-04-12 17:43:53 -0700 | [diff] [blame] | 867 | { |
| 868 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 869 | |
Naveen Rawat | d2657be | 2017-10-10 14:31:23 -0700 | [diff] [blame] | 870 | ucfg_wifi_pos_set_ftm_cap(mac_ctx->psoc, val); |
Krunal Soni | e353194 | 2016-04-12 17:43:53 -0700 | [diff] [blame] | 871 | |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 872 | if (!val) { |
Krunal Soni | e353194 | 2016-04-12 17:43:53 -0700 | [diff] [blame] | 873 | mac_ctx->rrm.rrmPEContext.rrmEnabledCaps.fine_time_meas_rpt = 0; |
| 874 | ((tpRRMCaps)mac_ctx->rrm.rrmSmeContext. |
| 875 | rrmConfig.rm_capability)->fine_time_meas_rpt = 0; |
| 876 | } else { |
| 877 | mac_ctx->rrm.rrmPEContext.rrmEnabledCaps.fine_time_meas_rpt = 1; |
| 878 | ((tpRRMCaps)mac_ctx->rrm.rrmSmeContext. |
| 879 | rrmConfig.rm_capability)->fine_time_meas_rpt = 1; |
| 880 | } |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 881 | |
| 882 | /* Inform this RRM IE change to FW */ |
| 883 | csr_roam_offload_scan(mac_ctx, session_id, |
| 884 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 885 | REASON_CONNECT_IES_CHANGED); |
Krunal Soni | e353194 | 2016-04-12 17:43:53 -0700 | [diff] [blame] | 886 | } |
| 887 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 888 | /* |
| 889 | * sme_update_config() - Change configurations for all SME moduels |
| 890 | * The function updates some configuration for modules in SME, CSR, etc |
| 891 | * during SMEs close open sequence. |
| 892 | * Modules inside SME apply the new configuration at the next transaction. |
| 893 | * This is a synchronous call |
| 894 | * |
| 895 | * hHal - The handle returned by mac_open. |
| 896 | * pSmeConfigParams - a pointer to a caller allocated object of |
| 897 | * typedef struct _smeConfigParams. |
| 898 | * Return QDF_STATUS_SUCCESS - SME update the config parameters successfully. |
| 899 | * Other status means SME is failed to update the config parameters. |
| 900 | */ |
| 901 | QDF_STATUS sme_update_config(tHalHandle hHal, tpSmeConfigParams |
| 902 | pSmeConfigParams) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 903 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 904 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 905 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 906 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 907 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 908 | TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, |
| 909 | 0)); |
| 910 | if (NULL == pSmeConfigParams) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 911 | sme_err("SME config params empty"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 912 | return status; |
| 913 | } |
| 914 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 915 | status = csr_change_default_config_param(pMac, &pSmeConfigParams-> |
| 916 | csrConfig); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 917 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 918 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 919 | sme_err("csr_change_default_config_param failed status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 920 | status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 921 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 922 | status = rrm_change_default_config_param(hHal, &pSmeConfigParams-> |
| 923 | rrmConfig); |
| 924 | |
| 925 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 926 | sme_err("rrm_change_default_config_param failed status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 927 | status); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 928 | |
| 929 | /* For SOC, CFG is set before start We don't want to apply global CFG |
| 930 | * in connect state because that may cause some side affect |
| 931 | */ |
| 932 | if (csr_is_all_session_disconnected(pMac)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 933 | csr_set_global_cfgs(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 934 | |
| 935 | /* |
| 936 | * If scan offload is enabled then lim has allow the sending of |
| 937 | * scan request to firmware even in powersave mode. The firmware has |
| 938 | * to take care of exiting from power save mode |
| 939 | */ |
| 940 | status = sme_cfg_set_int(hHal, WNI_CFG_SCAN_IN_POWERSAVE, true); |
| 941 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 942 | if (QDF_STATUS_SUCCESS != status) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 943 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 944 | "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CFG"); |
Kapil Gupta | 4f0c0c1 | 2017-02-07 15:21:15 +0530 | [diff] [blame] | 945 | |
| 946 | pMac->snr_monitor_enabled = pSmeConfigParams->snr_monitor_enabled; |
| 947 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 948 | return status; |
| 949 | } |
| 950 | |
| 951 | /** |
Abhishek Singh | 158fe25 | 2017-03-23 11:09:34 +0530 | [diff] [blame] | 952 | * sme_update_scan_roam_params() - Update the scan roaming params |
| 953 | * @mac_ctx: mac ctx |
| 954 | * |
| 955 | * Return: void. |
| 956 | */ |
| 957 | static void sme_update_scan_roam_params(tpAniSirGlobal mac_ctx) |
| 958 | { |
| 959 | struct roam_filter_params scan_params = {0}; |
| 960 | struct roam_ext_params *roam_params_src; |
| 961 | uint8_t i; |
| 962 | QDF_STATUS status; |
| 963 | |
| 964 | roam_params_src = &mac_ctx->roam.configParam.roam_params; |
| 965 | |
| 966 | scan_params.num_bssid_avoid_list = |
| 967 | roam_params_src->num_bssid_avoid_list; |
Abhishek Singh | 158fe25 | 2017-03-23 11:09:34 +0530 | [diff] [blame] | 968 | |
| 969 | if (scan_params.num_bssid_avoid_list > |
| 970 | MAX_AVOID_LIST_BSSID) |
| 971 | scan_params.num_bssid_avoid_list = |
| 972 | MAX_AVOID_LIST_BSSID; |
| 973 | |
| 974 | for (i = 0; i < scan_params.num_bssid_avoid_list; i++) { |
| 975 | qdf_copy_macaddr(&scan_params.bssid_avoid_list[i], |
| 976 | &roam_params_src->bssid_avoid_list[i]); |
| 977 | } |
| 978 | |
| 979 | status = ucfg_scan_update_roam_params(mac_ctx->psoc, &scan_params); |
| 980 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 981 | sme_err("ailed to update scan roam params with status=%d", |
Abhishek Singh | 158fe25 | 2017-03-23 11:09:34 +0530 | [diff] [blame] | 982 | status); |
| 983 | } |
| 984 | |
| 985 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 986 | * sme_update_roam_params() - Store/Update the roaming params |
| 987 | * @hal: Handle for Hal layer |
| 988 | * @session_id: SME Session ID |
| 989 | * @roam_params_src: The source buffer to copy |
| 990 | * @update_param: Type of parameter to be updated |
| 991 | * |
| 992 | * Return: Return the status of the updation. |
| 993 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 994 | QDF_STATUS sme_update_roam_params(tHalHandle hal, |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 995 | uint8_t session_id, struct roam_ext_params *roam_params_src, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 996 | int update_param) |
| 997 | { |
| 998 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 999 | struct roam_ext_params *roam_params_dst; |
| 1000 | uint8_t i; |
| 1001 | |
| 1002 | roam_params_dst = &mac_ctx->roam.configParam.roam_params; |
| 1003 | switch (update_param) { |
| 1004 | case REASON_ROAM_EXT_SCAN_PARAMS_CHANGED: |
| 1005 | roam_params_dst->raise_rssi_thresh_5g = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1006 | roam_params_src->raise_rssi_thresh_5g; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1007 | roam_params_dst->drop_rssi_thresh_5g = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1008 | roam_params_src->drop_rssi_thresh_5g; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1009 | roam_params_dst->raise_factor_5g = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1010 | roam_params_src->raise_factor_5g; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1011 | roam_params_dst->drop_factor_5g = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1012 | roam_params_src->drop_factor_5g; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1013 | roam_params_dst->max_raise_rssi_5g = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1014 | roam_params_src->max_raise_rssi_5g; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1015 | roam_params_dst->max_drop_rssi_5g = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1016 | roam_params_src->max_drop_rssi_5g; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1017 | roam_params_dst->alert_rssi_threshold = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1018 | roam_params_src->alert_rssi_threshold; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1019 | roam_params_dst->is_5g_pref_enabled = true; |
| 1020 | break; |
| 1021 | case REASON_ROAM_SET_SSID_ALLOWED: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1022 | qdf_mem_set(&roam_params_dst->ssid_allowed_list, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1023 | sizeof(tSirMacSSid) * MAX_SSID_ALLOWED_LIST); |
| 1024 | roam_params_dst->num_ssid_allowed_list = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1025 | roam_params_src->num_ssid_allowed_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1026 | for (i = 0; i < roam_params_dst->num_ssid_allowed_list; i++) { |
| 1027 | roam_params_dst->ssid_allowed_list[i].length = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1028 | roam_params_src->ssid_allowed_list[i].length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1029 | qdf_mem_copy(roam_params_dst->ssid_allowed_list[i].ssId, |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1030 | roam_params_src->ssid_allowed_list[i].ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1031 | roam_params_dst->ssid_allowed_list[i].length); |
| 1032 | } |
| 1033 | break; |
| 1034 | case REASON_ROAM_SET_FAVORED_BSSID: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1035 | qdf_mem_set(&roam_params_dst->bssid_favored, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1036 | sizeof(tSirMacAddr) * MAX_BSSID_FAVORED); |
| 1037 | roam_params_dst->num_bssid_favored = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1038 | roam_params_src->num_bssid_favored; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1039 | for (i = 0; i < roam_params_dst->num_bssid_favored; i++) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1040 | qdf_mem_copy(&roam_params_dst->bssid_favored[i], |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1041 | &roam_params_src->bssid_favored[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1042 | sizeof(tSirMacAddr)); |
| 1043 | roam_params_dst->bssid_favored_factor[i] = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1044 | roam_params_src->bssid_favored_factor[i]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1045 | } |
| 1046 | break; |
| 1047 | case REASON_ROAM_SET_BLACKLIST_BSSID: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1048 | qdf_mem_set(&roam_params_dst->bssid_avoid_list, 0, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1049 | QDF_MAC_ADDR_SIZE * MAX_BSSID_AVOID_LIST); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1050 | roam_params_dst->num_bssid_avoid_list = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1051 | roam_params_src->num_bssid_avoid_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1052 | for (i = 0; i < roam_params_dst->num_bssid_avoid_list; i++) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1053 | qdf_copy_macaddr(&roam_params_dst->bssid_avoid_list[i], |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1054 | &roam_params_src->bssid_avoid_list[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1055 | } |
| 1056 | break; |
| 1057 | case REASON_ROAM_GOOD_RSSI_CHANGED: |
| 1058 | roam_params_dst->good_rssi_roam = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1059 | roam_params_src->good_rssi_roam; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1060 | break; |
| 1061 | default: |
| 1062 | break; |
| 1063 | } |
| 1064 | csr_roam_offload_scan(mac_ctx, session_id, ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 1065 | update_param); |
Abhishek Singh | 158fe25 | 2017-03-23 11:09:34 +0530 | [diff] [blame] | 1066 | |
| 1067 | sme_update_scan_roam_params(mac_ctx); |
| 1068 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1069 | return 0; |
| 1070 | } |
| 1071 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1072 | /* |
| 1073 | * sme_process_ready_to_suspend() - |
| 1074 | * On getting ready to suspend indication, this function calls |
| 1075 | * callback registered (HDD callbacks) with SME to inform ready |
| 1076 | * to suspend indication. |
| 1077 | * |
| 1078 | * hHal - Handle returned by mac_open. |
| 1079 | * pReadyToSuspend - Parameter received along with ready to suspend |
| 1080 | * indication from WMA. |
| 1081 | * Return: None |
| 1082 | */ |
Jeff Johnson | 49c02f9 | 2016-10-07 10:29:09 -0700 | [diff] [blame] | 1083 | static void sme_process_ready_to_suspend(tHalHandle hHal, |
| 1084 | tpSirReadyToSuspendInd pReadyToSuspend) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1085 | { |
| 1086 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1087 | |
| 1088 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1089 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1090 | "%s: pMac is null", __func__); |
| 1091 | return; |
| 1092 | } |
| 1093 | |
| 1094 | if (NULL != pMac->readyToSuspendCallback) { |
| 1095 | pMac->readyToSuspendCallback(pMac->readyToSuspendContext, |
| 1096 | pReadyToSuspend->suspended); |
| 1097 | pMac->readyToSuspendCallback = NULL; |
| 1098 | } |
| 1099 | } |
| 1100 | |
| 1101 | #ifdef WLAN_FEATURE_EXTWOW_SUPPORT |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1102 | |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 1103 | /** |
| 1104 | * sme_process_ready_to_ext_wow() - inform ready to ExtWoW indication. |
| 1105 | * @hHal - Handle returned by mac_open. |
| 1106 | * @pReadyToExtWoW - Parameter received along with ready to Ext WoW |
| 1107 | * indication from WMA. |
| 1108 | * |
| 1109 | * On getting ready to Ext WoW indication, this function calls callback |
| 1110 | * registered (HDD callback)with SME to inform ready to ExtWoW indication. |
| 1111 | * |
| 1112 | * Return: None |
| 1113 | */ |
Jeff Johnson | 49c02f9 | 2016-10-07 10:29:09 -0700 | [diff] [blame] | 1114 | static void sme_process_ready_to_ext_wow(tHalHandle hHal, |
| 1115 | tpSirReadyToExtWoWInd pReadyToExtWoW) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1116 | { |
| 1117 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1118 | |
| 1119 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1120 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1121 | "%s: pMac is null", __func__); |
| 1122 | return; |
| 1123 | } |
| 1124 | |
| 1125 | if (NULL != pMac->readyToExtWoWCallback) { |
| 1126 | pMac->readyToExtWoWCallback(pMac->readyToExtWoWContext, |
| 1127 | pReadyToExtWoW->status); |
| 1128 | pMac->readyToExtWoWCallback = NULL; |
| 1129 | pMac->readyToExtWoWContext = NULL; |
| 1130 | } |
| 1131 | |
| 1132 | } |
| 1133 | #endif |
| 1134 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1135 | /* |
| 1136 | * sme_hdd_ready_ind() - SME sends eWNI_SME_SYS_READY_IND to PE to inform |
| 1137 | * that the NIC is ready tio run. |
| 1138 | * The function is called by HDD at the end of initialization stage so PE/HAL |
| 1139 | * can enable the NIC to running state. |
| 1140 | * This is a synchronous call |
| 1141 | * |
| 1142 | * @hHal - The handle returned by mac_open. |
| 1143 | * Return QDF_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE |
| 1144 | * successfully. |
| 1145 | * Other status means SME failed to send the message to PE. |
| 1146 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1147 | QDF_STATUS sme_hdd_ready_ind(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1148 | { |
Abhishek Singh | de410b7 | 2017-05-22 15:25:39 +0530 | [diff] [blame] | 1149 | tSirSmeReadyReq *msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1150 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1151 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1152 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1153 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1154 | TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0)); |
| 1155 | do { |
| 1156 | |
Abhishek Singh | de410b7 | 2017-05-22 15:25:39 +0530 | [diff] [blame] | 1157 | msg = qdf_mem_malloc(sizeof(*msg)); |
| 1158 | if (!msg) { |
| 1159 | sme_err("Memory allocation failed! for msg"); |
| 1160 | return QDF_STATUS_E_NOMEM; |
| 1161 | } |
| 1162 | msg->messageType = eWNI_SME_SYS_READY_IND; |
| 1163 | msg->length = sizeof(*msg); |
Abhishek Singh | de410b7 | 2017-05-22 15:25:39 +0530 | [diff] [blame] | 1164 | msg->csr_roam_synch_cb = csr_roam_synch_callback; |
Sandeep Puligilla | 1426d61 | 2017-04-12 18:22:06 -0700 | [diff] [blame] | 1165 | msg->sme_msg_cb = sme_process_msg_callback; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1166 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1167 | if (eSIR_FAILURE != u_mac_post_ctrl_msg(hHal, (tSirMbMsg *) |
| 1168 | msg)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1169 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1170 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1171 | sme_err("u_mac_post_ctrl_msg failed to send eWNI_SME_SYS_READY_IND"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1172 | break; |
| 1173 | } |
| 1174 | |
| 1175 | status = csr_ready(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1176 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1177 | sme_err("csr_ready failed with status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1178 | break; |
| 1179 | } |
| 1180 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1181 | pMac->sme.state = SME_STATE_READY; |
| 1182 | } while (0); |
| 1183 | |
| 1184 | return status; |
| 1185 | } |
| 1186 | |
Tushnim Bhattacharyya | c3c375e | 2017-08-04 23:39:55 -0700 | [diff] [blame] | 1187 | QDF_STATUS sme_get_valid_channels(uint8_t *chan_list, uint32_t *list_len) |
| 1188 | { |
| 1189 | tpAniSirGlobal mac_ctx = sme_get_mac_context(); |
| 1190 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1191 | |
| 1192 | if (NULL == mac_ctx) { |
| 1193 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 1194 | FL("Invalid MAC context")); |
| 1195 | return QDF_STATUS_E_FAILURE; |
| 1196 | } |
| 1197 | |
| 1198 | if (eSIR_SUCCESS != wlan_cfg_get_str(mac_ctx, |
| 1199 | WNI_CFG_VALID_CHANNEL_LIST, chan_list, list_len)) |
| 1200 | status = QDF_STATUS_E_INVAL; |
| 1201 | |
| 1202 | return status; |
| 1203 | } |
| 1204 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1205 | /* |
| 1206 | * sme_start() - Put all SME modules at ready state. |
| 1207 | * The function starts each module in SME, PMC, CSR, etc. . Upon |
| 1208 | * successfully return, all modules are ready to run. |
| 1209 | * This is a synchronous call |
| 1210 | * |
| 1211 | * hHal - The handle returned by mac_open. |
| 1212 | * Return QDF_STATUS_SUCCESS - SME is ready. |
| 1213 | * Other status means SME is failed to start |
| 1214 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1215 | QDF_STATUS sme_start(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1216 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1217 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1218 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 1219 | struct policy_mgr_sme_cbacks sme_cbacks; |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 1220 | struct spectral_legacy_cbacks spectral_cb; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1221 | |
| 1222 | do { |
| 1223 | status = csr_start(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1224 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1225 | sme_err("csr_start failed status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1226 | break; |
| 1227 | } |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 1228 | sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss; |
Tushnim Bhattacharyya | c3c375e | 2017-08-04 23:39:55 -0700 | [diff] [blame] | 1229 | sme_cbacks.sme_get_valid_channels = sme_get_valid_channels; |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 1230 | sme_cbacks.sme_nss_update_request = sme_nss_update_request; |
| 1231 | sme_cbacks.sme_pdev_set_hw_mode = sme_pdev_set_hw_mode; |
| 1232 | sme_cbacks.sme_pdev_set_pcl = sme_pdev_set_pcl; |
| 1233 | sme_cbacks.sme_soc_set_dual_mac_config = |
| 1234 | sme_soc_set_dual_mac_config; |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 1235 | sme_cbacks.sme_change_mcc_beacon_interval = |
| 1236 | sme_change_mcc_beacon_interval; |
| 1237 | sme_cbacks.sme_get_ap_channel_from_scan = |
| 1238 | sme_get_ap_channel_from_scan; |
| 1239 | sme_cbacks.sme_scan_result_purge = sme_scan_result_purge; |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 1240 | status = policy_mgr_register_sme_cb(pMac->psoc, &sme_cbacks); |
| 1241 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 1242 | sme_err("Failed to register sme cb with Policy Manager: %d", |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 1243 | status); |
| 1244 | break; |
| 1245 | } |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 1246 | spectral_cb.vdev_get_chan_freq = sme_get_oper_chan_freq; |
| 1247 | spectral_cb.vdev_get_ch_width = sme_get_oper_ch_width; |
| 1248 | spectral_cb.vdev_get_sec20chan_freq_mhz = sme_get_sec20chan_freq_mhz; |
| 1249 | spectral_register_legacy_cb(pMac->psoc, &spectral_cb); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1250 | pMac->sme.state = SME_STATE_START; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1251 | |
Sandeep Puligilla | 66d09c4 | 2017-09-06 17:10:27 -0700 | [diff] [blame] | 1252 | /* START RRM */ |
| 1253 | status = rrm_start(pMac); |
| 1254 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1255 | sme_err("Failed to start RRM"); |
| 1256 | break; |
| 1257 | } |
| 1258 | } while (0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1259 | return status; |
| 1260 | } |
| 1261 | |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 1262 | static QDF_STATUS dfs_msg_processor(tpAniSirGlobal mac, |
| 1263 | struct scheduler_msg *msg) |
| 1264 | { |
| 1265 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1266 | struct csr_roam_info roam_info = { 0 }; |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 1267 | tSirSmeCSAIeTxCompleteRsp *csa_ie_tx_complete_rsp; |
| 1268 | uint32_t session_id = 0; |
| 1269 | eRoamCmdStatus roam_status; |
| 1270 | eCsrRoamResult roam_result; |
| 1271 | |
| 1272 | switch (msg->type) { |
| 1273 | case eWNI_SME_DFS_RADAR_FOUND: |
| 1274 | { |
| 1275 | session_id = msg->bodyval; |
| 1276 | roam_status = eCSR_ROAM_DFS_RADAR_IND; |
| 1277 | roam_result = eCSR_ROAM_RESULT_DFS_RADAR_FOUND_IND; |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1278 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 1279 | "sapdfs: Radar indication event occurred"); |
| 1280 | break; |
| 1281 | } |
| 1282 | case eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND: |
| 1283 | { |
| 1284 | csa_ie_tx_complete_rsp = |
| 1285 | (tSirSmeCSAIeTxCompleteRsp *) msg->bodyptr; |
| 1286 | if (!csa_ie_tx_complete_rsp) { |
| 1287 | sme_err("eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND null msg"); |
| 1288 | return QDF_STATUS_E_FAILURE; |
| 1289 | } |
| 1290 | session_id = csa_ie_tx_complete_rsp->sessionId; |
| 1291 | roam_status = eCSR_ROAM_DFS_CHAN_SW_NOTIFY; |
| 1292 | roam_result = eCSR_ROAM_RESULT_DFS_CHANSW_UPDATE_SUCCESS; |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1293 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 1294 | "eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND session=%d", |
| 1295 | session_id); |
| 1296 | break; |
| 1297 | } |
| 1298 | case eWNI_SME_DFS_CAC_COMPLETE: |
| 1299 | { |
| 1300 | session_id = msg->bodyval; |
| 1301 | roam_status = eCSR_ROAM_CAC_COMPLETE_IND; |
| 1302 | roam_result = eCSR_ROAM_RESULT_CAC_END_IND; |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1303 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 1304 | "sapdfs: Received eWNI_SME_DFS_CAC_COMPLETE vdevid%d", |
| 1305 | session_id); |
| 1306 | break; |
| 1307 | } |
| 1308 | default: |
| 1309 | { |
| 1310 | sme_err("Invalid DFS message: 0x%x", msg->type); |
| 1311 | status = QDF_STATUS_E_FAILURE; |
| 1312 | return status; |
| 1313 | } |
| 1314 | } |
| 1315 | |
| 1316 | /* Indicate Radar Event to SAP */ |
| 1317 | csr_roam_call_callback(mac, session_id, &roam_info, 0, |
| 1318 | roam_status, roam_result); |
| 1319 | return status; |
| 1320 | } |
| 1321 | |
| 1322 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1323 | #ifdef WLAN_FEATURE_11W |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1324 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1325 | * Handle the unprotected management frame indication from LIM and |
| 1326 | * forward it to HDD. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1327 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1328 | QDF_STATUS sme_unprotected_mgmt_frm_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1329 | tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm) |
| 1330 | { |
| 1331 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1332 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1333 | struct csr_roam_info roam_info = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1334 | uint32_t SessionId = pSmeMgmtFrm->sessionId; |
| 1335 | |
Jeff Johnson | eddf544 | 2017-10-04 10:55:53 -0700 | [diff] [blame] | 1336 | roam_info.nFrameLength = pSmeMgmtFrm->frameLen; |
| 1337 | roam_info.pbFrames = pSmeMgmtFrm->frameBuf; |
| 1338 | roam_info.frameType = pSmeMgmtFrm->frameType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1339 | |
| 1340 | /* forward the mgmt frame to HDD */ |
Jeff Johnson | eddf544 | 2017-10-04 10:55:53 -0700 | [diff] [blame] | 1341 | csr_roam_call_callback(pMac, SessionId, &roam_info, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1342 | eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0); |
| 1343 | |
| 1344 | return status; |
| 1345 | } |
| 1346 | #endif |
| 1347 | |
Kapil Gupta | 8878ad9 | 2017-02-13 11:56:04 +0530 | [diff] [blame] | 1348 | QDF_STATUS sme_update_new_channel_event(tHalHandle hal, uint8_t session_id) |
| 1349 | { |
| 1350 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1351 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1352 | struct csr_roam_info *roamInfo; |
Kapil Gupta | 8878ad9 | 2017-02-13 11:56:04 +0530 | [diff] [blame] | 1353 | eRoamCmdStatus roamStatus; |
| 1354 | eCsrRoamResult roamResult; |
| 1355 | |
| 1356 | roamInfo = qdf_mem_malloc(sizeof(*roamInfo)); |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 1357 | if (!roamInfo) { |
| 1358 | sme_err("mem alloc failed for roam info"); |
| 1359 | return QDF_STATUS_E_FAILURE; |
| 1360 | } |
Kapil Gupta | 8878ad9 | 2017-02-13 11:56:04 +0530 | [diff] [blame] | 1361 | roamInfo->dfs_event.sessionId = session_id; |
| 1362 | |
| 1363 | roamStatus = eCSR_ROAM_CHANNEL_COMPLETE_IND; |
| 1364 | roamResult = eCSR_ROAM_RESULT_DFS_RADAR_FOUND_IND; |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1365 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Kapil Gupta | 8878ad9 | 2017-02-13 11:56:04 +0530 | [diff] [blame] | 1366 | "sapdfs: Updated new channel event"); |
| 1367 | |
| 1368 | /* Indicate channel Event to SAP */ |
| 1369 | csr_roam_call_callback(mac, session_id, roamInfo, 0, |
| 1370 | roamStatus, roamResult); |
| 1371 | |
| 1372 | qdf_mem_free(roamInfo); |
| 1373 | return status; |
| 1374 | } |
| 1375 | |
| 1376 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1377 | /** |
| 1378 | * sme_extended_change_channel_ind()- function to indicate ECSA |
| 1379 | * action frame is received in lim to SAP |
| 1380 | * @mac_ctx: pointer to global mac structure |
| 1381 | * @msg_buf: contain new channel and session id. |
| 1382 | * |
| 1383 | * This function is called to post ECSA action frame |
| 1384 | * receive event to SAP. |
| 1385 | * |
| 1386 | * Return: success if msg indicated to SAP else return failure |
| 1387 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1388 | static QDF_STATUS sme_extended_change_channel_ind(tpAniSirGlobal mac_ctx, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1389 | void *msg_buf) |
| 1390 | { |
| 1391 | struct sir_sme_ext_cng_chan_ind *ext_chan_ind; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1392 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1393 | uint32_t session_id = 0; |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1394 | struct csr_roam_info roamInfo = {0}; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1395 | eRoamCmdStatus roam_status; |
| 1396 | eCsrRoamResult roam_result; |
| 1397 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1398 | ext_chan_ind = msg_buf; |
| 1399 | if (NULL == ext_chan_ind) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1400 | sme_err("ext_chan_ind is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1401 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1402 | } |
| 1403 | session_id = ext_chan_ind->session_id; |
| 1404 | roamInfo.target_channel = ext_chan_ind->new_channel; |
| 1405 | roam_status = eCSR_ROAM_EXT_CHG_CHNL_IND; |
| 1406 | roam_result = eCSR_ROAM_EXT_CHG_CHNL_UPDATE_IND; |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1407 | sme_debug("sapdfs: Received eWNI_SME_EXT_CHANGE_CHANNEL_IND for session id [%d]", |
| 1408 | session_id); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1409 | |
| 1410 | /* Indicate Ext Channel Change event to SAP */ |
| 1411 | csr_roam_call_callback(mac_ctx, session_id, &roamInfo, 0, |
| 1412 | roam_status, roam_result); |
| 1413 | return status; |
| 1414 | } |
| 1415 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1416 | #ifdef FEATURE_WLAN_ESE |
| 1417 | /** |
| 1418 | * sme_update_is_ese_feature_enabled() - enable/disable ESE support at runtime |
| 1419 | * @hHal: HAL handle |
| 1420 | * @sessionId: session id |
| 1421 | * @isEseIniFeatureEnabled: ese ini enabled |
| 1422 | * |
| 1423 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 1424 | * isEseIniFeatureEnabled. This is a synchronous call |
| 1425 | * |
| 1426 | * Return: QDF_STATUS enumeration |
| 1427 | */ |
| 1428 | QDF_STATUS sme_update_is_ese_feature_enabled(tHalHandle hHal, |
| 1429 | uint8_t sessionId, const bool isEseIniFeatureEnabled) |
| 1430 | { |
| 1431 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1432 | |
| 1433 | if (pMac->roam.configParam.isEseIniFeatureEnabled == |
| 1434 | isEseIniFeatureEnabled) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1435 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1436 | "%s: ESE Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", |
| 1437 | __func__, |
| 1438 | pMac->roam.configParam.isEseIniFeatureEnabled, |
| 1439 | isEseIniFeatureEnabled); |
| 1440 | return QDF_STATUS_SUCCESS; |
| 1441 | } |
| 1442 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1443 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1444 | "%s: EseEnabled is changed from %d to %d", __func__, |
| 1445 | pMac->roam.configParam.isEseIniFeatureEnabled, |
| 1446 | isEseIniFeatureEnabled); |
| 1447 | pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled; |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 1448 | csr_neighbor_roam_update_fast_roaming_enabled( |
| 1449 | pMac, sessionId, isEseIniFeatureEnabled); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1450 | |
| 1451 | if (true == isEseIniFeatureEnabled) |
| 1452 | sme_update_fast_transition_enabled(hHal, true); |
| 1453 | |
| 1454 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 1455 | csr_roam_offload_scan(pMac, sessionId, |
| 1456 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 1457 | REASON_ESE_INI_CFG_CHANGED); |
| 1458 | |
| 1459 | return QDF_STATUS_SUCCESS; |
| 1460 | } |
| 1461 | |
| 1462 | /** |
| 1463 | * sme_set_plm_request() - set plm request |
| 1464 | * @hHal: HAL handle |
| 1465 | * @pPlmReq: Pointer to input plm request |
| 1466 | * |
| 1467 | * Return: QDF_STATUS enumeration |
| 1468 | */ |
| 1469 | QDF_STATUS sme_set_plm_request(tHalHandle hHal, tpSirPlmReq pPlmReq) |
| 1470 | { |
| 1471 | QDF_STATUS status; |
| 1472 | bool ret = false; |
| 1473 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Varun Reddy Yeturu | 87c8ad8 | 2017-10-03 17:48:12 -0700 | [diff] [blame] | 1474 | uint8_t ch_list[WNI_CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1475 | uint8_t count, valid_count = 0; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1476 | struct scheduler_msg msg = {0}; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 1477 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, |
| 1478 | pPlmReq->sessionId); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1479 | |
| 1480 | status = sme_acquire_global_lock(&pMac->sme); |
| 1481 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 1482 | return status; |
| 1483 | |
| 1484 | if (!pSession) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1485 | sme_err("session %d not found", pPlmReq->sessionId); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1486 | sme_release_global_lock(&pMac->sme); |
| 1487 | return QDF_STATUS_E_FAILURE; |
| 1488 | } |
| 1489 | |
| 1490 | if (!pSession->sessionActive) { |
| 1491 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 1492 | FL("Invalid Sessionid")); |
| 1493 | sme_release_global_lock(&pMac->sme); |
| 1494 | return QDF_STATUS_E_FAILURE; |
| 1495 | } |
| 1496 | |
| 1497 | if (!pPlmReq->enable) |
| 1498 | goto send_plm_start; |
| 1499 | /* validating channel numbers */ |
| 1500 | for (count = 0; count < pPlmReq->plmNumCh; count++) { |
| 1501 | ret = csr_is_supported_channel(pMac, pPlmReq->plmChList[count]); |
| 1502 | if (ret && pPlmReq->plmChList[count] > 14) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 1503 | if (CHANNEL_STATE_DFS == wlan_reg_get_channel_state( |
| 1504 | pMac->pdev, |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1505 | pPlmReq->plmChList[count])) { |
| 1506 | /* DFS channel is provided, no PLM bursts can be |
| 1507 | * transmitted. Ignoring these channels. |
| 1508 | */ |
| 1509 | QDF_TRACE(QDF_MODULE_ID_SME, |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1510 | QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1511 | FL("DFS channel %d ignored for PLM"), |
| 1512 | pPlmReq->plmChList[count]); |
| 1513 | continue; |
| 1514 | } |
| 1515 | } else if (!ret) { |
| 1516 | /* Not supported, ignore the channel */ |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1517 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1518 | FL("Unsupported channel %d ignored for PLM"), |
| 1519 | pPlmReq->plmChList[count]); |
| 1520 | continue; |
| 1521 | } |
| 1522 | ch_list[valid_count] = pPlmReq->plmChList[count]; |
| 1523 | valid_count++; |
| 1524 | } /* End of for () */ |
| 1525 | |
| 1526 | /* Copying back the valid channel list to plm struct */ |
| 1527 | qdf_mem_set((void *)pPlmReq->plmChList, |
| 1528 | pPlmReq->plmNumCh, 0); |
| 1529 | if (valid_count) |
| 1530 | qdf_mem_copy(pPlmReq->plmChList, ch_list, |
| 1531 | valid_count); |
| 1532 | /* All are invalid channels, FW need to send the PLM |
| 1533 | * report with "incapable" bit set. |
| 1534 | */ |
| 1535 | pPlmReq->plmNumCh = valid_count; |
| 1536 | |
| 1537 | send_plm_start: |
| 1538 | /* PLM START */ |
| 1539 | msg.type = WMA_SET_PLM_REQ; |
| 1540 | msg.reserved = 0; |
| 1541 | msg.bodyptr = pPlmReq; |
| 1542 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 1543 | if (!QDF_IS_STATUS_SUCCESS(scheduler_post_msg(QDF_MODULE_ID_WMA, |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1544 | &msg))) { |
| 1545 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 1546 | FL("Not able to post WMA_SET_PLM_REQ to WMA")); |
| 1547 | sme_release_global_lock(&pMac->sme); |
| 1548 | return QDF_STATUS_E_FAILURE; |
| 1549 | } |
| 1550 | |
| 1551 | sme_release_global_lock(&pMac->sme); |
| 1552 | return status; |
| 1553 | } |
| 1554 | |
| 1555 | /** |
| 1556 | * sme_tsm_ie_ind() - sme tsm ie indication |
| 1557 | * @hHal: HAL handle |
| 1558 | * @pSmeTsmIeInd: Pointer to tsm ie indication |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1559 | * |
| 1560 | * Handle the tsm ie indication from LIM and forward it to HDD. |
| 1561 | * |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1562 | * Return: QDF_STATUS enumeration |
| 1563 | */ |
| 1564 | static QDF_STATUS sme_tsm_ie_ind(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1565 | { |
| 1566 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1567 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1568 | struct csr_roam_info roam_info = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1569 | uint32_t SessionId = pSmeTsmIeInd->sessionId; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1570 | |
Jeff Johnson | eddf544 | 2017-10-04 10:55:53 -0700 | [diff] [blame] | 1571 | roam_info.tsmIe.tsid = pSmeTsmIeInd->tsmIe.tsid; |
| 1572 | roam_info.tsmIe.state = pSmeTsmIeInd->tsmIe.state; |
| 1573 | roam_info.tsmIe.msmt_interval = pSmeTsmIeInd->tsmIe.msmt_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1574 | /* forward the tsm ie information to HDD */ |
Jeff Johnson | eddf544 | 2017-10-04 10:55:53 -0700 | [diff] [blame] | 1575 | csr_roam_call_callback(pMac, SessionId, &roam_info, 0, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1576 | eCSR_ROAM_TSM_IE_IND, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1577 | return status; |
| 1578 | } |
| 1579 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1580 | /** |
| 1581 | * sme_set_cckm_ie() - set cckm ie |
| 1582 | * @hHal: HAL handle |
| 1583 | * @sessionId: session id |
| 1584 | * @pCckmIe: Pointer to CCKM Ie |
| 1585 | * @cckmIeLen: Length of @pCckmIe |
| 1586 | * |
| 1587 | * Function to store the CCKM IE passed from supplicant and use |
| 1588 | * it while packing reassociation request. |
| 1589 | * |
| 1590 | * Return: QDF_STATUS enumeration |
| 1591 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1592 | QDF_STATUS sme_set_cckm_ie(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1593 | uint8_t *pCckmIe, uint8_t cckmIeLen) |
| 1594 | { |
| 1595 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1596 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1597 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1598 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1599 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1600 | csr_set_cckm_ie(pMac, sessionId, pCckmIe, cckmIeLen); |
| 1601 | sme_release_global_lock(&pMac->sme); |
| 1602 | } |
| 1603 | return status; |
| 1604 | } |
| 1605 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1606 | /** |
| 1607 | * sme_set_ese_beacon_request() - set ese beacon request |
| 1608 | * @hHal: HAL handle |
| 1609 | * @sessionId: session id |
| 1610 | * @pEseBcnReq: Ese beacon report |
| 1611 | * |
| 1612 | * function to set ESE beacon request parameters |
| 1613 | * |
| 1614 | * Return: QDF_STATUS enumeration |
| 1615 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1616 | 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] | 1617 | const tCsrEseBeaconReq *pEseBcnReq) |
| 1618 | { |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 1619 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1620 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1621 | tpSirBeaconReportReqInd pSmeBcnReportReq = NULL; |
| 1622 | tCsrEseBeaconReqParams *pBeaconReq = NULL; |
| 1623 | uint8_t counter = 0; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 1624 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1625 | tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext; |
| 1626 | |
| 1627 | if (pSmeRrmContext->eseBcnReqInProgress == true) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1628 | sme_err("A Beacon Report Req is already in progress"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1629 | return QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1630 | } |
| 1631 | |
| 1632 | /* Store the info in RRM context */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1633 | qdf_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1634 | sizeof(tCsrEseBeaconReq)); |
| 1635 | |
| 1636 | /* Prepare the request to send to SME. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1637 | pSmeBcnReportReq = qdf_mem_malloc(sizeof(tSirBeaconReportReqInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1638 | if (NULL == pSmeBcnReportReq) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1639 | sme_err("Memory Allocation Failure!!! ESE BcnReq Ind to SME"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1640 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1641 | } |
| 1642 | |
| 1643 | pSmeRrmContext->eseBcnReqInProgress = true; |
| 1644 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1645 | sme_debug("Sending Beacon Report Req to SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1646 | |
| 1647 | pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND; |
| 1648 | pSmeBcnReportReq->length = sizeof(tSirBeaconReportReqInd); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1649 | qdf_mem_copy(pSmeBcnReportReq->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1650 | pSession->connectedProfile.bssid.bytes, |
| 1651 | sizeof(tSirMacAddr)); |
| 1652 | pSmeBcnReportReq->channelInfo.channelNum = 255; |
| 1653 | pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe; |
| 1654 | pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD; |
| 1655 | |
| 1656 | for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++) { |
| 1657 | pBeaconReq = |
| 1658 | (tCsrEseBeaconReqParams *) &pEseBcnReq->bcnReq[counter]; |
| 1659 | pSmeBcnReportReq->fMeasurementtype[counter] = |
| 1660 | pBeaconReq->scanMode; |
| 1661 | pSmeBcnReportReq->measurementDuration[counter] = |
| 1662 | SYS_TU_TO_MS(pBeaconReq->measurementDuration); |
| 1663 | pSmeBcnReportReq->channelList.channelNumber[counter] = |
| 1664 | pBeaconReq->channel; |
| 1665 | } |
| 1666 | |
| 1667 | status = sme_rrm_process_beacon_report_req_ind(pMac, pSmeBcnReportReq); |
| 1668 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1669 | if (status != QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1670 | pSmeRrmContext->eseBcnReqInProgress = false; |
| 1671 | |
Hanumanth Reddy Pothula | 7f7a271 | 2016-09-07 18:44:47 +0530 | [diff] [blame] | 1672 | qdf_mem_free(pSmeBcnReportReq); |
| 1673 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1674 | return status; |
| 1675 | } |
| 1676 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1677 | /** |
| 1678 | * sme_get_tsm_stats() - SME get tsm stats |
| 1679 | * @hHal: HAL handle |
| 1680 | * @callback: SME sends back the requested stats using the callback |
| 1681 | * @staId: The station ID for which the stats is requested for |
| 1682 | * @bssId: bssid |
| 1683 | * @pContext: user context to be passed back along with the callback |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1684 | * @tid: Traffic id |
| 1685 | * |
| 1686 | * API register a callback to get TSM Stats. |
| 1687 | * |
| 1688 | * Return: QDF_STATUS enumeration |
| 1689 | */ |
| 1690 | QDF_STATUS sme_get_tsm_stats(tHalHandle hHal, |
| 1691 | tCsrTsmStatsCallback callback, |
| 1692 | uint8_t staId, struct qdf_mac_addr bssId, |
Jeff Johnson | 30f8455 | 2017-09-13 14:55:25 -0700 | [diff] [blame] | 1693 | void *pContext, uint8_t tid) |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1694 | { |
| 1695 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 1696 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1697 | |
| 1698 | status = sme_acquire_global_lock(&pMac->sme); |
| 1699 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 1700 | status = csr_get_tsm_stats(pMac, callback, |
| 1701 | staId, bssId, pContext, |
Jeff Johnson | 30f8455 | 2017-09-13 14:55:25 -0700 | [diff] [blame] | 1702 | tid); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1703 | sme_release_global_lock(&pMac->sme); |
| 1704 | } |
| 1705 | return status; |
| 1706 | } |
| 1707 | |
| 1708 | /** |
| 1709 | * sme_set_ese_roam_scan_channel_list() - To set ese roam scan channel list |
| 1710 | * @hHal: pointer HAL handle returned by mac_open |
| 1711 | * @sessionId: sme session id |
| 1712 | * @pChannelList: Output channel list |
| 1713 | * @numChannels: Output number of channels |
| 1714 | * |
| 1715 | * This routine is called to set ese roam scan channel list. |
| 1716 | * This is a synchronous call |
| 1717 | * |
| 1718 | * Return: QDF_STATUS |
| 1719 | */ |
| 1720 | QDF_STATUS sme_set_ese_roam_scan_channel_list(tHalHandle hHal, |
| 1721 | uint8_t sessionId, |
| 1722 | uint8_t *pChannelList, |
| 1723 | uint8_t numChannels) |
| 1724 | { |
| 1725 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1726 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 1727 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 1728 | tpCsrChannelInfo curchnl_list_info = NULL; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1729 | uint8_t oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN * 2] = { 0 }; |
| 1730 | uint8_t newChannelList[128] = { 0 }; |
| 1731 | uint8_t i = 0, j = 0; |
| 1732 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 1733 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 1734 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 1735 | FL("Invalid sme session id: %d"), sessionId); |
| 1736 | return QDF_STATUS_E_INVAL; |
| 1737 | } |
| 1738 | |
| 1739 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
| 1740 | curchnl_list_info = |
| 1741 | &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
| 1742 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1743 | status = sme_acquire_global_lock(&pMac->sme); |
| 1744 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1745 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 1746 | csr_roam_offload_scan(pMac, sessionId, |
| 1747 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 1748 | REASON_CHANNEL_LIST_CHANGED); |
| 1749 | return status; |
| 1750 | } |
| 1751 | if (NULL != curchnl_list_info->ChannelList) { |
| 1752 | for (i = 0; i < curchnl_list_info->numOfChannels; i++) { |
| 1753 | j += snprintf(oldChannelList + j, |
| 1754 | sizeof(oldChannelList) - j, "%d", |
| 1755 | curchnl_list_info->ChannelList[i]); |
| 1756 | } |
| 1757 | } |
| 1758 | status = csr_create_roam_scan_channel_list(pMac, sessionId, |
| 1759 | pChannelList, numChannels, |
| 1760 | csr_get_current_band(hHal)); |
| 1761 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 1762 | if (NULL != curchnl_list_info->ChannelList) { |
| 1763 | j = 0; |
| 1764 | for (i = 0; i < curchnl_list_info->numOfChannels; i++) { |
| 1765 | j += snprintf(newChannelList + j, |
| 1766 | sizeof(newChannelList) - j, "%d", |
| 1767 | curchnl_list_info->ChannelList[i]); |
| 1768 | } |
| 1769 | } |
| 1770 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 1771 | "ESE roam scan chnl list successfully set to %s-old value is %s-roam state is %d", |
| 1772 | newChannelList, oldChannelList, |
| 1773 | pNeighborRoamInfo->neighborRoamState); |
| 1774 | } |
| 1775 | sme_release_global_lock(&pMac->sme); |
| 1776 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 1777 | csr_roam_offload_scan(pMac, sessionId, |
| 1778 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 1779 | REASON_CHANNEL_LIST_CHANGED); |
| 1780 | return status; |
| 1781 | } |
| 1782 | |
| 1783 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1784 | |
Jeff Johnson | 49c02f9 | 2016-10-07 10:29:09 -0700 | [diff] [blame] | 1785 | static |
| 1786 | QDF_STATUS sme_ibss_peer_info_response_handler(tHalHandle hHal, |
| 1787 | tpSirIbssGetPeerInfoRspParams |
| 1788 | pIbssPeerInfoParams) |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1789 | { |
| 1790 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1791 | |
| 1792 | if (NULL == pMac) { |
| 1793 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
| 1794 | "%s: pMac is null", __func__); |
| 1795 | return QDF_STATUS_E_FAILURE; |
| 1796 | } |
| 1797 | if (pMac->sme.peerInfoParams.peerInfoCbk == NULL) { |
| 1798 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 1799 | "%s: HDD callback is null", __func__); |
| 1800 | return QDF_STATUS_E_FAILURE; |
| 1801 | } |
| 1802 | pMac->sme.peerInfoParams.peerInfoCbk(pMac->sme.peerInfoParams.pUserData, |
| 1803 | &pIbssPeerInfoParams-> |
| 1804 | ibssPeerInfoRspParams); |
| 1805 | return QDF_STATUS_SUCCESS; |
| 1806 | } |
| 1807 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1808 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1809 | * sme_process_dual_mac_config_resp() - Process set Dual mac config response |
| 1810 | * @mac: Global MAC pointer |
| 1811 | * @msg: Dual mac config response |
| 1812 | * |
| 1813 | * Processes the dual mac configuration response and invokes the HDD callback |
| 1814 | * to process further |
| 1815 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1816 | static QDF_STATUS sme_process_dual_mac_config_resp(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1817 | uint8_t *msg) |
| 1818 | { |
| 1819 | tListElem *entry = NULL; |
| 1820 | tSmeCmd *command = NULL; |
| 1821 | bool found; |
| 1822 | dual_mac_cb callback = NULL; |
| 1823 | struct sir_dual_mac_config_resp *param; |
| 1824 | |
| 1825 | param = (struct sir_dual_mac_config_resp *)msg; |
| 1826 | if (!param) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1827 | sme_err("Dual mac config resp param is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1828 | /* Not returning. Need to check if active command list |
| 1829 | * needs to be freed |
| 1830 | */ |
| 1831 | } |
| 1832 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 1833 | entry = csr_nonscan_active_ll_peek_head(mac, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1834 | if (!entry) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1835 | sme_err("No cmd found in active list"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1836 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1837 | } |
| 1838 | |
| 1839 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 1840 | if (!command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1841 | sme_err("Base address is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1842 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1843 | } |
| 1844 | |
| 1845 | if (e_sme_command_set_dual_mac_config != command->command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1846 | sme_err("Command mismatch!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1847 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1848 | } |
| 1849 | |
| 1850 | callback = command->u.set_dual_mac_cmd.set_dual_mac_cb; |
| 1851 | if (callback) { |
| 1852 | if (!param) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1853 | sme_err("Callback failed-Dual mac config is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1854 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1855 | sme_debug("Calling HDD callback for Dual mac config"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1856 | callback(param->status, |
| 1857 | command->u.set_dual_mac_cmd.scan_config, |
| 1858 | command->u.set_dual_mac_cmd.fw_mode_config); |
| 1859 | } |
| 1860 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1861 | sme_err("Callback does not exist"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1862 | } |
| 1863 | |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 1864 | found = csr_nonscan_active_ll_remove_entry(mac, entry, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1865 | if (found) |
| 1866 | /* Now put this command back on the available command list */ |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 1867 | csr_release_command(mac, command); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1868 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1869 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1870 | } |
| 1871 | |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1872 | /** |
| 1873 | * sme_process_antenna_mode_resp() - Process set antenna mode |
| 1874 | * response |
| 1875 | * @mac: Global MAC pointer |
| 1876 | * @msg: antenna mode response |
| 1877 | * |
| 1878 | * Processes the antenna mode response and invokes the HDD |
| 1879 | * callback to process further |
| 1880 | */ |
| 1881 | static QDF_STATUS sme_process_antenna_mode_resp(tpAniSirGlobal mac, |
| 1882 | uint8_t *msg) |
| 1883 | { |
| 1884 | tListElem *entry; |
| 1885 | tSmeCmd *command; |
| 1886 | bool found; |
| 1887 | antenna_mode_cb callback; |
| 1888 | struct sir_antenna_mode_resp *param; |
| 1889 | |
| 1890 | param = (struct sir_antenna_mode_resp *)msg; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1891 | if (!param) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1892 | sme_err("set antenna mode resp is NULL"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1893 | /* Not returning. Need to check if active command list |
| 1894 | * needs to be freed |
| 1895 | */ |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1896 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 1897 | entry = csr_nonscan_active_ll_peek_head(mac, LL_ACCESS_LOCK); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1898 | if (!entry) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1899 | sme_err("No cmd found in active list"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1900 | return QDF_STATUS_E_FAILURE; |
| 1901 | } |
| 1902 | |
| 1903 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 1904 | if (!command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1905 | sme_err("Base address is NULL"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1906 | return QDF_STATUS_E_FAILURE; |
| 1907 | } |
| 1908 | |
| 1909 | if (e_sme_command_set_antenna_mode != command->command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1910 | sme_err("Command mismatch!"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1911 | return QDF_STATUS_E_FAILURE; |
| 1912 | } |
| 1913 | |
| 1914 | callback = |
| 1915 | command->u.set_antenna_mode_cmd.set_antenna_mode_resp; |
| 1916 | if (callback) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1917 | if (!param) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1918 | sme_err("Set antenna mode call back is NULL"); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1919 | else |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1920 | callback(param->status); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1921 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1922 | sme_err("Callback does not exist"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1923 | } |
| 1924 | |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 1925 | found = csr_nonscan_active_ll_remove_entry(mac, entry, LL_ACCESS_LOCK); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1926 | if (found) |
| 1927 | /* Now put this command back on the available command list */ |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 1928 | csr_release_command(mac, command); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1929 | |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1930 | return QDF_STATUS_SUCCESS; |
| 1931 | } |
| 1932 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1933 | /* |
| 1934 | * sme_process_msg() - The main message processor for SME. |
| 1935 | * The function is called by a message dispatcher when to process a message |
| 1936 | * targeted for SME. |
| 1937 | * This is a synchronous call |
| 1938 | * |
| 1939 | * hHal - The handle returned by mac_open. |
| 1940 | * pMsg - A pointer to a caller allocated object of tSirMsgQ. |
| 1941 | * Return QDF_STATUS_SUCCESS - SME successfully process the message. |
| 1942 | * Other status means SME failed to process the message to HAL. |
| 1943 | */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 1944 | QDF_STATUS sme_process_msg(tHalHandle hHal, struct scheduler_msg *pMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1945 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1946 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1947 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 1948 | struct sir_peer_info *peer_stats; |
| 1949 | struct sir_peer_info_resp *peer_info_rsp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1950 | |
| 1951 | if (pMsg == NULL) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1952 | sme_err("Empty message for SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1953 | return status; |
| 1954 | } |
| 1955 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1956 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1957 | sme_warn("Locking failed, bailing out"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1958 | if (pMsg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1959 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1960 | return status; |
| 1961 | } |
| 1962 | if (!SME_IS_START(pMac)) { |
Rajeev Kumar | 3887f9b | 2018-01-10 11:24:01 -0800 | [diff] [blame] | 1963 | sme_debug("message type %d in stop state ignored", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1964 | if (pMsg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1965 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1966 | goto release_lock; |
| 1967 | } |
| 1968 | switch (pMsg->type) { |
| 1969 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1970 | case eWNI_SME_HO_FAIL_IND: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1971 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1972 | FL("LFR3: Rcvd eWNI_SME_HO_FAIL_IND")); |
| 1973 | csr_process_ho_fail_ind(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1974 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1975 | break; |
| 1976 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1977 | case WNI_CFG_SET_CNF: |
| 1978 | case WNI_CFG_DNLD_CNF: |
| 1979 | case WNI_CFG_GET_RSP: |
| 1980 | case WNI_CFG_ADD_GRP_ADDR_CNF: |
| 1981 | case WNI_CFG_DEL_GRP_ADDR_CNF: |
| 1982 | break; |
| 1983 | case eWNI_SME_ADDTS_RSP: |
| 1984 | case eWNI_SME_DELTS_RSP: |
| 1985 | case eWNI_SME_DELTS_IND: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1986 | case eWNI_SME_FT_AGGR_QOS_RSP: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1987 | /* QoS */ |
| 1988 | if (pMsg->bodyptr) { |
| 1989 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 1990 | status = sme_qos_msg_processor(pMac, pMsg->type, |
| 1991 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1992 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1993 | #endif |
| 1994 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1995 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1996 | } |
| 1997 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1998 | case eWNI_SME_NEIGHBOR_REPORT_IND: |
| 1999 | case eWNI_SME_BEACON_REPORT_REQ_IND: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2000 | if (pMsg->bodyptr) { |
| 2001 | status = sme_rrm_msg_processor(pMac, pMsg->type, |
| 2002 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2003 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2004 | } else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2005 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2006 | } |
| 2007 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2008 | case eWNI_SME_ADD_STA_SELF_RSP: |
| 2009 | if (pMsg->bodyptr) { |
| 2010 | status = csr_process_add_sta_session_rsp(pMac, |
| 2011 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2012 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2013 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2014 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2015 | } |
| 2016 | break; |
| 2017 | case eWNI_SME_DEL_STA_SELF_RSP: |
| 2018 | if (pMsg->bodyptr) { |
| 2019 | status = csr_process_del_sta_session_rsp(pMac, |
| 2020 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2021 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2022 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2023 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2024 | } |
| 2025 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2026 | case eWNI_SME_CHANGE_COUNTRY_CODE: |
| 2027 | if (pMsg->bodyptr) { |
| 2028 | status = sme_handle_change_country_code((void *)pMac, |
| 2029 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2030 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2031 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2032 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2033 | } |
| 2034 | break; |
| 2035 | case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE: |
| 2036 | if (pMsg->bodyptr) { |
| 2037 | status = sme_handle_generic_change_country_code( |
| 2038 | (void *)pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2039 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2040 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2041 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2042 | } |
| 2043 | break; |
Sandeep Puligilla | 8d6011b | 2017-11-08 00:06:18 -0800 | [diff] [blame] | 2044 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2045 | #ifdef WLAN_FEATURE_11W |
| 2046 | case eWNI_SME_UNPROT_MGMT_FRM_IND: |
| 2047 | if (pMsg->bodyptr) { |
| 2048 | sme_unprotected_mgmt_frm_ind(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2049 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2050 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2051 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2052 | } |
| 2053 | break; |
| 2054 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 2055 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2056 | case eWNI_SME_TSM_IE_IND: |
| 2057 | if (pMsg->bodyptr) { |
| 2058 | sme_tsm_ie_ind(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2059 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2060 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2061 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2062 | } |
| 2063 | break; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 2064 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2065 | case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP: |
| 2066 | status = csr_roam_offload_scan_rsp_hdlr((void *)pMac, |
| 2067 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2068 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2069 | break; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 2070 | case eWNI_SME_IBSS_PEER_INFO_RSP: |
| 2071 | if (pMsg->bodyptr) { |
Jeff Johnson | 49c02f9 | 2016-10-07 10:29:09 -0700 | [diff] [blame] | 2072 | sme_ibss_peer_info_response_handler(pMac, |
| 2073 | pMsg->bodyptr); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 2074 | qdf_mem_free(pMsg->bodyptr); |
| 2075 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2076 | sme_err("Empty message for: %d", pMsg->type); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 2077 | } |
| 2078 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2079 | case eWNI_SME_READY_TO_SUSPEND_IND: |
| 2080 | if (pMsg->bodyptr) { |
| 2081 | sme_process_ready_to_suspend(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2082 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2083 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2084 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2085 | } |
| 2086 | break; |
| 2087 | #ifdef WLAN_FEATURE_EXTWOW_SUPPORT |
| 2088 | case eWNI_SME_READY_TO_EXTWOW_IND: |
| 2089 | if (pMsg->bodyptr) { |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 2090 | sme_process_ready_to_ext_wow(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2091 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2092 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2093 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2094 | } |
| 2095 | break; |
| 2096 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2097 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 2098 | case eWNI_SME_AUTO_SHUTDOWN_IND: |
| 2099 | if (pMac->sme.pAutoShutdownNotificationCb) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 2100 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2101 | FL("Auto shutdown notification")); |
| 2102 | pMac->sme.pAutoShutdownNotificationCb(); |
| 2103 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2104 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2105 | break; |
| 2106 | #endif |
| 2107 | case eWNI_SME_DFS_RADAR_FOUND: |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 2108 | case eWNI_SME_DFS_CAC_COMPLETE: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2109 | case eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND: |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 2110 | status = dfs_msg_processor(pMac, pMsg); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2111 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2112 | break; |
| 2113 | case eWNI_SME_CHANNEL_CHANGE_RSP: |
| 2114 | if (pMsg->bodyptr) { |
| 2115 | status = sme_process_channel_change_resp(pMac, |
| 2116 | pMsg->type, |
| 2117 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2118 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2119 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2120 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2121 | } |
| 2122 | break; |
| 2123 | #ifdef WLAN_FEATURE_STATS_EXT |
| 2124 | case eWNI_SME_STATS_EXT_EVENT: |
| 2125 | if (pMsg->bodyptr) { |
| 2126 | status = sme_stats_ext_event(hHal, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2127 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2128 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2129 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2130 | } |
| 2131 | break; |
| 2132 | #endif |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 2133 | case eWNI_SME_GET_PEER_INFO_IND: |
| 2134 | if (pMac->sme.pget_peer_info_ind_cb) |
| 2135 | pMac->sme.pget_peer_info_ind_cb(pMsg->bodyptr, |
| 2136 | pMac->sme.pget_peer_info_cb_context); |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2137 | if (pMsg->bodyptr) { |
| 2138 | peer_info_rsp = (struct sir_peer_info_resp *) |
| 2139 | (pMsg->bodyptr); |
| 2140 | peer_stats = (struct sir_peer_info *) |
| 2141 | (peer_info_rsp->info); |
| 2142 | if (peer_stats) { |
| 2143 | pMac->peer_rssi = peer_stats[0].rssi; |
| 2144 | pMac->peer_txrate = peer_stats[0].tx_rate; |
| 2145 | pMac->peer_rxrate = peer_stats[0].rx_rate; |
| 2146 | } |
| 2147 | } |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 2148 | qdf_mem_free(pMsg->bodyptr); |
| 2149 | break; |
| 2150 | case eWNI_SME_GET_PEER_INFO_EXT_IND: |
| 2151 | if (pMac->sme.pget_peer_info_ext_ind_cb) |
| 2152 | pMac->sme.pget_peer_info_ext_ind_cb(pMsg->bodyptr, |
| 2153 | pMac->sme.pget_peer_info_ext_cb_context); |
| 2154 | qdf_mem_free(pMsg->bodyptr); |
| 2155 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2156 | case eWNI_SME_CSA_OFFLOAD_EVENT: |
| 2157 | if (pMsg->bodyptr) { |
| 2158 | csr_scan_flush_bss_entry(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2159 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2160 | } |
| 2161 | break; |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 2162 | case eWNI_SME_TSF_EVENT: |
| 2163 | if (pMac->sme.get_tsf_cb) { |
| 2164 | pMac->sme.get_tsf_cb(pMac->sme.get_tsf_cxt, |
| 2165 | (struct stsf *)pMsg->bodyptr); |
| 2166 | } |
| 2167 | if (pMsg->bodyptr) |
| 2168 | qdf_mem_free(pMsg->bodyptr); |
| 2169 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2170 | #ifdef WLAN_FEATURE_NAN |
| 2171 | case eWNI_SME_NAN_EVENT: |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 2172 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_WMA_MSG, |
| 2173 | NO_SESSION, pMsg->type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2174 | if (pMsg->bodyptr) { |
| 2175 | sme_nan_event(hHal, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2176 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2177 | } |
| 2178 | break; |
| 2179 | #endif /* WLAN_FEATURE_NAN */ |
| 2180 | case eWNI_SME_LINK_STATUS_IND: |
| 2181 | { |
| 2182 | tAniGetLinkStatus *pLinkStatus = |
| 2183 | (tAniGetLinkStatus *) pMsg->bodyptr; |
| 2184 | if (pLinkStatus) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2185 | if (pMac->sme.linkStatusCallback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2186 | pMac->sme.linkStatusCallback( |
| 2187 | pLinkStatus->linkStatus, |
| 2188 | pMac->sme.linkStatusContext); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2189 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2190 | pMac->sme.linkStatusCallback = NULL; |
| 2191 | pMac->sme.linkStatusContext = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2192 | qdf_mem_free(pLinkStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2193 | } |
| 2194 | break; |
| 2195 | } |
| 2196 | case eWNI_SME_MSG_GET_TEMPERATURE_IND: |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2197 | if (pMac->sme.pGetTemperatureCb) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2198 | pMac->sme.pGetTemperatureCb(pMsg->bodyval, |
| 2199 | pMac->sme.pTemperatureCbContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2200 | break; |
| 2201 | case eWNI_SME_SNR_IND: |
| 2202 | { |
| 2203 | tAniGetSnrReq *pSnrReq = (tAniGetSnrReq *) pMsg->bodyptr; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2204 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2205 | if (pSnrReq) { |
| 2206 | if (pSnrReq->snrCallback) { |
| 2207 | ((tCsrSnrCallback) |
| 2208 | (pSnrReq->snrCallback)) |
| 2209 | (pSnrReq->snr, pSnrReq->staId, |
| 2210 | pSnrReq->pDevContext); |
| 2211 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2212 | qdf_mem_free(pSnrReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2213 | } |
| 2214 | break; |
| 2215 | } |
| 2216 | #ifdef FEATURE_WLAN_EXTSCAN |
| 2217 | case eWNI_SME_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 2218 | if (pMac->sme.pExtScanIndCb) |
| 2219 | pMac->sme.pExtScanIndCb(pMac->hHdd, |
| 2220 | eSIR_EXTSCAN_FULL_SCAN_RESULT_IND, |
| 2221 | pMsg->bodyptr); |
| 2222 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2223 | sme_err("callback not registered to process: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2224 | pMsg->type); |
| 2225 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2226 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2227 | break; |
| 2228 | case eWNI_SME_EPNO_NETWORK_FOUND_IND: |
| 2229 | if (pMac->sme.pExtScanIndCb) |
| 2230 | pMac->sme.pExtScanIndCb(pMac->hHdd, |
| 2231 | eSIR_EPNO_NETWORK_FOUND_IND, |
| 2232 | pMsg->bodyptr); |
| 2233 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2234 | sme_err("callback not registered to process: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2235 | pMsg->type); |
| 2236 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2237 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2238 | break; |
| 2239 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2240 | case eWNI_SME_SET_HW_MODE_RESP: |
| 2241 | if (pMsg->bodyptr) { |
| 2242 | status = sme_process_set_hw_mode_resp(pMac, |
| 2243 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2244 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2245 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2246 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2247 | } |
| 2248 | break; |
| 2249 | case eWNI_SME_HW_MODE_TRANS_IND: |
| 2250 | if (pMsg->bodyptr) { |
| 2251 | status = sme_process_hw_mode_trans_ind(pMac, |
| 2252 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2253 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2254 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2255 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2256 | } |
| 2257 | break; |
| 2258 | case eWNI_SME_NSS_UPDATE_RSP: |
| 2259 | if (pMsg->bodyptr) { |
| 2260 | status = sme_process_nss_update_resp(pMac, |
| 2261 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2262 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2263 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2264 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2265 | } |
| 2266 | break; |
| 2267 | case eWNI_SME_OCB_SET_CONFIG_RSP: |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2268 | if (pMac->sme.ocb_set_config_callback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2269 | pMac->sme.ocb_set_config_callback( |
| 2270 | pMac->sme.ocb_set_config_context, |
| 2271 | pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2272 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2273 | sme_err("No callback for Msg type: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2274 | pMac->sme.ocb_set_config_callback = NULL; |
| 2275 | pMac->sme.ocb_set_config_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2276 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2277 | break; |
| 2278 | case eWNI_SME_OCB_GET_TSF_TIMER_RSP: |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2279 | if (pMac->sme.ocb_get_tsf_timer_callback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2280 | pMac->sme.ocb_get_tsf_timer_callback( |
| 2281 | pMac->sme.ocb_get_tsf_timer_context, |
| 2282 | pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2283 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2284 | sme_err("No callback for Msg type: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2285 | pMac->sme.ocb_get_tsf_timer_callback = NULL; |
| 2286 | pMac->sme.ocb_get_tsf_timer_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2287 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2288 | break; |
| 2289 | case eWNI_SME_DCC_GET_STATS_RSP: |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2290 | if (pMac->sme.dcc_get_stats_callback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2291 | pMac->sme.dcc_get_stats_callback( |
| 2292 | pMac->sme.dcc_get_stats_context, |
| 2293 | pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2294 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2295 | sme_err("No callback for Msg type: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2296 | pMac->sme.dcc_get_stats_callback = NULL; |
| 2297 | pMac->sme.dcc_get_stats_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2298 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2299 | break; |
| 2300 | case eWNI_SME_DCC_UPDATE_NDL_RSP: |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2301 | if (pMac->sme.dcc_update_ndl_callback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2302 | pMac->sme.dcc_update_ndl_callback( |
| 2303 | pMac->sme.dcc_update_ndl_context, |
| 2304 | pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2305 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2306 | sme_err("No callback for Msg type: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2307 | pMac->sme.dcc_update_ndl_callback = NULL; |
| 2308 | pMac->sme.dcc_update_ndl_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2309 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2310 | break; |
| 2311 | case eWNI_SME_DCC_STATS_EVENT: |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2312 | if (pMac->sme.dcc_stats_event_callback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2313 | pMac->sme.dcc_stats_event_callback( |
| 2314 | pMac->sme.dcc_stats_event_context, |
| 2315 | pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2316 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2317 | sme_err("No callback for Msg type: %d", pMsg->type); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2318 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2319 | break; |
| 2320 | case eWNI_SME_SET_DUAL_MAC_CFG_RESP: |
| 2321 | if (pMsg->bodyptr) { |
| 2322 | status = sme_process_dual_mac_config_resp(pMac, |
| 2323 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2324 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2325 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2326 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2327 | } |
| 2328 | case eWNI_SME_SET_THERMAL_LEVEL_IND: |
| 2329 | if (pMac->sme.set_thermal_level_cb) |
| 2330 | pMac->sme.set_thermal_level_cb(pMac->hHdd, |
| 2331 | pMsg->bodyval); |
| 2332 | break; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 2333 | case eWNI_SME_EXT_CHANGE_CHANNEL_IND: |
| 2334 | status = sme_extended_change_channel_ind(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2335 | qdf_mem_free(pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2336 | break; |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 2337 | case eWNI_SME_SET_ANTENNA_MODE_RESP: |
| 2338 | if (pMsg->bodyptr) { |
| 2339 | status = sme_process_antenna_mode_resp(pMac, |
| 2340 | pMsg->bodyptr); |
| 2341 | qdf_mem_free(pMsg->bodyptr); |
| 2342 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2343 | sme_err("Empty message for: %d", pMsg->type); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 2344 | } |
| 2345 | break; |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 2346 | case eWNI_SME_LOST_LINK_INFO_IND: |
| 2347 | if (pMac->sme.lost_link_info_cb) |
| 2348 | pMac->sme.lost_link_info_cb(pMac->hHdd, |
| 2349 | (struct sir_lost_link_info *)pMsg->bodyptr); |
| 2350 | qdf_mem_free(pMsg->bodyptr); |
| 2351 | break; |
Sreelakshmi Konamki | 88a2a41 | 2017-04-14 15:11:55 +0530 | [diff] [blame] | 2352 | case eWNI_SME_RSO_CMD_STATUS_IND: |
| 2353 | if (pMac->sme.rso_cmd_status_cb) |
| 2354 | pMac->sme.rso_cmd_status_cb(pMac->hHdd, pMsg->bodyptr); |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 2355 | qdf_mem_free(pMsg->bodyptr); |
| 2356 | break; |
Zhang Qian | a6e9c10 | 2016-12-22 16:47:24 +0800 | [diff] [blame] | 2357 | case eWMI_SME_LL_STATS_IND: |
| 2358 | if (pMac->sme.link_layer_stats_ext_cb) |
| 2359 | pMac->sme.link_layer_stats_ext_cb(pMac->hHdd, |
| 2360 | pMsg->bodyptr); |
Sreelakshmi Konamki | 88a2a41 | 2017-04-14 15:11:55 +0530 | [diff] [blame] | 2361 | qdf_mem_free(pMsg->bodyptr); |
| 2362 | break; |
Vidyullatha Kanchanapally | be0ebb3 | 2017-03-23 14:36:21 +0530 | [diff] [blame] | 2363 | case eWNI_SME_BT_ACTIVITY_INFO_IND: |
| 2364 | if (pMac->sme.bt_activity_info_cb) |
| 2365 | pMac->sme.bt_activity_info_cb(pMac->hHdd, |
| 2366 | pMsg->bodyval); |
| 2367 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2368 | default: |
| 2369 | |
| 2370 | if ((pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN) |
| 2371 | && (pMsg->type <= eWNI_SME_MSG_TYPES_END)) { |
| 2372 | /* CSR */ |
| 2373 | if (pMsg->bodyptr) { |
| 2374 | status = csr_msg_processor(hHal, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2375 | qdf_mem_free(pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2376 | } else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2377 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2378 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2379 | sme_warn("Unknown message type: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2380 | if (pMsg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2381 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2382 | } |
| 2383 | } /* switch */ |
| 2384 | release_lock: |
| 2385 | sme_release_global_lock(&pMac->sme); |
| 2386 | return status; |
| 2387 | } |
| 2388 | |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 2389 | QDF_STATUS sme_mc_process_handler(struct scheduler_msg *msg) |
| 2390 | { |
| 2391 | tpAniSirGlobal mac_ctx = cds_get_context(QDF_MODULE_ID_SME); |
| 2392 | |
| 2393 | if (mac_ctx == NULL) { |
| 2394 | QDF_ASSERT(0); |
| 2395 | return QDF_STATUS_E_FAILURE; |
| 2396 | } |
| 2397 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 2398 | return sme_process_msg((tHalHandle)mac_ctx, msg); |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 2399 | } |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 2400 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2401 | /** |
| 2402 | * sme_process_nss_update_resp() - Process nss update response |
| 2403 | * @mac: Global MAC pointer |
| 2404 | * @msg: nss update response |
| 2405 | * |
| 2406 | * Processes the nss update response and invokes the HDD |
| 2407 | * callback to process further |
| 2408 | */ |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2409 | static QDF_STATUS sme_process_nss_update_resp(tpAniSirGlobal mac, uint8_t *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2410 | { |
| 2411 | tListElem *entry = NULL; |
| 2412 | tSmeCmd *command = NULL; |
| 2413 | bool found; |
Tushnim Bhattacharyya | eab33dd | 2017-11-15 15:20:02 -0800 | [diff] [blame] | 2414 | policy_mgr_nss_update_cback callback = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2415 | struct sir_beacon_tx_complete_rsp *param; |
| 2416 | |
| 2417 | param = (struct sir_beacon_tx_complete_rsp *)msg; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2418 | if (!param) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2419 | sme_err("nss update resp param is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2420 | /* Not returning. Need to check if active command list |
| 2421 | * needs to be freed |
| 2422 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2423 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 2424 | entry = csr_nonscan_active_ll_peek_head(mac, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2425 | if (!entry) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2426 | sme_err("No cmd found in active list"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2427 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2428 | } |
| 2429 | |
| 2430 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 2431 | if (!command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2432 | sme_err("Base address is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2433 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2434 | } |
| 2435 | |
| 2436 | if (e_sme_command_nss_update != command->command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2437 | sme_err("Command mismatch!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2438 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2439 | } |
| 2440 | |
| 2441 | callback = command->u.nss_update_cmd.nss_update_cb; |
| 2442 | if (callback) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2443 | if (!param) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2444 | sme_err("Callback failed since nss update params is NULL"); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2445 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2446 | callback(command->u.nss_update_cmd.context, |
| 2447 | param->tx_status, |
| 2448 | param->session_id, |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 2449 | command->u.nss_update_cmd.next_action, |
| 2450 | command->u.nss_update_cmd.reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2451 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2452 | sme_err("Callback does not exisit"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2453 | } |
| 2454 | |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 2455 | found = csr_nonscan_active_ll_remove_entry(mac, entry, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2456 | if (found) { |
| 2457 | /* Now put this command back on the avilable command list */ |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 2458 | csr_release_command(mac, command); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2459 | } |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 2460 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2461 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2462 | } |
| 2463 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2464 | /* No need to hold the global lock here because this function can only be |
| 2465 | * called after sme_stop. |
| 2466 | */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 2467 | void sme_free_msg(tHalHandle hHal, struct scheduler_msg *pMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2468 | { |
| 2469 | if (pMsg) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2470 | if (pMsg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2471 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2472 | } |
| 2473 | |
| 2474 | } |
| 2475 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2476 | /* |
| 2477 | * sme_stop() - Stop all SME modules and put them at idle state |
| 2478 | * |
| 2479 | * The function stops each module in SME, PMC, CSR, etc. . Upon |
| 2480 | * return, all modules are at idle state ready to start. |
| 2481 | * This is a synchronous call |
| 2482 | * |
| 2483 | * hHal - The handle returned by mac_open |
| 2484 | * tHalStopType - reason for stopping |
| 2485 | * Return QDF_STATUS_SUCCESS - SME is stopped. |
| 2486 | * Other status means SME is failed to stop but caller should still |
| 2487 | * consider SME is stopped. |
| 2488 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2489 | QDF_STATUS sme_stop(tHalHandle hHal, tHalStopType stopType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2490 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2491 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 2492 | QDF_STATUS fail_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2493 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2494 | |
Sandeep Puligilla | 66d09c4 | 2017-09-06 17:10:27 -0700 | [diff] [blame] | 2495 | status = rrm_stop(pMac); |
| 2496 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 2497 | sme_err("rrm_stop failed with status: %d", status); |
| 2498 | } |
| 2499 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2500 | status = csr_stop(pMac, stopType); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2501 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2502 | sme_err("csr_stop failed with status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2503 | fail_status = status; |
| 2504 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2505 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2506 | if (!QDF_IS_STATUS_SUCCESS(fail_status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2507 | status = fail_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2508 | |
| 2509 | pMac->sme.state = SME_STATE_STOP; |
| 2510 | |
| 2511 | return status; |
| 2512 | } |
| 2513 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2514 | /* |
| 2515 | * sme_close() - Release all SME modules and their resources. |
| 2516 | * The function release each module in SME, PMC, CSR, etc. . Upon |
| 2517 | * return, all modules are at closed state. |
| 2518 | * |
| 2519 | * No SME APIs can be involved after smeClose except smeOpen. |
| 2520 | * smeClose must be called before mac_close. |
| 2521 | * This is a synchronous call |
| 2522 | * |
| 2523 | * hHal - The handle returned by mac_open |
| 2524 | * Return QDF_STATUS_SUCCESS - SME is successfully close. |
| 2525 | * |
| 2526 | * Other status means SME is failed to be closed but caller still cannot |
| 2527 | * call any other SME functions except smeOpen. |
| 2528 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2529 | QDF_STATUS sme_close(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2530 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2531 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 2532 | QDF_STATUS fail_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2533 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2534 | |
| 2535 | if (!pMac) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2536 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2537 | |
| 2538 | /* Note: pSession will be invalid from here on, do not access */ |
| 2539 | status = csr_close(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2540 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2541 | sme_err("csr_close failed with status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2542 | fail_status = status; |
| 2543 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2544 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 2545 | status = sme_qos_close(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2546 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2547 | sme_err("Qos close failed with status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2548 | fail_status = status; |
| 2549 | } |
| 2550 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2551 | status = sme_ps_close(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2552 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2553 | sme_err("sme_ps_close failed status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2554 | fail_status = status; |
| 2555 | } |
| 2556 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2557 | status = rrm_close(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2558 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2559 | sme_err("RRM close failed with status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2560 | fail_status = status; |
| 2561 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2562 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2563 | free_sme_cmd_list(pMac); |
| 2564 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2565 | if (!QDF_IS_STATUS_SUCCESS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2566 | (qdf_mutex_destroy(&pMac->sme.lkSmeGlobalLock))) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2567 | fail_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2568 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2569 | if (!QDF_IS_STATUS_SUCCESS(fail_status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2570 | status = fail_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2571 | |
| 2572 | pMac->sme.state = SME_STATE_STOP; |
| 2573 | |
| 2574 | return status; |
| 2575 | } |
| 2576 | |
| 2577 | /** |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 2578 | * sme_remove_bssid_from_scan_list() - wrapper to remove the bssid from |
| 2579 | * scan list |
| 2580 | * @hal: hal context. |
| 2581 | * @bssid: bssid to be removed |
| 2582 | * |
| 2583 | * This function remove the given bssid from scan list. |
| 2584 | * |
| 2585 | * Return: QDF status. |
| 2586 | */ |
| 2587 | QDF_STATUS sme_remove_bssid_from_scan_list(tHalHandle hal, |
| 2588 | tSirMacAddr bssid) |
| 2589 | { |
| 2590 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 2591 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 2592 | |
| 2593 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 2594 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 2595 | csr_remove_bssid_from_scan_list(mac_ctx, bssid); |
| 2596 | sme_release_global_lock(&mac_ctx->sme); |
| 2597 | } |
| 2598 | |
| 2599 | return status; |
| 2600 | } |
| 2601 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2602 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2603 | /* |
| 2604 | * sme_scan_get_result |
| 2605 | * A wrapper function to request scan results from CSR. |
| 2606 | * This is a synchronous call |
| 2607 | * |
| 2608 | * pFilter - If pFilter is NULL, all cached results are returned |
| 2609 | * phResult - an object for the result. |
| 2610 | * Return QDF_STATUS |
| 2611 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2612 | QDF_STATUS sme_scan_get_result(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2613 | tCsrScanResultFilter *pFilter, |
| 2614 | tScanResultHandle *phResult) |
| 2615 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2616 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2617 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2618 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2619 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2620 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId, |
| 2621 | 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2622 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2623 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2624 | status = csr_scan_get_result(hHal, pFilter, phResult); |
| 2625 | sme_release_global_lock(&pMac->sme); |
| 2626 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2627 | |
| 2628 | return status; |
| 2629 | } |
| 2630 | |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 2631 | QDF_STATUS sme_scan_get_result_for_bssid(tHalHandle hal_handle, |
| 2632 | struct qdf_mac_addr *bssid, |
| 2633 | tCsrScanResultInfo *res) |
| 2634 | { |
| 2635 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
| 2636 | QDF_STATUS status; |
| 2637 | |
| 2638 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 2639 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 2640 | status = csr_scan_get_result_for_bssid(hal_handle, bssid, res); |
| 2641 | sme_release_global_lock(&mac_ctx->sme); |
| 2642 | } |
| 2643 | |
| 2644 | return status; |
| 2645 | } |
| 2646 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2647 | /** |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 2648 | * sme_get_ap_channel_from_scan() - a wrapper function to get |
Srinivas Girigowda | 828ef23 | 2017-10-13 22:31:27 -0700 | [diff] [blame] | 2649 | * AP's channel id from |
| 2650 | * CSR by filtering the |
| 2651 | * result which matches |
| 2652 | * our roam profile. |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 2653 | * @profile: SAP profile |
| 2654 | * @ap_chnl_id: pointer to channel id of SAP. Fill the value after finding the |
| 2655 | * best ap from scan cache. |
| 2656 | * |
| 2657 | * This function is written to get AP's channel id from CSR by filtering |
| 2658 | * the result which matches our roam profile. This is a synchronous call. |
| 2659 | * |
| 2660 | * Return: QDF_STATUS. |
| 2661 | */ |
| 2662 | QDF_STATUS sme_get_ap_channel_from_scan(void *profile, |
| 2663 | tScanResultHandle *scan_cache, |
| 2664 | uint8_t *ap_chnl_id) |
| 2665 | { |
| 2666 | return sme_get_ap_channel_from_scan_cache((tCsrRoamProfile *) |
| 2667 | profile, |
| 2668 | scan_cache, |
| 2669 | ap_chnl_id); |
| 2670 | } |
| 2671 | |
| 2672 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2673 | * sme_get_ap_channel_from_scan_cache() - a wrapper function to get AP's |
| 2674 | * channel id from CSR by filtering the |
| 2675 | * result which matches our roam profile. |
| 2676 | * @profile: SAP adapter |
| 2677 | * @ap_chnl_id: pointer to channel id of SAP. Fill the value after finding the |
| 2678 | * best ap from scan cache. |
| 2679 | * |
| 2680 | * This function is written to get AP's channel id from CSR by filtering |
| 2681 | * the result which matches our roam profile. This is a synchronous call. |
| 2682 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2683 | * Return: QDF_STATUS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2684 | */ |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 2685 | QDF_STATUS sme_get_ap_channel_from_scan_cache( |
| 2686 | tCsrRoamProfile *profile, tScanResultHandle *scan_cache, |
| 2687 | uint8_t *ap_chnl_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2688 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2689 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 2690 | tpAniSirGlobal mac_ctx = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2691 | tCsrScanResultFilter *scan_filter = NULL; |
| 2692 | tScanResultHandle filtered_scan_result = NULL; |
| 2693 | tSirBssDescription first_ap_profile; |
| 2694 | |
| 2695 | if (NULL == mac_ctx) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2696 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2697 | FL("mac_ctx is NULL")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2698 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2699 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2700 | scan_filter = qdf_mem_malloc(sizeof(tCsrScanResultFilter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2701 | if (NULL == scan_filter) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2702 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2703 | FL("scan_filter mem alloc failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2704 | return QDF_STATUS_E_FAILURE; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2705 | } |
| 2706 | qdf_mem_set(&first_ap_profile, sizeof(tSirBssDescription), 0); |
| 2707 | if (NULL == profile) { |
| 2708 | scan_filter->EncryptionType.numEntries = 1; |
| 2709 | scan_filter->EncryptionType.encryptionType[0] |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2710 | = eCSR_ENCRYPT_TYPE_NONE; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2711 | } else { |
| 2712 | /* Here is the profile we need to connect to */ |
| 2713 | status = csr_roam_prepare_filter_from_profile(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2714 | profile, |
| 2715 | scan_filter); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2716 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2717 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2718 | if (QDF_STATUS_SUCCESS == status) { |
| 2719 | /* Save the WPS info */ |
| 2720 | if (NULL != profile) { |
| 2721 | scan_filter->bWPSAssociation = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2722 | profile->bWPSAssociation; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2723 | scan_filter->bOSENAssociation = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2724 | profile->bOSENAssociation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2725 | } else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2726 | scan_filter->bWPSAssociation = 0; |
| 2727 | scan_filter->bOSENAssociation = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2728 | } |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2729 | } else { |
| 2730 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 2731 | FL("Preparing the profile filter failed")); |
| 2732 | qdf_mem_free(scan_filter); |
| 2733 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2734 | } |
| 2735 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2736 | if (QDF_STATUS_SUCCESS == status) { |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 2737 | status = csr_scan_get_result(mac_ctx, scan_filter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2738 | &filtered_scan_result); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2739 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2740 | csr_get_bssdescr_from_scan_handle(filtered_scan_result, |
| 2741 | &first_ap_profile); |
| 2742 | *scan_cache = filtered_scan_result; |
| 2743 | if (0 != first_ap_profile.channelId) { |
| 2744 | *ap_chnl_id = first_ap_profile.channelId; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2745 | QDF_TRACE(QDF_MODULE_ID_SME, |
Abhishek Singh | 5d8d733 | 2017-08-10 15:15:24 +0530 | [diff] [blame] | 2746 | QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2747 | FL("Found best AP & its on chnl[%d]"), |
| 2748 | first_ap_profile.channelId); |
| 2749 | } else { |
| 2750 | /* |
| 2751 | * This means scan result is empty |
| 2752 | * so set the channel to zero, caller should |
| 2753 | * take of zero channel id case. |
| 2754 | */ |
| 2755 | *ap_chnl_id = 0; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2756 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 2757 | QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2758 | FL("Scan is empty, set chnl to 0")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2759 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2760 | } |
| 2761 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2762 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2763 | FL("Failed to get scan get result")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2764 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2765 | } |
| 2766 | csr_free_scan_filter(mac_ctx, scan_filter); |
| 2767 | sme_release_global_lock(&mac_ctx->sme); |
| 2768 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2769 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2770 | FL("Aquiring lock failed")); |
Krunal Soni | f988222 | 2016-01-22 17:16:50 -0800 | [diff] [blame] | 2771 | csr_free_scan_filter(mac_ctx, scan_filter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2772 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2773 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2774 | qdf_mem_free(scan_filter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2775 | return status; |
| 2776 | } |
| 2777 | |
| 2778 | /** |
| 2779 | * sme_store_joinreq_param() - This function will pass station's join |
| 2780 | * request to store to csr. |
| 2781 | * @hal_handle: pointer to hal context. |
| 2782 | * @profile: pointer to station's roam profile. |
| 2783 | * @scan_cache: pointer to station's scan cache. |
| 2784 | * @roam_id: reference to roam_id variable being passed. |
| 2785 | * @session_id: station's session id. |
| 2786 | * |
| 2787 | * This function will pass station's join request further down to csr |
| 2788 | * to store it. this stored parameter will be used later. |
| 2789 | * |
| 2790 | * Return: true or false based on function's overall success. |
| 2791 | **/ |
| 2792 | bool sme_store_joinreq_param(tHalHandle hal_handle, |
| 2793 | tCsrRoamProfile *profile, |
| 2794 | tScanResultHandle scan_cache, |
| 2795 | uint32_t *roam_id, |
| 2796 | uint32_t session_id) |
| 2797 | { |
| 2798 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2799 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2800 | bool ret_status = true; |
| 2801 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2802 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2803 | TRACE_CODE_SME_RX_HDD_STORE_JOIN_REQ, |
| 2804 | session_id, 0)); |
| 2805 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2806 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2807 | if (false == csr_store_joinreq_param(mac_ctx, profile, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2808 | scan_cache, roam_id, session_id)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2809 | ret_status = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2810 | sme_release_global_lock(&mac_ctx->sme); |
| 2811 | } else { |
| 2812 | ret_status = false; |
| 2813 | } |
| 2814 | |
| 2815 | return ret_status; |
| 2816 | } |
| 2817 | |
| 2818 | /** |
| 2819 | * sme_clear_joinreq_param() - This function will pass station's clear |
| 2820 | * the join request to csr. |
| 2821 | * @hal_handle: pointer to hal context. |
| 2822 | * @session_id: station's session id. |
| 2823 | * |
| 2824 | * This function will pass station's clear join request further down to csr |
| 2825 | * to cleanup. |
| 2826 | * |
| 2827 | * Return: true or false based on function's overall success. |
| 2828 | **/ |
| 2829 | bool sme_clear_joinreq_param(tHalHandle hal_handle, |
| 2830 | uint32_t session_id) |
| 2831 | { |
| 2832 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2833 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2834 | bool ret_status = true; |
| 2835 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2836 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2837 | TRACE_CODE_SME_RX_HDD_CLEAR_JOIN_REQ, |
| 2838 | session_id, 0)); |
| 2839 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2840 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2841 | if (false == csr_clear_joinreq_param(mac_ctx, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2842 | session_id)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2843 | ret_status = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2844 | sme_release_global_lock(&mac_ctx->sme); |
| 2845 | } else { |
| 2846 | ret_status = false; |
| 2847 | } |
| 2848 | |
| 2849 | return ret_status; |
| 2850 | } |
| 2851 | |
| 2852 | /** |
| 2853 | * sme_issue_stored_joinreq() - This function will issues station's stored |
| 2854 | * the join request to csr. |
| 2855 | * @hal_handle: pointer to hal context. |
| 2856 | * @roam_id: reference to roam_id variable being passed. |
| 2857 | * @session_id: station's session id. |
| 2858 | * |
| 2859 | * This function will issue station's stored join request further down to csr |
| 2860 | * to proceed forward. |
| 2861 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2862 | * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2863 | **/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2864 | QDF_STATUS sme_issue_stored_joinreq(tHalHandle hal_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2865 | uint32_t *roam_id, |
| 2866 | uint32_t session_id) |
| 2867 | { |
| 2868 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2869 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 2870 | QDF_STATUS ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2871 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2872 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2873 | TRACE_CODE_SME_RX_HDD_ISSUE_JOIN_REQ, |
| 2874 | session_id, 0)); |
| 2875 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2876 | if (QDF_STATUS_SUCCESS == status) { |
| 2877 | if (QDF_STATUS_SUCCESS != csr_issue_stored_joinreq(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2878 | roam_id, |
| 2879 | session_id)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2880 | ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2881 | } |
| 2882 | sme_release_global_lock(&mac_ctx->sme); |
| 2883 | } else { |
| 2884 | csr_clear_joinreq_param(mac_ctx, session_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2885 | ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2886 | } |
| 2887 | return ret_status; |
| 2888 | } |
| 2889 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2890 | /* |
| 2891 | * sme_scan_flush_result() - |
| 2892 | * A wrapper function to request CSR to clear scan results. |
| 2893 | * This is a synchronous call |
| 2894 | * |
| 2895 | * Return QDF_STATUS |
| 2896 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2897 | QDF_STATUS sme_scan_flush_result(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2898 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2899 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2900 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2901 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2902 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2903 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, |
| 2904 | 0, 0)); |
| 2905 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2906 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2907 | status = csr_scan_flush_result(hHal); |
| 2908 | sme_release_global_lock(&pMac->sme); |
| 2909 | } |
| 2910 | |
| 2911 | return status; |
| 2912 | } |
| 2913 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2914 | /* |
| 2915 | * sme_filter_scan_results() - |
| 2916 | * A wrapper function to request CSR to clear scan results. |
| 2917 | * This is a synchronous call |
| 2918 | * |
| 2919 | * tHalHandle - HAL context handle |
| 2920 | * sessionId - session id |
| 2921 | * Return QDF_STATUS |
| 2922 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2923 | QDF_STATUS sme_filter_scan_results(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2924 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2925 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2926 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2927 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2928 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2929 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, |
| 2930 | sessionId, 0)); |
| 2931 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2932 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2933 | csr_scan_filter_results(pMac); |
| 2934 | sme_release_global_lock(&pMac->sme); |
| 2935 | } |
| 2936 | |
| 2937 | return status; |
| 2938 | } |
| 2939 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2940 | QDF_STATUS sme_scan_flush_p2p_result(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2941 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2942 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2943 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2944 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2945 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2946 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, |
| 2947 | sessionId, 0)); |
| 2948 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2949 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2950 | status = csr_scan_flush_selective_result(hHal, true); |
| 2951 | sme_release_global_lock(&pMac->sme); |
| 2952 | } |
| 2953 | |
| 2954 | return status; |
| 2955 | } |
| 2956 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2957 | /* |
| 2958 | * sme_scan_result_get_first() - |
| 2959 | * A wrapper function to request CSR to returns the first element of |
| 2960 | * scan result. |
| 2961 | * This is a synchronous call |
| 2962 | * |
| 2963 | * hScanResult - returned from csr_scan_get_result |
| 2964 | * Return tCsrScanResultInfo * - NULL if no result |
| 2965 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2966 | tCsrScanResultInfo *sme_scan_result_get_first(tHalHandle hHal, |
| 2967 | tScanResultHandle hScanResult) |
| 2968 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2969 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2970 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2971 | tCsrScanResultInfo *pRet = NULL; |
| 2972 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2973 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2974 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, |
| 2975 | NO_SESSION, 0)); |
| 2976 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2977 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2978 | pRet = csr_scan_result_get_first(pMac, hScanResult); |
| 2979 | sme_release_global_lock(&pMac->sme); |
| 2980 | } |
| 2981 | |
| 2982 | return pRet; |
| 2983 | } |
| 2984 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2985 | /* |
| 2986 | * sme_scan_result_get_next() - |
| 2987 | * A wrapper function to request CSR to returns the next element of |
| 2988 | * scan result. It can be called without calling csr_scan_result_get_first first |
| 2989 | * This is a synchronous call |
| 2990 | * |
| 2991 | * hScanResult - returned from csr_scan_get_result |
| 2992 | * Return Null if no result or reach the end |
| 2993 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2994 | tCsrScanResultInfo *sme_scan_result_get_next(tHalHandle hHal, |
| 2995 | tScanResultHandle hScanResult) |
| 2996 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2997 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2998 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2999 | tCsrScanResultInfo *pRet = NULL; |
| 3000 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3001 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3002 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3003 | pRet = csr_scan_result_get_next(pMac, hScanResult); |
| 3004 | sme_release_global_lock(&pMac->sme); |
| 3005 | } |
| 3006 | |
| 3007 | return pRet; |
| 3008 | } |
| 3009 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3010 | /* |
| 3011 | * sme_scan_result_purge() - |
| 3012 | * A wrapper function to request CSR to remove all items(tCsrScanResult) |
| 3013 | * in the list and free memory for each item |
| 3014 | * This is a synchronous call |
| 3015 | * |
| 3016 | * hScanResult - returned from csr_scan_get_result. hScanResult is |
| 3017 | * considered gone by |
| 3018 | * calling this function and even before this function reutrns. |
| 3019 | * Return QDF_STATUS |
| 3020 | */ |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 3021 | QDF_STATUS sme_scan_result_purge(tScanResultHandle hScanResult) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3022 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3023 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 3024 | tpAniSirGlobal mac_ctx = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3025 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3026 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3027 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, |
| 3028 | NO_SESSION, 0)); |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 3029 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3030 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 3031 | status = csr_scan_result_purge(mac_ctx, hScanResult); |
| 3032 | sme_release_global_lock(&mac_ctx->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3033 | } |
| 3034 | |
| 3035 | return status; |
| 3036 | } |
| 3037 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3038 | /* |
| 3039 | * sme_scan_get_pmkid_candidate_list() - |
| 3040 | * A wrapper function to return the PMKID candidate list |
| 3041 | * This is a synchronous call |
| 3042 | * |
| 3043 | * pPmkidList - caller allocated buffer point to an array of |
| 3044 | * tPmkidCandidateInfo |
| 3045 | * pNumItems - pointer to a variable that has the number of |
| 3046 | * tPmkidCandidateInfo allocated when retruning, this is |
| 3047 | * either the number needed or number of items put into |
| 3048 | * pPmkidList |
| 3049 | * Return QDF_STATUS - when fail, it usually means the buffer allocated is not |
| 3050 | * big enough and pNumItems |
| 3051 | * has the number of tPmkidCandidateInfo. |
| 3052 | * \Note: pNumItems is a number of tPmkidCandidateInfo, |
| 3053 | * not sizeof(tPmkidCandidateInfo) * something |
| 3054 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3055 | 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] | 3056 | tPmkidCandidateInfo *pPmkidList, |
| 3057 | uint32_t *pNumItems) |
| 3058 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3059 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3060 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3061 | |
| 3062 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3063 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3064 | status = |
| 3065 | csr_scan_get_pmkid_candidate_list(pMac, sessionId, |
| 3066 | pPmkidList, |
| 3067 | pNumItems); |
| 3068 | sme_release_global_lock(&pMac->sme); |
| 3069 | } |
| 3070 | |
| 3071 | return status; |
| 3072 | } |
| 3073 | |
| 3074 | eCsrPhyMode sme_get_phy_mode(tHalHandle hHal) |
| 3075 | { |
| 3076 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3077 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3078 | return pMac->roam.configParam.phyMode; |
| 3079 | } |
| 3080 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3081 | /* |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3082 | * sme_get_channel_bonding_mode5_g() - get the channel bonding mode for 5G band |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3083 | * |
| 3084 | * hHal - HAL handle |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3085 | * mode - channel bonding mode |
| 3086 | * |
| 3087 | * Return QDF_STATUS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3088 | */ |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3089 | QDF_STATUS sme_get_channel_bonding_mode5_g(tHalHandle hHal, uint32_t *mode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3090 | { |
| 3091 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3092 | tSmeConfigParams *smeConfig; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3093 | |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3094 | if (!mode) { |
| 3095 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3096 | "%s: invalid mode", __func__); |
| 3097 | return QDF_STATUS_E_FAILURE; |
| 3098 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3099 | |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3100 | smeConfig = qdf_mem_malloc(sizeof(*smeConfig)); |
| 3101 | if (!smeConfig) { |
| 3102 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3103 | "%s: failed to alloc smeConfig", __func__); |
| 3104 | return QDF_STATUS_E_NOMEM; |
| 3105 | } |
| 3106 | |
| 3107 | if (sme_get_config_param(pMac, smeConfig) != QDF_STATUS_SUCCESS) { |
| 3108 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3109 | "%s: sme_get_config_param failed", __func__); |
| 3110 | qdf_mem_free(smeConfig); |
| 3111 | return QDF_STATUS_E_FAILURE; |
| 3112 | } |
| 3113 | |
| 3114 | *mode = smeConfig->csrConfig.channelBondingMode5GHz; |
| 3115 | qdf_mem_free(smeConfig); |
| 3116 | |
| 3117 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3118 | } |
| 3119 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3120 | /* |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3121 | * sme_get_channel_bonding_mode24_g() - get the channel bonding mode for 2.4G |
| 3122 | * band |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3123 | * |
| 3124 | * hHal - HAL handle |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3125 | * mode - channel bonding mode |
| 3126 | * |
| 3127 | * Return QDF_STATUS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3128 | */ |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3129 | QDF_STATUS sme_get_channel_bonding_mode24_g(tHalHandle hHal, uint32_t *mode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3130 | { |
| 3131 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3132 | tSmeConfigParams *smeConfig; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3133 | |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3134 | if (!mode) { |
| 3135 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3136 | "%s: invalid mode", __func__); |
| 3137 | return QDF_STATUS_E_FAILURE; |
| 3138 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3139 | |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3140 | smeConfig = qdf_mem_malloc(sizeof(*smeConfig)); |
| 3141 | if (!smeConfig) { |
| 3142 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3143 | "%s: failed to alloc smeConfig", __func__); |
| 3144 | return QDF_STATUS_E_NOMEM; |
| 3145 | } |
| 3146 | |
| 3147 | if (sme_get_config_param(pMac, smeConfig) != QDF_STATUS_SUCCESS) { |
| 3148 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3149 | "%s: sme_get_config_param failed", __func__); |
| 3150 | qdf_mem_free(smeConfig); |
| 3151 | return QDF_STATUS_E_FAILURE; |
| 3152 | } |
| 3153 | |
| 3154 | *mode = smeConfig->csrConfig.channelBondingMode24GHz; |
| 3155 | qdf_mem_free(smeConfig); |
| 3156 | |
| 3157 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3158 | } |
| 3159 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3160 | /* |
| 3161 | * sme_roam_connect() - |
| 3162 | * A wrapper function to request CSR to inititiate an association |
| 3163 | * This is an asynchronous call. |
| 3164 | * |
| 3165 | * sessionId - the sessionId returned by sme_open_session. |
| 3166 | * pProfile - description of the network to which to connect |
| 3167 | * hBssListIn - a list of BSS descriptor to roam to. It is returned |
| 3168 | * from csr_scan_get_result |
| 3169 | * pRoamId - to get back the request ID |
| 3170 | * Return QDF_STATUS |
| 3171 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3172 | QDF_STATUS sme_roam_connect(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3173 | tCsrRoamProfile *pProfile, uint32_t *pRoamId) |
| 3174 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3175 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3176 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3177 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3178 | if (!pMac) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3179 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3180 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3181 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3182 | TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3183 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3184 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3185 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 3186 | status = |
| 3187 | csr_roam_connect(pMac, sessionId, pProfile, |
| 3188 | pRoamId); |
| 3189 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 3190 | sme_err("Invalid sessionID: %d", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3191 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3192 | } |
| 3193 | sme_release_global_lock(&pMac->sme); |
| 3194 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 3195 | sme_err("sme_acquire_global_lock failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3196 | } |
| 3197 | |
| 3198 | return status; |
| 3199 | } |
| 3200 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3201 | /* |
| 3202 | * sme_set_phy_mode() - |
| 3203 | * Changes the PhyMode. |
| 3204 | * |
| 3205 | * hHal - The handle returned by mac_open. |
| 3206 | * phyMode new phyMode which is to set |
| 3207 | * Return QDF_STATUS SUCCESS. |
| 3208 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3209 | QDF_STATUS sme_set_phy_mode(tHalHandle hHal, eCsrPhyMode phyMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3210 | { |
| 3211 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3212 | |
| 3213 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3214 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3215 | "%s: invalid context", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3216 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3217 | } |
| 3218 | |
| 3219 | pMac->roam.configParam.phyMode = phyMode; |
| 3220 | pMac->roam.configParam.uCfgDot11Mode = |
| 3221 | csr_get_cfg_dot11_mode_from_csr_phy_mode(NULL, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3222 | pMac->roam.configParam.phyMode, |
| 3223 | pMac->roam.configParam. |
| 3224 | ProprietaryRatesEnabled); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3225 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3226 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3227 | } |
| 3228 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3229 | /* |
| 3230 | * sme_roam_reassoc() - |
| 3231 | * A wrapper function to request CSR to inititiate a re-association |
| 3232 | * |
| 3233 | * pProfile - can be NULL to join the currently connected AP. In that |
| 3234 | * case modProfileFields should carry the modified field(s) which could trigger |
| 3235 | * reassoc |
| 3236 | * modProfileFields - fields which are part of tCsrRoamConnectedProfile |
| 3237 | * that might need modification dynamically once STA is up & running and this |
| 3238 | * could trigger a reassoc |
| 3239 | * pRoamId - to get back the request ID |
| 3240 | * Return QDF_STATUS |
| 3241 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3242 | QDF_STATUS sme_roam_reassoc(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3243 | tCsrRoamProfile *pProfile, |
| 3244 | tCsrRoamModifyProfileFields modProfileFields, |
| 3245 | uint32_t *pRoamId, bool fForce) |
| 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 pMac = PMAC_STRUCT(hHal); |
| 3249 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3250 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3251 | TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3252 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3253 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3254 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3255 | if ((NULL == pProfile) && (fForce == 1)) |
| 3256 | status = csr_reassoc(pMac, sessionId, |
| 3257 | &modProfileFields, pRoamId, |
| 3258 | fForce); |
| 3259 | else |
| 3260 | status = csr_roam_reassoc(pMac, sessionId, |
| 3261 | pProfile, |
| 3262 | modProfileFields, pRoamId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3263 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3264 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3265 | } |
| 3266 | sme_release_global_lock(&pMac->sme); |
| 3267 | } |
| 3268 | |
| 3269 | return status; |
| 3270 | } |
| 3271 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3272 | /* |
| 3273 | * sme_roam_connect_to_last_profile() - |
| 3274 | * A wrapper function to request CSR to disconnect and reconnect with |
| 3275 | * the same profile |
| 3276 | * This is an asynchronous call. |
| 3277 | * |
| 3278 | * Return QDF_STATUS. It returns fail if currently connected |
| 3279 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3280 | 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] | 3281 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3282 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3283 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3284 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3285 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3286 | TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, |
| 3287 | sessionId, 0)); |
| 3288 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3289 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3290 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3291 | status = csr_roam_connect_to_last_profile(pMac, |
| 3292 | sessionId); |
| 3293 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3294 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3295 | sme_release_global_lock(&pMac->sme); |
| 3296 | } |
| 3297 | |
| 3298 | return status; |
| 3299 | } |
| 3300 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3301 | /* |
| 3302 | * sme_roam_disconnect() - |
| 3303 | * A wrapper function to request CSR to disconnect from a network |
| 3304 | * This is an asynchronous call. |
| 3305 | * |
| 3306 | * reason -- To indicate the reason for disconnecting. Currently, only |
| 3307 | * eCSR_DISCONNECT_REASON_MIC_ERROR is meanful. |
| 3308 | * Return QDF_STATUS |
| 3309 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3310 | QDF_STATUS sme_roam_disconnect(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3311 | eCsrRoamDisconnectReason reason) |
| 3312 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3313 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3314 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3315 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3316 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3317 | TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, |
| 3318 | reason)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3319 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3320 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3321 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3322 | status = csr_roam_disconnect(pMac, sessionId, reason); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3323 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3324 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3325 | sme_release_global_lock(&pMac->sme); |
| 3326 | } |
| 3327 | |
| 3328 | return status; |
| 3329 | } |
| 3330 | |
Abhishek Singh | ca40803 | 2016-09-13 15:26:12 +0530 | [diff] [blame] | 3331 | /* sme_dhcp_done_ind() - send dhcp done ind |
| 3332 | * @hal: hal context |
| 3333 | * @session_id: session id |
| 3334 | * |
| 3335 | * Return: void. |
| 3336 | */ |
| 3337 | void sme_dhcp_done_ind(tHalHandle hal, uint8_t session_id) |
| 3338 | { |
| 3339 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 3340 | struct csr_roam_session *session; |
Abhishek Singh | ca40803 | 2016-09-13 15:26:12 +0530 | [diff] [blame] | 3341 | |
| 3342 | if (!mac_ctx) |
| 3343 | return; |
| 3344 | |
| 3345 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 3346 | if (!session) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 3347 | sme_err("Session: %d not found", session_id); |
Abhishek Singh | ca40803 | 2016-09-13 15:26:12 +0530 | [diff] [blame] | 3348 | return; |
| 3349 | } |
| 3350 | session->dhcp_done = true; |
| 3351 | } |
| 3352 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3353 | /* |
| 3354 | * sme_roam_stop_bss() - |
| 3355 | * To stop BSS for Soft AP. This is an asynchronous API. |
| 3356 | * |
| 3357 | * hHal - Global structure |
| 3358 | * sessionId - sessionId of SoftAP |
| 3359 | * Return QDF_STATUS SUCCESS Roam callback will be called to indicate |
| 3360 | * actual results |
| 3361 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3362 | QDF_STATUS sme_roam_stop_bss(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3363 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3364 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3365 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3366 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3367 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3368 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3369 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3370 | status = csr_roam_issue_stop_bss_cmd(pMac, sessionId, |
Himanshu Agarwal | 75c8d79 | 2017-12-19 18:31:04 +0530 | [diff] [blame] | 3371 | false); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3372 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3373 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3374 | sme_release_global_lock(&pMac->sme); |
| 3375 | } |
| 3376 | |
| 3377 | return status; |
| 3378 | } |
| 3379 | |
Deepthi Gowri | b3bfefd | 2016-09-13 15:14:34 +0530 | [diff] [blame] | 3380 | /** |
| 3381 | * sme_roam_disconnect_sta() - disassociate a station |
| 3382 | * @hHal: Global structure |
| 3383 | * @sessionId: SessionId of SoftAP |
| 3384 | * @p_del_sta_params: Pointer to parameters of the station to disassoc |
| 3385 | * |
| 3386 | * To disassociate a station. This is an asynchronous API. |
| 3387 | * |
| 3388 | * Return: QDF_STATUS_SUCCESS on success.Roam callback will |
| 3389 | * be called to indicate actual result. |
| 3390 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3391 | QDF_STATUS sme_roam_disconnect_sta(tHalHandle hHal, uint8_t sessionId, |
Jeff Johnson | e6bf719 | 2017-11-07 15:16:09 -0800 | [diff] [blame] | 3392 | struct csr_del_sta_params *p_del_sta_params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3393 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3394 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3395 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3396 | |
| 3397 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3398 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3399 | return status; |
| 3400 | } |
| 3401 | |
| 3402 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3403 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3404 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3405 | status = csr_roam_issue_disassociate_sta_cmd(pMac, |
Deepthi Gowri | b3bfefd | 2016-09-13 15:14:34 +0530 | [diff] [blame] | 3406 | sessionId, p_del_sta_params); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3407 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3408 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3409 | sme_release_global_lock(&pMac->sme); |
| 3410 | } |
| 3411 | |
| 3412 | return status; |
| 3413 | } |
| 3414 | |
| 3415 | /** |
| 3416 | * sme_roam_deauth_sta() - deauthenticate a station |
| 3417 | * @hHal: Global structure |
| 3418 | * @sessionId: SessionId of SoftAP |
| 3419 | * @pDelStaParams: Pointer to parameters of the station to deauthenticate |
| 3420 | * |
| 3421 | * To disassociate a station. This is an asynchronous API. |
| 3422 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3423 | * Return: QDF_STATUS_SUCCESS on success or another QDF_STATUS error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3424 | * code on error. Roam callback will be called to indicate actual |
| 3425 | * result |
| 3426 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3427 | QDF_STATUS sme_roam_deauth_sta(tHalHandle hHal, uint8_t sessionId, |
Jeff Johnson | e6bf719 | 2017-11-07 15:16:09 -0800 | [diff] [blame] | 3428 | struct csr_del_sta_params *pDelStaParams) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3429 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3430 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3431 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3432 | |
| 3433 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3434 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3435 | return status; |
| 3436 | } |
| 3437 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3438 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 3439 | TRACE_CODE_SME_RX_HDD_MSG_DEAUTH_STA, |
| 3440 | sessionId, pDelStaParams->reason_code)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3441 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3442 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3443 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3444 | status = |
| 3445 | csr_roam_issue_deauth_sta_cmd(pMac, sessionId, |
| 3446 | pDelStaParams); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3447 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3448 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3449 | sme_release_global_lock(&pMac->sme); |
| 3450 | } |
| 3451 | |
| 3452 | return status; |
| 3453 | } |
| 3454 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3455 | /* |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3456 | * sme_roam_get_associated_stas() - |
| 3457 | * To probe the list of associated stations from various modules |
| 3458 | * of CORE stack. |
| 3459 | * This is an asynchronous API. |
| 3460 | * |
| 3461 | * sessionId - sessionId of SoftAP |
| 3462 | * modId - Module from whom list of associtated stations is |
| 3463 | * to be probed. If an invalid module is passed then |
| 3464 | * by default QDF_MODULE_ID_PE will be probed. |
| 3465 | * pUsrContext - Opaque HDD context |
| 3466 | * pfnSapEventCallback - Sap event callback in HDD |
| 3467 | * pAssocBuf - Caller allocated memory to be filled with associatd |
| 3468 | * stations info |
| 3469 | * Return QDF_STATUS |
| 3470 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3471 | QDF_STATUS sme_roam_get_associated_stas(tHalHandle hHal, uint8_t sessionId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3472 | QDF_MODULE_ID modId, void *pUsrContext, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3473 | void *pfnSapEventCallback, |
| 3474 | uint8_t *pAssocStasBuf) |
| 3475 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3476 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3477 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3478 | |
| 3479 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3480 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3481 | return status; |
| 3482 | } |
| 3483 | |
| 3484 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3485 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3486 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3487 | status = |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3488 | csr_roam_get_associated_stas(pMac, sessionId, |
| 3489 | modId, |
| 3490 | pUsrContext, |
| 3491 | pfnSapEventCallback, |
| 3492 | pAssocStasBuf); |
| 3493 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3494 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3495 | sme_release_global_lock(&pMac->sme); |
| 3496 | } |
| 3497 | |
| 3498 | return status; |
| 3499 | } |
| 3500 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3501 | /* |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3502 | * sme_roam_get_connect_state() - |
| 3503 | * A wrapper function to request CSR to return the current connect state |
| 3504 | * of Roaming |
| 3505 | * This is a synchronous call. |
| 3506 | * |
| 3507 | * Return QDF_STATUS |
| 3508 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3509 | QDF_STATUS sme_roam_get_connect_state(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3510 | eCsrConnectState *pState) |
| 3511 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3512 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3513 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3514 | |
| 3515 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3516 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3517 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3518 | status = csr_roam_get_connect_state(pMac, sessionId, |
| 3519 | pState); |
| 3520 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3521 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3522 | sme_release_global_lock(&pMac->sme); |
| 3523 | } |
| 3524 | |
| 3525 | return status; |
| 3526 | } |
| 3527 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3528 | /* |
| 3529 | * sme_roam_get_connect_profile() - |
| 3530 | * A wrapper function to request CSR to return the current connect |
| 3531 | * profile. Caller must call csr_roam_free_connect_profile after it is done |
| 3532 | * and before reuse for another csr_roam_get_connect_profile call. |
| 3533 | * This is a synchronous call. |
| 3534 | * |
| 3535 | * pProfile - pointer to a caller allocated structure |
| 3536 | * tCsrRoamConnectedProfile |
| 3537 | * eturn QDF_STATUS. Failure if not connected |
| 3538 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3539 | QDF_STATUS sme_roam_get_connect_profile(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3540 | tCsrRoamConnectedProfile *pProfile) |
| 3541 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3542 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3543 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3544 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3545 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3546 | TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, |
| 3547 | sessionId, 0)); |
| 3548 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3549 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3550 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3551 | status = csr_roam_get_connect_profile(pMac, sessionId, |
| 3552 | pProfile); |
| 3553 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3554 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3555 | sme_release_global_lock(&pMac->sme); |
| 3556 | } |
| 3557 | |
| 3558 | return status; |
| 3559 | } |
| 3560 | |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 3561 | /** |
| 3562 | * sme_roam_free_connect_profile - a wrapper function to request CSR to free and |
| 3563 | * reinitialize the profile returned previously by csr_roam_get_connect_profile. |
| 3564 | * |
| 3565 | * @profile - pointer to a caller allocated structure tCsrRoamConnectedProfile |
| 3566 | * |
| 3567 | * Return: none |
| 3568 | */ |
| 3569 | void sme_roam_free_connect_profile(tCsrRoamConnectedProfile *profile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3570 | { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3571 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3572 | TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, |
| 3573 | NO_SESSION, 0)); |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 3574 | csr_roam_free_connect_profile(profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3575 | } |
| 3576 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3577 | /* |
| 3578 | * sme_roam_set_pmkid_cache() - |
| 3579 | * A wrapper function to request CSR to return the PMKID candidate list |
| 3580 | * This is a synchronous call. |
| 3581 | |
| 3582 | * pPMKIDCache - caller allocated buffer point to an array of |
| 3583 | * tPmkidCacheInfo |
| 3584 | * numItems - a variable that has the number of tPmkidCacheInfo |
| 3585 | * allocated when retruning, this is either the number needed |
| 3586 | * or number of items put into pPMKIDCache |
| 3587 | * update_entire_cache - this bool value specifies if the entire pmkid |
| 3588 | * cache should be overwritten or should it be |
| 3589 | * updated entry by entry. |
| 3590 | * Return QDF_STATUS - when fail, it usually means the buffer allocated is not |
| 3591 | * big enough and pNumItems has the number of |
| 3592 | * tPmkidCacheInfo. |
| 3593 | * \Note: pNumItems is a number of tPmkidCacheInfo, |
| 3594 | * not sizeof(tPmkidCacheInfo) * something |
| 3595 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3596 | QDF_STATUS sme_roam_set_pmkid_cache(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3597 | tPmkidCacheInfo *pPMKIDCache, |
| 3598 | uint32_t numItems, bool update_entire_cache) |
| 3599 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3600 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3601 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3602 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3603 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3604 | TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, |
| 3605 | numItems)); |
| 3606 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3607 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3608 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3609 | status = csr_roam_set_pmkid_cache(pMac, sessionId, |
| 3610 | pPMKIDCache, |
| 3611 | numItems, update_entire_cache); |
| 3612 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3613 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3614 | sme_release_global_lock(&pMac->sme); |
| 3615 | } |
| 3616 | |
| 3617 | return status; |
| 3618 | } |
| 3619 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3620 | QDF_STATUS sme_roam_del_pmkid_from_cache(tHalHandle hHal, uint8_t sessionId, |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3621 | tPmkidCacheInfo *pmksa, |
| 3622 | bool flush_cache) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3623 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3624 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3625 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 3626 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3627 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 3628 | TRACE_CODE_SME_RX_HDD_ROAM_DEL_PMKIDCACHE, |
| 3629 | sessionId, flush_cache)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3630 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3631 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3632 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3633 | status = csr_roam_del_pmkid_from_cache(pMac, sessionId, |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3634 | pmksa, flush_cache); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3635 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3636 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3637 | sme_release_global_lock(&pMac->sme); |
| 3638 | } |
| 3639 | return status; |
| 3640 | } |
| 3641 | |
| 3642 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3643 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3644 | * \fn sme_roam_set_psk_pmk |
| 3645 | * \brief a wrapper function to request CSR to save PSK/PMK |
| 3646 | * This is a synchronous call. |
| 3647 | * \param hHal - Global structure |
| 3648 | * \param sessionId - SME sessionId |
| 3649 | * \param pPSK_PMK - pointer to an array of Psk[]/Pmk |
| 3650 | * \param pmk_len - Length could be only 16 bytes in case if LEAP |
| 3651 | * connections. Need to pass this information to |
| 3652 | * firmware. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3653 | * \return QDF_STATUS -status whether PSK/PMK is set or not |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3654 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3655 | QDF_STATUS sme_roam_set_psk_pmk(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3656 | uint8_t *pPSK_PMK, size_t pmk_len) |
| 3657 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3658 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3659 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3660 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3661 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3662 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3663 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3664 | status = csr_roam_set_psk_pmk(pMac, sessionId, pPSK_PMK, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3665 | pmk_len); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3666 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3667 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3668 | sme_release_global_lock(&pMac->sme); |
| 3669 | } |
| 3670 | return status; |
| 3671 | } |
| 3672 | #endif |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3673 | /* |
| 3674 | * sme_roam_get_security_req_ie() - |
| 3675 | * A wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR |
| 3676 | * passes to PE to JOIN request or START_BSS request |
| 3677 | * This is a synchronous call. |
| 3678 | * |
| 3679 | * pLen - caller allocated memory that has the length of pBuf as input. |
| 3680 | * Upon returned, *pLen has the needed or IE length in pBuf. |
| 3681 | * pBuf - Caller allocated memory that contain the IE field, if any, |
| 3682 | * upon return |
| 3683 | * secType - Specifies whether looking for WPA/WPA2/WAPI IE |
| 3684 | * Return QDF_STATUS - when fail, it usually means the buffer allocated is not |
| 3685 | * big enough |
| 3686 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3687 | 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] | 3688 | uint32_t *pLen, uint8_t *pBuf, |
| 3689 | eCsrSecurityType secType) |
| 3690 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3691 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3692 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3693 | |
| 3694 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3695 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3696 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3697 | status = csr_roam_get_wpa_rsn_req_ie(hHal, sessionId, |
| 3698 | pLen, pBuf); |
| 3699 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3700 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3701 | sme_release_global_lock(&pMac->sme); |
| 3702 | } |
| 3703 | |
| 3704 | return status; |
| 3705 | } |
| 3706 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3707 | /* |
| 3708 | * sme_roam_get_security_rsp_ie() - |
| 3709 | * A wrapper function to request CSR to return the WPA or RSN or |
| 3710 | * WAPI IE from the beacon or probe rsp if connected |
| 3711 | * This is a synchronous call. |
| 3712 | * |
| 3713 | * pLen - caller allocated memory that has the length of pBuf as input. |
| 3714 | * Upon returned, *pLen has the needed or IE length in pBuf. |
| 3715 | * pBuf - Caller allocated memory that contain the IE field, if any, |
| 3716 | * upon return |
| 3717 | * secType - Specifies whether looking for WPA/WPA2/WAPI IE |
| 3718 | * Return QDF_STATUS - when fail, it usually means the buffer allocated is not |
| 3719 | * big enough |
| 3720 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3721 | 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] | 3722 | uint32_t *pLen, uint8_t *pBuf, |
| 3723 | eCsrSecurityType secType) |
| 3724 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3725 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3726 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3727 | |
| 3728 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3729 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3730 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3731 | status = csr_roam_get_wpa_rsn_rsp_ie(pMac, sessionId, |
| 3732 | pLen, pBuf); |
| 3733 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3734 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3735 | sme_release_global_lock(&pMac->sme); |
| 3736 | } |
| 3737 | |
| 3738 | return status; |
| 3739 | |
| 3740 | } |
| 3741 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3742 | /* |
| 3743 | * sme_roam_get_num_pmkid_cache() - |
| 3744 | * A wrapper function to request CSR to return number of PMKID cache |
| 3745 | * entries |
| 3746 | * This is a synchronous call. |
| 3747 | * |
| 3748 | * Return uint32_t - the number of PMKID cache entries |
| 3749 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3750 | uint32_t sme_roam_get_num_pmkid_cache(tHalHandle hHal, uint8_t sessionId) |
| 3751 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3752 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3753 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3754 | uint32_t numPmkidCache = 0; |
| 3755 | |
| 3756 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3757 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3758 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 3759 | numPmkidCache = |
| 3760 | csr_roam_get_num_pmkid_cache(pMac, sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3761 | status = QDF_STATUS_SUCCESS; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3762 | } else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3763 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3764 | sme_release_global_lock(&pMac->sme); |
| 3765 | } |
| 3766 | |
| 3767 | return numPmkidCache; |
| 3768 | } |
| 3769 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3770 | /* |
| 3771 | * sme_roam_get_pmkid_cache() - |
| 3772 | * A wrapper function to request CSR to return PMKID cache from CSR |
| 3773 | * This is a synchronous call. |
| 3774 | * |
| 3775 | * pNum - caller allocated memory that has the space of the number of |
| 3776 | * pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the |
| 3777 | * needed or actually number in tPmkidCacheInfo. |
| 3778 | * pPmkidCache - Caller allocated memory that contains PMKID cache, if |
| 3779 | * any, upon return |
| 3780 | * Return QDF_STATUS - when fail, it usually means the buffer allocated is not |
| 3781 | * big enough |
| 3782 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3783 | QDF_STATUS sme_roam_get_pmkid_cache(tHalHandle hHal, uint8_t sessionId, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3784 | uint32_t *pNum, tPmkidCacheInfo *pPmkidCache) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3785 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3786 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3787 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3788 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3789 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3790 | TRACE_CODE_SME_RX_HDD_ROAM_GET_PMKIDCACHE, sessionId, |
| 3791 | 0)); |
| 3792 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3793 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3794 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3795 | status = csr_roam_get_pmkid_cache(pMac, sessionId, pNum, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3796 | pPmkidCache); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3797 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3798 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3799 | sme_release_global_lock(&pMac->sme); |
| 3800 | } |
| 3801 | |
| 3802 | return status; |
| 3803 | } |
| 3804 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3805 | /* |
| 3806 | * sme_get_config_param() - |
| 3807 | * A wrapper function that HDD calls to get the global settings |
| 3808 | * currently maintained by CSR. |
| 3809 | * This is a synchronous call. |
| 3810 | * |
| 3811 | * pParam - caller allocated memory |
| 3812 | * Return QDF_STATUS |
| 3813 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3814 | QDF_STATUS sme_get_config_param(tHalHandle hHal, tSmeConfigParams *pParam) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3815 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3816 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3817 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3818 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3819 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3820 | TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0)); |
| 3821 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3822 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3823 | status = csr_get_config_param(pMac, &pParam->csrConfig); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3824 | if (status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 3825 | sme_err("csr_get_config_param failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3826 | sme_release_global_lock(&pMac->sme); |
| 3827 | return status; |
| 3828 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3829 | qdf_mem_copy(&pParam->rrmConfig, |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 3830 | &pMac->rrm.rrmSmeContext.rrmConfig, |
| 3831 | sizeof(pMac->rrm.rrmSmeContext.rrmConfig)); |
Kapil Gupta | ab7961d | 2017-06-06 13:54:09 +0530 | [diff] [blame] | 3832 | pParam->snr_monitor_enabled = pMac->snr_monitor_enabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3833 | sme_release_global_lock(&pMac->sme); |
| 3834 | } |
| 3835 | |
| 3836 | return status; |
| 3837 | } |
| 3838 | |
| 3839 | /** |
| 3840 | * sme_cfg_set_int() - Sets the cfg parameter value. |
| 3841 | * @hal: Handle to hal. |
| 3842 | * @cfg_id: Configuration parameter ID. |
Jeff Johnson | 560dc56 | 2017-03-17 15:19:31 -0700 | [diff] [blame] | 3843 | * @value: value to be saved in the cfg parameter. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3844 | * |
| 3845 | * This function sets the string value in cfg parameter. |
| 3846 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3847 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3848 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3849 | 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] | 3850 | { |
| 3851 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3852 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3853 | |
| 3854 | if (eSIR_SUCCESS != cfg_set_int(pmac, cfg_id, value)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3855 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3856 | |
| 3857 | return status; |
| 3858 | } |
| 3859 | |
| 3860 | /** |
| 3861 | * sme_cfg_set_str() - Sets the cfg parameter string. |
| 3862 | * @hal: Handle to hal. |
| 3863 | * @cfg_id: Configuration parameter ID. |
| 3864 | * @str: Pointer to the string buffer. |
| 3865 | * @length: Length of the string. |
| 3866 | * |
| 3867 | * This function sets the string value in cfg parameter. |
| 3868 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3869 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3870 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3871 | 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] | 3872 | uint32_t length) |
| 3873 | { |
| 3874 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3875 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3876 | |
| 3877 | if (eSIR_SUCCESS != cfg_set_str(pmac, cfg_id, str, length)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3878 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3879 | |
| 3880 | return status; |
| 3881 | } |
| 3882 | |
| 3883 | /** |
| 3884 | * sme_cfg_get_int() - Gets the cfg parameter value. |
| 3885 | * @hal: Handle to hal. |
| 3886 | * @cfg_id: Configuration parameter ID. |
| 3887 | * @cfg_value: Pointer to variable in which cfg value |
Jeff Johnson | 560dc56 | 2017-03-17 15:19:31 -0700 | [diff] [blame] | 3888 | * will be saved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3889 | * |
| 3890 | * This function gets the value of the cfg parameter. |
| 3891 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3892 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3893 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3894 | 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] | 3895 | { |
| 3896 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3897 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3898 | |
| 3899 | if (eSIR_SUCCESS != wlan_cfg_get_int(pmac, cfg_id, cfg_value)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3900 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3901 | |
| 3902 | return status; |
| 3903 | } |
| 3904 | |
| 3905 | /** |
| 3906 | * sme_cfg_get_str() - Gets the cfg parameter string. |
| 3907 | * @hal: Handle to hal. |
| 3908 | * @cfg_id: Configuration parameter ID. |
| 3909 | * @str: Pointer to the string buffer. |
| 3910 | * @length: Pointer to length of the string. |
| 3911 | * |
| 3912 | * This function gets the string value of the cfg parameter. |
| 3913 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3914 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3915 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3916 | 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] | 3917 | uint32_t *length) |
| 3918 | { |
| 3919 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3920 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3921 | |
| 3922 | if (eSIR_SUCCESS != wlan_cfg_get_str(pmac, cfg_id, str, length)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3923 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3924 | |
| 3925 | return status; |
| 3926 | } |
| 3927 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3928 | /* |
| 3929 | * sme_get_modify_profile_fields() - |
| 3930 | * HDD or SME - QOS calls this function to get the current values of |
| 3931 | * connected profile fields, changing which can cause reassoc. |
| 3932 | * This function must be called after CFG is downloaded and STA is in connected |
| 3933 | * state. Also, make sure to call this function to get the current profile |
| 3934 | * fields before calling the reassoc. So that pModifyProfileFields will have |
| 3935 | * all the latest values plus the one(s) has been updated as part of reassoc |
| 3936 | * request. |
| 3937 | * |
| 3938 | * pModifyProfileFields - pointer to the connected profile fields |
| 3939 | * changing which can cause reassoc |
| 3940 | * Return QDF_STATUS |
| 3941 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3942 | QDF_STATUS sme_get_modify_profile_fields(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3943 | tCsrRoamModifyProfileFields * |
| 3944 | pModifyProfileFields) |
| 3945 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3946 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3947 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3948 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3949 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3950 | TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, |
| 3951 | 0)); |
| 3952 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3953 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3954 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3955 | status = csr_get_modify_profile_fields(pMac, sessionId, |
| 3956 | pModifyProfileFields); |
| 3957 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3958 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3959 | sme_release_global_lock(&pMac->sme); |
| 3960 | } |
| 3961 | |
| 3962 | return status; |
| 3963 | } |
| 3964 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3965 | /* |
| 3966 | * sme_set_dhcp_till_power_active_flag() - |
| 3967 | * Sets/Clears DHCP related flag to disable/enable auto PS |
| 3968 | * |
| 3969 | * hal - The handle returned by mac_open. |
| 3970 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3971 | void sme_set_dhcp_till_power_active_flag(tHalHandle hal, uint8_t flag) |
| 3972 | { |
| 3973 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 3974 | struct ps_global_info *ps_global_info = &mac->sme.ps_global_info; |
| 3975 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3976 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3977 | TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, |
| 3978 | flag)); |
| 3979 | /* Set/Clear the DHCP flag which will disable/enable auto PS */ |
| 3980 | ps_global_info->remain_in_power_active_till_dhcp = flag; |
| 3981 | } |
| 3982 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3983 | /* |
| 3984 | * sme_register11d_scan_done_callback() - |
| 3985 | * Register a routine of type csr_scan_completeCallback which is |
| 3986 | * called whenever an 11d scan is done |
| 3987 | * |
| 3988 | * hHal - The handle returned by mac_open. |
| 3989 | * callback - 11d scan complete routine to be registered |
| 3990 | * Return QDF_STATUS |
| 3991 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3992 | QDF_STATUS sme_register11d_scan_done_callback(tHalHandle hHal, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3993 | csr_scan_completeCallback callback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3994 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3995 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3996 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3997 | |
| 3998 | pMac->scan.callback11dScanDone = callback; |
| 3999 | |
| 4000 | return status; |
| 4001 | } |
| 4002 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 4003 | /** |
| 4004 | * sme_deregister11d_scan_done_callback() - De-register scandone callback |
| 4005 | * @h_hal: Handler return by mac_open |
| 4006 | * |
| 4007 | * This function De-registers the scandone callback to SME |
| 4008 | * |
| 4009 | * Return: None |
| 4010 | */ |
| 4011 | void sme_deregister11d_scan_done_callback(tHalHandle h_hal) |
| 4012 | { |
| 4013 | tpAniSirGlobal pmac; |
| 4014 | |
| 4015 | if (!h_hal) { |
| 4016 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 4017 | FL("hHal is not valid")); |
| 4018 | return; |
| 4019 | } |
| 4020 | |
| 4021 | pmac = PMAC_STRUCT(h_hal); |
| 4022 | pmac->scan.callback11dScanDone = NULL; |
| 4023 | } |
| 4024 | |
| 4025 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4026 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 4027 | /** |
| 4028 | * sme_register_oem_data_rsp_callback() - Register a routine of |
| 4029 | * type send_oem_data_rsp_msg |
| 4030 | * @h_hal: Handle returned by mac_open. |
| 4031 | * @callback: Callback to send response |
| 4032 | * to oem application. |
| 4033 | * |
| 4034 | * sme_oem_data_rsp_callback is used to register sme_send_oem_data_rsp_msg |
| 4035 | * callback function. |
| 4036 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4037 | * Return: QDF_STATUS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4038 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4039 | QDF_STATUS sme_register_oem_data_rsp_callback(tHalHandle h_hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4040 | sme_send_oem_data_rsp_msg callback) |
| 4041 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4042 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4043 | tpAniSirGlobal pmac = PMAC_STRUCT(h_hal); |
| 4044 | |
Krishna Kumaar Natarajan | bbbf2ef | 2016-08-03 14:06:26 -0700 | [diff] [blame] | 4045 | pmac->sme.oem_data_rsp_callback = callback; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4046 | |
| 4047 | return status; |
| 4048 | |
| 4049 | } |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 4050 | |
| 4051 | /** |
| 4052 | * sme_deregister_oem_data_rsp_callback() - De-register OEM datarsp callback |
| 4053 | * @h_hal: Handler return by mac_open |
| 4054 | * This function De-registers the OEM data response callback to SME |
| 4055 | * |
| 4056 | * Return: None |
| 4057 | */ |
| 4058 | void sme_deregister_oem_data_rsp_callback(tHalHandle h_hal) |
| 4059 | { |
| 4060 | tpAniSirGlobal pmac; |
| 4061 | |
| 4062 | if (!h_hal) { |
| 4063 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 4064 | FL("hHal is not valid")); |
| 4065 | return; |
| 4066 | } |
| 4067 | pmac = PMAC_STRUCT(h_hal); |
| 4068 | |
Krishna Kumaar Natarajan | bbbf2ef | 2016-08-03 14:06:26 -0700 | [diff] [blame] | 4069 | pmac->sme.oem_data_rsp_callback = NULL; |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 4070 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4071 | |
| 4072 | /** |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4073 | * sme_oem_update_capability() - update UMAC's oem related capability. |
| 4074 | * @hal: Handle returned by mac_open |
| 4075 | * @oem_cap: pointer to oem_capability |
| 4076 | * |
| 4077 | * This function updates OEM capability to UMAC. Currently RTT |
| 4078 | * related capabilities are updated. More capabilities can be |
| 4079 | * added in future. |
| 4080 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4081 | * Return: QDF_STATUS |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4082 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4083 | QDF_STATUS sme_oem_update_capability(tHalHandle hal, |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4084 | struct sme_oem_capability *cap) |
| 4085 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4086 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4087 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 4088 | uint8_t *bytes; |
| 4089 | |
| 4090 | bytes = pmac->rrm.rrmSmeContext.rrmConfig.rm_capability; |
| 4091 | |
| 4092 | if (cap->ftm_rr) |
| 4093 | bytes[4] |= RM_CAP_FTM_RANGE_REPORT; |
| 4094 | if (cap->lci_capability) |
| 4095 | bytes[4] |= RM_CAP_CIVIC_LOC_MEASUREMENT; |
| 4096 | |
| 4097 | return status; |
| 4098 | } |
| 4099 | |
| 4100 | /** |
| 4101 | * sme_oem_get_capability() - get oem capability |
| 4102 | * @hal: Handle returned by mac_open |
| 4103 | * @oem_cap: pointer to oem_capability |
| 4104 | * |
| 4105 | * This function is used to get the OEM capability from UMAC. |
| 4106 | * Currently RTT related capabilities are received. More |
| 4107 | * capabilities can be added in future. |
| 4108 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4109 | * Return: QDF_STATUS |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4110 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4111 | QDF_STATUS sme_oem_get_capability(tHalHandle hal, |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4112 | struct sme_oem_capability *cap) |
| 4113 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4114 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4115 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 4116 | uint8_t *bytes; |
| 4117 | |
| 4118 | bytes = pmac->rrm.rrmSmeContext.rrmConfig.rm_capability; |
| 4119 | |
| 4120 | cap->ftm_rr = bytes[4] & RM_CAP_FTM_RANGE_REPORT; |
| 4121 | cap->lci_capability = bytes[4] & RM_CAP_CIVIC_LOC_MEASUREMENT; |
| 4122 | |
| 4123 | return status; |
| 4124 | } |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 4125 | #endif |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4126 | |
| 4127 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4128 | * sme_enter_wowl(): SME API exposed to HDD to request enabling of WOWL mode. |
| 4129 | * @hal_ctx - The handle returned by mac_open. |
| 4130 | * @enter_wowl_callback_routine - Callback routine provided by HDD. |
| 4131 | * Used for success/failure notification by SME |
| 4132 | * @enter_wowl_callback_context - A cookie passed by HDD, that is passed |
| 4133 | * back to HDD at the time of callback. |
| 4134 | * @wake_reason_ind_cb - Callback routine provided by HDD. |
| 4135 | * Used for Wake Reason Indication by SME |
| 4136 | * @wake_reason_ind_cb_ctx - A cookie passed by HDD, that is passed |
| 4137 | * back to HDD at the time of callback. |
| 4138 | * |
| 4139 | * WoWLAN works on top of BMPS mode. |
| 4140 | * If the device is not in BMPS mode, |
| 4141 | * SME will will cache the information that |
| 4142 | * WOWL has been enabled and attempt to put the device |
| 4143 | * in BMPS. On entry into BMPS, SME will enable the |
| 4144 | * WOWL mode. |
| 4145 | * Note 1: If we exit BMPS mode (someone requests full power), |
| 4146 | * we will NOT resume WOWL when we go back to BMPS again. |
| 4147 | * Request for full power (while in WOWL mode) means disable |
| 4148 | * WOWL and go to full power. |
| 4149 | * Note 2: Both UAPSD and WOWL work on top of BMPS. |
| 4150 | * On entry into BMPS, SME will give priority to UAPSD and |
| 4151 | * enable only UAPSD if both UAPSD and WOWL are required. |
| 4152 | * Currently there is no requirement or use case to support |
| 4153 | * UAPSD and WOWL at the same time. |
| 4154 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4155 | * Return: QDF_STATUS |
| 4156 | * QDF_STATUS_SUCCESS Device is already in WoWLAN mode |
| 4157 | * QDF_STATUS_E_FAILURE Device cannot enter WoWLAN mode. |
| 4158 | * QDF_STATUS_PMC_PENDING Request accepted. SME will enable |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4159 | * WOWL after BMPS mode is entered. |
| 4160 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4161 | QDF_STATUS sme_enter_wowl(tHalHandle hal_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4162 | void (*enter_wowl_callback_routine)(void |
| 4163 | *callback_context, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4164 | QDF_STATUS status), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4165 | void *enter_wowl_callback_context, |
| 4166 | #ifdef WLAN_WAKEUP_EVENTS |
| 4167 | void (*wakeIndicationCB)(void *callback_context, |
| 4168 | tpSirWakeReasonInd |
| 4169 | wake_reason_ind), |
| 4170 | void *wakeIndicationCBContext, |
| 4171 | #endif /* WLAN_WAKEUP_EVENTS */ |
| 4172 | tpSirSmeWowlEnterParams wowl_enter_params, |
| 4173 | uint8_t session_id) |
| 4174 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4175 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4176 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx); |
| 4177 | struct ps_global_info *ps_global_info = &mac_ctx->sme.ps_global_info; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4178 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4179 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4180 | TRACE_CODE_SME_RX_HDD_ENTER_WOWL, session_id, 0)); |
| 4181 | |
| 4182 | /* cache the WOWL information */ |
| 4183 | ps_global_info->ps_params[session_id].wowl_enter_params = |
| 4184 | *wowl_enter_params; |
| 4185 | ps_global_info->ps_params[session_id].enter_wowl_callback_routine = |
| 4186 | enter_wowl_callback_routine; |
| 4187 | ps_global_info->ps_params[session_id].enter_wowl_callback_context = |
| 4188 | enter_wowl_callback_context; |
| 4189 | #ifdef WLAN_WAKEUP_EVENTS |
| 4190 | /* Cache the Wake Reason Indication callback information */ |
| 4191 | ps_global_info->ps_params[session_id].wake_reason_ind_cb = |
| 4192 | wakeIndicationCB; |
| 4193 | ps_global_info->ps_params[session_id].wake_reason_ind_cb_ctx = |
| 4194 | wakeIndicationCBContext; |
| 4195 | #endif /* WLAN_WAKEUP_EVENTS */ |
| 4196 | |
| 4197 | status = sme_ps_process_command(mac_ctx, session_id, SME_PS_WOWL_ENTER); |
| 4198 | return status; |
| 4199 | } |
| 4200 | /** |
| 4201 | *sme_exit_wowl(): SME API exposed to HDD to request exit from WoWLAN mode. |
| 4202 | * @hal_ctx - The handle returned by mac_open. |
| 4203 | * @wowl_exit_params - Carries info on which smesession |
| 4204 | * wowl exit is requested. |
| 4205 | * |
| 4206 | * SME will initiate exit from WoWLAN mode and device will be |
| 4207 | * put in BMPS mode. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4208 | * Return QDF_STATUS |
| 4209 | * QDF_STATUS_E_FAILURE Device cannot exit WoWLAN mode. |
| 4210 | * QDF_STATUS_SUCCESS Request accepted to exit WoWLAN mode. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4211 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4212 | QDF_STATUS sme_exit_wowl(tHalHandle hal_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4213 | tpSirSmeWowlExitParams wowl_exit_params) |
| 4214 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4215 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4216 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx); |
| 4217 | uint8_t session_id; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4218 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4219 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4220 | TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0)); |
| 4221 | session_id = wowl_exit_params->sessionId; |
| 4222 | status = sme_ps_process_command(mac_ctx, session_id, SME_PS_WOWL_EXIT); |
| 4223 | return status; |
| 4224 | } |
| 4225 | |
| 4226 | /** |
| 4227 | * sme_roam_set_key() - To set encryption key. |
| 4228 | * @hal: hal global context |
| 4229 | * @session_id: session id |
| 4230 | * @set_key: pointer to a caller allocated object of tCsrSetContextInfo |
| 4231 | * @ptr_roam_id: Upon success return, this is the id caller can use to |
| 4232 | * identify the request in roamcallback |
| 4233 | * |
| 4234 | * This function should be called only when connected. This is an asynchronous |
| 4235 | * API. |
| 4236 | * |
| 4237 | * Return: Status of operation |
| 4238 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4239 | QDF_STATUS sme_roam_set_key(tHalHandle hal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4240 | tCsrRoamSetKey *set_key, uint32_t *ptr_roam_id) |
| 4241 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4242 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4243 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 4244 | uint32_t roam_id; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 4245 | struct csr_roam_session *session = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4246 | struct ps_global_info *ps_global_info = &mac_ctx->sme.ps_global_info; |
| 4247 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4248 | 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] | 4249 | session_id, 0)); |
| 4250 | if (set_key->keyLength > CSR_MAX_KEY_LEN) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4251 | sme_err("Invalid key length: %d", set_key->keyLength); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4252 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4253 | } |
| 4254 | /*Once Setkey is done, we can go in BMPS */ |
| 4255 | if (set_key->keyLength) |
| 4256 | ps_global_info->remain_in_power_active_till_dhcp = false; |
| 4257 | |
| 4258 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4259 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4260 | return status; |
| 4261 | |
| 4262 | roam_id = GET_NEXT_ROAM_ID(&mac_ctx->roam); |
| 4263 | if (ptr_roam_id) |
| 4264 | *ptr_roam_id = roam_id; |
| 4265 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4266 | sme_debug("keyLength: %d", set_key->keyLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4267 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4268 | sme_debug("Session_id: %d roam_id: %d", session_id, roam_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4269 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 4270 | if (!session) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4271 | sme_err("session %d not found", session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4272 | sme_release_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4273 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4274 | } |
| 4275 | if (CSR_IS_INFRA_AP(&session->connectedProfile) |
| 4276 | && set_key->keyDirection == eSIR_TX_DEFAULT) { |
| 4277 | if ((eCSR_ENCRYPT_TYPE_WEP40 == set_key->encType) |
| 4278 | || (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == |
| 4279 | set_key->encType)) { |
| 4280 | session->pCurRoamProfile->negotiatedUCEncryptionType = |
| 4281 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 4282 | } |
| 4283 | if ((eCSR_ENCRYPT_TYPE_WEP104 == set_key->encType) |
| 4284 | || (eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == |
| 4285 | set_key->encType)) { |
| 4286 | session->pCurRoamProfile->negotiatedUCEncryptionType = |
| 4287 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4288 | } |
| 4289 | } |
| 4290 | status = csr_roam_set_key(mac_ctx, session_id, set_key, roam_id); |
| 4291 | sme_release_global_lock(&mac_ctx->sme); |
| 4292 | return status; |
| 4293 | } |
| 4294 | |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 4295 | /** |
| 4296 | * sme_roam_set_default_key_index - To set default wep key idx |
| 4297 | * @hal: pointer to hal handler |
| 4298 | * @session_id: session id |
| 4299 | * @default_idx: default wep key index |
| 4300 | * |
| 4301 | * This function prepares a message and post to WMA to set wep default |
| 4302 | * key index |
| 4303 | * |
| 4304 | * Return: Success:QDF_STATUS_SUCCESS Failure: Error value |
| 4305 | */ |
| 4306 | QDF_STATUS sme_roam_set_default_key_index(tHalHandle hal, uint8_t session_id, |
| 4307 | uint8_t default_idx) |
| 4308 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4309 | struct scheduler_msg msg = {0}; |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 4310 | struct wep_update_default_key_idx *update_key; |
| 4311 | |
| 4312 | update_key = qdf_mem_malloc(sizeof(*update_key)); |
| 4313 | if (!update_key) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4314 | sme_err("Failed to allocate memory for update key"); |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 4315 | return QDF_STATUS_E_NOMEM; |
| 4316 | } |
| 4317 | |
| 4318 | update_key->session_id = session_id; |
| 4319 | update_key->default_idx = default_idx; |
| 4320 | |
| 4321 | msg.type = WMA_UPDATE_WEP_DEFAULT_KEY; |
| 4322 | msg.reserved = 0; |
| 4323 | msg.bodyptr = (void *)update_key; |
| 4324 | |
| 4325 | if (QDF_STATUS_SUCCESS != |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4326 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4327 | sme_err("Failed to post WMA_UPDATE_WEP_DEFAULT_KEY to WMA"); |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 4328 | qdf_mem_free(update_key); |
| 4329 | return QDF_STATUS_E_FAILURE; |
| 4330 | } |
| 4331 | |
| 4332 | return QDF_STATUS_SUCCESS; |
| 4333 | } |
| 4334 | |
| 4335 | |
Jeff Johnson | 8bd2335 | 2017-09-26 11:39:24 -0700 | [diff] [blame] | 4336 | /** |
| 4337 | * sme_get_rssi() - API to retrieve current RSSI |
| 4338 | * @hHal: HAL handle for device |
| 4339 | * @callback: SME sends back the requested stats using the callback |
| 4340 | * @staId: The station ID for which the RSSI is requested for |
| 4341 | * @bssid: The bssid of the connected session |
| 4342 | * @lastRSSI: RSSI value at time of request. In case fw cannot provide |
| 4343 | * RSSI, do not hold up but return this value. |
| 4344 | * @pContext: user context to be passed back along with the callback |
| 4345 | * |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4346 | * A wrapper function that client calls to register a callback to get RSSI |
| 4347 | * |
Jeff Johnson | 8bd2335 | 2017-09-26 11:39:24 -0700 | [diff] [blame] | 4348 | * Return: QDF_STATUS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4349 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4350 | QDF_STATUS sme_get_rssi(tHalHandle hHal, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4351 | tCsrRssiCallback callback, uint8_t staId, |
| 4352 | struct qdf_mac_addr bssId, int8_t lastRSSI, |
Jeff Johnson | 8bd2335 | 2017-09-26 11:39:24 -0700 | [diff] [blame] | 4353 | void *pContext) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4354 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4355 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4356 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4357 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4358 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4359 | TRACE_CODE_SME_RX_HDD_GET_RSSI, NO_SESSION, 0)); |
| 4360 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4361 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4362 | status = csr_get_rssi(pMac, callback, |
| 4363 | staId, bssId, lastRSSI, |
Jeff Johnson | 8bd2335 | 2017-09-26 11:39:24 -0700 | [diff] [blame] | 4364 | pContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4365 | sme_release_global_lock(&pMac->sme); |
| 4366 | } |
| 4367 | return status; |
| 4368 | } |
| 4369 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4370 | /* |
| 4371 | * sme_get_snr() - |
| 4372 | * A wrapper function that client calls to register a callback to get SNR |
| 4373 | * |
| 4374 | * callback - SME sends back the requested stats using the callback |
| 4375 | * staId - The station ID for which the stats is requested for |
| 4376 | * pContext - user context to be passed back along with the callback |
| 4377 | * p_cds_context - cds context |
| 4378 | * \return QDF_STATUS |
| 4379 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4380 | QDF_STATUS sme_get_snr(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4381 | tCsrSnrCallback callback, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4382 | uint8_t staId, struct qdf_mac_addr bssId, void *pContext) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4383 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4384 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4385 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4386 | |
| 4387 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4388 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4389 | status = csr_get_snr(pMac, callback, staId, bssId, pContext); |
| 4390 | sme_release_global_lock(&pMac->sme); |
| 4391 | } |
| 4392 | return status; |
| 4393 | } |
| 4394 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4395 | /* |
| 4396 | * sme_get_statistics() - |
| 4397 | * A wrapper function that client calls to register a callback to get |
| 4398 | * different PHY level statistics from CSR. |
| 4399 | * |
| 4400 | * requesterId - different client requesting for statistics, |
| 4401 | * HDD, UMA/GAN etc |
| 4402 | * statsMask - The different category/categories of stats requester |
| 4403 | * is looking for |
| 4404 | * callback - SME sends back the requested stats using the callback |
| 4405 | * periodicity - If requester needs periodic update in millisec, 0 means |
| 4406 | * it's an one time request |
| 4407 | * cache - If requester is happy with cached stats |
| 4408 | * staId - The station ID for which the stats is requested for |
| 4409 | * pContext - user context to be passed back along with the callback |
| 4410 | * sessionId - sme session interface |
| 4411 | * Return QDF_STATUS |
| 4412 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4413 | QDF_STATUS sme_get_statistics(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4414 | eCsrStatsRequesterType requesterId, |
| 4415 | uint32_t statsMask, tCsrStatsCallback callback, |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 4416 | uint8_t staId, void *pContext, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4417 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4418 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4419 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4420 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4421 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4422 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4423 | status = csr_get_statistics(pMac, requesterId, statsMask, |
| 4424 | callback, staId, pContext, |
| 4425 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4426 | sme_release_global_lock(&pMac->sme); |
| 4427 | } |
| 4428 | |
| 4429 | return status; |
| 4430 | |
| 4431 | } |
| 4432 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4433 | QDF_STATUS sme_get_link_status(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4434 | tCsrLinkStatusCallback callback, |
| 4435 | void *pContext, uint8_t sessionId) |
| 4436 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4437 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4438 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4439 | tAniGetLinkStatus *pMsg; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4440 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4441 | |
| 4442 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4443 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4444 | pMsg = qdf_mem_malloc(sizeof(tAniGetLinkStatus)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4445 | if (NULL == pMsg) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4446 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4447 | "%s: Not able to allocate memory for link status", |
| 4448 | __func__); |
| 4449 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4450 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4451 | } |
| 4452 | |
| 4453 | pMsg->msgType = WMA_LINK_STATUS_GET_REQ; |
| 4454 | pMsg->msgLen = (uint16_t) sizeof(tAniGetLinkStatus); |
| 4455 | pMsg->sessionId = sessionId; |
| 4456 | pMac->sme.linkStatusContext = pContext; |
| 4457 | pMac->sme.linkStatusCallback = callback; |
| 4458 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4459 | message.type = WMA_LINK_STATUS_GET_REQ; |
| 4460 | message.bodyptr = pMsg; |
| 4461 | message.reserved = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4462 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4463 | if (!QDF_IS_STATUS_SUCCESS |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4464 | (scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 4465 | &message))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4466 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4467 | "%s: Post LINK STATUS MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4468 | qdf_mem_free(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4469 | pMac->sme.linkStatusContext = NULL; |
| 4470 | pMac->sme.linkStatusCallback = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4471 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4472 | } |
| 4473 | |
| 4474 | sme_release_global_lock(&pMac->sme); |
| 4475 | } |
| 4476 | |
| 4477 | return status; |
| 4478 | } |
| 4479 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4480 | /* |
| 4481 | * sme_get_country_code() - |
| 4482 | * To return the current country code. If no country code is applied, |
| 4483 | * default country code is used to fill the buffer. |
| 4484 | * If 11d supported is turned off, an error is return and the last |
| 4485 | * applied/default country code is used. |
| 4486 | * This is a synchronous API. |
| 4487 | * |
| 4488 | * pBuf - pointer to a caller allocated buffer for returned country code. |
| 4489 | * pbLen For input, this parameter indicates how big is the buffer. |
| 4490 | * Upon return, this parameter has the number of bytes for |
| 4491 | * country. If pBuf doesn't have enough space, this function |
| 4492 | * returns fail status and this parameter contains the number |
| 4493 | * that is needed. |
| 4494 | * |
| 4495 | * Return QDF_STATUS SUCCESS. |
| 4496 | * |
| 4497 | * FAILURE or RESOURCES The API finished and failed. |
| 4498 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4499 | 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] | 4500 | { |
| 4501 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4502 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4503 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4504 | TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0)); |
| 4505 | |
| 4506 | return csr_get_country_code(pMac, pBuf, pbLen); |
| 4507 | } |
| 4508 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4509 | /* some support functions */ |
| 4510 | bool sme_is11d_supported(tHalHandle hHal) |
| 4511 | { |
| 4512 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4513 | |
Kiran Kumar Lokere | 3beeb95 | 2017-05-02 18:40:24 -0700 | [diff] [blame] | 4514 | return wlan_reg_11d_enabled_on_host(pMac->psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4515 | } |
| 4516 | |
| 4517 | bool sme_is11h_supported(tHalHandle hHal) |
| 4518 | { |
| 4519 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4520 | |
| 4521 | return csr_is11h_supported(pMac); |
| 4522 | } |
| 4523 | |
| 4524 | bool sme_is_wmm_supported(tHalHandle hHal) |
| 4525 | { |
| 4526 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4527 | |
| 4528 | return csr_is_wmm_supported(pMac); |
| 4529 | } |
| 4530 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4531 | /* |
| 4532 | * sme_change_country_code() - |
| 4533 | * Change Country code from upperlayer during WLAN driver operation. |
| 4534 | * This is a synchronous API. |
| 4535 | * |
| 4536 | * hHal - The handle returned by mac_open. |
| 4537 | * pCountry New Country Code String |
| 4538 | * sendRegHint If we want to send reg hint to nl80211 |
| 4539 | * Return QDF_STATUS SUCCESS. |
| 4540 | * FAILURE or RESOURCES The API finished and failed. |
| 4541 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4542 | QDF_STATUS sme_change_country_code(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4543 | tSmeChangeCountryCallback callback, |
| 4544 | uint8_t *pCountry, |
| 4545 | void *pContext, |
| 4546 | void *p_cds_context, |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 4547 | bool countryFromUserSpace, |
| 4548 | bool sendRegHint) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4549 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4550 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4551 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4552 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4553 | tAniChangeCountryCodeReq *pMsg; |
| 4554 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4555 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4556 | TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, |
| 4557 | 0)); |
| 4558 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4559 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4560 | if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) |
| 4561 | && (!pMac->roam.configParam. |
| 4562 | fSupplicantCountryCodeHasPriority)) { |
| 4563 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4564 | sme_warn("Set Country Code Fail since the STA is associated and userspace does not have priority"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4565 | |
| 4566 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4567 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4568 | return status; |
| 4569 | } |
| 4570 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4571 | pMsg = qdf_mem_malloc(sizeof(tAniChangeCountryCodeReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4572 | if (NULL == pMsg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4573 | sme_err("csrChangeCountryCode: failed to allocate mem for req"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4574 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4575 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4576 | } |
| 4577 | |
| 4578 | pMsg->msgType = eWNI_SME_CHANGE_COUNTRY_CODE; |
| 4579 | pMsg->msgLen = (uint16_t) sizeof(tAniChangeCountryCodeReq); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4580 | qdf_mem_copy(pMsg->countryCode, pCountry, 3); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4581 | pMsg->countryFromUserSpace = countryFromUserSpace; |
| 4582 | pMsg->sendRegHint = sendRegHint; |
| 4583 | pMsg->changeCCCallback = callback; |
| 4584 | pMsg->pDevContext = pContext; |
| 4585 | pMsg->p_cds_context = p_cds_context; |
| 4586 | |
| 4587 | msg.type = eWNI_SME_CHANGE_COUNTRY_CODE; |
| 4588 | msg.bodyptr = pMsg; |
| 4589 | msg.reserved = 0; |
| 4590 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4591 | if (QDF_STATUS_SUCCESS != |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4592 | scheduler_post_msg(QDF_MODULE_ID_SME, &msg)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4593 | sme_err("sme_change_country_code failed to post msg to self"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4594 | qdf_mem_free((void *)pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4595 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4596 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4597 | sme_release_global_lock(&pMac->sme); |
| 4598 | } |
| 4599 | |
| 4600 | return status; |
| 4601 | } |
| 4602 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4603 | /* |
| 4604 | * sme_generic_change_country_code() - |
| 4605 | * Change Country code from upperlayer during WLAN driver operation. |
| 4606 | * This is a synchronous API. |
| 4607 | * |
| 4608 | * hHal - The handle returned by mac_open. |
| 4609 | * pCountry New Country Code String |
| 4610 | * reg_domain regulatory domain |
| 4611 | * Return QDF_STATUS SUCCESS. |
| 4612 | * FAILURE or RESOURCES The API finished and failed. |
| 4613 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4614 | QDF_STATUS sme_generic_change_country_code(tHalHandle hHal, |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 4615 | uint8_t *pCountry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4616 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4617 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4618 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4619 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4620 | tAniGenericChangeCountryCodeReq *pMsg; |
| 4621 | |
| 4622 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4623 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4624 | "%s: pMac is null", __func__); |
| 4625 | return status; |
| 4626 | } |
| 4627 | |
| 4628 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4629 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4630 | pMsg = qdf_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4631 | |
| 4632 | if (NULL == pMsg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4633 | sme_err("sme_generic_change_country_code: failed to allocate mem for req"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4634 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4635 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4636 | } |
| 4637 | |
| 4638 | pMsg->msgType = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE; |
| 4639 | pMsg->msgLen = |
| 4640 | (uint16_t) sizeof(tAniGenericChangeCountryCodeReq); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4641 | qdf_mem_copy(pMsg->countryCode, pCountry, 2); |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 4642 | pMsg->countryCode[2] = ' '; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4643 | |
| 4644 | msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE; |
| 4645 | msg.bodyptr = pMsg; |
| 4646 | msg.reserved = 0; |
| 4647 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4648 | if (QDF_STATUS_SUCCESS != |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4649 | scheduler_post_msg(QDF_MODULE_ID_SME, &msg)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4650 | sme_err("sme_generic_change_country_code failed to post msg to self"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4651 | qdf_mem_free(pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4652 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4653 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4654 | sme_release_global_lock(&pMac->sme); |
| 4655 | } |
| 4656 | |
| 4657 | return status; |
| 4658 | } |
| 4659 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4660 | /* |
| 4661 | * sme_dhcp_start_ind() - |
| 4662 | * API to signal the FW about the DHCP Start event. |
| 4663 | * |
| 4664 | * hHal - HAL handle for device. |
| 4665 | * device_mode - mode(AP,SAP etc) of the device. |
| 4666 | * macAddr - MAC address of the adapter. |
| 4667 | * sessionId - session ID. |
| 4668 | * Return QDF_STATUS SUCCESS. |
| 4669 | * FAILURE or RESOURCES The API finished and failed. |
| 4670 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4671 | QDF_STATUS sme_dhcp_start_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4672 | uint8_t device_mode, |
| 4673 | uint8_t *macAddr, uint8_t sessionId) |
| 4674 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4675 | QDF_STATUS status; |
| 4676 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4677 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4678 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4679 | tAniDHCPInd *pMsg; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 4680 | struct csr_roam_session *pSession; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4681 | |
| 4682 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4683 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4684 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 4685 | |
| 4686 | if (!pSession) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4687 | sme_err("Session: %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4688 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4689 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4690 | } |
Arif Hussain | 3316f40 | 2016-11-10 13:08:03 -0800 | [diff] [blame] | 4691 | pSession->dhcp_done = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4692 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4693 | pMsg = (tAniDHCPInd *) qdf_mem_malloc(sizeof(tAniDHCPInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4694 | if (NULL == pMsg) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4695 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4696 | "%s: Not able to allocate memory for dhcp start", |
| 4697 | __func__); |
| 4698 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4699 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4700 | } |
| 4701 | pMsg->msgType = WMA_DHCP_START_IND; |
| 4702 | pMsg->msgLen = (uint16_t) sizeof(tAniDHCPInd); |
| 4703 | pMsg->device_mode = device_mode; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4704 | qdf_mem_copy(pMsg->adapterMacAddr.bytes, macAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4705 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 4706 | qdf_copy_macaddr(&pMsg->peerMacAddr, |
Srinivas Girigowda | 296105a | 2015-09-24 16:31:16 -0700 | [diff] [blame] | 4707 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4708 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4709 | message.type = WMA_DHCP_START_IND; |
| 4710 | message.bodyptr = pMsg; |
| 4711 | message.reserved = 0; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 4712 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4713 | sessionId, message.type)); |
| 4714 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 4715 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4716 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4717 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4718 | "%s: Post DHCP Start MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4719 | qdf_mem_free(pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4720 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4721 | } |
| 4722 | sme_release_global_lock(&pMac->sme); |
| 4723 | } |
| 4724 | return status; |
| 4725 | } |
| 4726 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4727 | /* |
| 4728 | * sme_dhcp_stop_ind() - |
| 4729 | * API to signal the FW about the DHCP complete event. |
| 4730 | * |
| 4731 | * hHal - HAL handle for device. |
| 4732 | * device_mode - mode(AP, SAP etc) of the device. |
| 4733 | * macAddr - MAC address of the adapter. |
| 4734 | * sessionId - session ID. |
| 4735 | * Return QDF_STATUS SUCCESS. |
| 4736 | * FAILURE or RESOURCES The API finished and failed. |
| 4737 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4738 | QDF_STATUS sme_dhcp_stop_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4739 | uint8_t device_mode, |
| 4740 | uint8_t *macAddr, uint8_t sessionId) |
| 4741 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4742 | QDF_STATUS status; |
| 4743 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4744 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4745 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4746 | tAniDHCPInd *pMsg; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 4747 | struct csr_roam_session *pSession; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4748 | |
| 4749 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4750 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4751 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 4752 | |
| 4753 | if (!pSession) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4754 | sme_err("Session: %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4755 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4756 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4757 | } |
Arif Hussain | 3316f40 | 2016-11-10 13:08:03 -0800 | [diff] [blame] | 4758 | pSession->dhcp_done = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4759 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4760 | pMsg = (tAniDHCPInd *) qdf_mem_malloc(sizeof(tAniDHCPInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4761 | if (NULL == pMsg) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4762 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4763 | "%s: Not able to allocate memory for dhcp stop", |
| 4764 | __func__); |
| 4765 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4766 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4767 | } |
| 4768 | |
| 4769 | pMsg->msgType = WMA_DHCP_STOP_IND; |
| 4770 | pMsg->msgLen = (uint16_t) sizeof(tAniDHCPInd); |
| 4771 | pMsg->device_mode = device_mode; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4772 | qdf_mem_copy(pMsg->adapterMacAddr.bytes, macAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4773 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 4774 | qdf_copy_macaddr(&pMsg->peerMacAddr, |
Srinivas Girigowda | 296105a | 2015-09-24 16:31:16 -0700 | [diff] [blame] | 4775 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4776 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4777 | message.type = WMA_DHCP_STOP_IND; |
| 4778 | message.bodyptr = pMsg; |
| 4779 | message.reserved = 0; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 4780 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4781 | sessionId, message.type)); |
| 4782 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 4783 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4784 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4785 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4786 | "%s: Post DHCP Stop MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4787 | qdf_mem_free(pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4788 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4789 | } |
| 4790 | |
| 4791 | sme_release_global_lock(&pMac->sme); |
| 4792 | } |
| 4793 | return status; |
| 4794 | } |
| 4795 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4796 | /* |
| 4797 | * sme_TXFailMonitorStopInd() - |
| 4798 | * API to signal the FW to start monitoring TX failures |
| 4799 | * |
| 4800 | * Return QDF_STATUS SUCCESS. |
| 4801 | * FAILURE or RESOURCES The API finished and failed. |
| 4802 | */ |
| 4803 | QDF_STATUS sme_tx_fail_monitor_start_stop_ind(tHalHandle hHal, uint8_t |
| 4804 | tx_fail_count, |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4805 | void *txFailIndCallback) |
| 4806 | { |
| 4807 | QDF_STATUS status; |
| 4808 | QDF_STATUS qdf_status; |
| 4809 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4810 | struct scheduler_msg message = {0}; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4811 | tAniTXFailMonitorInd *pMsg; |
| 4812 | |
| 4813 | status = sme_acquire_global_lock(&pMac->sme); |
| 4814 | if (QDF_STATUS_SUCCESS == status) { |
| 4815 | pMsg = (tAniTXFailMonitorInd *) |
| 4816 | qdf_mem_malloc(sizeof(tAniTXFailMonitorInd)); |
| 4817 | if (NULL == pMsg) { |
| 4818 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 4819 | "%s: Failed to allocate memory", __func__); |
| 4820 | sme_release_global_lock(&pMac->sme); |
| 4821 | return QDF_STATUS_E_NOMEM; |
| 4822 | } |
| 4823 | |
| 4824 | pMsg->msgType = WMA_TX_FAIL_MONITOR_IND; |
| 4825 | pMsg->msgLen = (uint16_t) sizeof(tAniTXFailMonitorInd); |
| 4826 | |
| 4827 | /* tx_fail_count = 0 should disable the Monitoring in FW */ |
| 4828 | pMsg->tx_fail_count = tx_fail_count; |
| 4829 | pMsg->txFailIndCallback = txFailIndCallback; |
| 4830 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4831 | message.type = WMA_TX_FAIL_MONITOR_IND; |
| 4832 | message.bodyptr = pMsg; |
| 4833 | message.reserved = 0; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4834 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4835 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 4836 | &message); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4837 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 4838 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 4839 | "%s: Post TX Fail monitor Start MSG fail", |
| 4840 | __func__); |
| 4841 | qdf_mem_free(pMsg); |
| 4842 | status = QDF_STATUS_E_FAILURE; |
| 4843 | } |
| 4844 | sme_release_global_lock(&pMac->sme); |
| 4845 | } |
| 4846 | return status; |
| 4847 | } |
| 4848 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4849 | /* |
| 4850 | * sme_set_cfg_privacy() - |
| 4851 | * API to set configure privacy parameters |
| 4852 | * |
| 4853 | * hHal - The handle returned by mac_open. |
| 4854 | * pProfile - Pointer CSR Roam profile. |
| 4855 | * fPrivacy - This parameter indicates status of privacy |
| 4856 | * Return void |
| 4857 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4858 | void sme_set_cfg_privacy(tHalHandle hHal, |
| 4859 | tCsrRoamProfile *pProfile, bool fPrivacy) |
| 4860 | { |
| 4861 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4862 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4863 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4864 | TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4865 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4866 | csr_set_cfg_privacy(pMac, pProfile, fPrivacy); |
| 4867 | sme_release_global_lock(&pMac->sme); |
| 4868 | } |
| 4869 | } |
| 4870 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4871 | /* |
| 4872 | * sme_neighbor_report_request() - |
| 4873 | * API to request neighbor report. |
| 4874 | * |
| 4875 | * hHal - The handle returned by mac_open. |
| 4876 | * pRrmNeighborReq - Pointer to a caller allocated object of type |
| 4877 | * tRrmNeighborReq. Caller owns the memory and is |
| 4878 | * responsible for freeing it. |
| 4879 | * Return QDF_STATUS |
| 4880 | * QDF_STATUS_E_FAILURE - failure |
| 4881 | * QDF_STATUS_SUCCESS success |
| 4882 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4883 | QDF_STATUS sme_neighbor_report_request(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4884 | tpRrmNeighborReq pRrmNeighborReq, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4885 | tpRrmNeighborRspCallbackInfo callbackInfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4886 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4887 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4888 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4889 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4890 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4891 | TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, |
| 4892 | 0)); |
| 4893 | |
Vignesh Viswanathan | 694e28e | 2018-01-18 20:53:57 +0530 | [diff] [blame] | 4894 | if (pRrmNeighborReq->neighbor_report_offload) { |
| 4895 | status = csr_invoke_neighbor_report_request(sessionId, |
| 4896 | pRrmNeighborReq, |
| 4897 | false); |
| 4898 | return status; |
| 4899 | } |
| 4900 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4901 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4902 | status = |
| 4903 | sme_rrm_neighbor_report_request(hHal, sessionId, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4904 | pRrmNeighborReq, callbackInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4905 | sme_release_global_lock(&pMac->sme); |
| 4906 | } |
| 4907 | |
| 4908 | return status; |
| 4909 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4910 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4911 | /* |
| 4912 | * sme_get_wcnss_wlan_compiled_version() - |
| 4913 | * This API returns the version of the WCNSS WLAN API with |
| 4914 | * which the HOST driver was built |
| 4915 | * |
| 4916 | * hHal - The handle returned by mac_open. |
| 4917 | * pVersion - Points to the Version structure to be filled |
| 4918 | * Return QDF_STATUS |
| 4919 | * QDF_STATUS_E_INVAL - failure |
| 4920 | * QDF_STATUS_SUCCESS success |
| 4921 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4922 | QDF_STATUS sme_get_wcnss_wlan_compiled_version(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4923 | tSirVersionType *pVersion) |
| 4924 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4925 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4926 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4927 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4928 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4929 | if (pVersion != NULL) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4930 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4931 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4932 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4933 | |
| 4934 | sme_release_global_lock(&pMac->sme); |
| 4935 | } |
| 4936 | |
| 4937 | return status; |
| 4938 | } |
| 4939 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4940 | /* |
| 4941 | * sme_get_wcnss_wlan_reported_version() - |
| 4942 | * This API returns the version of the WCNSS WLAN API with |
| 4943 | * which the WCNSS driver reports it was built |
| 4944 | * hHal - The handle returned by mac_open. |
| 4945 | * pVersion - Points to the Version structure to be filled |
| 4946 | * Return QDF_STATUS |
| 4947 | * QDF_STATUS_E_INVAL - failure |
| 4948 | * QDF_STATUS_SUCCESS success |
| 4949 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4950 | QDF_STATUS sme_get_wcnss_wlan_reported_version(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4951 | tSirVersionType *pVersion) |
| 4952 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4953 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4954 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4955 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4956 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4957 | if (pVersion != NULL) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4958 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4959 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4960 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4961 | |
| 4962 | sme_release_global_lock(&pMac->sme); |
| 4963 | } |
| 4964 | |
| 4965 | return status; |
| 4966 | } |
| 4967 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4968 | /* |
| 4969 | * sme_get_wcnss_software_version() - |
| 4970 | * This API returns the version string of the WCNSS driver |
| 4971 | * |
| 4972 | * hHal - The handle returned by mac_open. |
| 4973 | * pVersion - Points to the Version string buffer to be filled |
| 4974 | * versionBufferSize - THe size of the Version string buffer |
| 4975 | * Return QDF_STATUS |
| 4976 | * QDF_STATUS_E_INVAL - failure |
| 4977 | * QDF_STATUS_SUCCESS success |
| 4978 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4979 | QDF_STATUS sme_get_wcnss_software_version(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4980 | uint8_t *pVersion, |
| 4981 | uint32_t versionBufferSize) |
| 4982 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4983 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4984 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4985 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4986 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4987 | if (pVersion != NULL) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4988 | status = |
Jeff Johnson | abb7404 | 2017-08-31 11:44:55 -0700 | [diff] [blame] | 4989 | wma_get_wcnss_software_version( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4990 | pVersion, |
| 4991 | versionBufferSize); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4992 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4993 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4994 | sme_release_global_lock(&pMac->sme); |
| 4995 | } |
| 4996 | |
| 4997 | return status; |
| 4998 | } |
| 4999 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5000 | /* |
| 5001 | * sme_get_wcnss_hardware_version() - |
| 5002 | * This API returns the version string of the WCNSS hardware |
| 5003 | * |
| 5004 | * hHal - The handle returned by mac_open. |
| 5005 | * pVersion - Points to the Version string buffer to be filled |
| 5006 | * versionBufferSize - THe size of the Version string buffer |
| 5007 | * Return QDF_STATUS |
| 5008 | * QDF_STATUS_E_INVAL - failure |
| 5009 | * QDF_STATUS_SUCCESS success |
| 5010 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5011 | QDF_STATUS sme_get_wcnss_hardware_version(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5012 | uint8_t *pVersion, |
| 5013 | uint32_t versionBufferSize) |
| 5014 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5015 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5016 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5017 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5018 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5019 | if (pVersion != NULL) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5020 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5021 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5022 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5023 | |
| 5024 | sme_release_global_lock(&pMac->sme); |
| 5025 | } |
| 5026 | |
| 5027 | return status; |
| 5028 | } |
| 5029 | |
| 5030 | #ifdef FEATURE_WLAN_WAPI |
| 5031 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5032 | /* |
| 5033 | * sme_scan_get_bkid_candidate_list() - |
| 5034 | * A wrapper function to return the BKID candidate list |
| 5035 | * |
| 5036 | * pBkidList - caller allocated buffer point to an array of |
| 5037 | * tBkidCandidateInfo |
| 5038 | * pNumItems - pointer to a variable that has the number of |
| 5039 | * tBkidCandidateInfo allocated when retruning, this is |
| 5040 | * either the number needed or number of items put into |
| 5041 | * pPmkidList |
| 5042 | * Return QDF_STATUS - when fail, it usually means the buffer allocated is not |
| 5043 | * big enough and pNumItems |
| 5044 | * has the number of tBkidCandidateInfo. |
| 5045 | * Note: pNumItems is a number of tBkidCandidateInfo, |
| 5046 | * not sizeof(tBkidCandidateInfo) * something |
| 5047 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5048 | 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] | 5049 | tBkidCandidateInfo *pBkidList, |
| 5050 | uint32_t *pNumItems) |
| 5051 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5052 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5053 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5054 | |
| 5055 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5056 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5057 | status = |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5058 | csr_scan_get_bkid_candidate_list(pMac, sessionId, |
| 5059 | pBkidList, pNumItems); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5060 | sme_release_global_lock(&pMac->sme); |
| 5061 | } |
| 5062 | |
| 5063 | return status; |
| 5064 | } |
| 5065 | #endif /* FEATURE_WLAN_WAPI */ |
| 5066 | |
| 5067 | #ifdef FEATURE_OEM_DATA_SUPPORT |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5068 | /** |
| 5069 | * sme_oem_data_req() - send oem data request to WMA |
| 5070 | * @hal: HAL handle |
| 5071 | * @hdd_oem_req: OEM data request from HDD |
| 5072 | * |
| 5073 | * Return: QDF_STATUS |
| 5074 | */ |
Krishna Kumaar Natarajan | c1fa17d | 2016-08-03 14:19:20 -0700 | [diff] [blame] | 5075 | 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] | 5076 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5077 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | c1fa17d | 2016-08-03 14:19:20 -0700 | [diff] [blame] | 5078 | struct oem_data_req *oem_data_req; |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5079 | void *wma_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5080 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5081 | SME_ENTER(); |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5082 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 5083 | if (!wma_handle) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5084 | sme_err("wma_handle is NULL"); |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5085 | return QDF_STATUS_E_FAILURE; |
| 5086 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5087 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5088 | oem_data_req = qdf_mem_malloc(sizeof(*oem_data_req)); |
| 5089 | if (!oem_data_req) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5090 | sme_err("mem alloc failed"); |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5091 | return QDF_STATUS_E_NOMEM; |
| 5092 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5093 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5094 | oem_data_req->data_len = hdd_oem_req->data_len; |
| 5095 | oem_data_req->data = qdf_mem_malloc(oem_data_req->data_len); |
| 5096 | if (!oem_data_req->data) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5097 | sme_err("mem alloc failed"); |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5098 | return QDF_STATUS_E_NOMEM; |
| 5099 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5100 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5101 | qdf_mem_copy(oem_data_req->data, hdd_oem_req->data, |
| 5102 | oem_data_req->data_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5103 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5104 | status = wma_start_oem_data_req(wma_handle, oem_data_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5105 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5106 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5107 | sme_err("Post oem data request msg fail"); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5108 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5109 | sme_debug("OEM request(length: %d) sent to WMA", |
| 5110 | oem_data_req->data_len); |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 5111 | |
| 5112 | if (oem_data_req->data_len) |
| 5113 | qdf_mem_free(oem_data_req->data); |
| 5114 | qdf_mem_free(oem_data_req); |
| 5115 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5116 | SME_EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5117 | return status; |
| 5118 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5119 | #endif /*FEATURE_OEM_DATA_SUPPORT */ |
| 5120 | |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 5121 | QDF_STATUS sme_open_session(tHalHandle hal, struct sme_session_params *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5122 | { |
Arif Hussain | ee67701 | 2017-01-26 17:50:13 -0800 | [diff] [blame] | 5123 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 5124 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Arif Hussain | ee67701 | 2017-01-26 17:50:13 -0800 | [diff] [blame] | 5125 | struct cdp_pdev *pdev; |
| 5126 | ol_txrx_peer_handle peer; |
| 5127 | uint8_t peer_id; |
Krishna Kumaar Natarajan | b9e1d71 | 2017-06-20 17:14:37 -0700 | [diff] [blame] | 5128 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5129 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 5130 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG, |
Rajeev Kumar | 7414c8c | 2017-04-06 15:42:52 -0700 | [diff] [blame] | 5131 | "%s: type=%d, session_id %d subType=%d addr:%pM", |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 5132 | __func__, params->type_of_persona, |
| 5133 | params->sme_session_id, params->subtype_of_persona, |
| 5134 | params->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5135 | |
Arif Hussain | ee67701 | 2017-01-26 17:50:13 -0800 | [diff] [blame] | 5136 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 5137 | |
| 5138 | if (NULL == pdev) { |
| 5139 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, |
| 5140 | "%s: Failed to get pdev handler", __func__); |
| 5141 | return status; |
| 5142 | } |
| 5143 | |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 5144 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 5145 | if (QDF_IS_STATUS_ERROR(status)) |
| 5146 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5147 | |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 5148 | peer = cdp_peer_find_by_addr(soc, pdev, params->self_mac_addr, |
| 5149 | &peer_id); |
Arif Hussain | ee67701 | 2017-01-26 17:50:13 -0800 | [diff] [blame] | 5150 | if (peer) { |
| 5151 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, |
| 5152 | "%s: Peer=%d exist with same MAC", |
| 5153 | __func__, peer_id); |
| 5154 | status = QDF_STATUS_E_INVAL; |
| 5155 | } else { |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 5156 | status = csr_roam_open_session(mac_ctx, params); |
Arif Hussain | ee67701 | 2017-01-26 17:50:13 -0800 | [diff] [blame] | 5157 | } |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 5158 | sme_release_global_lock(&mac_ctx->sme); |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 5159 | |
| 5160 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_HDD_OPEN_SESSION, |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 5161 | params->sme_session_id, 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5162 | |
| 5163 | return status; |
| 5164 | } |
| 5165 | |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 5166 | QDF_STATUS sme_close_session(tHalHandle hal, uint8_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5167 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5168 | QDF_STATUS status; |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 5169 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5170 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5171 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 5172 | TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, session_id, 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5173 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5174 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 5175 | status = csr_roam_close_session(pMac, session_id, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5176 | sme_release_global_lock(&pMac->sme); |
| 5177 | } |
| 5178 | |
| 5179 | return status; |
| 5180 | } |
| 5181 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5182 | /* |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5183 | * sme_change_mcc_beacon_interval() - |
| 5184 | * To update P2P-GO beaconInterval. This function should be called after |
| 5185 | * disassociating all the station is done |
| 5186 | * This is an asynchronous API. |
| 5187 | * |
| 5188 | * @sessionId: Session Identifier |
| 5189 | * Return QDF_STATUS SUCCESS |
| 5190 | * FAILURE or RESOURCES |
| 5191 | * The API finished and failed. |
| 5192 | */ |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 5193 | QDF_STATUS sme_change_mcc_beacon_interval(uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5194 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5195 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 5196 | tpAniSirGlobal mac_ctx = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5197 | |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 5198 | if (!mac_ctx) { |
| 5199 | sme_err("mac_ctx is NULL"); |
| 5200 | return status; |
| 5201 | } |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 5202 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5203 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 5204 | status = csr_send_chng_mcc_beacon_interval(mac_ctx, |
| 5205 | sessionId); |
| 5206 | sme_release_global_lock(&mac_ctx->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5207 | } |
| 5208 | return status; |
| 5209 | } |
| 5210 | |
| 5211 | /** |
| 5212 | * sme_set_host_offload(): API to set the host offload feature. |
| 5213 | * @hHal: The handle returned by mac_open. |
| 5214 | * @sessionId: Session Identifier |
| 5215 | * @request: Pointer to the offload request. |
| 5216 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5217 | * Return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5218 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5219 | QDF_STATUS sme_set_host_offload(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5220 | tpSirHostOffloadReq request) |
| 5221 | { |
| 5222 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5223 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5224 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5225 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5226 | TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0)); |
| 5227 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5228 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5229 | #ifdef WLAN_NS_OFFLOAD |
| 5230 | if (SIR_IPV6_NS_OFFLOAD == request->offloadType) { |
| 5231 | status = sme_set_ps_ns_offload(hHal, request, |
| 5232 | sessionId); |
| 5233 | } else |
| 5234 | #endif /* WLAN_NS_OFFLOAD */ |
| 5235 | { |
| 5236 | status = sme_set_ps_host_offload(hHal, request, |
| 5237 | sessionId); |
| 5238 | } |
| 5239 | sme_release_global_lock(&pMac->sme); |
| 5240 | } |
| 5241 | |
| 5242 | return status; |
| 5243 | } |
| 5244 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5245 | /* |
| 5246 | * sme_set_keep_alive() - |
| 5247 | * API to set the Keep Alive feature. |
| 5248 | * |
| 5249 | * hHal - The handle returned by mac_open. |
| 5250 | * request - Pointer to the Keep Alive request. |
| 5251 | * Return QDF_STATUS |
| 5252 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5253 | QDF_STATUS sme_set_keep_alive(tHalHandle hHal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5254 | tpSirKeepAliveReq request) |
| 5255 | { |
| 5256 | tpSirKeepAliveReq request_buf; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 5257 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5258 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 5259 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5260 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 5261 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5262 | FL("WMA_SET_KEEP_ALIVE message")); |
| 5263 | |
| 5264 | if (pSession == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5265 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5266 | FL("Session not Found")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5267 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5268 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5269 | request_buf = qdf_mem_malloc(sizeof(tSirKeepAliveReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5270 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5271 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5272 | "Not able to allocate memory for keep alive request"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5273 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5274 | } |
| 5275 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 5276 | qdf_copy_macaddr(&request->bssid, &pSession->connectedProfile.bssid); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5277 | qdf_mem_copy(request_buf, request, sizeof(tSirKeepAliveReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5278 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 5279 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5280 | "buff TP %d input TP %d ", request_buf->timePeriod, |
| 5281 | request->timePeriod); |
| 5282 | request_buf->sessionId = session_id; |
| 5283 | |
| 5284 | msg.type = WMA_SET_KEEP_ALIVE; |
| 5285 | msg.reserved = 0; |
| 5286 | msg.bodyptr = request_buf; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 5287 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 5288 | session_id, msg.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5289 | if (QDF_STATUS_SUCCESS != |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 5290 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5291 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5292 | "Not able to post WMA_SET_KEEP_ALIVE message to WMA"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5293 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5294 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5295 | } |
| 5296 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5297 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5298 | } |
| 5299 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5300 | /* |
| 5301 | * sme_get_operation_channel() - |
| 5302 | * API to get current channel on which STA is parked his function gives |
| 5303 | * channel information only of infra station or IBSS station |
| 5304 | * |
| 5305 | * hHal, pointer to memory location and sessionId |
| 5306 | * Returns QDF_STATUS_SUCCESS |
| 5307 | * QDF_STATUS_E_FAILURE |
| 5308 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5309 | QDF_STATUS sme_get_operation_channel(tHalHandle hHal, uint32_t *pChannel, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5310 | uint8_t sessionId) |
| 5311 | { |
| 5312 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 5313 | struct csr_roam_session *pSession; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5314 | |
| 5315 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 5316 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5317 | |
| 5318 | if ((pSession->connectedProfile.BSSType == |
| 5319 | eCSR_BSS_TYPE_INFRASTRUCTURE) |
| 5320 | || (pSession->connectedProfile.BSSType == |
| 5321 | eCSR_BSS_TYPE_IBSS) |
| 5322 | || (pSession->connectedProfile.BSSType == |
| 5323 | eCSR_BSS_TYPE_INFRA_AP) |
| 5324 | || (pSession->connectedProfile.BSSType == |
| 5325 | eCSR_BSS_TYPE_START_IBSS)) { |
| 5326 | *pChannel = pSession->connectedProfile.operationChannel; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5327 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5328 | } |
| 5329 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5330 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5331 | } /* sme_get_operation_channel ends here */ |
| 5332 | |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5333 | /** |
| 5334 | * sme_register_mgmt_frame_ind_callback() - Register a callback for |
| 5335 | * management frame indication to PE. |
| 5336 | * |
| 5337 | * @hal: hal pointer |
| 5338 | * @callback: callback pointer to be registered |
| 5339 | * |
| 5340 | * This function is used to register a callback for management |
| 5341 | * frame indication to PE. |
| 5342 | * |
| 5343 | * Return: Success if msg is posted to PE else Failure. |
| 5344 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5345 | QDF_STATUS sme_register_mgmt_frame_ind_callback(tHalHandle hal, |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5346 | sir_mgmt_frame_ind_callback callback) |
| 5347 | { |
| 5348 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 5349 | struct sir_sme_mgmt_frame_cb_req *msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5350 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5351 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5352 | if (QDF_STATUS_SUCCESS == |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5353 | sme_acquire_global_lock(&mac_ctx->sme)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5354 | msg = qdf_mem_malloc(sizeof(*msg)); |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5355 | if (NULL == msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5356 | sme_err("Not able to allocate memory"); |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5357 | sme_release_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5358 | return QDF_STATUS_E_NOMEM; |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5359 | } |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5360 | msg->message_type = eWNI_SME_REGISTER_MGMT_FRAME_CB; |
| 5361 | msg->length = sizeof(*msg); |
| 5362 | |
| 5363 | msg->callback = callback; |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 5364 | status = umac_send_mb_message_to_mac(msg); |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5365 | sme_release_global_lock(&mac_ctx->sme); |
| 5366 | return status; |
| 5367 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5368 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5369 | } |
| 5370 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5371 | /* |
| 5372 | * sme_RegisterMgtFrame() - |
| 5373 | * To register managment frame of specified type and subtype. |
| 5374 | * |
| 5375 | * frameType - type of the frame that needs to be passed to HDD. |
| 5376 | * matchData - data which needs to be matched before passing frame |
| 5377 | * to HDD. |
| 5378 | * matchDataLen - Length of matched data. |
| 5379 | * Return QDF_STATUS |
| 5380 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5381 | QDF_STATUS sme_register_mgmt_frame(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5382 | uint16_t frameType, uint8_t *matchData, |
| 5383 | uint16_t matchLen) |
| 5384 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5385 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5386 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5387 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5388 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5389 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5390 | tSirRegisterMgmtFrame *pMsg; |
| 5391 | uint16_t len; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 5392 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, |
| 5393 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5394 | |
| 5395 | if (!CSR_IS_SESSION_ANY(sessionId) && !pSession) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5396 | sme_err("Session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5397 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5398 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5399 | } |
| 5400 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5401 | if (!CSR_IS_SESSION_ANY(sessionId) && |
| 5402 | !pSession->sessionActive) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5403 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5404 | "%s Invalid Sessionid", __func__); |
| 5405 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5406 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5407 | } |
| 5408 | |
| 5409 | len = sizeof(tSirRegisterMgmtFrame) + matchLen; |
| 5410 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5411 | pMsg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5412 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5413 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5414 | else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5415 | pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ; |
| 5416 | pMsg->length = len; |
| 5417 | pMsg->sessionId = sessionId; |
| 5418 | pMsg->registerFrame = true; |
| 5419 | pMsg->frameType = frameType; |
| 5420 | pMsg->matchLen = matchLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5421 | qdf_mem_copy(pMsg->matchData, matchData, matchLen); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 5422 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5423 | } |
| 5424 | sme_release_global_lock(&pMac->sme); |
| 5425 | } |
| 5426 | return status; |
| 5427 | } |
| 5428 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5429 | /* |
| 5430 | * sme_DeregisterMgtFrame() - |
| 5431 | * To De-register managment frame of specified type and subtype. |
| 5432 | * |
| 5433 | * frameType - type of the frame that needs to be passed to HDD. |
| 5434 | * matchData - data which needs to be matched before passing frame |
| 5435 | * to HDD. |
| 5436 | * matchDataLen - Length of matched data. |
| 5437 | * Return QDF_STATUS |
| 5438 | */ |
| 5439 | QDF_STATUS sme_deregister_mgmt_frame(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5440 | uint16_t frameType, uint8_t *matchData, |
| 5441 | uint16_t matchLen) |
| 5442 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5443 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5444 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5445 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5446 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5447 | TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, |
| 5448 | 0)); |
| 5449 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5450 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5451 | tSirRegisterMgmtFrame *pMsg; |
| 5452 | uint16_t len; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 5453 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, |
| 5454 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5455 | |
| 5456 | if (!CSR_IS_SESSION_ANY(sessionId) && !pSession) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5457 | sme_err("Session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5458 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5459 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5460 | } |
| 5461 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5462 | if (!CSR_IS_SESSION_ANY(sessionId) && |
| 5463 | !pSession->sessionActive) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5464 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5465 | "%s Invalid Sessionid", __func__); |
| 5466 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5467 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5468 | } |
| 5469 | |
| 5470 | len = sizeof(tSirRegisterMgmtFrame) + matchLen; |
| 5471 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5472 | pMsg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5473 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5474 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5475 | else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5476 | pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ; |
| 5477 | pMsg->length = len; |
| 5478 | pMsg->registerFrame = false; |
| 5479 | pMsg->frameType = frameType; |
| 5480 | pMsg->matchLen = matchLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5481 | qdf_mem_copy(pMsg->matchData, matchData, matchLen); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 5482 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5483 | } |
| 5484 | sme_release_global_lock(&pMac->sme); |
| 5485 | } |
| 5486 | return status; |
| 5487 | } |
| 5488 | |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5489 | /** |
| 5490 | * sme_prepare_mgmt_tx() - Prepares mgmt frame |
| 5491 | * @hal: The handle returned by mac_open |
| 5492 | * @session_id: session id |
| 5493 | * @buf: pointer to frame |
| 5494 | * @len: frame length |
| 5495 | * |
| 5496 | * Return: QDF_STATUS |
| 5497 | */ |
| 5498 | static QDF_STATUS sme_prepare_mgmt_tx(tHalHandle hal, uint8_t session_id, |
| 5499 | const uint8_t *buf, uint32_t len) |
| 5500 | { |
| 5501 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 5502 | struct sir_mgmt_msg *msg; |
| 5503 | uint16_t msg_len; |
| 5504 | struct scheduler_msg sch_msg = {0}; |
| 5505 | |
| 5506 | sme_debug("prepares auth frame"); |
| 5507 | |
| 5508 | msg_len = sizeof(*msg) + len; |
| 5509 | msg = qdf_mem_malloc(msg_len); |
| 5510 | if (msg == NULL) { |
| 5511 | status = QDF_STATUS_E_NOMEM; |
| 5512 | } else { |
| 5513 | msg->type = eWNI_SME_SEND_MGMT_FRAME_TX; |
| 5514 | msg->msg_len = msg_len; |
| 5515 | msg->session_id = session_id; |
| 5516 | msg->data = (uint8_t *)msg + sizeof(*msg); |
| 5517 | qdf_mem_copy(msg->data, buf, len); |
| 5518 | |
| 5519 | sch_msg.type = eWNI_SME_SEND_MGMT_FRAME_TX; |
| 5520 | sch_msg.bodyptr = msg; |
| 5521 | status = scheduler_post_msg(QDF_MODULE_ID_PE, &sch_msg); |
| 5522 | } |
| 5523 | return status; |
| 5524 | } |
| 5525 | |
| 5526 | QDF_STATUS sme_send_mgmt_tx(tHalHandle hal, uint8_t session_id, |
| 5527 | const uint8_t *buf, uint32_t len) |
| 5528 | { |
| 5529 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 5530 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 5531 | |
| 5532 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
| 5533 | TRACE_CODE_SME_RX_HDD_SEND_MGMT_TX, session_id, 0)); |
| 5534 | |
| 5535 | status = sme_acquire_global_lock(&mac->sme); |
| 5536 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 5537 | status = sme_prepare_mgmt_tx(hal, session_id, buf, len); |
| 5538 | sme_release_global_lock(&mac->sme); |
| 5539 | } |
| 5540 | |
| 5541 | return status; |
| 5542 | } |
| 5543 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5544 | #ifdef WLAN_FEATURE_EXTWOW_SUPPORT |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 5545 | /** |
| 5546 | * sme_configure_ext_wow() - configure Extr WoW |
| 5547 | * @hHal - The handle returned by mac_open. |
| 5548 | * @wlanExtParams - Depicts the wlan Ext params. |
| 5549 | * @callback - ext_wow callback to be registered. |
| 5550 | * @callback_context - ext_wow callback context |
| 5551 | * |
| 5552 | * SME will pass this request to lower mac to configure Extr WoW |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5553 | * Return: QDF_STATUS |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 5554 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5555 | QDF_STATUS sme_configure_ext_wow(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5556 | tpSirExtWoWParams wlanExtParams, |
| 5557 | csr_readyToExtWoWCallback callback, |
| 5558 | void *callback_context) |
| 5559 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5560 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 5561 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5562 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 5563 | struct scheduler_msg message = {0}; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5564 | tpSirExtWoWParams MsgPtr = qdf_mem_malloc(sizeof(*MsgPtr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5565 | |
| 5566 | if (!MsgPtr) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5567 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5568 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5569 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5570 | TRACE_CODE_SME_RX_HDD_CONFIG_EXTWOW, NO_SESSION, 0)); |
| 5571 | |
| 5572 | pMac->readyToExtWoWCallback = callback; |
| 5573 | pMac->readyToExtWoWContext = callback_context; |
| 5574 | |
| 5575 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5576 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5577 | |
| 5578 | /* serialize the req through MC thread */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5579 | qdf_mem_copy(MsgPtr, wlanExtParams, sizeof(*MsgPtr)); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 5580 | message.bodyptr = MsgPtr; |
| 5581 | message.type = WMA_WLAN_EXT_WOW; |
| 5582 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 5583 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5584 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5585 | pMac->readyToExtWoWCallback = NULL; |
| 5586 | pMac->readyToExtWoWContext = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5587 | qdf_mem_free(MsgPtr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5588 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5589 | } |
| 5590 | sme_release_global_lock(&pMac->sme); |
| 5591 | } else { |
| 5592 | pMac->readyToExtWoWCallback = NULL; |
| 5593 | pMac->readyToExtWoWContext = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5594 | qdf_mem_free(MsgPtr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5595 | } |
| 5596 | |
| 5597 | return status; |
| 5598 | } |
| 5599 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5600 | /* |
| 5601 | * sme_configure_app_type1_params() - |
| 5602 | * SME will pass this request to lower mac to configure Indoor WoW parameters. |
| 5603 | * |
| 5604 | * hHal - The handle returned by mac_open. |
| 5605 | * wlanAppType1Params- Depicts the wlan App Type 1(Indoor) params |
| 5606 | * Return QDF_STATUS |
| 5607 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5608 | QDF_STATUS sme_configure_app_type1_params(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5609 | tpSirAppType1Params wlanAppType1Params) |
| 5610 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5611 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 5612 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5613 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 5614 | struct scheduler_msg message = {0}; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5615 | tpSirAppType1Params MsgPtr = qdf_mem_malloc(sizeof(*MsgPtr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5616 | |
| 5617 | if (!MsgPtr) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5618 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5619 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5620 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5621 | TRACE_CODE_SME_RX_HDD_CONFIG_APP_TYPE1, NO_SESSION, |
| 5622 | 0)); |
| 5623 | |
| 5624 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5625 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5626 | /* serialize the req through MC thread */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5627 | qdf_mem_copy(MsgPtr, wlanAppType1Params, sizeof(*MsgPtr)); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 5628 | message.bodyptr = MsgPtr; |
| 5629 | message.type = WMA_WLAN_SET_APP_TYPE1_PARAMS; |
| 5630 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 5631 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5632 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5633 | qdf_mem_free(MsgPtr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5634 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5635 | } |
| 5636 | sme_release_global_lock(&pMac->sme); |
| 5637 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5638 | qdf_mem_free(MsgPtr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5639 | } |
| 5640 | |
| 5641 | return status; |
| 5642 | } |
| 5643 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5644 | /* |
| 5645 | * sme_configure_app_type2_params() - |
| 5646 | * SME will pass this request to lower mac to configure Indoor WoW parameters. |
| 5647 | * |
| 5648 | * hHal - The handle returned by mac_open. |
| 5649 | * wlanAppType2Params- Depicts the wlan App Type 2 (Outdoor) params |
| 5650 | * Return QDF_STATUS |
| 5651 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5652 | QDF_STATUS sme_configure_app_type2_params(tHalHandle hHal, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5653 | tpSirAppType2Params wlanAppType2Params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5654 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5655 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 5656 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5657 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 5658 | struct scheduler_msg message = {0}; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5659 | tpSirAppType2Params MsgPtr = qdf_mem_malloc(sizeof(*MsgPtr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5660 | |
| 5661 | if (!MsgPtr) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5662 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5663 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5664 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5665 | TRACE_CODE_SME_RX_HDD_CONFIG_APP_TYPE2, NO_SESSION, |
| 5666 | 0)); |
| 5667 | |
| 5668 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5669 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5670 | /* serialize the req through MC thread */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5671 | qdf_mem_copy(MsgPtr, wlanAppType2Params, sizeof(*MsgPtr)); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 5672 | message.bodyptr = MsgPtr; |
| 5673 | message.type = WMA_WLAN_SET_APP_TYPE2_PARAMS; |
| 5674 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 5675 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5676 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5677 | qdf_mem_free(MsgPtr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5678 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5679 | } |
| 5680 | sme_release_global_lock(&pMac->sme); |
| 5681 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5682 | qdf_mem_free(MsgPtr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5683 | } |
| 5684 | |
| 5685 | return status; |
| 5686 | } |
| 5687 | #endif |
| 5688 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5689 | /* |
| 5690 | * sme_get_infra_session_id |
| 5691 | * To get the session ID for infra session, if connected |
| 5692 | * This is a synchronous API. |
| 5693 | * |
| 5694 | * hHal - The handle returned by mac_open. |
| 5695 | * sessionid, -1 if infra session is not connected |
| 5696 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5697 | int8_t sme_get_infra_session_id(tHalHandle hHal) |
| 5698 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5699 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5700 | int8_t sessionid = -1; |
| 5701 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5702 | |
| 5703 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5704 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5705 | |
| 5706 | sessionid = csr_get_infra_session_id(pMac); |
| 5707 | |
| 5708 | sme_release_global_lock(&pMac->sme); |
| 5709 | } |
| 5710 | |
| 5711 | return sessionid; |
| 5712 | } |
| 5713 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5714 | /* |
| 5715 | * sme_get_infra_operation_channel() - |
| 5716 | * To get the operating channel for infra session, if connected |
| 5717 | * This is a synchronous API. |
| 5718 | * |
| 5719 | * hHal - The handle returned by mac_open. |
| 5720 | * sessionId - the sessionId returned by sme_open_session. |
| 5721 | * Return operating channel, 0 if infra session is not connected |
| 5722 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5723 | uint8_t sme_get_infra_operation_channel(tHalHandle hHal, uint8_t sessionId) |
| 5724 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5725 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5726 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5727 | uint8_t channel = 0; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5728 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5729 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5730 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5731 | |
| 5732 | channel = csr_get_infra_operation_channel(pMac, sessionId); |
| 5733 | |
| 5734 | sme_release_global_lock(&pMac->sme); |
| 5735 | } |
| 5736 | |
| 5737 | return channel; |
| 5738 | } |
| 5739 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5740 | /* This routine will return poerating channel on which other BSS is operating |
| 5741 | * to be used for concurrency mode. If other BSS is not up or not connected it |
| 5742 | * will return 0 |
| 5743 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5744 | uint8_t sme_get_concurrent_operation_channel(tHalHandle hHal) |
| 5745 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5746 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5747 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5748 | uint8_t channel = 0; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5749 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5750 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5751 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5752 | |
| 5753 | channel = csr_get_concurrent_operation_channel(pMac); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5754 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
| 5755 | "%s: Other Concurrent Channel: %d", __func__, channel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5756 | sme_release_global_lock(&pMac->sme); |
| 5757 | } |
| 5758 | |
| 5759 | return channel; |
| 5760 | } |
| 5761 | |
| 5762 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 5763 | uint16_t sme_check_concurrent_channel_overlap(tHalHandle hHal, uint16_t sap_ch, |
| 5764 | eCsrPhyMode sapPhyMode, |
| 5765 | uint8_t cc_switch_mode) |
| 5766 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5767 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5768 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5769 | uint16_t channel = 0; |
| 5770 | |
| 5771 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5772 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5773 | channel = |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5774 | csr_check_concurrent_channel_overlap(pMac, sap_ch, |
| 5775 | sapPhyMode, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5776 | cc_switch_mode); |
| 5777 | sme_release_global_lock(&pMac->sme); |
| 5778 | } |
| 5779 | |
| 5780 | return channel; |
| 5781 | } |
| 5782 | #endif |
| 5783 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 5784 | /** |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 5785 | * sme_set_tsfcb() - Set callback for TSF capture |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5786 | * @h_hal: Handler return by mac_open |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 5787 | * @cb_fn: Callback function pointer |
| 5788 | * @db_ctx: Callback data |
| 5789 | * |
| 5790 | * Return: QDF_STATUS |
| 5791 | */ |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5792 | QDF_STATUS sme_set_tsfcb(tHalHandle h_hal, |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 5793 | int (*cb_fn)(void *cb_ctx, struct stsf *ptsf), void *cb_ctx) |
| 5794 | { |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5795 | tpAniSirGlobal mac = PMAC_STRUCT(h_hal); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 5796 | QDF_STATUS status; |
| 5797 | |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5798 | status = sme_acquire_global_lock(&mac->sme); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 5799 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5800 | mac->sme.get_tsf_cb = cb_fn; |
| 5801 | mac->sme.get_tsf_cxt = cb_ctx; |
| 5802 | sme_release_global_lock(&mac->sme); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 5803 | } |
| 5804 | return status; |
| 5805 | } |
| 5806 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 5807 | /** |
| 5808 | * sme_reset_tsfcb() - Reset callback for TSF capture |
| 5809 | * @h_hal: Handler return by mac_open |
| 5810 | * |
| 5811 | * This function reset the tsf capture callback to SME |
| 5812 | * |
| 5813 | * Return: QDF_STATUS |
| 5814 | */ |
| 5815 | QDF_STATUS sme_reset_tsfcb(tHalHandle h_hal) |
| 5816 | { |
| 5817 | tpAniSirGlobal mac; |
| 5818 | QDF_STATUS status; |
| 5819 | |
| 5820 | if (!h_hal) { |
| 5821 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 5822 | FL("h_hal is not valid")); |
| 5823 | return QDF_STATUS_E_INVAL; |
| 5824 | } |
| 5825 | mac = PMAC_STRUCT(h_hal); |
| 5826 | |
| 5827 | status = sme_acquire_global_lock(&mac->sme); |
| 5828 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 5829 | mac->sme.get_tsf_cb = NULL; |
| 5830 | mac->sme.get_tsf_cxt = NULL; |
| 5831 | sme_release_global_lock(&mac->sme); |
| 5832 | } |
| 5833 | return status; |
| 5834 | } |
| 5835 | |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5836 | #ifdef WLAN_FEATURE_TSF |
| 5837 | /* |
| 5838 | * sme_set_tsf_gpio() - set gpio pin that be toggled when capture tef |
| 5839 | * @h_hal: Handler return by mac_open |
| 5840 | * @pinvalue: gpio pin id |
| 5841 | * |
| 5842 | * Return: QDF_STATUS |
| 5843 | */ |
| 5844 | QDF_STATUS sme_set_tsf_gpio(tHalHandle h_hal, uint32_t pinvalue) |
| 5845 | { |
| 5846 | QDF_STATUS status; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 5847 | struct scheduler_msg tsf_msg = {0}; |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5848 | tpAniSirGlobal mac = PMAC_STRUCT(h_hal); |
| 5849 | |
| 5850 | status = sme_acquire_global_lock(&mac->sme); |
| 5851 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 5852 | tsf_msg.type = WMA_TSF_GPIO_PIN; |
| 5853 | tsf_msg.reserved = 0; |
| 5854 | tsf_msg.bodyval = pinvalue; |
| 5855 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 5856 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &tsf_msg); |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5857 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5858 | sme_err("Unable to post WMA_TSF_GPIO_PIN"); |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5859 | status = QDF_STATUS_E_FAILURE; |
| 5860 | } |
| 5861 | sme_release_global_lock(&mac->sme); |
| 5862 | } |
| 5863 | return status; |
| 5864 | } |
| 5865 | #endif |
| 5866 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 5867 | QDF_STATUS sme_get_cfg_valid_channels(uint8_t *aValidChannels, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5868 | uint32_t *len) |
| 5869 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5870 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 5871 | tpAniSirGlobal mac_ctx = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5872 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 5873 | if (NULL == mac_ctx) { |
| 5874 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 5875 | FL("Invalid MAC context")); |
| 5876 | return QDF_STATUS_E_FAILURE; |
| 5877 | } |
| 5878 | |
| 5879 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5880 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 5881 | status = csr_get_cfg_valid_channels(mac_ctx, |
| 5882 | aValidChannels, len); |
| 5883 | sme_release_global_lock(&mac_ctx->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5884 | } |
| 5885 | |
| 5886 | return status; |
| 5887 | } |
| 5888 | |
Amar Singhal | f0a94ad | 2017-11-27 15:20:00 -0800 | [diff] [blame] | 5889 | static uint8_t *sme_reg_hint_to_str(const enum country_src src) |
| 5890 | { |
| 5891 | switch (src) { |
| 5892 | case SOURCE_CORE: |
| 5893 | return "WORLD MODE"; |
| 5894 | |
| 5895 | case SOURCE_DRIVER: |
| 5896 | return "BDF file"; |
| 5897 | |
| 5898 | case SOURCE_USERSPACE: |
| 5899 | return "user-space"; |
| 5900 | |
| 5901 | case SOURCE_11D: |
| 5902 | return "802.11D IEs in beacons"; |
| 5903 | |
| 5904 | default: |
| 5905 | return "unknown"; |
| 5906 | } |
| 5907 | } |
| 5908 | |
Amar Singhal | 6edf973 | 2016-11-20 21:43:40 -0800 | [diff] [blame] | 5909 | void sme_set_cc_src(tHalHandle hHal, enum country_src cc_src) |
| 5910 | { |
| 5911 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hHal); |
| 5912 | |
| 5913 | mac_ctx->reg_hint_src = cc_src; |
Amar Singhal | f0a94ad | 2017-11-27 15:20:00 -0800 | [diff] [blame] | 5914 | |
| 5915 | sme_debug("Country source is %s", |
| 5916 | sme_reg_hint_to_str(cc_src)); |
Amar Singhal | 6edf973 | 2016-11-20 21:43:40 -0800 | [diff] [blame] | 5917 | } |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5918 | /* |
| 5919 | * sme_handle_change_country_code() - |
| 5920 | * Change Country code, Reg Domain and channel list |
| 5921 | * |
| 5922 | * Details Country Code Priority |
| 5923 | * If Supplicant country code is priority than 11d is disabled. |
| 5924 | * If 11D is enabled, we update the country code after every scan. |
| 5925 | * Hence when Supplicant country code is priority, we don't need 11D info. |
| 5926 | * Country code from Supplicant is set as current courtry code. |
| 5927 | * User can send reset command XX (instead of country code) to reset the |
| 5928 | * country code to default values. If 11D is priority, |
| 5929 | * Than Supplicant country code code is set to default code. But 11D code |
| 5930 | * is set as current country code |
| 5931 | * |
| 5932 | * pMac - The handle returned by mac_open. |
| 5933 | * pMsgBuf - MSG Buffer |
| 5934 | * Return QDF_STATUS |
| 5935 | */ |
| 5936 | static QDF_STATUS sme_handle_change_country_code(tpAniSirGlobal pMac, |
| 5937 | void *pMsgBuf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5938 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5939 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5940 | tAniChangeCountryCodeReq *pMsg; |
| 5941 | v_REGDOMAIN_t domainIdIoctl; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5942 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 5943 | static uint8_t default_country[CDS_COUNTRY_CODE_LEN + 1]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5944 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5945 | pMsg = (tAniChangeCountryCodeReq *) pMsgBuf; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5946 | /* |
| 5947 | * if the reset Supplicant country code command is triggered, |
| 5948 | * enable 11D, reset the country code and return |
| 5949 | */ |
Ankit Gupta | a507601 | 2016-09-14 11:32:19 -0700 | [diff] [blame] | 5950 | if (!qdf_mem_cmp(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5951 | pMac->roam.configParam.Is11dSupportEnabled = |
| 5952 | pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 5953 | |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 5954 | qdf_status = ucfg_reg_get_default_country(pMac->psoc, |
| 5955 | default_country); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5956 | |
| 5957 | /* read the country code and use it */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5958 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5959 | qdf_mem_copy(pMsg->countryCode, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5960 | default_country, |
| 5961 | WNI_CFG_COUNTRY_CODE_LEN); |
| 5962 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5963 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5964 | return status; |
| 5965 | } |
| 5966 | /* |
| 5967 | * Update the 11d country to default country so that when |
| 5968 | * callback is received for this default country, driver will |
| 5969 | * not disable the 11d taking it as valid country by user. |
| 5970 | */ |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5971 | sme_debug( |
| 5972 | "Set default country code (%c%c) as invalid country received", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5973 | pMsg->countryCode[0], pMsg->countryCode[1]); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5974 | qdf_mem_copy(pMac->scan.countryCode11d, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5975 | pMsg->countryCode, |
| 5976 | WNI_CFG_COUNTRY_CODE_LEN); |
| 5977 | } else { |
| 5978 | /* if Supplicant country code has priority, disable 11d */ |
| 5979 | if (pMac->roam.configParam.fSupplicantCountryCodeHasPriority && |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5980 | pMsg->countryFromUserSpace) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5981 | pMac->roam.configParam.Is11dSupportEnabled = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5982 | } |
| 5983 | |
| 5984 | if (pMac->roam.configParam.Is11dSupportEnabled) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5985 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5986 | |
| 5987 | /* Set Current Country code and Current Regulatory domain */ |
| 5988 | status = csr_set_country_code(pMac, pMsg->countryCode); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5989 | if (QDF_STATUS_SUCCESS != status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5990 | /* Supplicant country code failed. So give 11D priority */ |
| 5991 | pMac->roam.configParam.Is11dSupportEnabled = |
| 5992 | pMac->roam.configParam.Is11dSupportEnabledOriginal; |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5993 | sme_err("Set Country Code Fail %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5994 | return status; |
| 5995 | } |
| 5996 | |
| 5997 | /* overwrite the defualt country code */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5998 | qdf_mem_copy(pMac->scan.countryCodeDefault, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5999 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 6000 | |
| 6001 | /* Get Domain ID from country code */ |
| 6002 | status = csr_get_regulatory_domain_for_country(pMac, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6003 | pMac->scan.countryCodeCurrent, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6004 | (v_REGDOMAIN_t *) & |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 6005 | domainIdIoctl, |
| 6006 | SOURCE_QUERY); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6007 | if (status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6008 | sme_err("Fail to get regId %d", domainIdIoctl); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6009 | return status; |
| 6010 | } else if (REGDOMAIN_WORLD == domainIdIoctl) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6011 | /* Supplicant country code is invalid, so we are on world mode |
| 6012 | * now. So give 11D chance to update |
| 6013 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6014 | pMac->roam.configParam.Is11dSupportEnabled = |
| 6015 | pMac->roam.configParam.Is11dSupportEnabledOriginal; |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6016 | sme_warn("Country Code unrecognized by driver"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6017 | } |
| 6018 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 6019 | if (domainIdIoctl >= REGDOMAIN_COUNT) { |
| 6020 | sme_err("Invalid regId %d", domainIdIoctl); |
| 6021 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6022 | } else { |
| 6023 | /* if 11d has priority, clear currentCountryBssid & countryCode11d to get */ |
| 6024 | /* set again if we find AP with 11d info during scan */ |
| 6025 | if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6026 | sme_warn("Clearing currentCountryBssid, countryCode11d"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6027 | qdf_mem_zero(&pMac->scan.currentCountryBssid, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6028 | sizeof(struct qdf_mac_addr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6029 | qdf_mem_zero(pMac->scan.countryCode11d, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6030 | sizeof(pMac->scan.countryCode11d)); |
| 6031 | } |
| 6032 | } |
| 6033 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6034 | if (pMsg->changeCCCallback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6035 | ((tSmeChangeCountryCallback) (pMsg->changeCCCallback))((void *) |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6036 | pMsg->pDevContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6037 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6038 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6039 | } |
| 6040 | |
| 6041 | /** |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 6042 | * sme_handle_generic_change_country_code() - handles country ch req |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6043 | * @mac_ctx: mac global context |
| 6044 | * @msg: request msg packet |
| 6045 | * |
| 6046 | * If Supplicant country code is priority than 11d is disabled. |
| 6047 | * If 11D is enabled, we update the country code after every scan. |
| 6048 | * Hence when Supplicant country code is priority, we don't need 11D info. |
| 6049 | * Country code from Supplicant is set as current country code. |
| 6050 | * |
| 6051 | * Return: status of operation |
| 6052 | */ |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6053 | static QDF_STATUS |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 6054 | sme_handle_generic_change_country_code(tpAniSirGlobal mac_ctx, |
| 6055 | void *pMsgBuf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6056 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6057 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 6058 | v_REGDOMAIN_t reg_domain_id = 0; |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 6059 | bool user_ctry_priority = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6060 | mac_ctx->roam.configParam.fSupplicantCountryCodeHasPriority; |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 6061 | tAniGenericChangeCountryCodeReq *msg = pMsgBuf; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6062 | |
Amar Singhal | 6edf973 | 2016-11-20 21:43:40 -0800 | [diff] [blame] | 6063 | if (SOURCE_11D != mac_ctx->reg_hint_src) { |
| 6064 | if (SOURCE_DRIVER != mac_ctx->reg_hint_src) { |
| 6065 | if (user_ctry_priority) |
| 6066 | mac_ctx->roam.configParam.Is11dSupportEnabled = |
| 6067 | false; |
| 6068 | else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6069 | if (mac_ctx->roam.configParam. |
| 6070 | Is11dSupportEnabled && |
| 6071 | mac_ctx->scan.countryCode11d[0] != 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6072 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6073 | sme_debug("restore 11d"); |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 6074 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6075 | status = |
| 6076 | csr_get_regulatory_domain_for_country( |
Amar Singhal | 6edf973 | 2016-11-20 21:43:40 -0800 | [diff] [blame] | 6077 | mac_ctx, |
| 6078 | mac_ctx->scan.countryCode11d, |
| 6079 | ®_domain_id, |
| 6080 | SOURCE_11D); |
| 6081 | return QDF_STATUS_E_FAILURE; |
| 6082 | } |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 6083 | } |
| 6084 | } |
| 6085 | } else { |
| 6086 | /* if kernel gets invalid country code; it |
| 6087 | * resets the country code to world |
| 6088 | */ |
| 6089 | if (('0' != msg->countryCode[0]) || |
| 6090 | ('0' != msg->countryCode[1])) |
| 6091 | qdf_mem_copy(mac_ctx->scan.countryCode11d, |
| 6092 | msg->countryCode, |
| 6093 | WNI_CFG_COUNTRY_CODE_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6094 | } |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 6095 | |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 6096 | qdf_mem_copy(mac_ctx->scan.countryCodeCurrent, |
| 6097 | msg->countryCode, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6098 | WNI_CFG_COUNTRY_CODE_LEN); |
Amar Singhal | 9d5b1fe | 2016-10-16 20:16:05 -0700 | [diff] [blame] | 6099 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6100 | /* get the channels based on new cc */ |
| 6101 | status = csr_get_channel_and_power_list(mac_ctx); |
| 6102 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6103 | if (status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6104 | sme_err("fail to get Channels"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6105 | return status; |
| 6106 | } |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 6107 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6108 | /* reset info based on new cc, and we are done */ |
| 6109 | csr_apply_channel_power_info_wrapper(mac_ctx); |
| 6110 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6111 | csr_scan_filter_results(mac_ctx); |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 6112 | |
| 6113 | /* scans after the country is set by User hints or |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6114 | * Country IE |
| 6115 | */ |
| 6116 | mac_ctx->scan.curScanType = eSIR_ACTIVE_SCAN; |
Amar Singhal | 9d5b1fe | 2016-10-16 20:16:05 -0700 | [diff] [blame] | 6117 | |
Amar Singhal | 6edf973 | 2016-11-20 21:43:40 -0800 | [diff] [blame] | 6118 | mac_ctx->reg_hint_src = SOURCE_UNKNOWN; |
| 6119 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6120 | sme_disconnect_connected_sessions(mac_ctx); |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 6121 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6122 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6123 | } |
| 6124 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6125 | static bool |
| 6126 | sme_search_in_base_ch_lst(tpAniSirGlobal mac_ctx, uint8_t curr_ch) |
| 6127 | { |
| 6128 | uint8_t i; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 6129 | struct csr_channel *ch_lst_info; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6130 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6131 | ch_lst_info = &mac_ctx->scan.base_channels; |
| 6132 | for (i = 0; i < ch_lst_info->numChannels; i++) { |
| 6133 | if (ch_lst_info->channelList[i] == curr_ch) |
| 6134 | return true; |
| 6135 | } |
| 6136 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6137 | return false; |
| 6138 | } |
| 6139 | /** |
| 6140 | * sme_disconnect_connected_sessions() - Disconnect STA and P2P client session |
| 6141 | * if channel is not supported |
| 6142 | * @mac_ctx: mac global context |
| 6143 | * |
| 6144 | * If new country code does not support the channel on which STA/P2P client |
| 6145 | * is connetced, it sends the disconnect to the AP/P2P GO |
| 6146 | * |
| 6147 | * Return: void |
| 6148 | */ |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6149 | static void sme_disconnect_connected_sessions(tpAniSirGlobal mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6150 | { |
| 6151 | uint8_t session_id, found = false; |
| 6152 | uint8_t curr_ch; |
| 6153 | |
| 6154 | for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) { |
| 6155 | if (!csr_is_session_client_and_connected(mac_ctx, session_id)) |
| 6156 | continue; |
| 6157 | found = false; |
| 6158 | /* Session is connected.Check the channel */ |
| 6159 | curr_ch = csr_get_infra_operation_channel(mac_ctx, |
| 6160 | session_id); |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6161 | sme_debug("Current Operating channel : %d, session :%d", |
| 6162 | curr_ch, session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6163 | found = sme_search_in_base_ch_lst(mac_ctx, curr_ch); |
| 6164 | if (!found) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6165 | sme_debug("Disconnect Session: %d", session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6166 | csr_roam_disconnect(mac_ctx, session_id, |
| 6167 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6168 | } |
| 6169 | } |
| 6170 | } |
| 6171 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6172 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6173 | QDF_STATUS sme_8023_multicast_list(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6174 | tpSirRcvFltMcAddrList pMulticastAddrs) |
| 6175 | { |
| 6176 | tpSirRcvFltMcAddrList request_buf; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 6177 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6178 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 6179 | struct csr_roam_session *pSession = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6180 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6181 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 6182 | "%s: ulMulticastAddrCnt: %d, multicastAddr[0]: %pK", __func__, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6183 | pMulticastAddrs->ulMulticastAddrCnt, |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 6184 | pMulticastAddrs->multicastAddr[0].bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6185 | |
Ravi Joshi | 4f447cb | 2016-07-19 13:42:01 -0700 | [diff] [blame] | 6186 | /* Find the connected Infra / P2P_client connected session */ |
Krunal Soni | fea0680 | 2017-04-13 14:44:48 -0700 | [diff] [blame] | 6187 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 6188 | if (!CSR_IS_SESSION_VALID(pMac, sessionId) || |
| 6189 | (!csr_is_conn_state_infra(pMac, sessionId) && |
| 6190 | !csr_is_ndi_started(pMac, sessionId))) { |
Abhishek Singh | 5d8d733 | 2017-08-10 15:15:24 +0530 | [diff] [blame] | 6191 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | f2599dd | 2015-11-16 18:20:46 -0800 | [diff] [blame] | 6192 | "%s: Unable to find the session Id: %d", __func__, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6193 | sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6194 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6195 | } |
| 6196 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6197 | request_buf = qdf_mem_malloc(sizeof(tSirRcvFltMcAddrList)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6198 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6199 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6200 | "%s: Not able to allocate memory for 8023 Multicast List request", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6201 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6202 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6203 | } |
| 6204 | |
Ravi Joshi | 4f447cb | 2016-07-19 13:42:01 -0700 | [diff] [blame] | 6205 | if (!csr_is_conn_state_connected_infra(pMac, sessionId) && |
| 6206 | !csr_is_ndi_started(pMac, sessionId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6207 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Ravi Joshi | 4f447cb | 2016-07-19 13:42:01 -0700 | [diff] [blame] | 6208 | "%s: Request ignored, session %d is not connected or started", |
| 6209 | __func__, sessionId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6210 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6211 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6212 | } |
| 6213 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6214 | qdf_mem_copy(request_buf, pMulticastAddrs, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6215 | sizeof(tSirRcvFltMcAddrList)); |
| 6216 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 6217 | qdf_copy_macaddr(&request_buf->self_macaddr, &pSession->selfMacAddr); |
| 6218 | qdf_copy_macaddr(&request_buf->bssid, |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 6219 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6220 | |
| 6221 | msg.type = WMA_8023_MULTICAST_LIST_REQ; |
| 6222 | msg.reserved = 0; |
| 6223 | msg.bodyptr = request_buf; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 6224 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 6225 | sessionId, msg.type)); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 6226 | if (QDF_STATUS_SUCCESS != scheduler_post_msg(QDF_MODULE_ID_WMA, |
Krunal Soni | 66c113f | 2016-12-21 16:46:47 -0800 | [diff] [blame] | 6227 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6228 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6229 | "%s: Not able to post WMA_8023_MULTICAST_LIST message to WMA", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6230 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6231 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6232 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6233 | } |
| 6234 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6235 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6236 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6237 | #endif /* WLAN_FEATURE_PACKET_FILTERING */ |
| 6238 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6239 | /* |
| 6240 | * sme_is_channel_valid() - |
| 6241 | * To check if the channel is valid for currently established domain |
| 6242 | * This is a synchronous API. |
| 6243 | * |
| 6244 | * hHal - The handle returned by mac_open. |
| 6245 | * channel - channel to verify |
| 6246 | * Return true/false, true if channel is valid |
| 6247 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6248 | bool sme_is_channel_valid(tHalHandle hHal, uint8_t channel) |
| 6249 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6250 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6251 | bool valid = false; |
| 6252 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6253 | |
| 6254 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6255 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6256 | |
| 6257 | valid = csr_roam_is_channel_valid(pMac, channel); |
| 6258 | |
| 6259 | sme_release_global_lock(&pMac->sme); |
| 6260 | } |
| 6261 | |
| 6262 | return valid; |
| 6263 | } |
| 6264 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6265 | /* |
| 6266 | * sme_set_freq_band() - |
| 6267 | * Used to set frequency band. |
| 6268 | * |
| 6269 | * hHal |
| 6270 | * sessionId - Session Identifier |
| 6271 | * band value to be configured |
| 6272 | * Return QDF_STATUS |
| 6273 | */ |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 6274 | QDF_STATUS sme_set_freq_band(tHalHandle hHal, uint8_t sessionId, |
| 6275 | enum band_info eBand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6276 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6277 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6278 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6279 | |
| 6280 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6281 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6282 | status = csr_set_band(hHal, sessionId, eBand); |
| 6283 | sme_release_global_lock(&pMac->sme); |
| 6284 | } |
| 6285 | return status; |
| 6286 | } |
| 6287 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6288 | /* |
| 6289 | * sme_get_freq_band() - |
| 6290 | * Used to get the current band settings. |
| 6291 | * |
| 6292 | * hHal |
| 6293 | * pBand pointer to hold band value |
| 6294 | * Return QDF_STATUS |
| 6295 | */ |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 6296 | QDF_STATUS sme_get_freq_band(tHalHandle hHal, enum band_info *pBand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6297 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6298 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6299 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6300 | |
| 6301 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6302 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6303 | *pBand = csr_get_current_band(hHal); |
| 6304 | sme_release_global_lock(&pMac->sme); |
| 6305 | } |
| 6306 | return status; |
| 6307 | } |
| 6308 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6309 | /* |
| 6310 | * sme_set_max_tx_power_per_band() - |
| 6311 | * Set the Maximum Transmit Power specific to band dynamically. |
| 6312 | * Note: this setting will not persist over reboots. |
| 6313 | * |
| 6314 | * band |
| 6315 | * power to set in dB |
| 6316 | * Return QDF_STATUS |
| 6317 | */ |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 6318 | QDF_STATUS sme_set_max_tx_power_per_band(enum band_info band, int8_t dB) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6319 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 6320 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6321 | tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL; |
| 6322 | |
| 6323 | pMaxTxPowerPerBandParams = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6324 | qdf_mem_malloc(sizeof(tMaxTxPowerPerBandParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6325 | if (NULL == pMaxTxPowerPerBandParams) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6326 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6327 | "%s:Not able to allocate memory for pMaxTxPowerPerBandParams", |
| 6328 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6329 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6330 | } |
| 6331 | |
| 6332 | pMaxTxPowerPerBandParams->power = dB; |
| 6333 | pMaxTxPowerPerBandParams->bandInfo = band; |
| 6334 | |
| 6335 | msg.type = WMA_SET_MAX_TX_POWER_PER_BAND_REQ; |
| 6336 | msg.reserved = 0; |
| 6337 | msg.bodyptr = pMaxTxPowerPerBandParams; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 6338 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 6339 | NO_SESSION, msg.type)); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 6340 | if (QDF_STATUS_SUCCESS != scheduler_post_msg(QDF_MODULE_ID_WMA, |
Krunal Soni | 66c113f | 2016-12-21 16:46:47 -0800 | [diff] [blame] | 6341 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6342 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6343 | "%s:Not able to post WMA_SET_MAX_TX_POWER_PER_BAND_REQ", |
| 6344 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6345 | qdf_mem_free(pMaxTxPowerPerBandParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6346 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6347 | } |
| 6348 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6349 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6350 | } |
| 6351 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6352 | /* |
| 6353 | * sme_set_max_tx_power() - |
| 6354 | * Set the Maximum Transmit Power dynamically. Note: this setting will |
| 6355 | * not persist over reboots. |
| 6356 | * |
| 6357 | * hHal |
| 6358 | * pBssid BSSID to set the power cap for |
| 6359 | * pBssid pSelfMacAddress self MAC Address |
| 6360 | * pBssid power to set in dB |
| 6361 | * Return QDF_STATUS |
| 6362 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6363 | QDF_STATUS sme_set_max_tx_power(tHalHandle hHal, struct qdf_mac_addr pBssid, |
| 6364 | struct qdf_mac_addr pSelfMacAddress, int8_t dB) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6365 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 6366 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6367 | tpMaxTxPowerParams pMaxTxParams = NULL; |
| 6368 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6369 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6370 | TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6371 | pMaxTxParams = qdf_mem_malloc(sizeof(tMaxTxPowerParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6372 | if (NULL == pMaxTxParams) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6373 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6374 | "%s: Not able to allocate memory for pMaxTxParams", |
| 6375 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6376 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6377 | } |
| 6378 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 6379 | qdf_copy_macaddr(&pMaxTxParams->bssId, &pBssid); |
| 6380 | qdf_copy_macaddr(&pMaxTxParams->selfStaMacAddr, &pSelfMacAddress); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6381 | pMaxTxParams->power = dB; |
| 6382 | |
| 6383 | msg.type = WMA_SET_MAX_TX_POWER_REQ; |
| 6384 | msg.reserved = 0; |
| 6385 | msg.bodyptr = pMaxTxParams; |
| 6386 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 6387 | if (QDF_STATUS_SUCCESS != scheduler_post_msg(QDF_MODULE_ID_WMA, |
Krunal Soni | 66c113f | 2016-12-21 16:46:47 -0800 | [diff] [blame] | 6388 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6389 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6390 | "%s: Not able to post WMA_SET_MAX_TX_POWER_REQ message to WMA", |
| 6391 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6392 | qdf_mem_free(pMaxTxParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6393 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6394 | } |
| 6395 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6396 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6397 | } |
| 6398 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6399 | /* |
| 6400 | * sme_set_custom_mac_addr() - |
| 6401 | * Set the customer Mac Address. |
| 6402 | * |
| 6403 | * customMacAddr customer MAC Address |
| 6404 | * Return QDF_STATUS |
| 6405 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6406 | QDF_STATUS sme_set_custom_mac_addr(tSirMacAddr customMacAddr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6407 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 6408 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6409 | tSirMacAddr *pBaseMacAddr; |
| 6410 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6411 | pBaseMacAddr = qdf_mem_malloc(sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6412 | if (NULL == pBaseMacAddr) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6413 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6414 | FL("Not able to allocate memory for pBaseMacAddr")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6415 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6416 | } |
| 6417 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6418 | qdf_mem_copy(*pBaseMacAddr, customMacAddr, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6419 | |
| 6420 | msg.type = SIR_HAL_SET_BASE_MACADDR_IND; |
| 6421 | msg.reserved = 0; |
| 6422 | msg.bodyptr = pBaseMacAddr; |
| 6423 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 6424 | if (QDF_STATUS_SUCCESS != scheduler_post_msg(QDF_MODULE_ID_WMA, |
Krunal Soni | 66c113f | 2016-12-21 16:46:47 -0800 | [diff] [blame] | 6425 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6426 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6427 | "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] | 6428 | qdf_mem_free(pBaseMacAddr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6429 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6430 | } |
| 6431 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6432 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6433 | } |
| 6434 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6435 | /* |
| 6436 | * sme_set_tx_power() - |
| 6437 | * Set Transmit Power dynamically. |
| 6438 | * |
| 6439 | * hHal |
| 6440 | * sessionId Target Session ID |
| 6441 | * BSSID |
| 6442 | * dev_mode dev_mode such as station, P2PGO, SAP |
| 6443 | * dBm power to set |
| 6444 | * Return QDF_STATUS |
| 6445 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6446 | QDF_STATUS sme_set_tx_power(tHalHandle hHal, uint8_t sessionId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6447 | struct qdf_mac_addr pBSSId, |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 6448 | enum QDF_OPMODE dev_mode, int dBm) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6449 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 6450 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6451 | tpMaxTxPowerParams pTxParams = NULL; |
| 6452 | int8_t power = (int8_t) dBm; |
| 6453 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6454 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6455 | TRACE_CODE_SME_RX_HDD_SET_TXPOW, sessionId, 0)); |
| 6456 | |
| 6457 | /* make sure there is no overflow */ |
| 6458 | if ((int)power != dBm) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6459 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6460 | "%s: error, invalid power = %d", __func__, dBm); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6461 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6462 | } |
| 6463 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6464 | pTxParams = qdf_mem_malloc(sizeof(tMaxTxPowerParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6465 | if (NULL == pTxParams) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6466 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6467 | "%s: Not able to allocate memory for pTxParams", |
| 6468 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6469 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6470 | } |
| 6471 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 6472 | qdf_copy_macaddr(&pTxParams->bssId, &pBSSId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6473 | pTxParams->power = power; /* unit is dBm */ |
| 6474 | pTxParams->dev_mode = dev_mode; |
| 6475 | msg.type = WMA_SET_TX_POWER_REQ; |
| 6476 | msg.reserved = 0; |
| 6477 | msg.bodyptr = pTxParams; |
| 6478 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 6479 | if (QDF_STATUS_SUCCESS != scheduler_post_msg(QDF_MODULE_ID_WMA, |
Krunal Soni | 66c113f | 2016-12-21 16:46:47 -0800 | [diff] [blame] | 6480 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6481 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6482 | "%s: failed to post WMA_SET_TX_POWER_REQ to WMA", |
| 6483 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6484 | qdf_mem_free(pTxParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6485 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6486 | } |
| 6487 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6488 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6489 | } |
| 6490 | |
Vignesh Viswanathan | 32761e4 | 2017-09-25 17:10:54 +0530 | [diff] [blame] | 6491 | QDF_STATUS sme_update_fils_setting(tHalHandle hal, uint8_t session_id, |
| 6492 | uint8_t param_val) |
| 6493 | { |
| 6494 | QDF_STATUS status; |
| 6495 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
| 6496 | |
| 6497 | pMac->roam.configParam.is_fils_enabled = !param_val; |
| 6498 | |
| 6499 | pMac->roam.configParam.enable_bcast_probe_rsp = !param_val; |
| 6500 | status = wma_cli_set_command((int)session_id, |
| 6501 | (int)WMI_VDEV_PARAM_ENABLE_BCAST_PROBE_RESPONSE, |
| 6502 | !param_val, VDEV_CMD); |
| 6503 | if (status) |
| 6504 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 6505 | "%s: Failed to set enable bcast probe setting", |
| 6506 | __func__); |
| 6507 | |
| 6508 | return status; |
| 6509 | } |
| 6510 | |
| 6511 | QDF_STATUS sme_update_session_param(tHalHandle hal, uint8_t session_id, |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6512 | uint32_t param_type, uint32_t param_val) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6513 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6514 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6515 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6516 | uint16_t len; |
| 6517 | |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6518 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6519 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6520 | struct sir_update_session_param *msg; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 6521 | struct csr_roam_session *session = CSR_GET_SESSION(mac_ctx, |
| 6522 | session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6523 | |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6524 | if (!session) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6525 | sme_err("Session: %d not found", session_id); |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6526 | sme_release_global_lock(&mac_ctx->sme); |
| 6527 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6528 | } |
| 6529 | |
Selvaraj, Sridhar | 5b5a065 | 2017-05-04 11:23:07 +0530 | [diff] [blame] | 6530 | if (param_type == SIR_PARAM_IGNORE_ASSOC_DISALLOWED) |
| 6531 | mac_ctx->ignore_assoc_disallowed = param_val; |
| 6532 | |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6533 | if (!session->sessionActive) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6534 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6535 | |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6536 | len = sizeof(*msg); |
| 6537 | msg = qdf_mem_malloc(len); |
| 6538 | if (!msg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6539 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6540 | else { |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6541 | msg->message_type = eWNI_SME_SESSION_UPDATE_PARAM; |
| 6542 | msg->length = len; |
| 6543 | msg->session_id = session_id; |
| 6544 | msg->param_type = param_type; |
| 6545 | msg->param_val = param_val; |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 6546 | status = umac_send_mb_message_to_mac(msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6547 | } |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6548 | sme_release_global_lock(&mac_ctx->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6549 | } |
| 6550 | return status; |
| 6551 | } |
| 6552 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6553 | /* |
| 6554 | * sme_set_tm_level() - |
| 6555 | * Set Thermal Mitigation Level to RIVA |
| 6556 | * |
| 6557 | * hHal - The handle returned by mac_open. |
| 6558 | * newTMLevel - new Thermal Mitigation Level |
| 6559 | * tmMode - Thermal Mitigation handle mode, default 0 |
| 6560 | * Return QDF_STATUS |
| 6561 | */ |
| 6562 | QDF_STATUS sme_set_tm_level(tHalHandle hHal, uint16_t newTMLevel, uint16_t |
| 6563 | tmMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6564 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6565 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 6566 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6567 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 6568 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6569 | tAniSetTmLevelReq *setTmLevelReq = NULL; |
| 6570 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6571 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6572 | TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0)); |
| 6573 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6574 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6575 | setTmLevelReq = |
| 6576 | (tAniSetTmLevelReq *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6577 | qdf_mem_malloc(sizeof(tAniSetTmLevelReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6578 | if (NULL == setTmLevelReq) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6579 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6580 | "%s: Not able to allocate memory for sme_set_tm_level", |
| 6581 | __func__); |
| 6582 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6583 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6584 | } |
| 6585 | |
| 6586 | setTmLevelReq->tmMode = tmMode; |
| 6587 | setTmLevelReq->newTmLevel = newTMLevel; |
| 6588 | |
| 6589 | /* serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 6590 | message.bodyptr = setTmLevelReq; |
| 6591 | message.type = WMA_SET_TM_LEVEL_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 6592 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 6593 | NO_SESSION, message.type)); |
| 6594 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 6595 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6596 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6597 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6598 | "%s: Post Set TM Level MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6599 | qdf_mem_free(setTmLevelReq); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6600 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6601 | } |
| 6602 | sme_release_global_lock(&pMac->sme); |
| 6603 | } |
| 6604 | return status; |
| 6605 | } |
| 6606 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6607 | /* |
| 6608 | * sme_feature_caps_exchange() - SME interface to exchange capabilities between |
| 6609 | * Host and FW. |
| 6610 | * |
| 6611 | * hHal - HAL handle for device |
| 6612 | * Return NONE |
| 6613 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6614 | void sme_feature_caps_exchange(tHalHandle hHal) |
| 6615 | { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6616 | MTRACE(qdf_trace |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6617 | (QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_HDD_CAPS_EXCH, |
| 6618 | NO_SESSION, 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6619 | } |
| 6620 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6621 | /* |
| 6622 | * sme_disable_feature_capablity() - SME interface to disable Active mode |
| 6623 | * offload capablity in Host. |
| 6624 | * |
| 6625 | * hHal - HAL handle for device |
| 6626 | * Return NONE |
| 6627 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6628 | void sme_disable_feature_capablity(uint8_t feature_index) |
| 6629 | { |
| 6630 | } |
| 6631 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6632 | /* |
| 6633 | * sme_reset_power_values_for5_g |
| 6634 | * Reset the power values for 5G band with default power values. |
| 6635 | * |
| 6636 | * hHal - HAL handle for device |
| 6637 | * Return NONE |
| 6638 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6639 | void sme_reset_power_values_for5_g(tHalHandle hHal) |
| 6640 | { |
| 6641 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6642 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6643 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6644 | TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0)); |
| 6645 | csr_save_channel_power_for_band(pMac, true); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6646 | /* Store the channel+power info in the global place: Cfg */ |
| 6647 | csr_apply_power2_current(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6648 | } |
| 6649 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6650 | /* |
| 6651 | * sme_update_roam_prefer5_g_hz() - |
| 6652 | * Enable/disable Roam prefer 5G runtime option |
| 6653 | * This function is called through dynamic setConfig callback function |
| 6654 | * to configure the Roam prefer 5G runtime option |
| 6655 | * |
| 6656 | * hHal - HAL handle for device |
| 6657 | * nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option |
| 6658 | * Return Success or failure |
| 6659 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6660 | |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 6661 | QDF_STATUS sme_update_roam_prefer5_g_hz(tHalHandle hHal, |
| 6662 | bool nRoamPrefer5GHz) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6663 | { |
| 6664 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6665 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6666 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6667 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6668 | TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0)); |
| 6669 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6670 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 6671 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6672 | "%s: gRoamPrefer5GHz is changed from %d to %d", |
| 6673 | __func__, pMac->roam.configParam.nRoamPrefer5GHz, |
| 6674 | nRoamPrefer5GHz); |
| 6675 | pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz; |
| 6676 | sme_release_global_lock(&pMac->sme); |
| 6677 | } |
| 6678 | |
| 6679 | return status; |
| 6680 | } |
| 6681 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6682 | /* |
| 6683 | * sme_set_roam_intra_band() - |
| 6684 | * enable/disable Intra band roaming |
| 6685 | * This function is called through dynamic setConfig callback function |
| 6686 | * to configure the intra band roaming |
| 6687 | * hHal - HAL handle for device |
| 6688 | * nRoamIntraBand Enable/Disable Intra band roaming |
| 6689 | * Return Success or failure |
| 6690 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6691 | QDF_STATUS sme_set_roam_intra_band(tHalHandle hHal, const bool nRoamIntraBand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6692 | { |
| 6693 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6694 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6695 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6696 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6697 | TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0)); |
| 6698 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6699 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 6700 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6701 | "%s: gRoamIntraBand is changed from %d to %d", |
| 6702 | __func__, pMac->roam.configParam.nRoamIntraBand, |
| 6703 | nRoamIntraBand); |
| 6704 | pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand; |
| 6705 | sme_release_global_lock(&pMac->sme); |
| 6706 | } |
| 6707 | |
| 6708 | return status; |
| 6709 | } |
| 6710 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6711 | /* |
| 6712 | * sme_update_roam_scan_n_probes() - |
| 6713 | * Function to update roam scan N probes |
| 6714 | * This function is called through dynamic setConfig callback function |
| 6715 | * to update roam scan N probes |
| 6716 | * hHal - HAL handle for device |
| 6717 | * sessionId - Session Identifier |
| 6718 | * nProbes number of probe requests to be sent out |
| 6719 | * Return Success or failure |
| 6720 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6721 | 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] | 6722 | const uint8_t nProbes) |
| 6723 | { |
| 6724 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6725 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6726 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6727 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6728 | TRACE_CODE_SME_RX_HDD_UPDATE_ROAM_SCAN_N_PROBES, |
| 6729 | NO_SESSION, 0)); |
| 6730 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6731 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 6732 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6733 | "%s: gRoamScanNProbes is changed from %d to %d", |
| 6734 | __func__, pMac->roam.configParam.nProbes, nProbes); |
| 6735 | pMac->roam.configParam.nProbes = nProbes; |
| 6736 | sme_release_global_lock(&pMac->sme); |
| 6737 | } |
| 6738 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 6739 | csr_roam_offload_scan(pMac, sessionId, |
| 6740 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 6741 | REASON_NPROBES_CHANGED); |
| 6742 | } |
| 6743 | return status; |
| 6744 | } |
| 6745 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6746 | /* |
| 6747 | * sme_update_roam_scan_home_away_time() - |
| 6748 | * Function to update roam scan Home away time |
| 6749 | * This function is called through dynamic setConfig callback function |
| 6750 | * to update roam scan home away time |
| 6751 | * |
| 6752 | * hHal - HAL handle for device |
| 6753 | * sessionId - Session Identifier |
| 6754 | * nRoamScanAwayTime Scan home away time |
| 6755 | * bSendOffloadCmd If true then send offload command to firmware |
| 6756 | * If false then command is not sent to firmware |
| 6757 | * Return Success or failure |
| 6758 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6759 | QDF_STATUS sme_update_roam_scan_home_away_time(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6760 | uint8_t sessionId, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6761 | const uint16_t nRoamScanHomeAwayTime, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6762 | const bool bSendOffloadCmd) |
| 6763 | { |
| 6764 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6765 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6766 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6767 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6768 | TRACE_CODE_SME_RX_HDD_UPDATE_ROAM_SCAN_HOME_AWAY_TIME, |
| 6769 | NO_SESSION, 0)); |
| 6770 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6771 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 6772 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6773 | "%s: gRoamScanHomeAwayTime is changed from %d to %d", |
| 6774 | __func__, |
| 6775 | pMac->roam.configParam.nRoamScanHomeAwayTime, |
| 6776 | nRoamScanHomeAwayTime); |
| 6777 | pMac->roam.configParam.nRoamScanHomeAwayTime = |
| 6778 | nRoamScanHomeAwayTime; |
| 6779 | sme_release_global_lock(&pMac->sme); |
| 6780 | } |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6781 | if (pMac->roam.configParam.isRoamOffloadScanEnabled && |
| 6782 | bSendOffloadCmd) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6783 | csr_roam_offload_scan(pMac, sessionId, |
| 6784 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 6785 | REASON_HOME_AWAY_TIME_CHANGED); |
| 6786 | } |
| 6787 | return status; |
| 6788 | } |
| 6789 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6790 | /** |
| 6791 | * sme_ext_change_channel()- function to post send ECSA |
| 6792 | * action frame to csr. |
| 6793 | * @hHal: Hal context |
| 6794 | * @channel: new channel to switch |
| 6795 | * @session_id: senssion it should be sent on. |
| 6796 | * |
| 6797 | * This function is called to post ECSA frame to csr. |
| 6798 | * |
| 6799 | * Return: success if msg is sent else return failure |
| 6800 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6801 | QDF_STATUS sme_ext_change_channel(tHalHandle h_hal, uint32_t channel, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6802 | uint8_t session_id) |
| 6803 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6804 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6805 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(h_hal); |
| 6806 | uint8_t channel_state; |
| 6807 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6808 | sme_err("Set Channel: %d", channel); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6809 | channel_state = |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 6810 | wlan_reg_get_channel_state(mac_ctx->pdev, channel); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6811 | |
| 6812 | if (CHANNEL_STATE_DISABLE == channel_state) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6813 | sme_err("Invalid channel: %d", channel); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6814 | return QDF_STATUS_E_INVAL; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6815 | } |
| 6816 | |
| 6817 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 6818 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6819 | if (QDF_STATUS_SUCCESS == status) { |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6820 | /* update the channel list to the firmware */ |
| 6821 | status = csr_send_ext_change_channel(mac_ctx, |
| 6822 | channel, session_id); |
| 6823 | sme_release_global_lock(&mac_ctx->sme); |
| 6824 | } |
| 6825 | |
| 6826 | return status; |
| 6827 | } |
| 6828 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6829 | /* |
| 6830 | * sme_get_roam_intra_band() - |
| 6831 | * get Intra band roaming |
| 6832 | * |
| 6833 | * hHal - HAL handle for device |
| 6834 | * Return Success or failure |
| 6835 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6836 | bool sme_get_roam_intra_band(tHalHandle hHal) |
| 6837 | { |
| 6838 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6839 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6840 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6841 | TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0)); |
| 6842 | return pMac->roam.configParam.nRoamIntraBand; |
| 6843 | } |
| 6844 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6845 | /* |
| 6846 | * sme_get_roam_scan_n_probes() - |
| 6847 | * get N Probes |
| 6848 | * |
| 6849 | * hHal - HAL handle for device |
| 6850 | * Return Success or failure |
| 6851 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6852 | uint8_t sme_get_roam_scan_n_probes(tHalHandle hHal) |
| 6853 | { |
| 6854 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6855 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6856 | return pMac->roam.configParam.nProbes; |
| 6857 | } |
| 6858 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6859 | /* |
| 6860 | * sme_get_roam_scan_home_away_time() - |
| 6861 | * get Roam scan home away time |
| 6862 | * |
| 6863 | * hHal - HAL handle for device |
| 6864 | * Return Success or failure |
| 6865 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6866 | uint16_t sme_get_roam_scan_home_away_time(tHalHandle hHal) |
| 6867 | { |
| 6868 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6869 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6870 | return pMac->roam.configParam.nRoamScanHomeAwayTime; |
| 6871 | } |
| 6872 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6873 | /* |
| 6874 | * sme_update_roam_rssi_diff() - |
| 6875 | * Update RoamRssiDiff |
| 6876 | * This function is called through dynamic setConfig callback function |
| 6877 | * to configure RoamRssiDiff |
| 6878 | * Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125] |
| 6879 | * |
| 6880 | * hHal - HAL handle for device |
| 6881 | * sessionId - Session Identifier |
| 6882 | * RoamRssiDiff - minimum rssi difference between potential |
| 6883 | * candidate and current AP. |
| 6884 | * Return Success or failure |
| 6885 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6886 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6887 | QDF_STATUS sme_update_roam_rssi_diff(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6888 | uint8_t RoamRssiDiff) |
| 6889 | { |
| 6890 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6891 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6892 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 6893 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 6894 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 6895 | FL("Invalid sme session id: %d"), sessionId); |
| 6896 | return QDF_STATUS_E_INVAL; |
| 6897 | } |
| 6898 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6901 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6902 | "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %s", |
| 6903 | RoamRssiDiff, |
| 6904 | pMac->roam.configParam.RoamRssiDiff, |
| 6905 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 6906 | neighborRoamInfo |
| 6907 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6908 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6909 | pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff; |
| 6910 | sme_release_global_lock(&pMac->sme); |
| 6911 | } |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 6912 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6913 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6914 | csr_roam_offload_scan(pMac, sessionId, |
| 6915 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 6916 | REASON_RSSI_DIFF_CHANGED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6917 | return status; |
| 6918 | } |
| 6919 | |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 6920 | #ifdef WLAN_FEATURE_FILS_SK |
| 6921 | QDF_STATUS sme_update_fils_config(tHalHandle hal, uint8_t session_id, |
| 6922 | tCsrRoamProfile *src_profile) |
| 6923 | { |
| 6924 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 6925 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 6926 | tpCsrNeighborRoamControlInfo neighbor_roam_info = |
| 6927 | &mac->roam.neighborRoamInfo[session_id]; |
| 6928 | |
| 6929 | if (session_id >= CSR_ROAM_SESSION_MAX) { |
| 6930 | sme_err("Invalid sme session id: %d", session_id); |
| 6931 | return QDF_STATUS_E_INVAL; |
| 6932 | } |
| 6933 | |
| 6934 | if (!src_profile) { |
| 6935 | sme_err("src roam profile NULL"); |
| 6936 | return QDF_STATUS_E_INVAL; |
| 6937 | } |
| 6938 | |
| 6939 | if (!mac->roam.configParam.isFastRoamIniFeatureEnabled || |
| 6940 | (neighbor_roam_info->neighborRoamState != |
| 6941 | eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)) { |
| 6942 | sme_info("Fast roam is disabled or not connected(%d)", |
| 6943 | neighbor_roam_info->neighborRoamState); |
| 6944 | return QDF_STATUS_E_PERM; |
| 6945 | } |
| 6946 | |
| 6947 | csr_update_fils_config(mac, session_id, src_profile); |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 6948 | if (csr_roamIsRoamOffloadEnabled(mac)) { |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 6949 | sme_debug("Updating fils config to fw"); |
| 6950 | csr_roam_offload_scan(mac, session_id, |
| 6951 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 6952 | REASON_FILS_PARAMS_CHANGED); |
| 6953 | } else { |
| 6954 | sme_info("LFR3 not enabled"); |
| 6955 | return QDF_STATUS_E_INVAL; |
| 6956 | } |
| 6957 | |
| 6958 | return status; |
| 6959 | } |
| 6960 | |
| 6961 | void sme_send_hlp_ie_info(tHalHandle hal, uint8_t session_id, |
| 6962 | tCsrRoamProfile *profile, uint32_t if_addr) |
| 6963 | { |
| 6964 | int i; |
| 6965 | struct scheduler_msg msg; |
| 6966 | QDF_STATUS status; |
| 6967 | struct hlp_params *params; |
| 6968 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 6969 | struct csr_roam_session *session = CSR_GET_SESSION(mac, session_id); |
| 6970 | tpCsrNeighborRoamControlInfo neighbor_roam_info = |
| 6971 | &mac->roam.neighborRoamInfo[session_id]; |
| 6972 | |
| 6973 | if (!session) { |
| 6974 | sme_err("session NULL"); |
| 6975 | return; |
| 6976 | } |
| 6977 | |
| 6978 | if (!mac->roam.configParam.isFastRoamIniFeatureEnabled || |
| 6979 | (neighbor_roam_info->neighborRoamState != |
| 6980 | eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)) { |
| 6981 | sme_debug("Fast roam is disabled or not connected(%d)", |
| 6982 | neighbor_roam_info->neighborRoamState); |
| 6983 | return; |
| 6984 | } |
| 6985 | |
| 6986 | params = qdf_mem_malloc(sizeof(*params)); |
| 6987 | if (!params) { |
| 6988 | sme_err("Mem alloc for HLP IE fails"); |
| 6989 | return; |
| 6990 | } |
| 6991 | if ((profile->hlp_ie_len + |
| 6992 | SIR_IPV4_ADDR_LEN) > FILS_MAX_HLP_DATA_LEN) { |
| 6993 | sme_err("HLP IE len exceeds %d", |
| 6994 | profile->hlp_ie_len); |
| 6995 | qdf_mem_free(params); |
| 6996 | return; |
| 6997 | } |
| 6998 | |
| 6999 | params->vdev_id = session_id; |
| 7000 | params->hlp_ie_len = profile->hlp_ie_len + SIR_IPV4_ADDR_LEN; |
| 7001 | |
| 7002 | for (i = 0; i < SIR_IPV4_ADDR_LEN; i++) |
| 7003 | params->hlp_ie[i] = (if_addr >> (i * 8)) & 0xFF; |
| 7004 | |
| 7005 | qdf_mem_copy(params->hlp_ie + SIR_IPV4_ADDR_LEN, |
| 7006 | profile->hlp_ie, profile->hlp_ie_len); |
| 7007 | |
| 7008 | msg.type = SIR_HAL_HLP_IE_INFO; |
| 7009 | msg.reserved = 0; |
| 7010 | msg.bodyptr = params; |
| 7011 | status = sme_acquire_global_lock(&mac->sme); |
| 7012 | if (status != QDF_STATUS_SUCCESS) { |
| 7013 | sme_err("sme lock acquire fails"); |
| 7014 | qdf_mem_free(params); |
| 7015 | return; |
| 7016 | } |
| 7017 | |
| 7018 | if (!QDF_IS_STATUS_SUCCESS |
| 7019 | (scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) { |
| 7020 | sme_err("Not able to post WMA_HLP_IE_INFO message to HAL"); |
| 7021 | sme_release_global_lock(&mac->sme); |
| 7022 | qdf_mem_free(params); |
| 7023 | return; |
| 7024 | } |
| 7025 | |
| 7026 | sme_release_global_lock(&mac->sme); |
| 7027 | } |
| 7028 | |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 7029 | void sme_free_join_rsp_fils_params(struct csr_roam_info *roam_info) |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 7030 | { |
| 7031 | struct fils_join_rsp_params *roam_fils_params; |
| 7032 | |
| 7033 | if (!roam_info) { |
| 7034 | sme_err("FILS Roam Info NULL"); |
| 7035 | return; |
| 7036 | } |
| 7037 | |
| 7038 | roam_fils_params = roam_info->fils_join_rsp; |
| 7039 | if (!roam_fils_params) { |
| 7040 | sme_err("FILS Roam Param NULL"); |
| 7041 | return; |
| 7042 | } |
| 7043 | |
| 7044 | if (roam_fils_params->fils_pmk) |
| 7045 | qdf_mem_free(roam_fils_params->fils_pmk); |
| 7046 | |
| 7047 | qdf_mem_free(roam_fils_params); |
| 7048 | |
| 7049 | roam_info->fils_join_rsp = NULL; |
| 7050 | } |
| 7051 | |
| 7052 | #else |
| 7053 | inline void sme_send_hlp_ie_info(tHalHandle hal, uint8_t session_id, |
| 7054 | tCsrRoamProfile *profile, uint32_t if_addr) |
| 7055 | {} |
| 7056 | #endif |
| 7057 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7058 | /* |
| 7059 | * sme_update_fast_transition_enabled() - enable/disable Fast Transition |
| 7060 | * support at runtime |
| 7061 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7062 | * isFastTransitionEnabled. |
| 7063 | * This is a synchronous call |
| 7064 | * |
| 7065 | * hHal - The handle returned by mac_open. |
| 7066 | * Return QDF_STATUS_SUCCESS - SME update isFastTransitionEnabled config |
| 7067 | * successfully. |
| 7068 | * Other status means SME is failed to update isFastTransitionEnabled. |
| 7069 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7070 | QDF_STATUS sme_update_fast_transition_enabled(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7071 | bool isFastTransitionEnabled) |
| 7072 | { |
| 7073 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7074 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7075 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7076 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7077 | TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, |
| 7078 | 0)); |
| 7079 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7080 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 7081 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7082 | "%s: FastTransitionEnabled is changed from %d to %d", |
| 7083 | __func__, |
| 7084 | pMac->roam.configParam.isFastTransitionEnabled, |
| 7085 | isFastTransitionEnabled); |
| 7086 | pMac->roam.configParam.isFastTransitionEnabled = |
| 7087 | isFastTransitionEnabled; |
| 7088 | sme_release_global_lock(&pMac->sme); |
| 7089 | } |
| 7090 | |
| 7091 | return status; |
| 7092 | } |
| 7093 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7094 | /* |
| 7095 | * sme_update_wes_mode() - |
| 7096 | * Update WES Mode |
| 7097 | * This function is called through dynamic setConfig callback function |
| 7098 | * to configure isWESModeEnabled |
| 7099 | * |
| 7100 | * hHal - HAL handle for device |
| 7101 | * isWESModeEnabled - WES mode |
| 7102 | * sessionId - Session Identifier |
| 7103 | * Return QDF_STATUS_SUCCESS - SME update isWESModeEnabled config successfully. |
| 7104 | * Other status means SME is failed to update isWESModeEnabled. |
| 7105 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7106 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7107 | QDF_STATUS sme_update_wes_mode(tHalHandle hHal, bool isWESModeEnabled, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7108 | uint8_t sessionId) |
| 7109 | { |
| 7110 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7111 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7112 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7113 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7114 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7115 | FL("Invalid sme session id: %d"), sessionId); |
| 7116 | return QDF_STATUS_E_INVAL; |
| 7117 | } |
| 7118 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7119 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7120 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7121 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7122 | "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %s", |
| 7123 | isWESModeEnabled, |
| 7124 | pMac->roam.configParam.isWESModeEnabled, |
| 7125 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 7126 | neighborRoamInfo |
| 7127 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7128 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7129 | pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled; |
| 7130 | sme_release_global_lock(&pMac->sme); |
| 7131 | } |
| 7132 | |
| 7133 | return status; |
| 7134 | } |
| 7135 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7136 | /* |
| 7137 | * sme_set_roam_scan_control() - |
| 7138 | * Set roam scan control |
| 7139 | * This function is called to set roam scan control |
| 7140 | * if roam scan control is set to 0, roaming scan cache is cleared |
| 7141 | * any value other than 0 is treated as invalid value |
| 7142 | * hHal - HAL handle for device |
| 7143 | * sessionId - Session Identifier |
| 7144 | * Return QDF_STATUS_SUCCESS - SME update config successfully. |
| 7145 | * Other status means SME failure to update |
| 7146 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7147 | QDF_STATUS sme_set_roam_scan_control(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7148 | bool roamScanControl) |
| 7149 | { |
| 7150 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7151 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7152 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7153 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7154 | TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0)); |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7155 | |
| 7156 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7157 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7158 | FL("Invalid sme session id: %d"), sessionId); |
| 7159 | return QDF_STATUS_E_INVAL; |
| 7160 | } |
| 7161 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7162 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7163 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7164 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7165 | "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %s", |
| 7166 | roamScanControl, |
| 7167 | pMac->roam.configParam.nRoamScanControl, |
| 7168 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 7169 | neighborRoamInfo |
| 7170 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7171 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7172 | pMac->roam.configParam.nRoamScanControl = roamScanControl; |
| 7173 | if (0 == roamScanControl) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7174 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7175 | "LFR runtime successfully cleared roam scan cache"); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7176 | csr_flush_cfg_bg_scan_roam_channel_list(pMac, |
| 7177 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7178 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 7179 | csr_roam_offload_scan(pMac, sessionId, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7180 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 7181 | REASON_FLUSH_CHANNEL_LIST); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7182 | } |
| 7183 | } |
| 7184 | sme_release_global_lock(&pMac->sme); |
| 7185 | } |
| 7186 | return status; |
| 7187 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7188 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7189 | /* |
| 7190 | * sme_update_is_fast_roam_ini_feature_enabled() - enable/disable LFR |
| 7191 | * support at runtime |
| 7192 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7193 | * isFastRoamIniFeatureEnabled. |
| 7194 | * This is a synchronous call |
| 7195 | * |
| 7196 | * hHal - The handle returned by mac_open. |
| 7197 | * sessionId - Session Identifier |
| 7198 | * Return QDF_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config |
| 7199 | * successfully. |
| 7200 | * Other status means SME is failed to update isFastRoamIniFeatureEnabled. |
| 7201 | */ |
| 7202 | QDF_STATUS sme_update_is_fast_roam_ini_feature_enabled(tHalHandle hHal, |
| 7203 | uint8_t sessionId, const bool isFastRoamIniFeatureEnabled) |
| 7204 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7205 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7206 | |
| 7207 | if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == |
| 7208 | isFastRoamIniFeatureEnabled) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7209 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7210 | "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", |
| 7211 | __func__, |
| 7212 | pMac->roam.configParam.isFastRoamIniFeatureEnabled, |
| 7213 | isFastRoamIniFeatureEnabled); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7214 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7215 | } |
| 7216 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7217 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7218 | "%s: FastRoamEnabled is changed from %d to %d", __func__, |
| 7219 | pMac->roam.configParam.isFastRoamIniFeatureEnabled, |
| 7220 | isFastRoamIniFeatureEnabled); |
| 7221 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = |
| 7222 | isFastRoamIniFeatureEnabled; |
| 7223 | csr_neighbor_roam_update_fast_roaming_enabled(pMac, sessionId, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7224 | isFastRoamIniFeatureEnabled); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7225 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7226 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7227 | } |
| 7228 | |
Mukul Sharma | 69c44cd | 2016-09-12 18:33:57 +0530 | [diff] [blame] | 7229 | /** |
| 7230 | * sme_config_fast_roaming() - enable/disable LFR support at runtime |
| 7231 | * @hal - The handle returned by macOpen. |
| 7232 | * @session_id - Session Identifier |
| 7233 | * @is_fast_roam_enabled - flag to enable/disable roaming |
| 7234 | * |
| 7235 | * When Supplicant issues enabled/disable fast roaming on the basis |
| 7236 | * of the Bssid modification in network block (e.g. AutoJoin mode N/W block) |
| 7237 | * |
| 7238 | * Return: QDF_STATUS |
| 7239 | */ |
| 7240 | |
| 7241 | QDF_STATUS sme_config_fast_roaming(tHalHandle hal, uint8_t session_id, |
| 7242 | const bool is_fast_roam_enabled) |
| 7243 | { |
| 7244 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 7245 | struct csr_roam_session *session = CSR_GET_SESSION(mac_ctx, session_id); |
Mukul Sharma | 69c44cd | 2016-09-12 18:33:57 +0530 | [diff] [blame] | 7246 | QDF_STATUS status; |
| 7247 | |
Varun Reddy Yeturu | e5a35d1 | 2017-10-20 11:26:57 -0700 | [diff] [blame] | 7248 | /* |
| 7249 | * supplicant_disabled_roaming flag is set to true in |
| 7250 | * wlan_hdd_cfg80211_connect_start when supplicant initiate connect |
| 7251 | * request with BSSID. This flag is reset when supplicant sends |
| 7252 | * vendor command to enable roaming after association. |
Arif Hussain | a48a9c0 | 2017-01-31 14:37:45 -0800 | [diff] [blame] | 7253 | * |
| 7254 | * This request from wpa_supplicant will be skipped in this function |
Varun Reddy Yeturu | e5a35d1 | 2017-10-20 11:26:57 -0700 | [diff] [blame] | 7255 | * if roaming is disabled using driver command or INI and |
| 7256 | * supplicant_disabled_roaming flag remains set. So make sure to set |
| 7257 | * supplicant_disabled_roaming flag as per wpa_supplicant even if roam |
| 7258 | * request from wpa_supplicant ignored. |
Arif Hussain | a48a9c0 | 2017-01-31 14:37:45 -0800 | [diff] [blame] | 7259 | */ |
| 7260 | if (session && session->pCurRoamProfile) |
Varun Reddy Yeturu | e5a35d1 | 2017-10-20 11:26:57 -0700 | [diff] [blame] | 7261 | session->pCurRoamProfile->supplicant_disabled_roaming = |
| 7262 | !is_fast_roam_enabled; |
Arif Hussain | a48a9c0 | 2017-01-31 14:37:45 -0800 | [diff] [blame] | 7263 | |
Mukul Sharma | 69c44cd | 2016-09-12 18:33:57 +0530 | [diff] [blame] | 7264 | if (!mac_ctx->roam.configParam.isFastRoamIniFeatureEnabled) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 7265 | sme_debug("Fast roam is disabled through ini"); |
Mukul Sharma | 69c44cd | 2016-09-12 18:33:57 +0530 | [diff] [blame] | 7266 | if (!is_fast_roam_enabled) |
| 7267 | return QDF_STATUS_SUCCESS; |
| 7268 | return QDF_STATUS_E_FAILURE; |
| 7269 | } |
Sreelakshmi Konamki | bda5bbf | 2016-09-12 18:38:10 +0530 | [diff] [blame] | 7270 | |
Mukul Sharma | 69c44cd | 2016-09-12 18:33:57 +0530 | [diff] [blame] | 7271 | status = csr_neighbor_roam_update_fast_roaming_enabled(mac_ctx, |
| 7272 | session_id, is_fast_roam_enabled); |
| 7273 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 7274 | sme_err("update fast roaming failed. status: %d", status); |
Mukul Sharma | 69c44cd | 2016-09-12 18:33:57 +0530 | [diff] [blame] | 7275 | return QDF_STATUS_E_FAILURE; |
| 7276 | } |
| 7277 | |
| 7278 | return QDF_STATUS_SUCCESS; |
| 7279 | } |
| 7280 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7281 | /* |
| 7282 | * sme_update_is_mawc_ini_feature_enabled() - |
| 7283 | * Enable/disable LFR MAWC support at runtime |
| 7284 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7285 | * isMAWCIniFeatureEnabled. |
| 7286 | * This is a synchronous call |
| 7287 | * |
| 7288 | * hHal - The handle returned by mac_open. |
| 7289 | * Return QDF_STATUS_SUCCESS - SME update MAWCEnabled config successfully. |
| 7290 | * Other status means SME is failed to update MAWCEnabled. |
| 7291 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7292 | QDF_STATUS sme_update_is_mawc_ini_feature_enabled(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7293 | const bool MAWCEnabled) |
| 7294 | { |
| 7295 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7296 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7297 | |
| 7298 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7299 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 7300 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7301 | "%s: MAWCEnabled is changed from %d to %d", __func__, |
Varun Reddy Yeturu | 061d4d6 | 2017-07-20 09:39:32 -0700 | [diff] [blame] | 7302 | pMac->roam.configParam.csr_mawc_config.mawc_enabled, |
| 7303 | MAWCEnabled); |
| 7304 | pMac->roam.configParam.csr_mawc_config.mawc_enabled = |
| 7305 | MAWCEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7306 | sme_release_global_lock(&pMac->sme); |
| 7307 | } |
| 7308 | |
| 7309 | return status; |
| 7310 | |
| 7311 | } |
| 7312 | |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 7313 | /** |
| 7314 | * sme_stop_roaming() - Stop roaming for a given sessionId |
| 7315 | * This is a synchronous call |
| 7316 | * |
| 7317 | * @hHal - The handle returned by mac_open |
| 7318 | * @sessionId - Session Identifier |
| 7319 | * |
| 7320 | * Return QDF_STATUS_SUCCESS on success |
| 7321 | * Other status on failure |
| 7322 | */ |
| 7323 | QDF_STATUS sme_stop_roaming(tHalHandle hal, uint8_t session_id, uint8_t reason) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7324 | { |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 7325 | struct scheduler_msg wma_msg = {0}; |
| 7326 | tSirRetStatus status; |
| 7327 | tSirRoamOffloadScanReq *req; |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 7328 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 7329 | tpCsrNeighborRoamControlInfo roam_info; |
Varun Reddy Yeturu | e5a35d1 | 2017-10-20 11:26:57 -0700 | [diff] [blame] | 7330 | struct csr_roam_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7331 | |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 7332 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 7333 | sme_err("incorrect session/vdev ID"); |
| 7334 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7335 | } |
Varun Reddy Yeturu | e5a35d1 | 2017-10-20 11:26:57 -0700 | [diff] [blame] | 7336 | |
| 7337 | session = CSR_GET_SESSION(mac_ctx, session_id); |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 7338 | |
| 7339 | roam_info = &mac_ctx->roam.neighborRoamInfo[session_id]; |
| 7340 | if (!roam_info->b_roam_scan_offload_started) { |
| 7341 | sme_debug("Roaming already disabled for session %d", session_id); |
Varun Reddy Yeturu | e5a35d1 | 2017-10-20 11:26:57 -0700 | [diff] [blame] | 7342 | return QDF_STATUS_SUCCESS; |
| 7343 | } |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 7344 | req = qdf_mem_malloc(sizeof(*req)); |
| 7345 | if (!req) { |
| 7346 | sme_err("failed to allocated memory"); |
| 7347 | return QDF_STATUS_E_NOMEM; |
| 7348 | } |
| 7349 | |
| 7350 | req->Command = ROAM_SCAN_OFFLOAD_STOP; |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 7351 | if (reason == eCsrForcedDisassoc) |
| 7352 | req->reason = REASON_ROAM_STOP_ALL; |
| 7353 | else |
Varun Reddy Yeturu | bc1bea0 | 2018-02-01 18:12:34 -0800 | [diff] [blame] | 7354 | req->reason = REASON_SME_ISSUED; |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 7355 | req->sessionId = session_id; |
| 7356 | if (csr_neighbor_middle_of_roaming(mac_ctx, session_id)) |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 7357 | req->middle_of_roaming = 1; |
| 7358 | else |
| 7359 | csr_roam_reset_roam_params(mac_ctx); |
| 7360 | |
| 7361 | wma_msg.type = WMA_ROAM_SCAN_OFFLOAD_REQ; |
| 7362 | wma_msg.bodyptr = req; |
| 7363 | |
| 7364 | status = wma_post_ctrl_msg(mac_ctx, &wma_msg); |
| 7365 | if (eSIR_SUCCESS != status) { |
| 7366 | sme_err("WMA_ROAM_SCAN_OFFLOAD_REQ failed, session_id: %d", |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 7367 | session_id); |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 7368 | qdf_mem_free(req); |
| 7369 | return QDF_STATUS_E_FAULT; |
| 7370 | } |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 7371 | roam_info->b_roam_scan_offload_started = false; |
| 7372 | roam_info->last_sent_cmd = ROAM_SCAN_OFFLOAD_STOP; |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 7373 | |
| 7374 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7375 | } |
| 7376 | |
Abhishek Singh | d568647 | 2017-09-20 15:18:50 +0530 | [diff] [blame] | 7377 | void sme_indicate_disconnect_inprogress(tHalHandle hal, uint8_t session_id) |
| 7378 | { |
| 7379 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 7380 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 7381 | struct csr_roam_session *session; |
| 7382 | |
| 7383 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 7384 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 7385 | if (CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
| 7386 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 7387 | if (session) |
| 7388 | session->discon_in_progress = true; |
| 7389 | } |
| 7390 | sme_release_global_lock(&mac_ctx->sme); |
| 7391 | } |
| 7392 | } |
| 7393 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7394 | /* |
| 7395 | * sme_start_roaming() - Start roaming for a given sessionId |
| 7396 | * This is a synchronous call |
| 7397 | * |
| 7398 | * hHal - The handle returned by mac_open |
| 7399 | * sessionId - Session Identifier |
| 7400 | * Return QDF_STATUS_SUCCESS on success |
| 7401 | * Other status on failure |
| 7402 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7403 | 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] | 7404 | { |
| 7405 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7406 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7407 | |
| 7408 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7409 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7410 | csr_roam_offload_scan(pMac, sessionId, ROAM_SCAN_OFFLOAD_START, |
| 7411 | reason); |
| 7412 | sme_release_global_lock(&pMac->sme); |
| 7413 | } |
| 7414 | |
| 7415 | return status; |
| 7416 | } |
| 7417 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7418 | /* |
| 7419 | * sme_update_enable_fast_roam_in_concurrency() - enable/disable LFR if |
| 7420 | * Concurrent session exists |
| 7421 | * This is a synchronuous call |
| 7422 | * |
| 7423 | * hHal - The handle returned by mac_open. |
| 7424 | * Return QDF_STATUS_SUCCESS |
| 7425 | * Other status means SME is failed |
| 7426 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7427 | QDF_STATUS sme_update_enable_fast_roam_in_concurrency(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7428 | bool |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7429 | bFastRoamInConIniFeatureEnabled) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7430 | { |
| 7431 | |
| 7432 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7433 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7434 | |
| 7435 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7436 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7437 | pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = |
| 7438 | bFastRoamInConIniFeatureEnabled; |
| 7439 | if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 7440 | pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = |
| 7441 | 0; |
| 7442 | } |
| 7443 | sme_release_global_lock(&pMac->sme); |
| 7444 | } |
| 7445 | |
| 7446 | return status; |
| 7447 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7448 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7449 | /* |
| 7450 | * sme_update_config_fw_rssi_monitoring() - enable/disable firmware RSSI |
| 7451 | * Monitoring at runtime |
| 7452 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7453 | * fEnableFwRssiMonitoring. |
| 7454 | * This is a synchronous call |
| 7455 | * |
| 7456 | * hHal - The handle returned by mac_open. |
| 7457 | * Return QDF_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. |
| 7458 | * config successfully. |
| 7459 | * Other status means SME is failed to update fEnableFwRssiMonitoring. |
| 7460 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7461 | QDF_STATUS sme_update_config_fw_rssi_monitoring(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7462 | bool fEnableFwRssiMonitoring) |
| 7463 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 7464 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7465 | |
| 7466 | if (sme_cfg_set_int (hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7467 | fEnableFwRssiMonitoring) == |
| 7468 | QDF_STATUS_E_FAILURE) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 7469 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7470 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7471 | "Could not pass on WNI_CFG_PS_RSSI_MONITOR to CFG"); |
| 7472 | } |
| 7473 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 7474 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7475 | } |
| 7476 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7477 | /* |
| 7478 | * sme_set_roam_opportunistic_scan_threshold_diff() - |
| 7479 | * Update Opportunistic Scan threshold diff |
| 7480 | * This function is called through dynamic setConfig callback function |
| 7481 | * to configure nOpportunisticThresholdDiff |
| 7482 | * |
| 7483 | * hHal - HAL handle for device |
| 7484 | * sessionId - Session Identifier |
| 7485 | * nOpportunisticThresholdDiff - Opportunistic Scan threshold diff |
| 7486 | * Return QDF_STATUS_SUCCESS - SME update nOpportunisticThresholdDiff config |
| 7487 | * successfully. |
| 7488 | * else SME is failed to update nOpportunisticThresholdDiff. |
| 7489 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7490 | QDF_STATUS sme_set_roam_opportunistic_scan_threshold_diff(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7491 | uint8_t sessionId, |
| 7492 | const uint8_t |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7493 | nOpportunisticThresholdDiff) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7494 | { |
| 7495 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7496 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7497 | |
| 7498 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7499 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 7500 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 7501 | nOpportunisticThresholdDiff, |
| 7502 | REASON_OPPORTUNISTIC_THRESH_DIFF_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7503 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7504 | pMac->roam.configParam.neighborRoamConfig. |
| 7505 | nOpportunisticThresholdDiff = |
| 7506 | nOpportunisticThresholdDiff; |
| 7507 | } |
| 7508 | sme_release_global_lock(&pMac->sme); |
| 7509 | } |
| 7510 | return status; |
| 7511 | } |
| 7512 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7513 | /* |
| 7514 | * sme_get_roam_opportunistic_scan_threshold_diff() |
| 7515 | * gets Opportunistic Scan threshold diff |
| 7516 | * This is a synchronous call |
| 7517 | * |
| 7518 | * hHal - The handle returned by mac_open |
| 7519 | * Return uint8_t - nOpportunisticThresholdDiff |
| 7520 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7521 | uint8_t sme_get_roam_opportunistic_scan_threshold_diff(tHalHandle hHal) |
| 7522 | { |
| 7523 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7524 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7525 | return pMac->roam.configParam.neighborRoamConfig. |
| 7526 | nOpportunisticThresholdDiff; |
| 7527 | } |
| 7528 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7529 | /* |
| 7530 | * sme_set_roam_rescan_rssi_diff() - Update roam rescan rssi diff |
| 7531 | * This function is called through dynamic setConfig callback function |
| 7532 | * to configure nRoamRescanRssiDiff |
| 7533 | * |
| 7534 | * hHal - HAL handle for device |
| 7535 | * sessionId - Session Identifier |
| 7536 | * nRoamRescanRssiDiff - roam rescan rssi diff |
| 7537 | * Return QDF_STATUS_SUCCESS - SME update nRoamRescanRssiDiff config |
| 7538 | * successfully. |
| 7539 | * else SME is failed to update nRoamRescanRssiDiff. |
| 7540 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7541 | QDF_STATUS sme_set_roam_rescan_rssi_diff(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7542 | uint8_t sessionId, |
| 7543 | const uint8_t nRoamRescanRssiDiff) |
| 7544 | { |
| 7545 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7546 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7547 | |
| 7548 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7549 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 7550 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 7551 | nRoamRescanRssiDiff, |
| 7552 | REASON_ROAM_RESCAN_RSSI_DIFF_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7553 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7554 | pMac->roam.configParam.neighborRoamConfig. |
| 7555 | nRoamRescanRssiDiff = nRoamRescanRssiDiff; |
| 7556 | } |
| 7557 | sme_release_global_lock(&pMac->sme); |
| 7558 | } |
| 7559 | return status; |
| 7560 | } |
| 7561 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7562 | /* |
| 7563 | * sme_get_roam_rescan_rssi_diff() |
| 7564 | * gets roam rescan rssi diff |
| 7565 | * This is a synchronous call |
| 7566 | * |
| 7567 | * hHal - The handle returned by mac_open |
| 7568 | * Return int8_t - nRoamRescanRssiDiff |
| 7569 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7570 | uint8_t sme_get_roam_rescan_rssi_diff(tHalHandle hHal) |
| 7571 | { |
| 7572 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7573 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7574 | return pMac->roam.configParam.neighborRoamConfig.nRoamRescanRssiDiff; |
| 7575 | } |
| 7576 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7577 | /* |
| 7578 | * sme_set_roam_bmiss_first_bcnt() - |
| 7579 | * Update Roam count for first beacon miss |
| 7580 | * This function is called through dynamic setConfig callback function |
| 7581 | * to configure nRoamBmissFirstBcnt |
| 7582 | * hHal - HAL handle for device |
| 7583 | * sessionId - Session Identifier |
| 7584 | * nRoamBmissFirstBcnt - Roam first bmiss count |
| 7585 | * Return QDF_STATUS_SUCCESS - SME update nRoamBmissFirstBcnt |
| 7586 | * successfully. |
| 7587 | * else SME is failed to update nRoamBmissFirstBcnt |
| 7588 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7589 | QDF_STATUS sme_set_roam_bmiss_first_bcnt(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7590 | uint8_t sessionId, |
| 7591 | const uint8_t nRoamBmissFirstBcnt) |
| 7592 | { |
| 7593 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7594 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7595 | |
| 7596 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7597 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 7598 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 7599 | nRoamBmissFirstBcnt, |
| 7600 | REASON_ROAM_BMISS_FIRST_BCNT_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7601 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7602 | pMac->roam.configParam.neighborRoamConfig. |
| 7603 | nRoamBmissFirstBcnt = nRoamBmissFirstBcnt; |
| 7604 | } |
| 7605 | sme_release_global_lock(&pMac->sme); |
| 7606 | } |
| 7607 | return status; |
| 7608 | } |
| 7609 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7610 | /* |
| 7611 | * sme_get_roam_bmiss_first_bcnt() - |
| 7612 | * get neighbor roam beacon miss first count |
| 7613 | * |
| 7614 | * hHal - The handle returned by mac_open. |
| 7615 | * Return uint8_t - neighbor roam beacon miss first count |
| 7616 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7617 | uint8_t sme_get_roam_bmiss_first_bcnt(tHalHandle hHal) |
| 7618 | { |
| 7619 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7620 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7621 | return pMac->roam.configParam.neighborRoamConfig.nRoamBmissFirstBcnt; |
| 7622 | } |
| 7623 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7624 | /* |
| 7625 | * sme_set_roam_bmiss_final_bcnt() - |
| 7626 | * Update Roam count for final beacon miss |
| 7627 | * This function is called through dynamic setConfig callback function |
| 7628 | * to configure nRoamBmissFinalBcnt |
| 7629 | * hHal - HAL handle for device |
| 7630 | * sessionId - Session Identifier |
| 7631 | * nRoamBmissFinalBcnt - Roam final bmiss count |
| 7632 | * Return QDF_STATUS_SUCCESS - SME update nRoamBmissFinalBcnt |
| 7633 | * successfully. |
| 7634 | * else SME is failed to update nRoamBmissFinalBcnt |
| 7635 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7636 | QDF_STATUS sme_set_roam_bmiss_final_bcnt(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7637 | uint8_t sessionId, |
| 7638 | const uint8_t nRoamBmissFinalBcnt) |
| 7639 | { |
| 7640 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7641 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7642 | |
| 7643 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7644 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 7645 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 7646 | nRoamBmissFinalBcnt, |
| 7647 | REASON_ROAM_BMISS_FINAL_BCNT_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7648 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7649 | pMac->roam.configParam.neighborRoamConfig. |
| 7650 | nRoamBmissFinalBcnt = nRoamBmissFinalBcnt; |
| 7651 | } |
| 7652 | sme_release_global_lock(&pMac->sme); |
| 7653 | } |
| 7654 | return status; |
| 7655 | } |
| 7656 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7657 | /* |
| 7658 | * sme_get_roam_bmiss_final_bcnt() - |
| 7659 | * gets Roam count for final beacon miss |
| 7660 | * This is a synchronous call |
| 7661 | * |
| 7662 | * hHal - The handle returned by mac_open |
| 7663 | * Return uint8_t - nRoamBmissFinalBcnt |
| 7664 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7665 | uint8_t sme_get_roam_bmiss_final_bcnt(tHalHandle hHal) |
| 7666 | { |
| 7667 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7668 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7669 | return pMac->roam.configParam.neighborRoamConfig.nRoamBmissFinalBcnt; |
| 7670 | } |
| 7671 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7672 | /* |
| 7673 | * sme_set_roam_beacon_rssi_weight() - |
| 7674 | * Update Roam beacon rssi weight |
| 7675 | * This function is called through dynamic setConfig callback function |
| 7676 | * to configure nRoamBeaconRssiWeight |
| 7677 | * |
| 7678 | * hHal - HAL handle for device |
| 7679 | * sessionId - Session Identifier |
| 7680 | * nRoamBeaconRssiWeight - Roam beacon rssi weight |
| 7681 | * Return QDF_STATUS_SUCCESS - SME update nRoamBeaconRssiWeight config |
| 7682 | * successfully. |
| 7683 | * else SME is failed to update nRoamBeaconRssiWeight |
| 7684 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7685 | QDF_STATUS sme_set_roam_beacon_rssi_weight(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7686 | uint8_t sessionId, |
| 7687 | const uint8_t nRoamBeaconRssiWeight) |
| 7688 | { |
| 7689 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7690 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7691 | |
| 7692 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7693 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 7694 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 7695 | nRoamBeaconRssiWeight, |
| 7696 | REASON_ROAM_BEACON_RSSI_WEIGHT_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7697 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7698 | pMac->roam.configParam.neighborRoamConfig. |
| 7699 | nRoamBeaconRssiWeight = nRoamBeaconRssiWeight; |
| 7700 | } |
| 7701 | sme_release_global_lock(&pMac->sme); |
| 7702 | } |
| 7703 | return status; |
| 7704 | } |
| 7705 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7706 | /* |
| 7707 | * sme_get_roam_beacon_rssi_weight() - |
| 7708 | * gets Roam beacon rssi weight |
| 7709 | * This is a synchronous call |
| 7710 | * |
| 7711 | * hHal - The handle returned by mac_open |
| 7712 | * Return uint8_t - nRoamBeaconRssiWeight |
| 7713 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7714 | uint8_t sme_get_roam_beacon_rssi_weight(tHalHandle hHal) |
| 7715 | { |
| 7716 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7717 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7718 | return pMac->roam.configParam.neighborRoamConfig.nRoamBeaconRssiWeight; |
| 7719 | } |
| 7720 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7721 | /* |
| 7722 | * sme_set_neighbor_lookup_rssi_threshold() - update neighbor lookup |
| 7723 | * rssi threshold |
| 7724 | * This is a synchronous call |
| 7725 | * |
| 7726 | * hHal - The handle returned by mac_open. |
| 7727 | * sessionId - Session Identifier |
| 7728 | * Return QDF_STATUS_SUCCESS - SME update config successful. |
| 7729 | * Other status means SME is failed to update |
| 7730 | */ |
| 7731 | QDF_STATUS sme_set_neighbor_lookup_rssi_threshold(tHalHandle hHal, |
| 7732 | uint8_t sessionId, uint8_t neighborLookupRssiThreshold) |
| 7733 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7734 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7735 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7736 | |
| 7737 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7738 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 7739 | status = csr_neighbor_roam_update_config(pMac, |
| 7740 | sessionId, neighborLookupRssiThreshold, |
| 7741 | REASON_LOOKUP_THRESH_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7742 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7743 | pMac->roam.configParam.neighborRoamConfig. |
| 7744 | nNeighborLookupRssiThreshold = |
| 7745 | neighborLookupRssiThreshold; |
| 7746 | } |
| 7747 | sme_release_global_lock(&pMac->sme); |
| 7748 | } |
| 7749 | return status; |
| 7750 | } |
| 7751 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7752 | /* |
| 7753 | * sme_set_delay_before_vdev_stop() - update delay before VDEV_STOP |
| 7754 | * This is a synchronous call |
| 7755 | * |
| 7756 | * hal - The handle returned by macOpen. |
| 7757 | * session_id - Session Identifier |
| 7758 | * delay_before_vdev_stop - value to be set |
| 7759 | * Return QDF_STATUS_SUCCESS - SME update config successful. |
| 7760 | * Other status means SME is failed to update |
| 7761 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7762 | QDF_STATUS sme_set_delay_before_vdev_stop(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7763 | uint8_t session_id, |
| 7764 | uint8_t delay_before_vdev_stop) |
| 7765 | { |
| 7766 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7767 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7768 | |
| 7769 | if (session_id >= CSR_ROAM_SESSION_MAX) { |
| 7770 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7771 | FL("Invalid sme session id: %d"), session_id); |
| 7772 | return QDF_STATUS_E_INVAL; |
| 7773 | } |
| 7774 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7775 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7776 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7777 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 7778 | "LFR param delay_before_vdev_stop changed from %d to %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7779 | pMac->roam.configParam.neighborRoamConfig. |
| 7780 | delay_before_vdev_stop, |
| 7781 | delay_before_vdev_stop); |
| 7782 | pMac->roam.neighborRoamInfo[session_id].cfgParams. |
| 7783 | delay_before_vdev_stop = delay_before_vdev_stop; |
| 7784 | pMac->roam.configParam.neighborRoamConfig. |
| 7785 | delay_before_vdev_stop = delay_before_vdev_stop; |
| 7786 | sme_release_global_lock(&pMac->sme); |
| 7787 | } |
| 7788 | return status; |
| 7789 | } |
| 7790 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7791 | /* |
| 7792 | * sme_get_neighbor_lookup_rssi_threshold() - get neighbor lookup |
| 7793 | * rssi threshold |
| 7794 | * This is a synchronous call |
| 7795 | * |
| 7796 | * hHal - The handle returned by mac_open. |
| 7797 | * Return QDF_STATUS_SUCCESS - SME update config successful. |
| 7798 | * Other status means SME is failed to update |
| 7799 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7800 | uint8_t sme_get_neighbor_lookup_rssi_threshold(tHalHandle hHal) |
| 7801 | { |
| 7802 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7803 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7804 | return pMac->roam.configParam.neighborRoamConfig. |
| 7805 | nNeighborLookupRssiThreshold; |
| 7806 | } |
| 7807 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7808 | /* |
| 7809 | * sme_set_neighbor_scan_refresh_period() - set neighbor scan results |
| 7810 | * refresh period |
| 7811 | * This is a synchronous call |
| 7812 | * |
| 7813 | * hHal - The handle returned by mac_open. |
| 7814 | * sessionId - Session Identifier |
| 7815 | * Return QDF_STATUS_SUCCESS - SME update config successful. |
| 7816 | * Other status means SME is failed to update |
| 7817 | */ |
| 7818 | QDF_STATUS sme_set_neighbor_scan_refresh_period(tHalHandle hHal, |
| 7819 | uint8_t sessionId, uint16_t neighborScanResultsRefreshPeriod) |
| 7820 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7821 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7822 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 7823 | struct csr_neighbor_roamconfig *pNeighborRoamConfig = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7824 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 7825 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7826 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7827 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7828 | FL("Invalid sme session id: %d"), sessionId); |
| 7829 | return QDF_STATUS_E_INVAL; |
| 7830 | } |
| 7831 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7832 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7833 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7834 | pNeighborRoamConfig = |
| 7835 | &pMac->roam.configParam.neighborRoamConfig; |
| 7836 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7837 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7838 | "LFR runtime successfully set roam scan refresh period to %d- old value is %d - roam state is %s", |
| 7839 | neighborScanResultsRefreshPeriod, |
| 7840 | pMac->roam.configParam.neighborRoamConfig. |
| 7841 | nNeighborResultsRefreshPeriod, |
| 7842 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 7843 | neighborRoamInfo |
| 7844 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7845 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7846 | pNeighborRoamConfig->nNeighborResultsRefreshPeriod = |
| 7847 | neighborScanResultsRefreshPeriod; |
| 7848 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod = |
| 7849 | neighborScanResultsRefreshPeriod; |
| 7850 | |
| 7851 | sme_release_global_lock(&pMac->sme); |
| 7852 | } |
| 7853 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 7854 | csr_roam_offload_scan(pMac, sessionId, |
| 7855 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7856 | REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7857 | } |
| 7858 | return status; |
| 7859 | } |
| 7860 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7861 | /* |
| 7862 | * sme_update_roam_scan_offload_enabled() - enable/disable roam scan |
| 7863 | * offload feaure |
| 7864 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7865 | * gRoamScanOffloadEnabled. |
| 7866 | * This is a synchronous call |
| 7867 | * |
| 7868 | * hHal - The handle returned by mac_open. |
| 7869 | * Return QDF_STATUS_SUCCESS - SME update config successfully. |
| 7870 | * Other status means SME is failed to update. |
| 7871 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7872 | QDF_STATUS sme_update_roam_scan_offload_enabled(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7873 | bool nRoamScanOffloadEnabled) |
| 7874 | { |
| 7875 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7876 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7877 | |
| 7878 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7879 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7880 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7881 | "gRoamScanOffloadEnabled is changed from %d to %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7882 | pMac->roam.configParam.isRoamOffloadScanEnabled, |
| 7883 | nRoamScanOffloadEnabled); |
| 7884 | pMac->roam.configParam.isRoamOffloadScanEnabled = |
| 7885 | nRoamScanOffloadEnabled; |
| 7886 | sme_release_global_lock(&pMac->sme); |
| 7887 | } |
| 7888 | |
| 7889 | return status; |
| 7890 | } |
| 7891 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7892 | /* |
| 7893 | * sme_get_neighbor_scan_refresh_period() - get neighbor scan results |
| 7894 | * refresh period |
| 7895 | * This is a synchronous call |
| 7896 | * |
| 7897 | * \param hHal - The handle returned by mac_open. |
| 7898 | * \return uint16_t - Neighbor scan results refresh period value |
| 7899 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7900 | uint16_t sme_get_neighbor_scan_refresh_period(tHalHandle hHal) |
| 7901 | { |
| 7902 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7903 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7904 | return pMac->roam.configParam.neighborRoamConfig. |
| 7905 | nNeighborResultsRefreshPeriod; |
| 7906 | } |
| 7907 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7908 | /* |
| 7909 | * sme_get_empty_scan_refresh_period() - get empty scan refresh period |
| 7910 | * This is a synchronuous call |
| 7911 | * |
| 7912 | * hHal - The handle returned by mac_open. |
| 7913 | * Return QDF_STATUS_SUCCESS - SME update config successful. |
| 7914 | * Other status means SME is failed to update |
| 7915 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7916 | uint16_t sme_get_empty_scan_refresh_period(tHalHandle hHal) |
| 7917 | { |
| 7918 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7919 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7920 | return pMac->roam.configParam.neighborRoamConfig. |
| 7921 | nEmptyScanRefreshPeriod; |
| 7922 | } |
| 7923 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7924 | /* |
| 7925 | * sme_update_empty_scan_refresh_period |
| 7926 | * Update nEmptyScanRefreshPeriod |
| 7927 | * This function is called through dynamic setConfig callback function |
| 7928 | * to configure nEmptyScanRefreshPeriod |
| 7929 | * Usage: adb shell iwpriv wlan0 setConfig |
| 7930 | * nEmptyScanRefreshPeriod=[0 .. 60] |
| 7931 | * |
| 7932 | * hHal - HAL handle for device |
| 7933 | * sessionId - Session Identifier |
| 7934 | * nEmptyScanRefreshPeriod - scan period following empty scan results. |
| 7935 | * Return Success or failure |
| 7936 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7937 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7938 | QDF_STATUS sme_update_empty_scan_refresh_period(tHalHandle hHal, uint8_t |
| 7939 | sessionId, uint16_t |
| 7940 | nEmptyScanRefreshPeriod) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7941 | { |
| 7942 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7943 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 7944 | struct csr_neighbor_roamconfig *pNeighborRoamConfig = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7945 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 7946 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7947 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7948 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7949 | FL("Invalid sme session id: %d"), sessionId); |
| 7950 | return QDF_STATUS_E_INVAL; |
| 7951 | } |
| 7952 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7953 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7954 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7955 | pNeighborRoamConfig = |
| 7956 | &pMac->roam.configParam.neighborRoamConfig; |
| 7957 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7958 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7959 | "LFR runtime successfully set roam scan period to %d -old value is %d - roam state is %s", |
| 7960 | nEmptyScanRefreshPeriod, |
| 7961 | pMac->roam.configParam.neighborRoamConfig. |
| 7962 | nEmptyScanRefreshPeriod, |
| 7963 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 7964 | neighborRoamInfo |
| 7965 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7966 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7967 | pNeighborRoamConfig->nEmptyScanRefreshPeriod = |
| 7968 | nEmptyScanRefreshPeriod; |
| 7969 | pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod = |
| 7970 | nEmptyScanRefreshPeriod; |
| 7971 | sme_release_global_lock(&pMac->sme); |
| 7972 | } |
| 7973 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 7974 | csr_roam_offload_scan(pMac, sessionId, |
| 7975 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 7976 | REASON_EMPTY_SCAN_REF_PERIOD_CHANGED); |
| 7977 | } |
| 7978 | return status; |
| 7979 | } |
| 7980 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7981 | /* |
| 7982 | * sme_set_neighbor_scan_min_chan_time() - |
| 7983 | * Update nNeighborScanMinChanTime |
| 7984 | * This function is called through dynamic setConfig callback function |
| 7985 | * to configure gNeighborScanChannelMinTime |
| 7986 | * Usage: adb shell iwpriv wlan0 setConfig |
| 7987 | * gNeighborScanChannelMinTime=[0 .. 60] |
| 7988 | * |
| 7989 | * hHal - HAL handle for device |
| 7990 | * nNeighborScanMinChanTime - Channel minimum dwell time |
| 7991 | * sessionId - Session Identifier |
| 7992 | * Return Success or failure |
| 7993 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7994 | QDF_STATUS sme_set_neighbor_scan_min_chan_time(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7995 | const uint16_t |
| 7996 | nNeighborScanMinChanTime, |
| 7997 | uint8_t sessionId) |
| 7998 | { |
| 7999 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8000 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8001 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8002 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 8003 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8004 | FL("Invalid sme session id: %d"), sessionId); |
| 8005 | return QDF_STATUS_E_INVAL; |
| 8006 | } |
| 8007 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8008 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8009 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8010 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8011 | "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %s", |
| 8012 | nNeighborScanMinChanTime, |
| 8013 | pMac->roam.configParam.neighborRoamConfig. |
| 8014 | nNeighborScanMinChanTime, |
| 8015 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 8016 | neighborRoamInfo |
| 8017 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8018 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8019 | |
| 8020 | pMac->roam.configParam.neighborRoamConfig. |
| 8021 | nNeighborScanMinChanTime = nNeighborScanMinChanTime; |
| 8022 | pMac->roam.neighborRoamInfo[sessionId].cfgParams. |
| 8023 | minChannelScanTime = nNeighborScanMinChanTime; |
| 8024 | sme_release_global_lock(&pMac->sme); |
| 8025 | } |
| 8026 | |
| 8027 | return status; |
| 8028 | } |
| 8029 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8030 | /* |
| 8031 | * sme_set_neighbor_scan_max_chan_time() - |
| 8032 | * Update nNeighborScanMaxChanTime |
| 8033 | * This function is called through dynamic setConfig callback function |
| 8034 | * to configure gNeighborScanChannelMaxTime |
| 8035 | * Usage: adb shell iwpriv wlan0 setConfig |
| 8036 | * gNeighborScanChannelMaxTime=[0 .. 60] |
| 8037 | * |
| 8038 | * hHal - HAL handle for device |
| 8039 | * sessionId - Session Identifier |
| 8040 | * nNeighborScanMinChanTime - Channel maximum dwell time |
| 8041 | * Return Success or failure |
| 8042 | */ |
| 8043 | QDF_STATUS sme_set_neighbor_scan_max_chan_time(tHalHandle hHal, uint8_t |
| 8044 | sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8045 | const uint16_t |
| 8046 | nNeighborScanMaxChanTime) |
| 8047 | { |
| 8048 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8049 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 8050 | struct csr_neighbor_roamconfig *pNeighborRoamConfig = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8051 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 8052 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8053 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 8054 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8055 | FL("Invalid sme session id: %d"), sessionId); |
| 8056 | return QDF_STATUS_E_INVAL; |
| 8057 | } |
| 8058 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8059 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8060 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8061 | pNeighborRoamConfig = |
| 8062 | &pMac->roam.configParam.neighborRoamConfig; |
| 8063 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8064 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8065 | "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %s", |
| 8066 | nNeighborScanMaxChanTime, |
| 8067 | pMac->roam.configParam.neighborRoamConfig. |
| 8068 | nNeighborScanMaxChanTime, |
| 8069 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 8070 | neighborRoamInfo |
| 8071 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8072 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8073 | pNeighborRoamConfig->nNeighborScanMaxChanTime = |
| 8074 | nNeighborScanMaxChanTime; |
| 8075 | pNeighborRoamInfo->cfgParams.maxChannelScanTime = |
| 8076 | nNeighborScanMaxChanTime; |
| 8077 | sme_release_global_lock(&pMac->sme); |
| 8078 | } |
| 8079 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 8080 | csr_roam_offload_scan(pMac, sessionId, |
| 8081 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 8082 | REASON_SCAN_CH_TIME_CHANGED); |
| 8083 | } |
| 8084 | |
| 8085 | return status; |
| 8086 | } |
| 8087 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8088 | /* |
| 8089 | * sme_get_neighbor_scan_min_chan_time() - |
| 8090 | * get neighbor scan min channel time |
| 8091 | * |
| 8092 | * hHal - The handle returned by mac_open. |
| 8093 | * sessionId - Session Identifier |
| 8094 | * Return uint16_t - channel min time value |
| 8095 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8096 | uint16_t sme_get_neighbor_scan_min_chan_time(tHalHandle hHal, uint8_t sessionId) |
| 8097 | { |
| 8098 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8099 | |
| 8100 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 8101 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8102 | FL("Invalid sme session id: %d"), sessionId); |
| 8103 | return 0; |
| 8104 | } |
| 8105 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8106 | return pMac->roam.neighborRoamInfo[sessionId].cfgParams. |
| 8107 | minChannelScanTime; |
| 8108 | } |
| 8109 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8110 | /* |
| 8111 | * sme_get_neighbor_roam_state() - |
| 8112 | * get neighbor roam state |
| 8113 | * |
| 8114 | * hHal - The handle returned by mac_open. |
| 8115 | * sessionId - Session Identifier |
| 8116 | * Return uint32_t - neighbor roam state |
| 8117 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8118 | uint32_t sme_get_neighbor_roam_state(tHalHandle hHal, uint8_t sessionId) |
| 8119 | { |
| 8120 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8121 | |
| 8122 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 8123 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8124 | FL("Invalid sme session id: %d"), sessionId); |
| 8125 | return 0; |
| 8126 | } |
| 8127 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8128 | return pMac->roam.neighborRoamInfo[sessionId].neighborRoamState; |
| 8129 | } |
| 8130 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8131 | /* |
| 8132 | * sme_get_current_roam_state() - |
| 8133 | * get current roam state |
| 8134 | * |
| 8135 | * hHal - The handle returned by mac_open. |
| 8136 | * sessionId - Session Identifier |
| 8137 | * Return uint32_t - current roam state |
| 8138 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8139 | uint32_t sme_get_current_roam_state(tHalHandle hHal, uint8_t sessionId) |
| 8140 | { |
| 8141 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8142 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8143 | return pMac->roam.curState[sessionId]; |
| 8144 | } |
| 8145 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8146 | /* |
| 8147 | * sme_get_current_roam_sub_state() - |
| 8148 | * \brief get neighbor roam sub state |
| 8149 | * |
| 8150 | * hHal - The handle returned by mac_open. |
| 8151 | * sessionId - Session Identifier |
| 8152 | * Return uint32_t - current roam sub state |
| 8153 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8154 | uint32_t sme_get_current_roam_sub_state(tHalHandle hHal, uint8_t sessionId) |
| 8155 | { |
| 8156 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8157 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8158 | return pMac->roam.curSubState[sessionId]; |
| 8159 | } |
| 8160 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8161 | /* |
| 8162 | * sme_get_lim_sme_state() - |
| 8163 | * get Lim Sme state |
| 8164 | * |
| 8165 | * hHal - The handle returned by mac_open. |
| 8166 | * Return uint32_t - Lim Sme state |
| 8167 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8168 | uint32_t sme_get_lim_sme_state(tHalHandle hHal) |
| 8169 | { |
| 8170 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8171 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8172 | return pMac->lim.gLimSmeState; |
| 8173 | } |
| 8174 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8175 | /* |
| 8176 | * sme_get_lim_mlm_state() - |
| 8177 | * get Lim Mlm state |
| 8178 | * |
| 8179 | * hHal - The handle returned by mac_open. |
| 8180 | * Return uint32_t - Lim Mlm state |
| 8181 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8182 | uint32_t sme_get_lim_mlm_state(tHalHandle hHal) |
| 8183 | { |
| 8184 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8185 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8186 | return pMac->lim.gLimMlmState; |
| 8187 | } |
| 8188 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8189 | /* |
| 8190 | * sme_is_lim_session_valid() - |
| 8191 | * is Lim session valid |
| 8192 | * |
| 8193 | * hHal - The handle returned by mac_open. |
| 8194 | * sessionId - Session Identifier |
| 8195 | * Return bool - true or false |
| 8196 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8197 | bool sme_is_lim_session_valid(tHalHandle hHal, uint8_t sessionId) |
| 8198 | { |
| 8199 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Hanumantha Reddy Pothula | 589fd70 | 2015-11-17 15:25:16 +0530 | [diff] [blame] | 8200 | |
| 8201 | if (sessionId > pMac->lim.maxBssId) |
| 8202 | return false; |
| 8203 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8204 | return pMac->lim.gpSession[sessionId].valid; |
| 8205 | } |
| 8206 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8207 | /* |
| 8208 | * sme_get_lim_sme_session_state() - |
| 8209 | * get Lim Sme session state |
| 8210 | * |
| 8211 | * hHal - The handle returned by mac_open. |
| 8212 | * sessionId - Session Identifier |
| 8213 | * Return uint32_t - Lim Sme session state |
| 8214 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8215 | uint32_t sme_get_lim_sme_session_state(tHalHandle hHal, uint8_t sessionId) |
| 8216 | { |
| 8217 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8218 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8219 | return pMac->lim.gpSession[sessionId].limSmeState; |
| 8220 | } |
| 8221 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8222 | /* |
| 8223 | * sme_get_lim_mlm_session_state() - |
| 8224 | * \brief get Lim Mlm session state |
| 8225 | * |
| 8226 | * hHal - The handle returned by mac_open. |
| 8227 | * sessionId - Session Identifier |
| 8228 | * Return uint32_t - Lim Mlm session state |
| 8229 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8230 | uint32_t sme_get_lim_mlm_session_state(tHalHandle hHal, uint8_t sessionId) |
| 8231 | { |
| 8232 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8233 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8234 | return pMac->lim.gpSession[sessionId].limMlmState; |
| 8235 | } |
| 8236 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8237 | /* |
| 8238 | * sme_get_neighbor_scan_max_chan_time() - |
| 8239 | * get neighbor scan max channel time |
| 8240 | * |
| 8241 | * hHal - The handle returned by mac_open. |
| 8242 | * sessionId - Session Identifier |
| 8243 | * Return uint16_t - channel max time value |
| 8244 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8245 | uint16_t sme_get_neighbor_scan_max_chan_time(tHalHandle hHal, uint8_t sessionId) |
| 8246 | { |
| 8247 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8248 | |
| 8249 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 8250 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8251 | FL("Invalid sme session id: %d"), sessionId); |
| 8252 | return 0; |
| 8253 | } |
| 8254 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8255 | return pMac->roam.neighborRoamInfo[sessionId].cfgParams. |
| 8256 | maxChannelScanTime; |
| 8257 | } |
| 8258 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8259 | /* |
| 8260 | * sme_set_neighbor_scan_period() - |
| 8261 | * Update nNeighborScanPeriod |
| 8262 | * This function is called through dynamic setConfig callback function |
| 8263 | * to configure nNeighborScanPeriod |
| 8264 | * Usage: adb shell iwpriv wlan0 setConfig |
| 8265 | * nNeighborScanPeriod=[0 .. 1000] |
| 8266 | * |
| 8267 | * hHal - HAL handle for device |
| 8268 | * sessionId - Session Identifier |
| 8269 | * nNeighborScanPeriod - neighbor scan period |
| 8270 | * Return Success or failure |
| 8271 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8272 | QDF_STATUS sme_set_neighbor_scan_period(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8273 | const uint16_t nNeighborScanPeriod) |
| 8274 | { |
| 8275 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8276 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 8277 | struct csr_neighbor_roamconfig *pNeighborRoamConfig = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8278 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 8279 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8280 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 8281 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8282 | FL("Invalid sme session id: %d"), sessionId); |
| 8283 | return QDF_STATUS_E_INVAL; |
| 8284 | } |
| 8285 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8286 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8287 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8288 | pNeighborRoamConfig = |
| 8289 | &pMac->roam.configParam.neighborRoamConfig; |
| 8290 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8291 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8292 | "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8293 | nNeighborScanPeriod, |
| 8294 | pMac->roam.configParam.neighborRoamConfig. |
| 8295 | nNeighborScanTimerPeriod, |
| 8296 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 8297 | neighborRoamInfo |
| 8298 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8299 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8300 | pNeighborRoamConfig->nNeighborScanTimerPeriod = |
| 8301 | nNeighborScanPeriod; |
| 8302 | pNeighborRoamInfo->cfgParams.neighborScanPeriod = |
| 8303 | nNeighborScanPeriod; |
| 8304 | sme_release_global_lock(&pMac->sme); |
| 8305 | } |
| 8306 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 8307 | csr_roam_offload_scan(pMac, sessionId, |
| 8308 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 8309 | REASON_SCAN_HOME_TIME_CHANGED); |
| 8310 | } |
| 8311 | |
| 8312 | return status; |
| 8313 | } |
| 8314 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8315 | /* |
| 8316 | * sme_get_neighbor_scan_period() - |
| 8317 | * get neighbor scan period |
| 8318 | * |
| 8319 | * hHal - The handle returned by mac_open. |
| 8320 | * sessionId - Session Identifier |
| 8321 | * Return uint16_t - neighbor scan period |
| 8322 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8323 | uint16_t sme_get_neighbor_scan_period(tHalHandle hHal, uint8_t sessionId) |
| 8324 | { |
| 8325 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8326 | |
| 8327 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 8328 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8329 | FL("Invalid sme session id: %d"), sessionId); |
| 8330 | return 0; |
| 8331 | } |
| 8332 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8333 | return pMac->roam.neighborRoamInfo[sessionId].cfgParams. |
| 8334 | neighborScanPeriod; |
| 8335 | } |
| 8336 | |
Sridhar Selvaraj | 1b2330c | 2017-07-21 15:16:42 +0530 | [diff] [blame] | 8337 | /** |
| 8338 | * sme_set_neighbor_scan_min_period() - Update neighbor_scan_min_period |
| 8339 | * This function is called through dynamic setConfig callback function |
| 8340 | * to configure neighbor_scan_min_period |
| 8341 | * |
| 8342 | * @hal - HAL handle for device |
| 8343 | * @session_id - Session Identifier |
| 8344 | * @neighbor_scan_min_period - neighbor scan min period |
| 8345 | * |
| 8346 | * Return - QDF_STATUS |
| 8347 | */ |
| 8348 | QDF_STATUS sme_set_neighbor_scan_min_period(tHalHandle hal, |
| 8349 | uint8_t session_id, |
| 8350 | const uint16_t |
| 8351 | neighbor_scan_min_period) |
| 8352 | { |
| 8353 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 8354 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 8355 | struct csr_neighbor_roamconfig *p_neighbor_roam_config = NULL; |
Sridhar Selvaraj | 1b2330c | 2017-07-21 15:16:42 +0530 | [diff] [blame] | 8356 | tpCsrNeighborRoamControlInfo p_neighbor_roam_info = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8357 | |
Sridhar Selvaraj | 1b2330c | 2017-07-21 15:16:42 +0530 | [diff] [blame] | 8358 | if (session_id >= CSR_ROAM_SESSION_MAX) { |
| 8359 | sme_err("Invalid sme session id: %d", session_id); |
| 8360 | return QDF_STATUS_E_INVAL; |
| 8361 | } |
| 8362 | |
| 8363 | status = sme_acquire_global_lock(&pmac->sme); |
| 8364 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 8365 | p_neighbor_roam_config = |
| 8366 | &pmac->roam.configParam.neighborRoamConfig; |
| 8367 | p_neighbor_roam_info = &pmac-> |
| 8368 | roam.neighborRoamInfo[session_id]; |
| 8369 | sme_debug("LFR:set neighbor scan min period, old:%d, " |
| 8370 | "new: %d, state: %s", |
| 8371 | pmac->roam.configParam.neighborRoamConfig. |
| 8372 | neighbor_scan_min_timer_period, |
| 8373 | neighbor_scan_min_period, |
| 8374 | mac_trace_get_neighbour_roam_state(pmac->roam. |
| 8375 | neighborRoamInfo[session_id]. |
| 8376 | neighborRoamState)); |
| 8377 | p_neighbor_roam_config->neighbor_scan_min_timer_period = |
| 8378 | neighbor_scan_min_period; |
| 8379 | p_neighbor_roam_info->cfgParams.neighbor_scan_min_period = |
| 8380 | neighbor_scan_min_period; |
| 8381 | sme_release_global_lock(&pmac->sme); |
| 8382 | } |
| 8383 | |
| 8384 | return status; |
| 8385 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8386 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8387 | /* |
| 8388 | * sme_get_roam_rssi_diff() - get Roam rssi diff |
| 8389 | * This is a synchronous call |
| 8390 | * |
| 8391 | * hHal - The handle returned by mac_open. |
| 8392 | * Return uint16_t - Rssi diff value |
| 8393 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8394 | uint8_t sme_get_roam_rssi_diff(tHalHandle hHal) |
| 8395 | { |
| 8396 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8397 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8398 | return pMac->roam.configParam.RoamRssiDiff; |
| 8399 | } |
| 8400 | |
| 8401 | /** |
| 8402 | * sme_change_roam_scan_channel_list() - to change scan channel list |
| 8403 | * @hHal: pointer HAL handle returned by mac_open |
| 8404 | * @sessionId: sme session id |
| 8405 | * @pChannelList: Output channel list |
| 8406 | * @numChannels: Output number of channels |
| 8407 | * |
| 8408 | * This routine is called to Change roam scan channel list. |
| 8409 | * This is a synchronous call |
| 8410 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8411 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8412 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8413 | 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] | 8414 | uint8_t *pChannelList, |
| 8415 | uint8_t numChannels) |
| 8416 | { |
| 8417 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8418 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8419 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8420 | uint8_t oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN * 2] = { 0 }; |
| 8421 | uint8_t newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN * 2] = { 0 }; |
| 8422 | uint8_t i = 0, j = 0; |
| 8423 | tCsrChannelInfo *chan_info; |
| 8424 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8425 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 8426 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8427 | FL("Invalid sme session id: %d"), sessionId); |
| 8428 | return QDF_STATUS_E_INVAL; |
| 8429 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8430 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8431 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8432 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8433 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8434 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 8435 | csr_roam_offload_scan(pMac, sessionId, |
| 8436 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 8437 | REASON_CHANNEL_LIST_CHANGED); |
| 8438 | return status; |
| 8439 | } |
| 8440 | chan_info = &pNeighborRoamInfo->cfgParams.channelInfo; |
| 8441 | |
| 8442 | if (NULL != chan_info->ChannelList) { |
| 8443 | for (i = 0; i < chan_info->numOfChannels; i++) { |
| 8444 | if (j < sizeof(oldChannelList)) |
| 8445 | j += snprintf(oldChannelList + j, |
| 8446 | sizeof(oldChannelList) - |
| 8447 | j, "%d", |
| 8448 | chan_info->ChannelList[i]); |
| 8449 | else |
| 8450 | break; |
| 8451 | } |
| 8452 | } |
| 8453 | csr_flush_cfg_bg_scan_roam_channel_list(pMac, sessionId); |
| 8454 | csr_create_bg_scan_roam_channel_list(pMac, sessionId, pChannelList, |
| 8455 | numChannels); |
| 8456 | sme_set_roam_scan_control(hHal, sessionId, 1); |
| 8457 | if (NULL != chan_info->ChannelList) { |
| 8458 | j = 0; |
| 8459 | for (i = 0; i < chan_info->numOfChannels; i++) { |
| 8460 | if (j < sizeof(newChannelList)) |
| 8461 | j += snprintf(newChannelList + j, |
| 8462 | sizeof(newChannelList) - |
| 8463 | j, " %d", |
| 8464 | chan_info->ChannelList[i]); |
| 8465 | else |
| 8466 | break; |
| 8467 | } |
| 8468 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8469 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8470 | "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8471 | newChannelList, oldChannelList, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8472 | pMac->roam.neighborRoamInfo[sessionId].neighborRoamState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8473 | sme_release_global_lock(&pMac->sme); |
| 8474 | |
| 8475 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 8476 | csr_roam_offload_scan(pMac, sessionId, |
| 8477 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 8478 | REASON_CHANNEL_LIST_CHANGED); |
| 8479 | return status; |
| 8480 | } |
| 8481 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8482 | /** |
| 8483 | * sme_get_roam_scan_channel_list() - To get roam scan channel list |
| 8484 | * @hHal: HAL pointer |
| 8485 | * @pChannelList: Output channel list |
| 8486 | * @pNumChannels: Output number of channels |
| 8487 | * @sessionId: Session Identifier |
| 8488 | * |
| 8489 | * To get roam scan channel list This is a synchronous call |
| 8490 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8491 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8492 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8493 | QDF_STATUS sme_get_roam_scan_channel_list(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8494 | uint8_t *pChannelList, uint8_t *pNumChannels, |
| 8495 | uint8_t sessionId) |
| 8496 | { |
| 8497 | int i = 0; |
| 8498 | uint8_t *pOutPtr = pChannelList; |
| 8499 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8500 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8501 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8502 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8503 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 8504 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8505 | FL("Invalid sme session id: %d"), sessionId); |
| 8506 | return QDF_STATUS_E_INVAL; |
| 8507 | } |
| 8508 | |
| 8509 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8510 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8511 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8512 | return status; |
| 8513 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8514 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_WARN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8515 | FL("Roam Scan channel list is NOT yet initialized")); |
| 8516 | *pNumChannels = 0; |
| 8517 | sme_release_global_lock(&pMac->sme); |
| 8518 | return status; |
| 8519 | } |
| 8520 | |
| 8521 | *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8522 | for (i = 0; i < (*pNumChannels); i++) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8523 | pOutPtr[i] = |
| 8524 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8525 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8526 | pOutPtr[i] = '\0'; |
| 8527 | sme_release_global_lock(&pMac->sme); |
| 8528 | return status; |
| 8529 | } |
| 8530 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8531 | /* |
| 8532 | * sme_get_is_ese_feature_enabled() - get ESE feature enabled or not |
| 8533 | * This is a synchronuous call |
| 8534 | * |
| 8535 | * hHal - The handle returned by mac_open. |
| 8536 | * Return true (1) - if the ESE feature is enabled |
| 8537 | * false (0) - if feature is disabled (compile or runtime) |
| 8538 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8539 | bool sme_get_is_ese_feature_enabled(tHalHandle hHal) |
| 8540 | { |
| 8541 | #ifdef FEATURE_WLAN_ESE |
| 8542 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8543 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8544 | return csr_roam_is_ese_ini_feature_enabled(pMac); |
| 8545 | #else |
| 8546 | return false; |
| 8547 | #endif |
| 8548 | } |
| 8549 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8550 | /* |
| 8551 | * sme_get_wes_mode() - get WES Mode |
| 8552 | * This is a synchronous call |
| 8553 | * |
| 8554 | * hHal - The handle returned by mac_open |
| 8555 | * Return uint8_t - WES Mode Enabled(1)/Disabled(0) |
| 8556 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8557 | bool sme_get_wes_mode(tHalHandle hHal) |
| 8558 | { |
| 8559 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8560 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8561 | return pMac->roam.configParam.isWESModeEnabled; |
| 8562 | } |
| 8563 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8564 | /* |
| 8565 | * sme_get_roam_scan_control() - get scan control |
| 8566 | * This is a synchronous call |
| 8567 | * |
| 8568 | * hHal - The handle returned by mac_open. |
| 8569 | * Return bool - Enabled(1)/Disabled(0) |
| 8570 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8571 | bool sme_get_roam_scan_control(tHalHandle hHal) |
| 8572 | { |
| 8573 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8574 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8575 | return pMac->roam.configParam.nRoamScanControl; |
| 8576 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8577 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8578 | /* |
| 8579 | * sme_get_is_lfr_feature_enabled() - get LFR feature enabled or not |
| 8580 | * This is a synchronuous call |
| 8581 | * hHal - The handle returned by mac_open. |
| 8582 | * Return true (1) - if the feature is enabled |
| 8583 | * false (0) - if feature is disabled (compile or runtime) |
| 8584 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8585 | bool sme_get_is_lfr_feature_enabled(tHalHandle hHal) |
| 8586 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8587 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8588 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8589 | return pMac->roam.configParam.isFastRoamIniFeatureEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8590 | } |
| 8591 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8592 | /* |
| 8593 | * sme_get_is_ft_feature_enabled() - get FT feature enabled or not |
| 8594 | * This is a synchronuous call |
| 8595 | * |
| 8596 | * hHal - The handle returned by mac_open. |
| 8597 | * Return true (1) - if the feature is enabled |
| 8598 | * false (0) - if feature is disabled (compile or runtime) |
| 8599 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8600 | bool sme_get_is_ft_feature_enabled(tHalHandle hHal) |
| 8601 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8602 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8603 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8604 | return pMac->roam.configParam.isFastTransitionEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8605 | } |
| 8606 | |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 8607 | /** |
| 8608 | * sme_is_feature_supported_by_fw() - check if feature is supported by FW |
| 8609 | * @feature: enum value of requested feature. |
| 8610 | * |
| 8611 | * Retrun: 1 if supported; 0 otherwise |
| 8612 | */ |
| 8613 | bool sme_is_feature_supported_by_fw(enum cap_bitmap feature) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8614 | { |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 8615 | return IS_FEATURE_SUPPORTED_BY_FW(feature); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8616 | } |
| 8617 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8618 | QDF_STATUS sme_get_link_speed(tHalHandle hHal, tSirLinkSpeedInfo *lsReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8619 | void *plsContext, |
| 8620 | void (*pCallbackfn)(tSirLinkSpeedInfo *indParam, |
| 8621 | void *pContext)) |
| 8622 | { |
| 8623 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8624 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8625 | tpAniSirGlobal pMac; |
| 8626 | tSirLinkSpeedInfo *req; |
Mukul Sharma | c3886aa | 2017-05-04 17:53:22 +0530 | [diff] [blame] | 8627 | void *wma_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8628 | |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8629 | if (!hHal || !pCallbackfn || !lsReq) { |
| 8630 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8631 | FL("Invalid parameter")); |
| 8632 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8633 | } |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8634 | |
Mukul Sharma | c3886aa | 2017-05-04 17:53:22 +0530 | [diff] [blame] | 8635 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 8636 | if (!wma_handle) { |
| 8637 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8638 | "wma handle is NULL"); |
| 8639 | return QDF_STATUS_E_FAILURE; |
| 8640 | } |
| 8641 | |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8642 | pMac = PMAC_STRUCT(hHal); |
| 8643 | req = qdf_mem_malloc(sizeof(*req)); |
| 8644 | if (!req) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 8645 | sme_err("Failed to allocate memory"); |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8646 | return QDF_STATUS_E_NOMEM; |
| 8647 | } |
| 8648 | *req = *lsReq; |
| 8649 | |
| 8650 | status = sme_acquire_global_lock(&pMac->sme); |
| 8651 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 8652 | sme_err("Failed to acquire global lock"); |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8653 | qdf_mem_free(req); |
| 8654 | return QDF_STATUS_E_FAILURE; |
| 8655 | } |
| 8656 | |
| 8657 | pMac->sme.pLinkSpeedCbContext = plsContext; |
| 8658 | pMac->sme.pLinkSpeedIndCb = pCallbackfn; |
Mukul Sharma | c3886aa | 2017-05-04 17:53:22 +0530 | [diff] [blame] | 8659 | status = wma_get_link_speed(wma_handle, req); |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8660 | sme_release_global_lock(&pMac->sme); |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8661 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8662 | return status; |
| 8663 | } |
| 8664 | |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 8665 | QDF_STATUS sme_get_peer_stats(tpAniSirGlobal mac, |
| 8666 | struct sir_peer_info_req req) |
| 8667 | { |
| 8668 | QDF_STATUS qdf_status; |
| 8669 | struct scheduler_msg message = {0}; |
| 8670 | |
| 8671 | qdf_status = sme_acquire_global_lock(&mac->sme); |
| 8672 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 8673 | sme_debug("Failed to get Lock"); |
| 8674 | return qdf_status; |
| 8675 | } |
| 8676 | /* serialize the req through MC thread */ |
| 8677 | message.bodyptr = qdf_mem_malloc(sizeof(req)); |
| 8678 | if (NULL == message.bodyptr) { |
| 8679 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8680 | "%s: Memory allocation failed.", __func__); |
| 8681 | sme_release_global_lock(&mac->sme); |
| 8682 | return QDF_STATUS_E_NOMEM; |
| 8683 | } |
| 8684 | qdf_mem_copy(message.bodyptr, &req, sizeof(req)); |
| 8685 | message.type = WMA_GET_PEER_INFO; |
| 8686 | message.reserved = 0; |
| 8687 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
| 8688 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 8689 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8690 | "%s: Post get peer info msg fail", __func__); |
| 8691 | qdf_mem_free(message.bodyptr); |
| 8692 | qdf_status = QDF_STATUS_E_FAILURE; |
| 8693 | } |
| 8694 | sme_release_global_lock(&mac->sme); |
| 8695 | return qdf_status; |
| 8696 | } |
| 8697 | |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 8698 | QDF_STATUS sme_get_peer_info(tHalHandle hal, struct sir_peer_info_req req, |
| 8699 | void *context, |
| 8700 | void (*callbackfn)(struct sir_peer_info_resp *param, |
| 8701 | void *pcontext)) |
| 8702 | { |
| 8703 | |
| 8704 | QDF_STATUS status; |
| 8705 | QDF_STATUS qdf_status; |
| 8706 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 658e849 | 2017-12-13 11:35:41 -0800 | [diff] [blame] | 8707 | struct scheduler_msg message = {0}; |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 8708 | |
| 8709 | status = sme_acquire_global_lock(&mac->sme); |
| 8710 | if (QDF_STATUS_SUCCESS == status) { |
| 8711 | if (NULL == callbackfn) { |
| 8712 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8713 | "%s: Indication Call back is NULL", |
| 8714 | __func__); |
| 8715 | sme_release_global_lock(&mac->sme); |
| 8716 | return QDF_STATUS_E_FAILURE; |
| 8717 | } |
| 8718 | |
| 8719 | mac->sme.pget_peer_info_ind_cb = callbackfn; |
| 8720 | mac->sme.pget_peer_info_cb_context = context; |
| 8721 | |
| 8722 | /* serialize the req through MC thread */ |
| 8723 | message.bodyptr = qdf_mem_malloc(sizeof(req)); |
| 8724 | if (NULL == message.bodyptr) { |
| 8725 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8726 | "%s: Memory allocation failed.", __func__); |
| 8727 | sme_release_global_lock(&mac->sme); |
| 8728 | return QDF_STATUS_E_NOMEM; |
| 8729 | } |
| 8730 | qdf_mem_copy(message.bodyptr, &req, sizeof(req)); |
| 8731 | message.type = WMA_GET_PEER_INFO; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 8732 | message.reserved = 0; |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 8733 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
| 8734 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 8735 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8736 | "%s: Post get peer info msg fail", __func__); |
| 8737 | qdf_mem_free(message.bodyptr); |
| 8738 | status = QDF_STATUS_E_FAILURE; |
| 8739 | } |
| 8740 | sme_release_global_lock(&mac->sme); |
| 8741 | } |
| 8742 | return status; |
| 8743 | } |
| 8744 | |
| 8745 | QDF_STATUS sme_get_peer_info_ext(tHalHandle hal, |
| 8746 | struct sir_peer_info_ext_req *req, |
| 8747 | void *context, |
| 8748 | void (*callbackfn)(struct sir_peer_info_ext_resp *param, |
| 8749 | void *pcontext)) |
| 8750 | { |
| 8751 | QDF_STATUS status; |
| 8752 | QDF_STATUS qdf_status; |
| 8753 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 658e849 | 2017-12-13 11:35:41 -0800 | [diff] [blame] | 8754 | struct scheduler_msg message = {0}; |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 8755 | |
| 8756 | status = sme_acquire_global_lock(&mac->sme); |
| 8757 | if (QDF_STATUS_SUCCESS == status) { |
| 8758 | if (NULL == callbackfn) { |
| 8759 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8760 | "%s: Indication Call back is NULL", |
| 8761 | __func__); |
| 8762 | sme_release_global_lock(&mac->sme); |
| 8763 | return QDF_STATUS_E_FAILURE; |
| 8764 | } |
| 8765 | |
| 8766 | mac->sme.pget_peer_info_ext_ind_cb = callbackfn; |
| 8767 | mac->sme.pget_peer_info_ext_cb_context = context; |
| 8768 | |
| 8769 | /* serialize the req through MC thread */ |
| 8770 | message.bodyptr = |
| 8771 | qdf_mem_malloc(sizeof(struct sir_peer_info_ext_req)); |
| 8772 | if (NULL == message.bodyptr) { |
| 8773 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8774 | "%s: Memory allocation failed.", __func__); |
| 8775 | sme_release_global_lock(&mac->sme); |
| 8776 | return QDF_STATUS_E_NOMEM; |
| 8777 | } |
| 8778 | qdf_mem_copy(message.bodyptr, |
| 8779 | req, |
| 8780 | sizeof(struct sir_peer_info_ext_req)); |
| 8781 | message.type = WMA_GET_PEER_INFO_EXT; |
| 8782 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
| 8783 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 8784 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8785 | "%s: Post get rssi msg fail", __func__); |
| 8786 | qdf_mem_free(message.bodyptr); |
| 8787 | status = QDF_STATUS_E_FAILURE; |
| 8788 | } |
| 8789 | sme_release_global_lock(&mac->sme); |
| 8790 | } |
| 8791 | return status; |
| 8792 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8793 | |
| 8794 | /* |
| 8795 | * SME API to enable/disable WLAN driver initiated SSR |
| 8796 | */ |
| 8797 | void sme_update_enable_ssr(tHalHandle hHal, bool enableSSR) |
| 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 | |
| 8802 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8803 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 8804 | sme_debug("SSR level is changed %d", enableSSR); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8805 | /* not serializing this messsage, as this is only going |
| 8806 | * to set a variable in WMA/WDI |
| 8807 | */ |
| 8808 | WMA_SetEnableSSR(enableSSR); |
| 8809 | sme_release_global_lock(&pMac->sme); |
| 8810 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8811 | } |
| 8812 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8813 | /*convert the ini value to the ENUM used in csr and MAC for CB state*/ |
| 8814 | ePhyChanBondState sme_get_cb_phy_state_from_cb_ini_value(uint32_t cb_ini_value) |
| 8815 | { |
| 8816 | return csr_convert_cb_ini_value_to_phy_cb_state(cb_ini_value); |
| 8817 | } |
| 8818 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8819 | /* |
| 8820 | * sme_set_curr_device_mode() - Sets the current operating device mode. |
| 8821 | * |
| 8822 | * hHal - The handle returned by mac_open. |
| 8823 | * currDeviceMode - Current operating device mode. |
| 8824 | */ |
Peng Xu | f5d60c8 | 2015-10-02 17:17:03 -0700 | [diff] [blame] | 8825 | void sme_set_curr_device_mode(tHalHandle hHal, |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 8826 | enum QDF_OPMODE currDeviceMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8827 | { |
| 8828 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8829 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8830 | pMac->sme.currDeviceMode = currDeviceMode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8831 | } |
| 8832 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8833 | /* |
| 8834 | * sme_handoff_request() - a wrapper function to Request a handoff from CSR. |
| 8835 | * This is a synchronous call |
| 8836 | * |
| 8837 | * hHal - The handle returned by mac_open |
| 8838 | * sessionId - Session Identifier |
| 8839 | * pHandoffInfo - info provided by HDD with the handoff request (namely: |
| 8840 | * BSSID, channel etc.) |
| 8841 | * Return QDF_STATUS_SUCCESS - SME passed the request to CSR successfully. |
| 8842 | * Other status means SME is failed to send the request. |
| 8843 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8844 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8845 | QDF_STATUS sme_handoff_request(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8846 | uint8_t sessionId, |
| 8847 | tCsrHandoffRequest *pHandoffInfo) |
| 8848 | { |
| 8849 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8850 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8851 | |
| 8852 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8853 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 8854 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8855 | "%s: invoked", __func__); |
| 8856 | status = csr_handoff_request(pMac, sessionId, pHandoffInfo); |
| 8857 | sme_release_global_lock(&pMac->sme); |
| 8858 | } |
| 8859 | |
| 8860 | return status; |
| 8861 | } |
| 8862 | |
| 8863 | #ifdef IPA_OFFLOAD |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8864 | /* |
| 8865 | * sme_ipa_offload_enable_disable() - |
| 8866 | * API to enable/disable IPA offload |
| 8867 | * |
| 8868 | * hal - The handle returned by macOpen. |
| 8869 | * session_id - Session Identifier |
| 8870 | * request - Pointer to the offload request. |
| 8871 | * Return QDF_STATUS |
| 8872 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8873 | 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] | 8874 | struct sir_ipa_offload_enable_disable *request) |
| 8875 | { |
| 8876 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8877 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8878 | struct sir_ipa_offload_enable_disable *request_buf; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 8879 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8880 | |
| 8881 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8882 | if (QDF_STATUS_SUCCESS == status) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8883 | request_buf = qdf_mem_malloc(sizeof(*request_buf)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8884 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8885 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8886 | "Not able to allocate memory for IPA_OFFLOAD_ENABLE_DISABLE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8887 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8888 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8889 | } |
| 8890 | |
| 8891 | request_buf->offload_type = request->offload_type; |
| 8892 | request_buf->vdev_id = request->vdev_id; |
| 8893 | request_buf->enable = request->enable; |
| 8894 | |
| 8895 | msg.type = WMA_IPA_OFFLOAD_ENABLE_DISABLE; |
| 8896 | msg.reserved = 0; |
| 8897 | msg.bodyptr = request_buf; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8898 | if (!QDF_IS_STATUS_SUCCESS( |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 8899 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8900 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8901 | "Not able to post WMA_IPA_OFFLOAD_ENABLE_DISABLE message to WMA"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8902 | qdf_mem_free(request_buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8903 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8904 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8905 | } |
| 8906 | |
| 8907 | sme_release_global_lock(&pMac->sme); |
| 8908 | } |
| 8909 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8910 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8911 | } |
| 8912 | #endif /* IPA_OFFLOAD */ |
| 8913 | |
| 8914 | /* |
| 8915 | * SME API to check if there is any infra station or |
| 8916 | * P2P client is connected |
| 8917 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8918 | QDF_STATUS sme_is_sta_p2p_client_connected(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8919 | { |
| 8920 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8921 | |
| 8922 | if (csr_is_infra_connected(pMac)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8923 | return QDF_STATUS_SUCCESS; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8924 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8925 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8926 | } |
| 8927 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8928 | /** |
| 8929 | * sme_add_periodic_tx_ptrn() - Add Periodic TX Pattern |
| 8930 | * @hal: global hal handle |
| 8931 | * @addPeriodicTxPtrnParams: request message |
| 8932 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8933 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8934 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8935 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8936 | sme_add_periodic_tx_ptrn(tHalHandle hal, |
| 8937 | struct sSirAddPeriodicTxPtrn *addPeriodicTxPtrnParams) |
| 8938 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8939 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8940 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 8941 | struct sSirAddPeriodicTxPtrn *req_msg; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 8942 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8943 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8944 | SME_ENTER(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8945 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8946 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8947 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8948 | sme_err("memory allocation failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8949 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8950 | } |
| 8951 | |
| 8952 | *req_msg = *addPeriodicTxPtrnParams; |
| 8953 | |
| 8954 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8955 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8956 | sme_err("sme_acquire_global_lock failed!(status=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8957 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8958 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8959 | return status; |
| 8960 | } |
| 8961 | |
| 8962 | /* Serialize the req through MC thread */ |
| 8963 | msg.bodyptr = req_msg; |
| 8964 | msg.type = WMA_ADD_PERIODIC_TX_PTRN_IND; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 8965 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 8966 | NO_SESSION, msg.type)); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 8967 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8968 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8969 | sme_err("scheduler_post_msg failed!(err=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8970 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8971 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8972 | } |
| 8973 | sme_release_global_lock(&mac->sme); |
| 8974 | return status; |
| 8975 | } |
| 8976 | |
| 8977 | /** |
| 8978 | * sme_del_periodic_tx_ptrn() - Delete Periodic TX Pattern |
| 8979 | * @hal: global hal handle |
| 8980 | * @delPeriodicTxPtrnParams: request message |
| 8981 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8982 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8983 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8984 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8985 | sme_del_periodic_tx_ptrn(tHalHandle hal, |
| 8986 | struct sSirDelPeriodicTxPtrn *delPeriodicTxPtrnParams) |
| 8987 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8988 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8989 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 8990 | struct sSirDelPeriodicTxPtrn *req_msg; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 8991 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8992 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8993 | SME_ENTER(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8994 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8995 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8996 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8997 | sme_err("memory allocation failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8998 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8999 | } |
| 9000 | |
| 9001 | *req_msg = *delPeriodicTxPtrnParams; |
| 9002 | |
| 9003 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9004 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 9005 | sme_err("sme_acquire_global_lock failed!(status=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9006 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9007 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9008 | return status; |
| 9009 | } |
| 9010 | |
| 9011 | /* Serialize the req through MC thread */ |
| 9012 | msg.bodyptr = req_msg; |
| 9013 | msg.type = WMA_DEL_PERIODIC_TX_PTRN_IND; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 9014 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 9015 | NO_SESSION, msg.type)); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9016 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9017 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 9018 | sme_err("scheduler_post_msg failed!(err=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9019 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9020 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9021 | } |
| 9022 | sme_release_global_lock(&mac->sme); |
| 9023 | return status; |
| 9024 | } |
| 9025 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9026 | /* |
| 9027 | * sme_enable_rmc() - enables RMC |
| 9028 | * @hHal : Pointer to global HAL handle |
| 9029 | * @sessionId : Session ID |
| 9030 | * |
| 9031 | * Return: QDF_STATUS |
| 9032 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9033 | QDF_STATUS sme_enable_rmc(tHalHandle hHal, uint32_t sessionId) |
| 9034 | { |
| 9035 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 9036 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 9037 | struct scheduler_msg message = {0}; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9038 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 9039 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 9040 | SME_ENTER(); |
| 9041 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9042 | status = sme_acquire_global_lock(&pMac->sme); |
| 9043 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9044 | message.bodyptr = NULL; |
| 9045 | message.type = WMA_RMC_ENABLE_IND; |
| 9046 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 9047 | &message); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9048 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 9049 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9050 | "%s: failed to post message to WMA", |
| 9051 | __func__); |
| 9052 | status = QDF_STATUS_E_FAILURE; |
| 9053 | } |
| 9054 | sme_release_global_lock(&pMac->sme); |
| 9055 | } |
| 9056 | return status; |
| 9057 | } |
| 9058 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9059 | /* |
| 9060 | * sme_disable_rmc() - disables RMC |
| 9061 | * @hHal : Pointer to global HAL handle |
| 9062 | * @sessionId : Session ID |
| 9063 | * |
| 9064 | * Return: QDF_STATUS |
| 9065 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9066 | QDF_STATUS sme_disable_rmc(tHalHandle hHal, uint32_t sessionId) |
| 9067 | { |
| 9068 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 9069 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 9070 | struct scheduler_msg message = {0}; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9071 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 9072 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 9073 | SME_ENTER(); |
| 9074 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9075 | status = sme_acquire_global_lock(&pMac->sme); |
| 9076 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9077 | message.bodyptr = NULL; |
| 9078 | message.type = WMA_RMC_DISABLE_IND; |
| 9079 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 9080 | &message); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9081 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 9082 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9083 | "%s: failed to post message to WMA", |
| 9084 | __func__); |
| 9085 | status = QDF_STATUS_E_FAILURE; |
| 9086 | } |
| 9087 | sme_release_global_lock(&pMac->sme); |
| 9088 | } |
| 9089 | return status; |
| 9090 | } |
| 9091 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9092 | /* |
| 9093 | * sme_send_rmc_action_period() - sends RMC action period param to target |
| 9094 | * @hHal : Pointer to global HAL handle |
| 9095 | * @sessionId : Session ID |
| 9096 | * |
| 9097 | * Return: QDF_STATUS |
| 9098 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9099 | QDF_STATUS sme_send_rmc_action_period(tHalHandle hHal, uint32_t sessionId) |
| 9100 | { |
| 9101 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 9102 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 9103 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 9104 | struct scheduler_msg message = {0}; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9105 | |
| 9106 | status = sme_acquire_global_lock(&pMac->sme); |
| 9107 | if (QDF_STATUS_SUCCESS == status) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9108 | message.bodyptr = NULL; |
| 9109 | message.type = WMA_RMC_ACTION_PERIOD_IND; |
| 9110 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 9111 | &message); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9112 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 9113 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9114 | "%s: failed to post message to WMA", |
| 9115 | __func__); |
| 9116 | status = QDF_STATUS_E_FAILURE; |
| 9117 | } |
| 9118 | sme_release_global_lock(&pMac->sme); |
| 9119 | } |
| 9120 | |
| 9121 | return status; |
| 9122 | } |
| 9123 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9124 | /* |
| 9125 | * sme_request_ibss_peer_info() - request ibss peer info |
| 9126 | * @hHal : Pointer to global HAL handle |
| 9127 | * @pUserData : Pointer to user data |
| 9128 | * @peerInfoCbk : Peer info callback |
| 9129 | * @allPeerInfoReqd : All peer info required or not |
| 9130 | * @staIdx : sta index |
| 9131 | * |
| 9132 | * Return: QDF_STATUS |
| 9133 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9134 | QDF_STATUS sme_request_ibss_peer_info(tHalHandle hHal, void *pUserData, |
| 9135 | pIbssPeerInfoCb peerInfoCbk, |
| 9136 | bool allPeerInfoReqd, uint8_t staIdx) |
| 9137 | { |
| 9138 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 9139 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
| 9140 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 9141 | struct scheduler_msg message = {0}; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9142 | tSirIbssGetPeerInfoReqParams *pIbssInfoReqParams; |
| 9143 | |
| 9144 | status = sme_acquire_global_lock(&pMac->sme); |
| 9145 | if (QDF_STATUS_SUCCESS == status) { |
| 9146 | pMac->sme.peerInfoParams.peerInfoCbk = peerInfoCbk; |
| 9147 | pMac->sme.peerInfoParams.pUserData = pUserData; |
| 9148 | |
| 9149 | pIbssInfoReqParams = (tSirIbssGetPeerInfoReqParams *) |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9150 | qdf_mem_malloc(sizeof(tSirIbssGetPeerInfoReqParams)); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9151 | if (NULL == pIbssInfoReqParams) { |
| 9152 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9153 | "%s: Not able to allocate memory for dhcp start", |
| 9154 | __func__); |
| 9155 | sme_release_global_lock(&pMac->sme); |
| 9156 | return QDF_STATUS_E_NOMEM; |
| 9157 | } |
| 9158 | pIbssInfoReqParams->allPeerInfoReqd = allPeerInfoReqd; |
| 9159 | pIbssInfoReqParams->staIdx = staIdx; |
| 9160 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9161 | message.type = WMA_GET_IBSS_PEER_INFO_REQ; |
| 9162 | message.bodyptr = pIbssInfoReqParams; |
| 9163 | message.reserved = 0; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9164 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9165 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 9166 | &message); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9167 | if (QDF_STATUS_SUCCESS != qdf_status) { |
| 9168 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9169 | "%s: Post WMA_GET_IBSS_PEER_INFO_REQ MSG failed", |
| 9170 | __func__); |
| 9171 | qdf_mem_free(pIbssInfoReqParams); |
| 9172 | qdf_status = QDF_STATUS_E_FAILURE; |
| 9173 | } |
| 9174 | sme_release_global_lock(&pMac->sme); |
| 9175 | } |
| 9176 | |
| 9177 | return qdf_status; |
| 9178 | } |
| 9179 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9180 | /* |
| 9181 | * sme_send_cesium_enable_ind() - |
| 9182 | * Used to send proprietary cesium enable indication to fw |
| 9183 | * |
| 9184 | * hHal |
| 9185 | * sessionId |
| 9186 | * Return QDF_STATUS |
| 9187 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9188 | QDF_STATUS sme_send_cesium_enable_ind(tHalHandle hHal, uint32_t sessionId) |
| 9189 | { |
| 9190 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 9191 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 9192 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 9193 | struct scheduler_msg message = {0}; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9194 | |
| 9195 | status = sme_acquire_global_lock(&pMac->sme); |
| 9196 | if (QDF_STATUS_SUCCESS == status) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9197 | message.bodyptr = NULL; |
| 9198 | message.type = WMA_IBSS_CESIUM_ENABLE_IND; |
| 9199 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 9200 | &message); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 9201 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 9202 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9203 | "%s: failed to post message to WMA", |
| 9204 | __func__); |
| 9205 | status = QDF_STATUS_E_FAILURE; |
| 9206 | } |
| 9207 | sme_release_global_lock(&pMac->sme); |
| 9208 | } |
| 9209 | |
| 9210 | return status; |
| 9211 | } |
| 9212 | |
Paul Zhang | 99fe884 | 2017-12-08 14:43:46 +0800 | [diff] [blame] | 9213 | QDF_STATUS sme_set_wlm_latency_level(tHalHandle hal, uint16_t session_id, |
| 9214 | uint16_t latency_level) |
| 9215 | { |
| 9216 | QDF_STATUS status; |
| 9217 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 9218 | struct wlm_latency_level_param params; |
| 9219 | void *wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 9220 | |
| 9221 | if (!mac_ctx->roam.configParam.wlm_latency_enable) { |
| 9222 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9223 | "%s: WLM latency level setting is disabled", |
| 9224 | __func__); |
| 9225 | return QDF_STATUS_E_FAILURE; |
| 9226 | } |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 9227 | if (!wma) { |
| 9228 | sme_err("wma is NULL"); |
| 9229 | return QDF_STATUS_E_FAILURE; |
| 9230 | } |
Paul Zhang | 99fe884 | 2017-12-08 14:43:46 +0800 | [diff] [blame] | 9231 | |
| 9232 | params.wlm_latency_level = latency_level; |
| 9233 | params.wlm_latency_flags = |
| 9234 | mac_ctx->roam.configParam.wlm_latency_flags[latency_level]; |
| 9235 | params.vdev_id = session_id; |
| 9236 | |
| 9237 | status = wma_set_wlm_latency_level(wma, ¶ms); |
| 9238 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 9239 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9240 | "%s: failed to set latency level", |
| 9241 | __func__); |
| 9242 | |
| 9243 | return status; |
| 9244 | } |
| 9245 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9246 | void sme_get_command_q_status(tHalHandle hHal) |
| 9247 | { |
| 9248 | tSmeCmd *pTempCmd = NULL; |
| 9249 | tListElem *pEntry; |
| 9250 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9251 | |
| 9252 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9253 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9254 | "%s: pMac is NULL", __func__); |
| 9255 | return; |
| 9256 | } |
| 9257 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 9258 | pEntry = csr_nonscan_active_ll_peek_head(pMac, LL_ACCESS_LOCK); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9259 | if (pEntry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9260 | pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9261 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 9262 | sme_err("Currently smeCmdActiveList has command (0x%X)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9263 | (pTempCmd) ? pTempCmd->command : eSmeNoCommand); |
| 9264 | if (pTempCmd) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9265 | if (eSmeCsrCommandMask & pTempCmd->command) |
| 9266 | /* CSR command is stuck. See what the reason code is |
| 9267 | * for that command |
| 9268 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9269 | dump_csr_command_info(pMac, pTempCmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9270 | } /* if(pTempCmd) */ |
| 9271 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 9272 | sme_err("Currently smeCmdPendingList has %d commands", |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 9273 | csr_nonscan_pending_ll_count(pMac)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9274 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9275 | } |
Kiran Kumar Lokere | 1aa9c9a | 2016-10-05 18:50:59 -0700 | [diff] [blame] | 9276 | /** |
| 9277 | * sme_set_prefer_80MHz_over_160MHz() - API to set sta_prefer_80MHz_over_160MHz |
| 9278 | * @hal: The handle returned by macOpen |
| 9279 | * @sta_prefer_80MHz_over_160MHz: sta_prefer_80MHz_over_160MHz config param |
| 9280 | */ |
| 9281 | void sme_set_prefer_80MHz_over_160MHz(tHalHandle hal, |
| 9282 | bool sta_prefer_80MHz_over_160MHz) |
| 9283 | { |
| 9284 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9285 | |
Kiran Kumar Lokere | 1aa9c9a | 2016-10-05 18:50:59 -0700 | [diff] [blame] | 9286 | mac_ctx->sta_prefer_80MHz_over_160MHz = sta_prefer_80MHz_over_160MHz; |
| 9287 | } |
| 9288 | |
Agrawal Ashish | b141b09 | 2016-09-02 19:59:26 +0530 | [diff] [blame] | 9289 | #ifdef WLAN_FEATURE_DSRC |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9290 | /** |
| 9291 | * sme_set_dot11p_config() - API to set the 802.11p config |
| 9292 | * @hHal: The handle returned by macOpen |
| 9293 | * @enable_dot11p: 802.11p config param |
| 9294 | */ |
| 9295 | void sme_set_dot11p_config(tHalHandle hHal, bool enable_dot11p) |
| 9296 | { |
| 9297 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9298 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9299 | pMac->enable_dot11p = enable_dot11p; |
| 9300 | } |
| 9301 | |
| 9302 | /** |
| 9303 | * copy_sir_ocb_config() - Performs deep copy of an OCB configuration |
| 9304 | * @src: the source configuration |
| 9305 | * |
| 9306 | * Return: pointer to the copied OCB configuration |
| 9307 | */ |
| 9308 | static struct sir_ocb_config *sme_copy_sir_ocb_config( |
| 9309 | struct sir_ocb_config *src) |
| 9310 | { |
| 9311 | struct sir_ocb_config *dst; |
| 9312 | uint32_t length; |
| 9313 | void *cursor; |
| 9314 | |
| 9315 | length = sizeof(*src) + |
| 9316 | src->channel_count * sizeof(*src->channels) + |
| 9317 | src->schedule_size * sizeof(*src->schedule) + |
| 9318 | src->dcc_ndl_chan_list_len + |
| 9319 | src->dcc_ndl_active_state_list_len; |
| 9320 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9321 | dst = qdf_mem_malloc(length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9322 | if (!dst) |
| 9323 | return NULL; |
| 9324 | |
| 9325 | *dst = *src; |
| 9326 | |
| 9327 | cursor = dst; |
| 9328 | cursor += sizeof(*dst); |
| 9329 | dst->channels = cursor; |
| 9330 | cursor += src->channel_count * sizeof(*src->channels); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9331 | qdf_mem_copy(dst->channels, src->channels, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9332 | src->channel_count * sizeof(*src->channels)); |
| 9333 | dst->schedule = cursor; |
| 9334 | cursor += src->schedule_size * sizeof(*src->schedule); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9335 | qdf_mem_copy(dst->schedule, src->schedule, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9336 | src->schedule_size * sizeof(*src->schedule)); |
| 9337 | dst->dcc_ndl_chan_list = cursor; |
| 9338 | cursor += src->dcc_ndl_chan_list_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9339 | 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] | 9340 | src->dcc_ndl_chan_list_len); |
| 9341 | dst->dcc_ndl_active_state_list = cursor; |
| 9342 | cursor += src->dcc_ndl_active_state_list_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9343 | qdf_mem_copy(dst->dcc_ndl_active_state_list, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9344 | src->dcc_ndl_active_state_list, |
| 9345 | src->dcc_ndl_active_state_list_len); |
| 9346 | return dst; |
| 9347 | } |
| 9348 | |
| 9349 | /** |
| 9350 | * sme_ocb_set_config() - Set the OCB configuration |
| 9351 | * @hHal: reference to the HAL |
| 9352 | * @context: the context of the call |
| 9353 | * @callback: the callback to hdd |
| 9354 | * @config: the OCB configuration |
| 9355 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9356 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9357 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9358 | QDF_STATUS sme_ocb_set_config(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9359 | ocb_callback callback, |
| 9360 | struct sir_ocb_config *config) |
| 9361 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9362 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9363 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9364 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9365 | struct sir_ocb_config *msg_body; |
| 9366 | |
| 9367 | /* Lock the SME structure */ |
| 9368 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9369 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9370 | return status; |
| 9371 | |
| 9372 | /* |
| 9373 | * Check if there is a pending request and return an error if one |
| 9374 | * exists |
| 9375 | */ |
| 9376 | if (pMac->sme.ocb_set_config_callback) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9377 | status = QDF_STATUS_E_BUSY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9378 | goto end; |
| 9379 | } |
| 9380 | |
| 9381 | msg_body = sme_copy_sir_ocb_config(config); |
| 9382 | |
| 9383 | if (!msg_body) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9384 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9385 | goto end; |
| 9386 | } |
| 9387 | |
| 9388 | msg.type = WMA_OCB_SET_CONFIG_CMD; |
| 9389 | msg.bodyptr = msg_body; |
| 9390 | |
| 9391 | /* Set the request callback and context */ |
| 9392 | pMac->sme.ocb_set_config_callback = callback; |
| 9393 | pMac->sme.ocb_set_config_context = context; |
| 9394 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9395 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9396 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9397 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9398 | FL("Error posting message to WDA: %d"), status); |
| 9399 | pMac->sme.ocb_set_config_callback = callback; |
| 9400 | pMac->sme.ocb_set_config_context = context; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9401 | qdf_mem_free(msg_body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9402 | goto end; |
| 9403 | } |
| 9404 | |
| 9405 | end: |
| 9406 | sme_release_global_lock(&pMac->sme); |
| 9407 | |
| 9408 | return status; |
| 9409 | } |
| 9410 | |
| 9411 | /** |
| 9412 | * sme_ocb_set_utc_time() - Set the OCB UTC time |
| 9413 | * @hHal: reference to the HAL |
| 9414 | * @utc: the UTC time struct |
| 9415 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9416 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9417 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9418 | 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] | 9419 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9420 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9421 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9422 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9423 | struct sir_ocb_utc *sme_utc; |
| 9424 | |
| 9425 | /* Lock the SME structure */ |
| 9426 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9427 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9428 | return status; |
| 9429 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9430 | sme_utc = qdf_mem_malloc(sizeof(*sme_utc)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9431 | if (!sme_utc) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9432 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9433 | FL("Malloc failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9434 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9435 | goto end; |
| 9436 | } |
| 9437 | *sme_utc = *utc; |
| 9438 | |
| 9439 | msg.type = WMA_OCB_SET_UTC_TIME_CMD; |
| 9440 | msg.reserved = 0; |
| 9441 | msg.bodyptr = sme_utc; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9442 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9443 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9444 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9445 | FL("Not able to post message to WDA")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9446 | qdf_mem_free(utc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9447 | goto end; |
| 9448 | } |
| 9449 | |
| 9450 | end: |
| 9451 | sme_release_global_lock(&pMac->sme); |
| 9452 | |
| 9453 | return status; |
| 9454 | } |
| 9455 | |
| 9456 | /** |
| 9457 | * sme_ocb_start_timing_advert() - Start sending timing advert frames |
| 9458 | * @hHal: reference to the HAL |
| 9459 | * @timing_advert: the timing advertisement struct |
| 9460 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9461 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9462 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9463 | QDF_STATUS sme_ocb_start_timing_advert(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9464 | struct sir_ocb_timing_advert *timing_advert) |
| 9465 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9466 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9467 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9468 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9469 | void *buf; |
| 9470 | struct sir_ocb_timing_advert *sme_timing_advert; |
| 9471 | |
| 9472 | /* Lock the SME structure */ |
| 9473 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9474 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9475 | return status; |
| 9476 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9477 | buf = qdf_mem_malloc(sizeof(*sme_timing_advert) + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9478 | timing_advert->template_length); |
| 9479 | if (!buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9480 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9481 | FL("Not able to allocate memory for start TA")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9482 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9483 | goto end; |
| 9484 | } |
| 9485 | |
| 9486 | sme_timing_advert = (struct sir_ocb_timing_advert *)buf; |
| 9487 | *sme_timing_advert = *timing_advert; |
| 9488 | sme_timing_advert->template_value = buf + sizeof(*sme_timing_advert); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9489 | qdf_mem_copy(sme_timing_advert->template_value, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9490 | timing_advert->template_value, timing_advert->template_length); |
| 9491 | |
| 9492 | msg.type = WMA_OCB_START_TIMING_ADVERT_CMD; |
| 9493 | msg.reserved = 0; |
| 9494 | msg.bodyptr = buf; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9495 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9496 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9497 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9498 | FL("Not able to post msg to WDA")); |
| 9499 | goto end; |
| 9500 | } |
| 9501 | |
| 9502 | end: |
| 9503 | sme_release_global_lock(&pMac->sme); |
| 9504 | |
| 9505 | return status; |
| 9506 | } |
| 9507 | |
| 9508 | /** |
| 9509 | * sme_ocb_stop_timing_advert() - Stop sending timing advert frames on a channel |
| 9510 | * @hHal: reference to the HAL |
| 9511 | * @timing_advert: the timing advertisement struct |
| 9512 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9513 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9514 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9515 | QDF_STATUS sme_ocb_stop_timing_advert(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9516 | struct sir_ocb_timing_advert *timing_advert) |
| 9517 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9518 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9519 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9520 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9521 | struct sir_ocb_timing_advert *sme_timing_advert; |
| 9522 | |
| 9523 | /* Lock the SME structure */ |
| 9524 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9525 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9526 | return status; |
| 9527 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9528 | sme_timing_advert = qdf_mem_malloc(sizeof(*timing_advert)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9529 | if (!sme_timing_advert) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9530 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9531 | FL("Not able to allocate memory for stop TA")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9532 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9533 | goto end; |
| 9534 | } |
| 9535 | *sme_timing_advert = *timing_advert; |
| 9536 | |
| 9537 | msg.type = WMA_OCB_STOP_TIMING_ADVERT_CMD; |
| 9538 | msg.reserved = 0; |
| 9539 | msg.bodyptr = sme_timing_advert; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9540 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9541 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9542 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9543 | FL("Not able to post msg to WDA")); |
| 9544 | goto end; |
| 9545 | } |
| 9546 | |
| 9547 | end: |
| 9548 | sme_release_global_lock(&pMac->sme); |
| 9549 | |
| 9550 | return status; |
| 9551 | } |
| 9552 | |
| 9553 | /** |
Naveen Rawat | b4d3762 | 2015-11-13 16:15:25 -0800 | [diff] [blame] | 9554 | * sme_ocb_gen_timing_advert_frame() - generate TA frame and populate the buffer |
| 9555 | * @hal_handle: reference to the HAL |
| 9556 | * @self_addr: the self MAC address |
| 9557 | * @buf: the buffer that will contain the frame |
| 9558 | * @timestamp_offset: return for the offset of the timestamp field |
| 9559 | * @time_value_offset: return for the time_value field in the TA IE |
| 9560 | * |
| 9561 | * Return: the length of the buffer. |
| 9562 | */ |
| 9563 | int sme_ocb_gen_timing_advert_frame(tHalHandle hal_handle, |
| 9564 | tSirMacAddr self_addr, uint8_t **buf, |
| 9565 | uint32_t *timestamp_offset, |
| 9566 | uint32_t *time_value_offset) |
| 9567 | { |
| 9568 | int template_length; |
| 9569 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
| 9570 | |
| 9571 | template_length = sch_gen_timing_advert_frame(mac_ctx, self_addr, buf, |
| 9572 | timestamp_offset, |
| 9573 | time_value_offset); |
| 9574 | return template_length; |
| 9575 | } |
| 9576 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9577 | * sme_ocb_get_tsf_timer() - Get the TSF timer value |
| 9578 | * @hHal: reference to the HAL |
| 9579 | * @context: the context of the call |
| 9580 | * @callback: the callback to hdd |
| 9581 | * @request: the TSF timer request |
| 9582 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9583 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9584 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9585 | QDF_STATUS sme_ocb_get_tsf_timer(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9586 | ocb_callback callback, |
| 9587 | struct sir_ocb_get_tsf_timer *request) |
| 9588 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9589 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9590 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9591 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9592 | struct sir_ocb_get_tsf_timer *msg_body; |
| 9593 | |
| 9594 | /* Lock the SME structure */ |
| 9595 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9596 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9597 | return status; |
| 9598 | |
| 9599 | /* Allocate memory for the WMI request, and copy the parameter */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9600 | msg_body = qdf_mem_malloc(sizeof(*msg_body)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9601 | if (!msg_body) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9602 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9603 | goto end; |
| 9604 | } |
| 9605 | *msg_body = *request; |
| 9606 | |
| 9607 | msg.type = WMA_OCB_GET_TSF_TIMER_CMD; |
| 9608 | msg.bodyptr = msg_body; |
| 9609 | |
| 9610 | /* Set the request callback and the context */ |
| 9611 | pMac->sme.ocb_get_tsf_timer_callback = callback; |
| 9612 | pMac->sme.ocb_get_tsf_timer_context = context; |
| 9613 | |
| 9614 | /* Post the message to WDA */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9615 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9616 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9617 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9618 | FL("Error posting message to WDA: %d"), status); |
| 9619 | pMac->sme.ocb_get_tsf_timer_callback = NULL; |
| 9620 | pMac->sme.ocb_get_tsf_timer_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9621 | qdf_mem_free(msg_body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9622 | goto end; |
| 9623 | } |
| 9624 | |
| 9625 | end: |
| 9626 | sme_release_global_lock(&pMac->sme); |
| 9627 | |
| 9628 | return status; |
| 9629 | } |
| 9630 | |
| 9631 | /** |
| 9632 | * sme_dcc_get_stats() - Get the DCC stats |
| 9633 | * @hHal: reference to the HAL |
| 9634 | * @context: the context of the call |
| 9635 | * @callback: the callback to hdd |
| 9636 | * @request: the get DCC stats request |
| 9637 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9638 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9639 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9640 | QDF_STATUS sme_dcc_get_stats(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9641 | ocb_callback callback, |
| 9642 | struct sir_dcc_get_stats *request) |
| 9643 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9644 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9645 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9646 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9647 | struct sir_dcc_get_stats *msg_body; |
| 9648 | |
| 9649 | /* Lock the SME structure */ |
| 9650 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9651 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9652 | return status; |
| 9653 | |
| 9654 | /* Allocate memory for the WMI request, and copy the parameter */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9655 | msg_body = qdf_mem_malloc(sizeof(*msg_body) + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9656 | request->request_array_len); |
| 9657 | if (!msg_body) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9658 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9659 | goto end; |
| 9660 | } |
| 9661 | *msg_body = *request; |
| 9662 | msg_body->request_array = (void *)msg_body + sizeof(*msg_body); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9663 | qdf_mem_copy(msg_body->request_array, request->request_array, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9664 | request->request_array_len); |
| 9665 | |
| 9666 | msg.type = WMA_DCC_GET_STATS_CMD; |
| 9667 | msg.bodyptr = msg_body; |
| 9668 | |
| 9669 | /* Set the request callback and context */ |
| 9670 | pMac->sme.dcc_get_stats_callback = callback; |
| 9671 | pMac->sme.dcc_get_stats_context = context; |
| 9672 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9673 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9674 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9675 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9676 | FL("Error posting message to WDA: %d"), status); |
| 9677 | pMac->sme.dcc_get_stats_callback = callback; |
| 9678 | pMac->sme.dcc_get_stats_context = context; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9679 | qdf_mem_free(msg_body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9680 | goto end; |
| 9681 | } |
| 9682 | |
| 9683 | end: |
| 9684 | sme_release_global_lock(&pMac->sme); |
| 9685 | |
| 9686 | return status; |
| 9687 | } |
| 9688 | |
| 9689 | /** |
| 9690 | * sme_dcc_clear_stats() - Clear the DCC stats |
| 9691 | * @hHal: reference to the HAL |
| 9692 | * @vdev_id: vdev id for OCB interface |
| 9693 | * @dcc_stats_bitmap: the entries in the stats to clear |
| 9694 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9695 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9696 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9697 | QDF_STATUS sme_dcc_clear_stats(tHalHandle hHal, uint32_t vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9698 | uint32_t dcc_stats_bitmap) |
| 9699 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9700 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9701 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9702 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9703 | struct sir_dcc_clear_stats *request; |
| 9704 | |
| 9705 | /* Lock the SME structure */ |
| 9706 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9707 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9708 | return status; |
| 9709 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9710 | request = qdf_mem_malloc(sizeof(struct sir_dcc_clear_stats)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9711 | if (!request) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9712 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9713 | FL("Not able to allocate memory")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9714 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9715 | goto end; |
| 9716 | } |
| 9717 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9718 | request->vdev_id = vdev_id; |
| 9719 | request->dcc_stats_bitmap = dcc_stats_bitmap; |
| 9720 | |
| 9721 | msg.type = WMA_DCC_CLEAR_STATS_CMD; |
| 9722 | msg.bodyptr = request; |
| 9723 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9724 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9725 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9726 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9727 | FL("Not able to post msg to WDA")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9728 | qdf_mem_free(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9729 | goto end; |
| 9730 | } |
| 9731 | |
| 9732 | end: |
| 9733 | sme_release_global_lock(&pMac->sme); |
| 9734 | |
| 9735 | return status; |
| 9736 | } |
| 9737 | |
| 9738 | /** |
| 9739 | * sme_dcc_update_ndl() - Update the DCC settings |
| 9740 | * @hHal: reference to the HAL |
| 9741 | * @context: the context of the call |
| 9742 | * @callback: the callback to hdd |
| 9743 | * @request: the update DCC request |
| 9744 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9745 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9746 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9747 | QDF_STATUS sme_dcc_update_ndl(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9748 | ocb_callback callback, |
| 9749 | struct sir_dcc_update_ndl *request) |
| 9750 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9751 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9752 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9753 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9754 | struct sir_dcc_update_ndl *msg_body; |
| 9755 | |
| 9756 | /* Lock the SME structure */ |
| 9757 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9758 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9759 | return status; |
| 9760 | |
| 9761 | /* Allocate memory for the WMI request, and copy the parameter */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9762 | msg_body = qdf_mem_malloc(sizeof(*msg_body) + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9763 | request->dcc_ndl_chan_list_len + |
| 9764 | request->dcc_ndl_active_state_list_len); |
| 9765 | if (!msg_body) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9766 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9767 | FL("Failed to allocate memory")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9768 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9769 | goto end; |
| 9770 | } |
| 9771 | |
| 9772 | *msg_body = *request; |
| 9773 | |
| 9774 | msg_body->dcc_ndl_chan_list = (void *)msg_body + sizeof(*msg_body); |
| 9775 | msg_body->dcc_ndl_active_state_list = msg_body->dcc_ndl_chan_list + |
| 9776 | request->dcc_ndl_chan_list_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9777 | 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] | 9778 | request->dcc_ndl_active_state_list_len); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9779 | qdf_mem_copy(msg_body->dcc_ndl_active_state_list, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9780 | request->dcc_ndl_active_state_list, |
| 9781 | request->dcc_ndl_active_state_list_len); |
| 9782 | |
| 9783 | msg.type = WMA_DCC_UPDATE_NDL_CMD; |
| 9784 | msg.bodyptr = msg_body; |
| 9785 | |
| 9786 | /* Set the request callback and the context */ |
| 9787 | pMac->sme.dcc_update_ndl_callback = callback; |
| 9788 | pMac->sme.dcc_update_ndl_context = context; |
| 9789 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9790 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9791 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9792 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9793 | FL("Error posting message to WDA: %d"), status); |
| 9794 | pMac->sme.dcc_update_ndl_callback = NULL; |
| 9795 | pMac->sme.dcc_update_ndl_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9796 | qdf_mem_free(msg_body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9797 | goto end; |
| 9798 | } |
| 9799 | |
| 9800 | end: |
| 9801 | sme_release_global_lock(&pMac->sme); |
| 9802 | |
| 9803 | return status; |
| 9804 | } |
| 9805 | |
| 9806 | /** |
| 9807 | * sme_register_for_dcc_stats_event() - Register for the periodic DCC stats |
| 9808 | * event |
| 9809 | * @hHal: reference to the HAL |
| 9810 | * @context: the context of the call |
| 9811 | * @callback: the callback to hdd |
| 9812 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9813 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9814 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9815 | QDF_STATUS sme_register_for_dcc_stats_event(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9816 | ocb_callback callback) |
| 9817 | { |
| 9818 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9819 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9820 | |
| 9821 | status = sme_acquire_global_lock(&pMac->sme); |
| 9822 | pMac->sme.dcc_stats_event_callback = callback; |
| 9823 | pMac->sme.dcc_stats_event_context = context; |
| 9824 | sme_release_global_lock(&pMac->sme); |
| 9825 | |
| 9826 | return 0; |
| 9827 | } |
| 9828 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 9829 | /** |
| 9830 | * sme_deregister_for_dcc_stats_event() - De-Register for the periodic DCC stats |
| 9831 | * event |
| 9832 | * @h_hal: Hal Handle |
| 9833 | * |
| 9834 | * This function de-registers the DCC perioc stats callback |
| 9835 | * |
| 9836 | * Return: QDF_STATUS Enumeration |
| 9837 | */ |
| 9838 | QDF_STATUS sme_deregister_for_dcc_stats_event(tHalHandle h_hal) |
| 9839 | { |
| 9840 | tpAniSirGlobal mac; |
| 9841 | QDF_STATUS status; |
| 9842 | |
| 9843 | if (!h_hal) { |
| 9844 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9845 | FL("h_hal is not valid")); |
| 9846 | return QDF_STATUS_E_INVAL; |
| 9847 | } |
| 9848 | mac = PMAC_STRUCT(h_hal); |
| 9849 | |
| 9850 | status = sme_acquire_global_lock(&mac->sme); |
| 9851 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 9852 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9853 | FL("Failed to acquire global lock")); |
| 9854 | return status; |
| 9855 | } |
| 9856 | mac->sme.dcc_stats_event_callback = NULL; |
| 9857 | mac->sme.dcc_stats_event_context = NULL; |
| 9858 | sme_release_global_lock(&mac->sme); |
| 9859 | |
| 9860 | return status; |
| 9861 | } |
Agrawal Ashish | b141b09 | 2016-09-02 19:59:26 +0530 | [diff] [blame] | 9862 | #endif |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 9863 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9864 | void sme_get_recovery_stats(tHalHandle hHal) |
| 9865 | { |
| 9866 | uint8_t i; |
| 9867 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9868 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9869 | "Self Recovery Stats"); |
| 9870 | for (i = 0; i < MAX_ACTIVE_CMD_STATS; i++) { |
| 9871 | if (eSmeNoCommand != |
| 9872 | g_self_recovery_stats.activeCmdStats[i].command) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9873 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9874 | "timestamp %llu: command 0x%0X: reason %d: session %d", |
| 9875 | g_self_recovery_stats.activeCmdStats[i]. |
| 9876 | timestamp, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9877 | g_self_recovery_stats.activeCmdStats[i].command, |
| 9878 | g_self_recovery_stats.activeCmdStats[i].reason, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9879 | g_self_recovery_stats.activeCmdStats[i]. |
| 9880 | sessionId); |
| 9881 | } |
| 9882 | } |
| 9883 | } |
| 9884 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9885 | QDF_STATUS sme_notify_modem_power_state(tHalHandle hHal, uint32_t value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9886 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 9887 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9888 | tpSirModemPowerStateInd request_buf; |
| 9889 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9890 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9891 | if (NULL == pMac) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9892 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9893 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9894 | request_buf = qdf_mem_malloc(sizeof(tSirModemPowerStateInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9895 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9896 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9897 | "%s: Not able to allocate memory for MODEM POWER STATE IND", |
| 9898 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9899 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9900 | } |
| 9901 | |
| 9902 | request_buf->param = value; |
| 9903 | |
| 9904 | msg.type = WMA_MODEM_POWER_STATE_IND; |
| 9905 | msg.reserved = 0; |
| 9906 | msg.bodyptr = request_buf; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9907 | if (!QDF_IS_STATUS_SUCCESS |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9908 | (scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9909 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9910 | "%s: Not able to post WMA_MODEM_POWER_STATE_IND message to WMA", |
| 9911 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9912 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9913 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9914 | } |
| 9915 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9916 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9917 | } |
| 9918 | |
| 9919 | #ifdef QCA_HT_2040_COEX |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9920 | QDF_STATUS sme_notify_ht2040_mode(tHalHandle hHal, uint16_t staId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 9921 | struct qdf_mac_addr macAddrSTA, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9922 | uint8_t sessionId, |
| 9923 | uint8_t channel_type) |
| 9924 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 9925 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9926 | tUpdateVHTOpMode *pHtOpMode = NULL; |
| 9927 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9928 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9929 | if (NULL == pMac) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9930 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9931 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9932 | pHtOpMode = qdf_mem_malloc(sizeof(tUpdateVHTOpMode)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9933 | if (NULL == pHtOpMode) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9934 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9935 | "%s: Not able to allocate memory for setting OP mode", |
| 9936 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9937 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9938 | } |
| 9939 | |
| 9940 | switch (channel_type) { |
| 9941 | case eHT_CHAN_HT20: |
| 9942 | pHtOpMode->opMode = eHT_CHANNEL_WIDTH_20MHZ; |
| 9943 | break; |
| 9944 | |
| 9945 | case eHT_CHAN_HT40MINUS: |
| 9946 | case eHT_CHAN_HT40PLUS: |
| 9947 | pHtOpMode->opMode = eHT_CHANNEL_WIDTH_40MHZ; |
| 9948 | break; |
| 9949 | |
| 9950 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9951 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9952 | "%s: Invalid OP mode", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9953 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9954 | } |
| 9955 | |
| 9956 | pHtOpMode->staId = staId, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9957 | qdf_mem_copy(pHtOpMode->peer_mac, macAddrSTA.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9958 | sizeof(tSirMacAddr)); |
| 9959 | pHtOpMode->smesessionId = sessionId; |
| 9960 | |
| 9961 | msg.type = WMA_UPDATE_OP_MODE; |
| 9962 | msg.reserved = 0; |
| 9963 | msg.bodyptr = pHtOpMode; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9964 | if (!QDF_IS_STATUS_SUCCESS |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9965 | (scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9966 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9967 | "%s: Not able to post WMA_UPDATE_OP_MODE message to WMA", |
| 9968 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9969 | qdf_mem_free(pHtOpMode); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9970 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9971 | } |
| 9972 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 9973 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9974 | "%s: Notifed FW about OP mode: %d for staId=%d", |
| 9975 | __func__, pHtOpMode->opMode, staId); |
| 9976 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9977 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9978 | } |
| 9979 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9980 | /* |
| 9981 | * sme_set_ht2040_mode() - |
| 9982 | * To update HT Operation beacon IE. |
| 9983 | * |
| 9984 | * Return QDF_STATUS SUCCESS |
| 9985 | * FAILURE or RESOURCES |
| 9986 | * The API finished and failed. |
| 9987 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9988 | QDF_STATUS sme_set_ht2040_mode(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9989 | uint8_t channel_type, bool obssEnabled) |
| 9990 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9991 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9992 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9993 | ePhyChanBondState cbMode; |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 9994 | struct csr_roam_session *session = CSR_GET_SESSION(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9995 | |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 9996 | if (!CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 9997 | sme_err("Session not valid for session id %d", sessionId); |
| 9998 | return QDF_STATUS_E_INVAL; |
| 9999 | } |
| 10000 | session = CSR_GET_SESSION(pMac, sessionId); |
| 10001 | sme_debug("Update HT operation beacon IE, channel_type=%d cur cbmode %d", |
| 10002 | channel_type, session->bssParams.cbMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10003 | |
| 10004 | switch (channel_type) { |
| 10005 | case eHT_CHAN_HT20: |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 10006 | if (!session->bssParams.cbMode) |
| 10007 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10008 | cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
| 10009 | break; |
| 10010 | case eHT_CHAN_HT40MINUS: |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 10011 | if (session->bssParams.cbMode) |
| 10012 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10013 | cbMode = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 10014 | break; |
| 10015 | case eHT_CHAN_HT40PLUS: |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 10016 | if (session->bssParams.cbMode) |
| 10017 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10018 | cbMode = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 10019 | break; |
| 10020 | default: |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 10021 | sme_err("Error!!! Invalid HT20/40 mode !"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10022 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10023 | } |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 10024 | session->bssParams.cbMode = cbMode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10025 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10026 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10027 | status = csr_set_ht2040_mode(pMac, sessionId, |
| 10028 | cbMode, obssEnabled); |
| 10029 | sme_release_global_lock(&pMac->sme); |
| 10030 | } |
| 10031 | return status; |
| 10032 | } |
| 10033 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10034 | #endif |
| 10035 | |
| 10036 | /* |
| 10037 | * SME API to enable/disable idle mode powersave |
| 10038 | * This should be called only if powersave offload |
| 10039 | * is enabled |
| 10040 | */ |
Arunk Khandavalli | 847969d | 2017-09-25 15:15:36 +0530 | [diff] [blame] | 10041 | QDF_STATUS sme_set_idle_powersave_config(bool value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10042 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10043 | void *wmaContext = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10044 | |
| 10045 | if (NULL == wmaContext) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10046 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10047 | "%s: wmaContext is NULL", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10048 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10049 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10050 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10051 | " Idle Ps Set Value %d", value); |
| 10052 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10053 | if (QDF_STATUS_SUCCESS != wma_set_idle_ps_config(wmaContext, value)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10054 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10055 | " Failed to Set Idle Ps Value %d", value); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10056 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10057 | } |
Arunk Khandavalli | 847969d | 2017-09-25 15:15:36 +0530 | [diff] [blame] | 10058 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10059 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10060 | } |
| 10061 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10062 | int16_t sme_get_ht_config(tHalHandle hHal, uint8_t session_id, |
| 10063 | uint16_t ht_capab) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10064 | { |
| 10065 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 10066 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10067 | |
| 10068 | if (NULL == pSession) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10069 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10070 | "%s: pSession is NULL", __func__); |
| 10071 | return -EIO; |
| 10072 | } |
| 10073 | switch (ht_capab) { |
| 10074 | case WNI_CFG_HT_CAP_INFO_ADVANCE_CODING: |
| 10075 | return pSession->htConfig.ht_rx_ldpc; |
| 10076 | case WNI_CFG_HT_CAP_INFO_TX_STBC: |
| 10077 | return pSession->htConfig.ht_tx_stbc; |
| 10078 | case WNI_CFG_HT_CAP_INFO_RX_STBC: |
| 10079 | return pSession->htConfig.ht_rx_stbc; |
| 10080 | case WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ: |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 10081 | return pSession->htConfig.ht_sgi20; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10082 | case WNI_CFG_HT_CAP_INFO_SHORT_GI_40MHZ: |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 10083 | return pSession->htConfig.ht_sgi40; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10084 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10085 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10086 | "invalid ht capability"); |
| 10087 | return -EIO; |
| 10088 | } |
| 10089 | } |
| 10090 | |
| 10091 | int sme_update_ht_config(tHalHandle hHal, uint8_t sessionId, uint16_t htCapab, |
| 10092 | int value) |
| 10093 | { |
| 10094 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 10095 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10096 | |
| 10097 | if (NULL == pSession) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10098 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10099 | "%s: pSession is NULL", __func__); |
| 10100 | return -EIO; |
| 10101 | } |
| 10102 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10103 | if (QDF_STATUS_SUCCESS != wma_set_htconfig(sessionId, htCapab, value)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10104 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10105 | "Failed to set ht capability in target"); |
| 10106 | return -EIO; |
| 10107 | } |
| 10108 | |
| 10109 | switch (htCapab) { |
| 10110 | case WNI_CFG_HT_CAP_INFO_ADVANCE_CODING: |
| 10111 | pSession->htConfig.ht_rx_ldpc = value; |
| 10112 | break; |
| 10113 | case WNI_CFG_HT_CAP_INFO_TX_STBC: |
| 10114 | pSession->htConfig.ht_tx_stbc = value; |
| 10115 | break; |
| 10116 | case WNI_CFG_HT_CAP_INFO_RX_STBC: |
| 10117 | pSession->htConfig.ht_rx_stbc = value; |
| 10118 | break; |
| 10119 | case WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ: |
Krishna Kumaar Natarajan | a5c5aad | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 10120 | value = value ? 1 : 0; /* HT SGI can be only 1 or 0 */ |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 10121 | pSession->htConfig.ht_sgi20 = value; |
| 10122 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10123 | case WNI_CFG_HT_CAP_INFO_SHORT_GI_40MHZ: |
Krishna Kumaar Natarajan | a5c5aad | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 10124 | value = value ? 1 : 0; /* HT SGI can be only 1 or 0 */ |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 10125 | pSession->htConfig.ht_sgi40 = value; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10126 | break; |
| 10127 | } |
| 10128 | |
Naveen Rawat | 8029a40 | 2017-06-01 10:54:19 -0700 | [diff] [blame] | 10129 | csr_roam_update_config(pMac, sessionId, htCapab, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10130 | return 0; |
| 10131 | } |
| 10132 | |
Kiran Kumar Lokere | 08195ef | 2018-01-17 19:25:15 -0800 | [diff] [blame] | 10133 | int sme_set_addba_accept(tHalHandle hal, uint8_t session_id, int value) |
| 10134 | { |
| 10135 | struct sme_addba_accept *addba_accept; |
| 10136 | struct scheduler_msg msg = {0}; |
| 10137 | QDF_STATUS status; |
| 10138 | |
| 10139 | addba_accept = qdf_mem_malloc(sizeof(*addba_accept)); |
| 10140 | if (!addba_accept) { |
| 10141 | sme_err("mem alloc failed for addba_accept"); |
| 10142 | return -EIO; |
| 10143 | } |
| 10144 | addba_accept->session_id = session_id; |
| 10145 | addba_accept->addba_accept = value; |
| 10146 | qdf_mem_zero(&msg, sizeof(msg)); |
| 10147 | msg.type = eWNI_SME_SET_ADDBA_ACCEPT; |
| 10148 | msg.reserved = 0; |
| 10149 | msg.bodyptr = addba_accept; |
| 10150 | status = scheduler_post_msg(QDF_MODULE_ID_PE, &msg); |
| 10151 | if (status != QDF_STATUS_SUCCESS) { |
| 10152 | sme_err("Not able to post addba reject"); |
| 10153 | qdf_mem_free(addba_accept); |
| 10154 | return -EIO; |
| 10155 | } |
| 10156 | return 0; |
| 10157 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10158 | #define HT20_SHORT_GI_MCS7_RATE 722 |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10159 | /* |
| 10160 | * sme_send_rate_update_ind() - |
| 10161 | * API to Update rate |
| 10162 | * |
| 10163 | * hHal - The handle returned by mac_open |
| 10164 | * rateUpdateParams - Pointer to rate update params |
| 10165 | * Return QDF_STATUS |
| 10166 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10167 | QDF_STATUS sme_send_rate_update_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10168 | tSirRateUpdateInd *rateUpdateParams) |
| 10169 | { |
| 10170 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10171 | QDF_STATUS status; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10172 | struct scheduler_msg msg = {0}; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10173 | tSirRateUpdateInd *rate_upd = qdf_mem_malloc(sizeof(tSirRateUpdateInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10174 | |
| 10175 | if (rate_upd == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10176 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10177 | "Rate update struct alloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10178 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10179 | } |
| 10180 | *rate_upd = *rateUpdateParams; |
| 10181 | |
| 10182 | if (rate_upd->mcastDataRate24GHz == HT20_SHORT_GI_MCS7_RATE) |
| 10183 | rate_upd->mcastDataRate24GHzTxFlag = |
| 10184 | eHAL_TX_RATE_HT20 | eHAL_TX_RATE_SGI; |
| 10185 | else if (rate_upd->reliableMcastDataRate == |
| 10186 | HT20_SHORT_GI_MCS7_RATE) |
| 10187 | rate_upd->reliableMcastDataRateTxFlag = |
| 10188 | eHAL_TX_RATE_HT20 | eHAL_TX_RATE_SGI; |
| 10189 | |
| 10190 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10191 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10192 | msg.type = WMA_RATE_UPDATE_IND; |
| 10193 | msg.bodyptr = rate_upd; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 10194 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 10195 | NO_SESSION, msg.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10196 | if (!QDF_IS_STATUS_SUCCESS |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10197 | (scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10198 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10199 | "%s: Not able to post WMA_SET_RMC_RATE_IND to WMA!", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10200 | __func__); |
| 10201 | |
| 10202 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10203 | qdf_mem_free(rate_upd); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10204 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10205 | } |
| 10206 | |
| 10207 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10208 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10209 | } |
| 10210 | |
| 10211 | return status; |
| 10212 | } |
| 10213 | |
| 10214 | /** |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 10215 | * sme_update_access_policy_vendor_ie() - update vendor ie and access policy. |
| 10216 | * @hal: Pointer to the mac context |
| 10217 | * @session_id: sme session id |
| 10218 | * @vendor_ie: vendor ie |
| 10219 | * @access_policy: vendor ie access policy |
| 10220 | * |
| 10221 | * This function updates the vendor ie and access policy to lim. |
| 10222 | * |
| 10223 | * Return: success or failure. |
| 10224 | */ |
| 10225 | QDF_STATUS sme_update_access_policy_vendor_ie(tHalHandle hal, |
| 10226 | uint8_t session_id, uint8_t *vendor_ie, int access_policy) |
| 10227 | { |
| 10228 | struct sme_update_access_policy_vendor_ie *msg; |
| 10229 | uint16_t msg_len; |
| 10230 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 10231 | |
| 10232 | msg_len = sizeof(*msg); |
| 10233 | |
| 10234 | msg = qdf_mem_malloc(msg_len); |
| 10235 | if (!msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 10236 | sme_err("failed to allocate memory for sme_update_access_policy_vendor_ie"); |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 10237 | return QDF_STATUS_E_FAILURE; |
| 10238 | } |
| 10239 | |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 10240 | msg->msg_type = (uint16_t)eWNI_SME_UPDATE_ACCESS_POLICY_VENDOR_IE; |
| 10241 | msg->length = (uint16_t)msg_len; |
| 10242 | |
| 10243 | qdf_mem_copy(&msg->ie[0], vendor_ie, sizeof(msg->ie)); |
| 10244 | |
| 10245 | msg->sme_session_id = session_id; |
| 10246 | msg->access_policy = access_policy; |
| 10247 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 10248 | sme_debug("sme_session_id: %hu, access_policy: %d", session_id, |
| 10249 | access_policy); |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 10250 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 10251 | status = umac_send_mb_message_to_mac(msg); |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 10252 | |
| 10253 | return status; |
| 10254 | } |
| 10255 | |
| 10256 | /** |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10257 | * sme_update_short_retry_limit_threshold() - update short frame retry limit TH |
| 10258 | * @hal: Handle returned by mac_open |
| 10259 | * @session_id: Session ID on which short frame retry limit needs to be |
| 10260 | * updated to FW |
| 10261 | * @short_limit_count_th: Retry count TH to retry short frame. |
| 10262 | * |
| 10263 | * This function is used to configure count to retry short frame. |
| 10264 | * |
| 10265 | * Return: QDF_STATUS |
| 10266 | */ |
| 10267 | QDF_STATUS sme_update_short_retry_limit_threshold(tHalHandle hal_handle, |
| 10268 | struct sme_short_retry_limit *short_retry_limit_th) |
| 10269 | { |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10270 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10271 | struct sme_short_retry_limit *srl; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10272 | struct scheduler_msg msg = {0}; |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10273 | |
| 10274 | srl = qdf_mem_malloc(sizeof(*srl)); |
| 10275 | if (NULL == srl) { |
| 10276 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10277 | "%s: fail to alloc short retry limit", __func__); |
| 10278 | return QDF_STATUS_E_FAILURE; |
| 10279 | } |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 10280 | sme_debug("session_id %d short retry limit count: %d", |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10281 | short_retry_limit_th->session_id, |
| 10282 | short_retry_limit_th->short_retry_limit); |
| 10283 | |
| 10284 | srl->session_id = short_retry_limit_th->session_id; |
| 10285 | srl->short_retry_limit = short_retry_limit_th->short_retry_limit; |
| 10286 | |
| 10287 | qdf_mem_zero(&msg, sizeof(msg)); |
| 10288 | msg.type = SIR_HAL_SHORT_RETRY_LIMIT_CNT; |
| 10289 | msg.reserved = 0; |
| 10290 | msg.bodyptr = srl; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10291 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10292 | if (status != QDF_STATUS_SUCCESS) { |
| 10293 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10294 | FL("Not able to post short retry limit count to WDA")); |
| 10295 | qdf_mem_free(srl); |
| 10296 | return QDF_STATUS_E_FAILURE; |
| 10297 | } |
| 10298 | |
| 10299 | return status; |
| 10300 | } |
| 10301 | |
| 10302 | /** |
| 10303 | * sme_update_long_retry_limit_threshold() - update long retry limit TH |
| 10304 | * @hal: Handle returned by mac_open |
| 10305 | * @session_id: Session ID on which long frames retry TH needs to be updated |
| 10306 | * to FW |
| 10307 | * @long_limit_count_th: Retry count to retry long frame. |
| 10308 | * |
| 10309 | * This function is used to configure TH to retry long frame. |
| 10310 | * |
| 10311 | * Return: QDF_STATUS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10312 | */ |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10313 | QDF_STATUS sme_update_long_retry_limit_threshold(tHalHandle hal_handle, |
| 10314 | struct sme_long_retry_limit *long_retry_limit_th) |
| 10315 | { |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10316 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10317 | struct sme_long_retry_limit *lrl; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10318 | struct scheduler_msg msg = {0}; |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10319 | |
| 10320 | lrl = qdf_mem_malloc(sizeof(*lrl)); |
| 10321 | if (NULL == lrl) { |
| 10322 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10323 | "%s: fail to alloc long retry limit", __func__); |
| 10324 | return QDF_STATUS_E_FAILURE; |
| 10325 | } |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 10326 | sme_debug("session_id %d long retry limit count: %d", |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10327 | long_retry_limit_th->session_id, |
| 10328 | long_retry_limit_th->long_retry_limit); |
| 10329 | |
| 10330 | lrl->session_id = long_retry_limit_th->session_id; |
| 10331 | lrl->long_retry_limit = long_retry_limit_th->long_retry_limit; |
| 10332 | |
| 10333 | qdf_mem_zero(&msg, sizeof(msg)); |
| 10334 | msg.type = SIR_HAL_LONG_RETRY_LIMIT_CNT; |
| 10335 | msg.reserved = 0; |
| 10336 | msg.bodyptr = lrl; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10337 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10338 | |
| 10339 | if (status != QDF_STATUS_SUCCESS) { |
| 10340 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10341 | FL("Not able to post long retry limit count to WDA")); |
| 10342 | qdf_mem_free(lrl); |
| 10343 | return QDF_STATUS_E_FAILURE; |
| 10344 | } |
| 10345 | |
| 10346 | return status; |
| 10347 | } |
| 10348 | |
| 10349 | /** |
Agrawal, Ashish | 4e5fa1c | 2016-09-21 19:03:43 +0530 | [diff] [blame] | 10350 | * sme_update_sta_inactivity_timeout(): Update sta_inactivity_timeout to FW |
| 10351 | * @hal: Handle returned by mac_open |
| 10352 | * @session_id: Session ID on which sta_inactivity_timeout needs |
| 10353 | * to be updated to FW |
| 10354 | * @sta_inactivity_timeout: sta inactivity timeout. |
| 10355 | * |
| 10356 | * If a station does not send anything in sta_inactivity_timeout seconds, an |
| 10357 | * empty data frame is sent to it in order to verify whether it is |
| 10358 | * still in range. If this frame is not ACKed, the station will be |
| 10359 | * disassociated and then deauthenticated. |
| 10360 | * |
| 10361 | * Return: QDF_STATUS_SUCCESS or non-zero on failure. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10362 | */ |
Agrawal, Ashish | 4e5fa1c | 2016-09-21 19:03:43 +0530 | [diff] [blame] | 10363 | QDF_STATUS sme_update_sta_inactivity_timeout(tHalHandle hal_handle, |
| 10364 | struct sme_sta_inactivity_timeout *sta_inactivity_timer) |
| 10365 | { |
| 10366 | struct sme_sta_inactivity_timeout *inactivity_time; |
| 10367 | void *wma_handle; |
| 10368 | |
| 10369 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 10370 | inactivity_time = qdf_mem_malloc(sizeof(*inactivity_time)); |
| 10371 | if (NULL == inactivity_time) { |
| 10372 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10373 | "%s: fail to alloc inactivity_time", __func__); |
| 10374 | return QDF_STATUS_E_FAILURE; |
| 10375 | } |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 10376 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Agrawal, Ashish | 4e5fa1c | 2016-09-21 19:03:43 +0530 | [diff] [blame] | 10377 | FL("sta_inactivity_timeout: %d"), |
| 10378 | sta_inactivity_timer->sta_inactivity_timeout); |
| 10379 | inactivity_time->session_id = sta_inactivity_timer->session_id; |
| 10380 | inactivity_time->sta_inactivity_timeout = |
| 10381 | sta_inactivity_timer->sta_inactivity_timeout; |
| 10382 | |
| 10383 | wma_update_sta_inactivity_timeout(wma_handle, |
| 10384 | inactivity_time); |
| 10385 | return QDF_STATUS_SUCCESS; |
| 10386 | } |
| 10387 | |
| 10388 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10389 | * sme_get_reg_info() - To get registration info |
| 10390 | * @hHal: HAL context |
| 10391 | * @chanId: channel id |
| 10392 | * @regInfo1: first reg info to fill |
| 10393 | * @regInfo2: second reg info to fill |
| 10394 | * |
| 10395 | * This routine will give you reg info |
| 10396 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10397 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10398 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10399 | QDF_STATUS sme_get_reg_info(tHalHandle hHal, uint8_t chanId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10400 | uint32_t *regInfo1, uint32_t *regInfo2) |
| 10401 | { |
| 10402 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10403 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10404 | uint8_t i; |
| 10405 | bool found = false; |
| 10406 | |
| 10407 | status = sme_acquire_global_lock(&pMac->sme); |
| 10408 | *regInfo1 = 0; |
| 10409 | *regInfo2 = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10410 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10411 | return status; |
| 10412 | |
| 10413 | for (i = 0; i < WNI_CFG_VALID_CHANNEL_LIST_LEN; i++) { |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 10414 | if (pMac->scan.defaultPowerTable[i].chan_num == chanId) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10415 | SME_SET_CHANNEL_REG_POWER(*regInfo1, |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 10416 | pMac->scan.defaultPowerTable[i].tx_power); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10417 | |
| 10418 | SME_SET_CHANNEL_MAX_TX_POWER(*regInfo2, |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 10419 | pMac->scan.defaultPowerTable[i].tx_power); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10420 | found = true; |
| 10421 | break; |
| 10422 | } |
| 10423 | } |
| 10424 | if (!found) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10425 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10426 | |
| 10427 | sme_release_global_lock(&pMac->sme); |
| 10428 | return status; |
| 10429 | } |
| 10430 | |
| 10431 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10432 | /* |
| 10433 | * sme_auto_shutdown_cb() - |
| 10434 | * Used to plug in callback function for receiving auto shutdown evt |
| 10435 | * |
| 10436 | * hHal |
| 10437 | * pCallbackfn : callback function pointer should be plugged in |
| 10438 | * Return QDF_STATUS |
| 10439 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10440 | QDF_STATUS sme_set_auto_shutdown_cb(tHalHandle hHal, void (*pCallbackfn)(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10441 | ) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10442 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10443 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10444 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10445 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10446 | "%s: Plug in Auto shutdown event callback", __func__); |
| 10447 | |
| 10448 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10449 | if (QDF_STATUS_SUCCESS == status) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10450 | if (NULL != pCallbackfn) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10451 | pMac->sme.pAutoShutdownNotificationCb = pCallbackfn; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10452 | sme_release_global_lock(&pMac->sme); |
| 10453 | } |
| 10454 | |
| 10455 | return status; |
| 10456 | } |
| 10457 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10458 | /* |
| 10459 | * sme_set_auto_shutdown_timer() - |
| 10460 | * API to set auto shutdown timer value in FW. |
| 10461 | * |
| 10462 | * hHal - The handle returned by mac_open |
| 10463 | * timer_val - The auto shutdown timer value to be set |
| 10464 | * Return Configuration message posting status, SUCCESS or Fail |
| 10465 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10466 | 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] | 10467 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10468 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10469 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10470 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10471 | tSirAutoShutdownCmdParams *auto_sh_cmd; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10472 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10473 | |
| 10474 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10475 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10476 | auto_sh_cmd = (tSirAutoShutdownCmdParams *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10477 | qdf_mem_malloc(sizeof(tSirAutoShutdownCmdParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10478 | if (auto_sh_cmd == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10479 | QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10480 | "%s Request Buffer Alloc Fail", __func__); |
| 10481 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10482 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10483 | } |
| 10484 | |
| 10485 | auto_sh_cmd->timer_val = timer_val; |
| 10486 | |
| 10487 | /* serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10488 | message.bodyptr = auto_sh_cmd; |
| 10489 | message.type = WMA_SET_AUTO_SHUTDOWN_TIMER_REQ; |
| 10490 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 10491 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10492 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10493 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10494 | "%s: Post Auto shutdown MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10495 | qdf_mem_free(auto_sh_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10496 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10497 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10498 | } |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 10499 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10500 | "%s: Posted Auto shutdown MSG", __func__); |
| 10501 | sme_release_global_lock(&pMac->sme); |
| 10502 | } |
| 10503 | |
| 10504 | return status; |
| 10505 | } |
| 10506 | #endif |
| 10507 | |
Nirav Shah | eb017be | 2018-02-15 11:20:58 +0530 | [diff] [blame^] | 10508 | #ifdef FEATURE_WLAN_CH_AVOID |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10509 | /* |
| 10510 | * sme_ch_avoid_update_req() - |
| 10511 | * API to request channel avoidance update from FW. |
| 10512 | * |
| 10513 | * hHal - The handle returned by mac_open |
| 10514 | * update_type - The udpate_type parameter of this request call |
| 10515 | * Return Configuration message posting status, SUCCESS or Fail |
| 10516 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10517 | QDF_STATUS sme_ch_avoid_update_req(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10518 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10519 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10520 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10521 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10522 | tSirChAvoidUpdateReq *cauReq; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10523 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10524 | |
| 10525 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10526 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10527 | cauReq = (tSirChAvoidUpdateReq *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10528 | qdf_mem_malloc(sizeof(tSirChAvoidUpdateReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10529 | if (NULL == cauReq) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10530 | QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10531 | "%s Request Buffer Alloc Fail", __func__); |
| 10532 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10533 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10534 | } |
| 10535 | |
| 10536 | cauReq->reserved_param = 0; |
| 10537 | |
| 10538 | /* serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10539 | message.bodyptr = cauReq; |
| 10540 | message.type = WMA_CH_AVOID_UPDATE_REQ; |
| 10541 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 10542 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10543 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10544 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10545 | "%s: Post Ch Avoid Update MSG fail", |
| 10546 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10547 | qdf_mem_free(cauReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10548 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10549 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10550 | } |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 10551 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10552 | "%s: Posted Ch Avoid Update MSG", __func__); |
| 10553 | sme_release_global_lock(&pMac->sme); |
| 10554 | } |
| 10555 | |
| 10556 | return status; |
| 10557 | } |
Nirav Shah | eb017be | 2018-02-15 11:20:58 +0530 | [diff] [blame^] | 10558 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10559 | |
| 10560 | /** |
| 10561 | * sme_set_miracast() - Function to set miracast value to UMAC |
| 10562 | * @hal: Handle returned by macOpen |
| 10563 | * @filter_type: 0-Disabled, 1-Source, 2-sink |
| 10564 | * |
| 10565 | * This function passes down the value of miracast set by |
| 10566 | * framework to UMAC |
| 10567 | * |
| 10568 | * Return: Configuration message posting status, SUCCESS or Fail |
| 10569 | * |
| 10570 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10571 | QDF_STATUS sme_set_miracast(tHalHandle hal, uint8_t filter_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10572 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10573 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10574 | uint32_t *val; |
| 10575 | tpAniSirGlobal mac_ptr = PMAC_STRUCT(hal); |
| 10576 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10577 | val = qdf_mem_malloc(sizeof(*val)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10578 | if (NULL == val || NULL == mac_ptr) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10579 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10580 | "%s: Invalid pointer", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10581 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10582 | } |
| 10583 | |
| 10584 | *val = filter_type; |
| 10585 | |
| 10586 | msg.type = SIR_HAL_SET_MIRACAST; |
| 10587 | msg.reserved = 0; |
| 10588 | msg.bodyptr = val; |
| 10589 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10590 | if (!QDF_IS_STATUS_SUCCESS( |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10591 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10592 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10593 | "%s: Not able to post WDA_SET_MAS_ENABLE_DISABLE to WMA!", |
| 10594 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10595 | qdf_mem_free(val); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10596 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10597 | } |
| 10598 | |
| 10599 | mac_ptr->sme.miracast_value = filter_type; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10600 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10601 | } |
| 10602 | |
| 10603 | /** |
| 10604 | * sme_set_mas() - Function to set MAS value to UMAC |
| 10605 | * @val: 1-Enable, 0-Disable |
| 10606 | * |
| 10607 | * This function passes down the value of MAS to the UMAC. A |
| 10608 | * value of 1 will enable MAS and a value of 0 will disable MAS |
| 10609 | * |
| 10610 | * Return: Configuration message posting status, SUCCESS or Fail |
| 10611 | * |
| 10612 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10613 | QDF_STATUS sme_set_mas(uint32_t val) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10614 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10615 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10616 | uint32_t *ptr_val; |
| 10617 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10618 | ptr_val = qdf_mem_malloc(sizeof(*ptr_val)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10619 | if (NULL == ptr_val) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10620 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10621 | "%s: could not allocate ptr_val", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10622 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10623 | } |
| 10624 | |
| 10625 | *ptr_val = val; |
| 10626 | |
| 10627 | msg.type = SIR_HAL_SET_MAS; |
| 10628 | msg.reserved = 0; |
| 10629 | msg.bodyptr = ptr_val; |
| 10630 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10631 | if (!QDF_IS_STATUS_SUCCESS( |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10632 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10633 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10634 | "%s: Not able to post WDA_SET_MAS_ENABLE_DISABLE to WMA!", |
| 10635 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10636 | qdf_mem_free(ptr_val); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10637 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10638 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10639 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10640 | } |
| 10641 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 10642 | /** |
| 10643 | * sme_roam_channel_change_req() - Channel change to new target channel |
| 10644 | * @hHal: handle returned by mac_open |
| 10645 | * @bssid: mac address of BSS |
| 10646 | * @ch_params: target channel information |
| 10647 | * @profile: CSR profile |
| 10648 | * |
| 10649 | * API to Indicate Channel change to new target channel |
| 10650 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10651 | * Return: QDF_STATUS |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 10652 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10653 | QDF_STATUS sme_roam_channel_change_req(tHalHandle hHal, |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 10654 | struct qdf_mac_addr bssid, |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 10655 | struct ch_params *ch_params, |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 10656 | tCsrRoamProfile *profile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10657 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10658 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10659 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10660 | |
| 10661 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10662 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10663 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 10664 | status = csr_roam_channel_change_req(pMac, bssid, ch_params, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10665 | profile); |
| 10666 | sme_release_global_lock(&pMac->sme); |
| 10667 | } |
| 10668 | return status; |
| 10669 | } |
| 10670 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10671 | /* |
| 10672 | * sme_process_channel_change_resp() - |
| 10673 | * API to Indicate Channel change response message to SAP. |
| 10674 | * |
| 10675 | * Return QDF_STATUS |
| 10676 | */ |
| 10677 | static QDF_STATUS sme_process_channel_change_resp(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10678 | uint16_t msg_type, void *pMsgBuf) |
| 10679 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10680 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 10681 | struct csr_roam_info proam_info = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10682 | eCsrRoamResult roamResult; |
| 10683 | tpSwitchChannelParams pChnlParams = (tpSwitchChannelParams) pMsgBuf; |
| 10684 | uint32_t SessionId = pChnlParams->peSessionId; |
| 10685 | |
| 10686 | proam_info.channelChangeRespEvent = |
| 10687 | (tSirChanChangeResponse *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10688 | qdf_mem_malloc(sizeof(tSirChanChangeResponse)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10689 | if (NULL == proam_info.channelChangeRespEvent) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10690 | status = QDF_STATUS_E_NOMEM; |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 10691 | sme_err("Channel Change Event Allocation Failed: %d\n", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10692 | return status; |
| 10693 | } |
| 10694 | if (msg_type == eWNI_SME_CHANNEL_CHANGE_RSP) { |
| 10695 | proam_info.channelChangeRespEvent->sessionId = SessionId; |
| 10696 | proam_info.channelChangeRespEvent->newChannelNumber = |
| 10697 | pChnlParams->channelNumber; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10698 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10699 | if (pChnlParams->status == QDF_STATUS_SUCCESS) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 10700 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10701 | "sapdfs: Received success eWNI_SME_CHANNEL_CHANGE_RSP for sessionId[%d]", |
| 10702 | SessionId); |
| 10703 | proam_info.channelChangeRespEvent->channelChangeStatus = |
| 10704 | 1; |
| 10705 | roamResult = eCSR_ROAM_RESULT_CHANNEL_CHANGE_SUCCESS; |
| 10706 | } else { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 10707 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10708 | "sapdfs: Received failure eWNI_SME_CHANNEL_CHANGE_RSP for sessionId[%d]", |
| 10709 | SessionId); |
| 10710 | proam_info.channelChangeRespEvent->channelChangeStatus = |
| 10711 | 0; |
| 10712 | roamResult = eCSR_ROAM_RESULT_CHANNEL_CHANGE_FAILURE; |
| 10713 | } |
| 10714 | |
| 10715 | csr_roam_call_callback(pMac, SessionId, &proam_info, 0, |
| 10716 | eCSR_ROAM_SET_CHANNEL_RSP, roamResult); |
| 10717 | |
| 10718 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10719 | status = QDF_STATUS_E_FAILURE; |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 10720 | sme_err("Invalid Channel Change Resp Message: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10721 | status); |
| 10722 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10723 | qdf_mem_free(proam_info.channelChangeRespEvent); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10724 | |
| 10725 | return status; |
| 10726 | } |
| 10727 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10728 | /* |
| 10729 | * sme_roam_start_beacon_req() - |
| 10730 | * API to Indicate LIM to start Beacon Tx after SAP CAC Wait is completed. |
| 10731 | * |
| 10732 | * hHal - The handle returned by mac_open |
| 10733 | * sessionId - session ID |
| 10734 | * dfsCacWaitStatus - CAC WAIT status flag |
| 10735 | * Return QDF_STATUS |
| 10736 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10737 | 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] | 10738 | uint8_t dfsCacWaitStatus) |
| 10739 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10740 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10741 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10742 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10743 | status = sme_acquire_global_lock(&pMac->sme); |
| 10744 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10745 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10746 | status = csr_roam_start_beacon_req(pMac, bssid, |
| 10747 | dfsCacWaitStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10748 | sme_release_global_lock(&pMac->sme); |
| 10749 | } |
| 10750 | return status; |
| 10751 | } |
| 10752 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 10753 | /** |
| 10754 | * sme_roam_csa_ie_request() - request CSA IE transmission from PE |
| 10755 | * @hHal: handle returned by mac_open |
| 10756 | * @bssid: SAP bssid |
| 10757 | * @targetChannel: target channel information |
| 10758 | * @csaIeReqd: CSA IE Request |
| 10759 | * @ch_params: channel information |
| 10760 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10761 | * Return: QDF_STATUS |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 10762 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10763 | 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] | 10764 | uint8_t targetChannel, uint8_t csaIeReqd, |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 10765 | struct ch_params *ch_params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10766 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10767 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10768 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10769 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10770 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10771 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 10772 | status = csr_roam_send_chan_sw_ie_request(pMac, bssid, |
| 10773 | targetChannel, csaIeReqd, ch_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10774 | sme_release_global_lock(&pMac->sme); |
| 10775 | } |
| 10776 | return status; |
| 10777 | } |
| 10778 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10779 | /* |
| 10780 | * sme_init_thermal_info() - |
| 10781 | * SME API to initialize the thermal mitigation parameters |
| 10782 | * |
| 10783 | * hHal |
| 10784 | * thermalParam : thermal mitigation parameters |
| 10785 | * Return QDF_STATUS |
| 10786 | */ |
| 10787 | QDF_STATUS sme_init_thermal_info(tHalHandle hHal, tSmeThermalParams |
| 10788 | thermalParam) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10789 | { |
| 10790 | t_thermal_mgmt *pWmaParam; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10791 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10792 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10793 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10794 | pWmaParam = (t_thermal_mgmt *) qdf_mem_malloc(sizeof(t_thermal_mgmt)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10795 | if (NULL == pWmaParam) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10796 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10797 | "%s: could not allocate tThermalMgmt", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10798 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10799 | } |
| 10800 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10801 | pWmaParam->thermalMgmtEnabled = thermalParam.smeThermalMgmtEnabled; |
| 10802 | pWmaParam->throttlePeriod = thermalParam.smeThrottlePeriod; |
Poddar, Siddarth | 8390502 | 2016-04-16 17:56:08 -0700 | [diff] [blame] | 10803 | |
| 10804 | pWmaParam->throttle_duty_cycle_tbl[0] = |
| 10805 | thermalParam.sme_throttle_duty_cycle_tbl[0]; |
| 10806 | pWmaParam->throttle_duty_cycle_tbl[1] = |
| 10807 | thermalParam.sme_throttle_duty_cycle_tbl[1]; |
| 10808 | pWmaParam->throttle_duty_cycle_tbl[2] = |
| 10809 | thermalParam.sme_throttle_duty_cycle_tbl[2]; |
| 10810 | pWmaParam->throttle_duty_cycle_tbl[3] = |
| 10811 | thermalParam.sme_throttle_duty_cycle_tbl[3]; |
| 10812 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10813 | pWmaParam->thermalLevels[0].minTempThreshold = |
| 10814 | thermalParam.smeThermalLevels[0].smeMinTempThreshold; |
| 10815 | pWmaParam->thermalLevels[0].maxTempThreshold = |
| 10816 | thermalParam.smeThermalLevels[0].smeMaxTempThreshold; |
| 10817 | pWmaParam->thermalLevels[1].minTempThreshold = |
| 10818 | thermalParam.smeThermalLevels[1].smeMinTempThreshold; |
| 10819 | pWmaParam->thermalLevels[1].maxTempThreshold = |
| 10820 | thermalParam.smeThermalLevels[1].smeMaxTempThreshold; |
| 10821 | pWmaParam->thermalLevels[2].minTempThreshold = |
| 10822 | thermalParam.smeThermalLevels[2].smeMinTempThreshold; |
| 10823 | pWmaParam->thermalLevels[2].maxTempThreshold = |
| 10824 | thermalParam.smeThermalLevels[2].smeMaxTempThreshold; |
| 10825 | pWmaParam->thermalLevels[3].minTempThreshold = |
| 10826 | thermalParam.smeThermalLevels[3].smeMinTempThreshold; |
| 10827 | pWmaParam->thermalLevels[3].maxTempThreshold = |
| 10828 | thermalParam.smeThermalLevels[3].smeMaxTempThreshold; |
| 10829 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10830 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10831 | msg.type = WMA_INIT_THERMAL_INFO_CMD; |
| 10832 | msg.bodyptr = pWmaParam; |
| 10833 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10834 | if (!QDF_IS_STATUS_SUCCESS |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10835 | (scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10836 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10837 | "%s: Not able to post WMA_SET_THERMAL_INFO_CMD to WMA!", |
| 10838 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10839 | qdf_mem_free(pWmaParam); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10840 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10841 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10842 | } |
| 10843 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10844 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10845 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10846 | qdf_mem_free(pWmaParam); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10847 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10848 | } |
| 10849 | |
| 10850 | /** |
| 10851 | * sme_add_set_thermal_level_callback() - Plug in set thermal level callback |
| 10852 | * @hal: Handle returned by macOpen |
| 10853 | * @callback: sme_set_thermal_level_callback |
| 10854 | * |
| 10855 | * Plug in set thermal level callback |
| 10856 | * |
| 10857 | * Return: none |
| 10858 | */ |
| 10859 | void sme_add_set_thermal_level_callback(tHalHandle hal, |
| 10860 | sme_set_thermal_level_callback callback) |
| 10861 | { |
| 10862 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
| 10863 | |
| 10864 | pMac->sme.set_thermal_level_cb = callback; |
| 10865 | } |
| 10866 | |
| 10867 | /** |
| 10868 | * sme_set_thermal_level() - SME API to set the thermal mitigation level |
| 10869 | * @hal: Handler to HAL |
| 10870 | * @level: Thermal mitigation level |
| 10871 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10872 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10873 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10874 | QDF_STATUS sme_set_thermal_level(tHalHandle hal, uint8_t level) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10875 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10876 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10877 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10878 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10879 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10880 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10881 | qdf_mem_set(&msg, sizeof(msg), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10882 | msg.type = WMA_SET_THERMAL_LEVEL; |
| 10883 | msg.bodyval = level; |
| 10884 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10885 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10886 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10887 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10888 | "%s: Not able to post WMA_SET_THERMAL_LEVEL to WMA!", |
| 10889 | __func__); |
| 10890 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10891 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10892 | } |
| 10893 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10894 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10895 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10896 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10897 | } |
| 10898 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10899 | /* |
| 10900 | * sme_txpower_limit() - |
| 10901 | * SME API to set txpower limits |
| 10902 | * |
| 10903 | * hHal |
| 10904 | * psmetx : power limits for 2g/5g |
| 10905 | * Return QDF_STATUS |
| 10906 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10907 | QDF_STATUS sme_txpower_limit(tHalHandle hHal, tSirTxPowerLimit *psmetx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10908 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10909 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10910 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10911 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10912 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 10913 | tSirTxPowerLimit *tx_power_limit; |
| 10914 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10915 | tx_power_limit = qdf_mem_malloc(sizeof(*tx_power_limit)); |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 10916 | if (!tx_power_limit) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10917 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 10918 | "%s: Memory allocation for TxPowerLimit failed!", |
| 10919 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10920 | return QDF_STATUS_E_FAILURE; |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 10921 | } |
| 10922 | |
| 10923 | *tx_power_limit = *psmetx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10924 | |
| 10925 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10926 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10927 | message.type = WMA_TX_POWER_LIMIT; |
| 10928 | message.reserved = 0; |
| 10929 | message.bodyptr = tx_power_limit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10930 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10931 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 10932 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10933 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10934 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10935 | "%s: not able to post WMA_TX_POWER_LIMIT", |
| 10936 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10937 | status = QDF_STATUS_E_FAILURE; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10938 | qdf_mem_free(tx_power_limit); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10939 | } |
| 10940 | sme_release_global_lock(&pMac->sme); |
| 10941 | } |
| 10942 | return status; |
| 10943 | } |
| 10944 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10945 | QDF_STATUS sme_update_connect_debug(tHalHandle hHal, uint32_t set_value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10946 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10947 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10948 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10949 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10950 | pMac->fEnableDebugLog = set_value; |
| 10951 | return status; |
| 10952 | } |
| 10953 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10954 | /* |
| 10955 | * sme_ap_disable_intra_bss_fwd() - |
| 10956 | * SME will send message to WMA to set Intra BSS in txrx |
| 10957 | * |
| 10958 | * hHal - The handle returned by mac_open |
| 10959 | * sessionId - session id ( vdev id) |
| 10960 | * disablefwd - bool value that indicate disable intrabss fwd disable |
| 10961 | * Return QDF_STATUS |
| 10962 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10963 | 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] | 10964 | bool disablefwd) |
| 10965 | { |
| 10966 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10967 | int status = QDF_STATUS_SUCCESS; |
| 10968 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10969 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10970 | tpDisableIntraBssFwd pSapDisableIntraFwd = NULL; |
| 10971 | |
| 10972 | /* Prepare the request to send to SME. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10973 | pSapDisableIntraFwd = qdf_mem_malloc(sizeof(tDisableIntraBssFwd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10974 | if (NULL == pSapDisableIntraFwd) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 10975 | sme_err("Memory Allocation Failure!!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10976 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10977 | } |
| 10978 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10979 | pSapDisableIntraFwd->sessionId = sessionId; |
| 10980 | pSapDisableIntraFwd->disableintrabssfwd = disablefwd; |
| 10981 | |
| 10982 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10983 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10984 | /* serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10985 | message.bodyptr = pSapDisableIntraFwd; |
| 10986 | message.type = WMA_SET_SAP_INTRABSS_DIS; |
| 10987 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 10988 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10989 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 10990 | status = QDF_STATUS_E_FAILURE; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10991 | qdf_mem_free(pSapDisableIntraFwd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10992 | } |
| 10993 | sme_release_global_lock(&pMac->sme); |
| 10994 | } |
| 10995 | return status; |
| 10996 | } |
| 10997 | |
| 10998 | #ifdef WLAN_FEATURE_STATS_EXT |
| 10999 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11000 | /* |
| 11001 | * sme_stats_ext_register_callback() - |
| 11002 | * This function called to register the callback that send vendor event for |
| 11003 | * stats ext |
| 11004 | * |
| 11005 | * callback - callback to be registered |
| 11006 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11007 | void sme_stats_ext_register_callback(tHalHandle hHal, StatsExtCallback callback) |
| 11008 | { |
| 11009 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11010 | |
| 11011 | pMac->sme.StatsExtCallback = callback; |
| 11012 | } |
| 11013 | |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 11014 | void sme_stats_ext2_register_callback(tHalHandle hal_handle, |
| 11015 | void (*stats_ext2_cb)(void *, struct sir_sme_rx_aggr_hole_ind *)) |
| 11016 | { |
| 11017 | tpAniSirGlobal pmac = PMAC_STRUCT(hal_handle); |
| 11018 | |
| 11019 | pmac->sme.stats_ext2_cb = stats_ext2_cb; |
| 11020 | } |
| 11021 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 11022 | /** |
| 11023 | * sme_stats_ext_deregister_callback() - De-register ext stats callback |
| 11024 | * @h_hal: Hal Handle |
| 11025 | * |
| 11026 | * This function is called to de initialize the HDD NAN feature. Currently |
| 11027 | * the only operation required is to de-register a callback with SME. |
| 11028 | * |
| 11029 | * Return: None |
| 11030 | */ |
| 11031 | void sme_stats_ext_deregister_callback(tHalHandle h_hal) |
| 11032 | { |
| 11033 | tpAniSirGlobal pmac; |
| 11034 | |
| 11035 | if (!h_hal) { |
| 11036 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11037 | FL("hHal is not valid")); |
| 11038 | return; |
| 11039 | } |
| 11040 | |
| 11041 | pmac = PMAC_STRUCT(h_hal); |
| 11042 | pmac->sme.StatsExtCallback = NULL; |
| 11043 | } |
| 11044 | |
| 11045 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11046 | /* |
| 11047 | * sme_stats_ext_request() - |
| 11048 | * Function called when HDD receives STATS EXT vendor command from userspace |
| 11049 | * |
| 11050 | * sessionID - vdevID for the stats ext request |
| 11051 | * input - Stats Ext Request structure ptr |
| 11052 | * Return QDF_STATUS |
| 11053 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11054 | QDF_STATUS sme_stats_ext_request(uint8_t session_id, tpStatsExtRequestReq input) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11055 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11056 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11057 | tpStatsExtRequest data; |
| 11058 | size_t data_len; |
| 11059 | |
| 11060 | data_len = sizeof(tStatsExtRequest) + input->request_data_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11061 | data = qdf_mem_malloc(data_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11062 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11063 | if (data == NULL) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11064 | return QDF_STATUS_E_NOMEM; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11065 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11066 | data->vdev_id = session_id; |
| 11067 | data->request_data_len = input->request_data_len; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11068 | if (input->request_data_len) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11069 | qdf_mem_copy(data->request_data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11070 | input->request_data, input->request_data_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11071 | |
| 11072 | msg.type = WMA_STATS_EXT_REQUEST; |
| 11073 | msg.reserved = 0; |
| 11074 | msg.bodyptr = data; |
| 11075 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11076 | if (QDF_STATUS_SUCCESS != scheduler_post_msg(QDF_MODULE_ID_WMA, |
Krunal Soni | 66c113f | 2016-12-21 16:46:47 -0800 | [diff] [blame] | 11077 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11078 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11079 | "%s: Not able to post WMA_STATS_EXT_REQUEST message to WMA", |
| 11080 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11081 | qdf_mem_free(data); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11082 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11083 | } |
| 11084 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11085 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11086 | } |
| 11087 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11088 | /* |
| 11089 | * sme_stats_ext_event() - |
| 11090 | * This callback function called when SME received eWNI_SME_STATS_EXT_EVENT |
| 11091 | * response from WMA |
| 11092 | * |
| 11093 | * hHal - HAL handle for device |
| 11094 | * pMsg - Message body passed from WMA; includes NAN header |
| 11095 | * Return QDF_STATUS |
| 11096 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11097 | QDF_STATUS sme_stats_ext_event(tHalHandle hHal, void *pMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11098 | { |
| 11099 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11100 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11101 | |
| 11102 | if (NULL == pMsg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11103 | sme_err("pMsg is NULL in sme_stats_ext_event"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11104 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11105 | } else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11106 | if (pMac->sme.StatsExtCallback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11107 | pMac->sme.StatsExtCallback(pMac->hHdd, |
| 11108 | (tpStatsExtEvent) pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11109 | } |
| 11110 | |
| 11111 | return status; |
| 11112 | } |
| 11113 | |
| 11114 | #endif |
| 11115 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11116 | /* |
| 11117 | * sme_update_dfs_scan_mode() - |
| 11118 | * Update DFS roam scan mode |
| 11119 | * This function is called through dynamic setConfig callback function |
| 11120 | * to configure allowDFSChannelRoam. |
| 11121 | * hHal - HAL handle for device |
| 11122 | * sessionId - Session Identifier |
| 11123 | * allowDFSChannelRoam - DFS roaming scan mode 0 (disable), |
| 11124 | * 1 (passive), 2 (active) |
| 11125 | * Return QDF_STATUS_SUCCESS - SME update DFS roaming scan config |
| 11126 | * successfully. |
| 11127 | * Other status means SME failed to update DFS roaming scan config. |
| 11128 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11129 | QDF_STATUS sme_update_dfs_scan_mode(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11130 | uint8_t allowDFSChannelRoam) |
| 11131 | { |
| 11132 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11133 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11134 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 11135 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 11136 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11137 | FL("Invalid sme session id: %d"), sessionId); |
| 11138 | return QDF_STATUS_E_INVAL; |
| 11139 | } |
| 11140 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11141 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11142 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11143 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11144 | "LFR runtime successfully set AllowDFSChannelRoam Mode to %d - old value is %d - roam state is %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11145 | allowDFSChannelRoam, |
| 11146 | pMac->roam.configParam.allowDFSChannelRoam, |
| 11147 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 11148 | neighborRoamInfo |
| 11149 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11150 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11151 | pMac->roam.configParam.allowDFSChannelRoam = |
| 11152 | allowDFSChannelRoam; |
| 11153 | sme_release_global_lock(&pMac->sme); |
| 11154 | } |
| 11155 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 11156 | csr_roam_offload_scan(pMac, sessionId, |
| 11157 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 11158 | REASON_ROAM_DFS_SCAN_MODE_CHANGED); |
| 11159 | } |
| 11160 | |
| 11161 | return status; |
| 11162 | } |
| 11163 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11164 | /* |
| 11165 | * sme_get_dfs_scan_mode() - get DFS roam scan mode |
| 11166 | * This is a synchronous call |
| 11167 | * |
| 11168 | * hHal - The handle returned by mac_open. |
| 11169 | * Return DFS roaming scan mode 0 (disable), 1 (passive), 2 (active) |
| 11170 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11171 | uint8_t sme_get_dfs_scan_mode(tHalHandle hHal) |
| 11172 | { |
| 11173 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11174 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11175 | return pMac->roam.configParam.allowDFSChannelRoam; |
| 11176 | } |
| 11177 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11178 | /* |
| 11179 | * sme_modify_add_ie() - |
| 11180 | * This function sends msg to updates the additional IE buffers in PE |
| 11181 | * |
| 11182 | * hHal - global structure |
| 11183 | * pModifyIE - pointer to tModifyIE structure |
| 11184 | * updateType - type of buffer |
| 11185 | * Return Success or failure |
| 11186 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11187 | QDF_STATUS sme_modify_add_ie(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11188 | tSirModifyIE *pModifyIE, eUpdateIEsType updateType) |
| 11189 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11190 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11191 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11192 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11193 | status = sme_acquire_global_lock(&pMac->sme); |
| 11194 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11195 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11196 | status = csr_roam_modify_add_ies(pMac, pModifyIE, updateType); |
| 11197 | sme_release_global_lock(&pMac->sme); |
| 11198 | } |
| 11199 | return status; |
| 11200 | } |
| 11201 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11202 | /* |
| 11203 | * sme_update_add_ie() - |
| 11204 | * This function sends msg to updates the additional IE buffers in PE |
| 11205 | * |
| 11206 | * hHal - global structure |
| 11207 | * pUpdateIE - pointer to structure tUpdateIE |
| 11208 | * updateType - type of buffer |
| 11209 | * Return Success or failure |
| 11210 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11211 | QDF_STATUS sme_update_add_ie(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11212 | tSirUpdateIE *pUpdateIE, eUpdateIEsType updateType) |
| 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); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11216 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11217 | status = sme_acquire_global_lock(&pMac->sme); |
| 11218 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11219 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11220 | status = csr_roam_update_add_ies(pMac, pUpdateIE, updateType); |
| 11221 | sme_release_global_lock(&pMac->sme); |
| 11222 | } |
| 11223 | return status; |
| 11224 | } |
| 11225 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11226 | /** |
| 11227 | * sme_update_dsc_pto_up_mapping() |
| 11228 | * @hHal: HAL context |
| 11229 | * @dscpmapping: pointer to DSCP mapping structure |
| 11230 | * @sessionId: SME session id |
| 11231 | * |
| 11232 | * This routine is called to update dscp mapping |
| 11233 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11234 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11235 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11236 | QDF_STATUS sme_update_dsc_pto_up_mapping(tHalHandle hHal, |
Abhishek Singh | 12be60f | 2017-08-11 13:52:42 +0530 | [diff] [blame] | 11237 | enum sme_qos_wmmuptype *dscpmapping, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11238 | uint8_t sessionId) |
| 11239 | { |
| 11240 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11241 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11242 | uint8_t i, j, peSessionId; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 11243 | struct csr_roam_session *pCsrSession = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11244 | tpPESession pSession = NULL; |
| 11245 | |
| 11246 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11247 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11248 | return status; |
| 11249 | pCsrSession = CSR_GET_SESSION(pMac, sessionId); |
| 11250 | if (pCsrSession == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11251 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11252 | FL("Session lookup fails for CSR session")); |
| 11253 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11254 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11255 | } |
| 11256 | if (!CSR_IS_SESSION_VALID(pMac, sessionId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11257 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11258 | FL("Invalid session Id %u"), sessionId); |
| 11259 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11260 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11261 | } |
| 11262 | |
| 11263 | pSession = pe_find_session_by_bssid(pMac, |
| 11264 | pCsrSession->connectedProfile.bssid.bytes, |
| 11265 | &peSessionId); |
| 11266 | |
| 11267 | if (pSession == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11268 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11269 | FL(" Session lookup fails for BSSID")); |
| 11270 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11271 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11272 | } |
| 11273 | |
| 11274 | if (!pSession->QosMapSet.present) { |
Srinivas Girigowda | 2b5d47c | 2017-03-29 00:28:46 -0700 | [diff] [blame] | 11275 | sme_debug("QOS Mapping IE not present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11276 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11277 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11278 | } |
| 11279 | for (i = 0; i < SME_QOS_WMM_UP_MAX; i++) { |
| 11280 | for (j = pSession->QosMapSet.dscp_range[i][0]; |
| 11281 | j <= pSession->QosMapSet.dscp_range[i][1]; |
| 11282 | j++) { |
| 11283 | if ((pSession->QosMapSet.dscp_range[i][0] == 255) |
| 11284 | && (pSession->QosMapSet.dscp_range[i][1] == |
| 11285 | 255)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11286 | QDF_TRACE(QDF_MODULE_ID_SME, |
Kiran Kumar Lokere | 1d411bb | 2017-11-29 15:24:05 -0800 | [diff] [blame] | 11287 | QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11288 | FL("User Priority %d isn't used"), i); |
| 11289 | break; |
| 11290 | } else { |
| 11291 | dscpmapping[j] = i; |
| 11292 | } |
| 11293 | } |
| 11294 | } |
| 11295 | for (i = 0; i < pSession->QosMapSet.num_dscp_exceptions; i++) |
| 11296 | if (pSession->QosMapSet.dscp_exceptions[i][0] != 255) |
| 11297 | dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0]] = |
| 11298 | pSession->QosMapSet.dscp_exceptions[i][1]; |
| 11299 | |
| 11300 | sme_release_global_lock(&pMac->sme); |
| 11301 | return status; |
| 11302 | } |
| 11303 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11304 | /* |
| 11305 | * sme_abort_roam_scan() - |
| 11306 | * API to abort current roam scan cycle by roam scan offload module. |
| 11307 | * |
| 11308 | * hHal - The handle returned by mac_open. |
| 11309 | * sessionId - Session Identifier |
| 11310 | * Return QDF_STATUS |
| 11311 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11312 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11313 | QDF_STATUS sme_abort_roam_scan(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11314 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11315 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11316 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11317 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11318 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 11319 | /* acquire the lock for the sme object */ |
| 11320 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11321 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11322 | csr_roam_offload_scan(pMac, sessionId, |
| 11323 | ROAM_SCAN_OFFLOAD_ABORT_SCAN, |
| 11324 | REASON_ROAM_ABORT_ROAM_SCAN); |
| 11325 | /* release the lock for the sme object */ |
| 11326 | sme_release_global_lock(&pMac->sme); |
| 11327 | } |
| 11328 | } |
| 11329 | |
| 11330 | return status; |
| 11331 | } |
| 11332 | |
| 11333 | #ifdef FEATURE_WLAN_EXTSCAN |
| 11334 | /** |
| 11335 | * sme_get_valid_channels_by_band() - to fetch valid channels filtered by band |
| 11336 | * @hHal: HAL context |
| 11337 | * @wifiBand: RF band information |
| 11338 | * @aValidChannels: output array to store channel info |
| 11339 | * @pNumChannels: output number of channels |
| 11340 | * |
| 11341 | * SME API to fetch all valid channels filtered by band |
| 11342 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11343 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11344 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11345 | QDF_STATUS sme_get_valid_channels_by_band(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11346 | uint8_t wifiBand, |
| 11347 | uint32_t *aValidChannels, |
| 11348 | uint8_t *pNumChannels) |
| 11349 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11350 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11351 | uint8_t chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11352 | uint8_t numChannels = 0; |
| 11353 | uint8_t i = 0; |
| 11354 | uint32_t totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 11355 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hHal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11356 | |
| 11357 | if (!aValidChannels || !pNumChannels) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11358 | sme_err("Output channel list/NumChannels is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11359 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11360 | } |
| 11361 | |
Sreelakshmi Konamki | 0d17c6a | 2017-06-08 12:58:54 +0530 | [diff] [blame] | 11362 | if (wifiBand >= WIFI_BAND_MAX) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11363 | sme_err("Invalid wifiBand: %d", wifiBand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11364 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11365 | } |
| 11366 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 11367 | status = sme_get_cfg_valid_channels(&chanList[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11368 | &totValidChannels); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11369 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11370 | sme_err("Fail to get valid channel list (err=%d)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11371 | return status; |
| 11372 | } |
| 11373 | |
| 11374 | switch (wifiBand) { |
| 11375 | case WIFI_BAND_UNSPECIFIED: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11376 | sme_debug("Unspec Band, return all %d valid channels", |
| 11377 | totValidChannels); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11378 | numChannels = totValidChannels; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11379 | for (i = 0; i < totValidChannels; i++) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11380 | aValidChannels[i] = cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11381 | break; |
| 11382 | |
| 11383 | case WIFI_BAND_BG: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11384 | sme_debug("WIFI_BAND_BG (2.4 GHz)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11385 | for (i = 0; i < totValidChannels; i++) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11386 | if (WLAN_REG_IS_24GHZ_CH(chanList[i])) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11387 | aValidChannels[numChannels++] = |
| 11388 | cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11389 | } |
| 11390 | break; |
| 11391 | |
| 11392 | case WIFI_BAND_A: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11393 | sme_debug("WIFI_BAND_A (5 GHz without DFS)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11394 | for (i = 0; i < totValidChannels; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 11395 | if (WLAN_REG_IS_5GHZ_CH(chanList[i]) && |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11396 | !wlan_reg_is_dfs_ch(mac_ctx->pdev, chanList[i])) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11397 | aValidChannels[numChannels++] = |
| 11398 | cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11399 | } |
| 11400 | break; |
| 11401 | |
| 11402 | case WIFI_BAND_ABG: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11403 | sme_debug("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11404 | for (i = 0; i < totValidChannels; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 11405 | if ((WLAN_REG_IS_24GHZ_CH(chanList[i]) || |
| 11406 | WLAN_REG_IS_5GHZ_CH(chanList[i])) && |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11407 | !wlan_reg_is_dfs_ch(mac_ctx->pdev, chanList[i])) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11408 | aValidChannels[numChannels++] = |
| 11409 | cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11410 | } |
| 11411 | break; |
| 11412 | |
| 11413 | case WIFI_BAND_A_DFS_ONLY: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11414 | sme_debug("WIFI_BAND_A_DFS (5 GHz DFS only)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11415 | for (i = 0; i < totValidChannels; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 11416 | if (WLAN_REG_IS_5GHZ_CH(chanList[i]) && |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11417 | wlan_reg_is_dfs_ch(mac_ctx->pdev, chanList[i])) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11418 | aValidChannels[numChannels++] = |
| 11419 | cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11420 | } |
| 11421 | break; |
| 11422 | |
| 11423 | case WIFI_BAND_A_WITH_DFS: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11424 | sme_debug("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11425 | for (i = 0; i < totValidChannels; i++) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11426 | if (WLAN_REG_IS_5GHZ_CH(chanList[i])) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11427 | aValidChannels[numChannels++] = |
| 11428 | cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11429 | } |
| 11430 | break; |
| 11431 | |
| 11432 | case WIFI_BAND_ABG_WITH_DFS: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11433 | sme_debug("WIFI_BAND_ABG_WITH_DFS (2.4 GHz+5 GHz with DFS)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11434 | for (i = 0; i < totValidChannels; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 11435 | if (WLAN_REG_IS_24GHZ_CH(chanList[i]) || |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11436 | WLAN_REG_IS_5GHZ_CH(chanList[i])) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11437 | aValidChannels[numChannels++] = |
| 11438 | cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11439 | } |
| 11440 | break; |
| 11441 | |
| 11442 | default: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11443 | sme_err("Unknown wifiBand: %d", wifiBand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11444 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11445 | } |
| 11446 | *pNumChannels = numChannels; |
| 11447 | |
| 11448 | return status; |
| 11449 | } |
| 11450 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11451 | /* |
| 11452 | * sme_ext_scan_get_capabilities() - |
| 11453 | * SME API to fetch extscan capabilities |
| 11454 | * |
| 11455 | * hHal |
| 11456 | * pReq: extscan capabilities structure |
| 11457 | * Return QDF_STATUS |
| 11458 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11459 | QDF_STATUS sme_ext_scan_get_capabilities(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11460 | tSirGetExtScanCapabilitiesReqParams * |
| 11461 | pReq) |
| 11462 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11463 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11464 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11465 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11466 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11467 | |
| 11468 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11469 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11470 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11471 | message.bodyptr = pReq; |
| 11472 | message.type = WMA_EXTSCAN_GET_CAPABILITIES_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11473 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11474 | NO_SESSION, message.type)); |
| 11475 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 11476 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11477 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 11478 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11479 | |
| 11480 | sme_release_global_lock(&pMac->sme); |
| 11481 | } |
| 11482 | return status; |
| 11483 | } |
| 11484 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11485 | /* |
| 11486 | * sme_ext_scan_start() - |
| 11487 | * SME API to issue extscan start |
| 11488 | * |
| 11489 | * hHal |
| 11490 | * pStartCmd: extscan start structure |
| 11491 | * Return QDF_STATUS |
| 11492 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11493 | QDF_STATUS sme_ext_scan_start(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11494 | tSirWifiScanCmdReqParams *pStartCmd) |
| 11495 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11496 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11497 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11498 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11499 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11500 | |
| 11501 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11502 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11503 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11504 | message.bodyptr = pStartCmd; |
| 11505 | message.type = WMA_EXTSCAN_START_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11506 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11507 | NO_SESSION, message.type)); |
| 11508 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 11509 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11510 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 11511 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11512 | |
| 11513 | sme_release_global_lock(&pMac->sme); |
| 11514 | } |
| 11515 | return status; |
| 11516 | } |
| 11517 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11518 | /* |
| 11519 | * sme_ext_scan_stop() - |
| 11520 | * SME API to issue extscan stop |
| 11521 | * |
| 11522 | * hHal |
| 11523 | * pStopReq: extscan stop structure |
| 11524 | * Return QDF_STATUS |
| 11525 | */ |
| 11526 | QDF_STATUS sme_ext_scan_stop(tHalHandle hHal, tSirExtScanStopReqParams |
| 11527 | *pStopReq) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11528 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11529 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11530 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11531 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11532 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11533 | |
| 11534 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11535 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11536 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11537 | message.bodyptr = pStopReq; |
| 11538 | message.type = WMA_EXTSCAN_STOP_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11539 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11540 | NO_SESSION, message.type)); |
| 11541 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 11542 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11543 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 11544 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11545 | sme_release_global_lock(&pMac->sme); |
| 11546 | } |
| 11547 | return status; |
| 11548 | } |
| 11549 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11550 | /* |
| 11551 | * sme_set_bss_hotlist() - |
| 11552 | * SME API to set BSSID hotlist |
| 11553 | * |
| 11554 | * hHal |
| 11555 | * pSetHotListReq: extscan set hotlist structure |
| 11556 | * Return QDF_STATUS |
| 11557 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11558 | QDF_STATUS sme_set_bss_hotlist(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11559 | tSirExtScanSetBssidHotListReqParams * |
| 11560 | pSetHotListReq) |
| 11561 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11562 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11563 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11564 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11565 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11566 | |
| 11567 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11568 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11569 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11570 | message.bodyptr = pSetHotListReq; |
| 11571 | message.type = WMA_EXTSCAN_SET_BSSID_HOTLIST_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11572 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11573 | NO_SESSION, message.type)); |
| 11574 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 11575 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11576 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 11577 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11578 | |
| 11579 | sme_release_global_lock(&pMac->sme); |
| 11580 | } |
| 11581 | return status; |
| 11582 | } |
| 11583 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11584 | /* |
| 11585 | * sme_reset_bss_hotlist() - |
| 11586 | * SME API to reset BSSID hotlist |
| 11587 | * |
| 11588 | * hHal |
| 11589 | * pSetHotListReq: extscan set hotlist structure |
| 11590 | * Return QDF_STATUS |
| 11591 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11592 | QDF_STATUS sme_reset_bss_hotlist(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11593 | tSirExtScanResetBssidHotlistReqParams * |
| 11594 | pResetReq) |
| 11595 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11596 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11597 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11598 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11599 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11600 | |
| 11601 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11602 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11603 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11604 | message.bodyptr = pResetReq; |
| 11605 | message.type = WMA_EXTSCAN_RESET_BSSID_HOTLIST_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11606 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11607 | NO_SESSION, message.type)); |
| 11608 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 11609 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11610 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 11611 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11612 | |
| 11613 | sme_release_global_lock(&pMac->sme); |
| 11614 | } |
| 11615 | return status; |
| 11616 | } |
| 11617 | |
Manikandan Mohan | 80dea79 | 2016-04-28 16:36:48 -0700 | [diff] [blame] | 11618 | /** |
| 11619 | * sme_send_wisa_params(): Pass WISA mode to WMA |
| 11620 | * @hal: HAL context |
| 11621 | * @wisa_params: pointer to WISA params struct |
| 11622 | * @sessionId: SME session id |
| 11623 | * |
| 11624 | * Pass WISA params to WMA |
| 11625 | * |
| 11626 | * Return: QDF_STATUS |
| 11627 | */ |
| 11628 | QDF_STATUS sme_set_wisa_params(tHalHandle hal, |
| 11629 | struct sir_wisa_params *wisa_params) |
| 11630 | { |
| 11631 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11632 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11633 | struct scheduler_msg message = {0}; |
Manikandan Mohan | 80dea79 | 2016-04-28 16:36:48 -0700 | [diff] [blame] | 11634 | struct sir_wisa_params *cds_msg_wisa_params; |
| 11635 | |
| 11636 | cds_msg_wisa_params = qdf_mem_malloc(sizeof(struct sir_wisa_params)); |
| 11637 | if (!cds_msg_wisa_params) |
| 11638 | return QDF_STATUS_E_NOMEM; |
| 11639 | |
| 11640 | *cds_msg_wisa_params = *wisa_params; |
| 11641 | status = sme_acquire_global_lock(&mac->sme); |
| 11642 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11643 | message.bodyptr = cds_msg_wisa_params; |
| 11644 | message.type = WMA_SET_WISA_PARAMS; |
| 11645 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
Manikandan Mohan | 80dea79 | 2016-04-28 16:36:48 -0700 | [diff] [blame] | 11646 | sme_release_global_lock(&mac->sme); |
| 11647 | } |
| 11648 | return status; |
| 11649 | } |
| 11650 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11651 | /* |
| 11652 | * sme_set_significant_change() - |
| 11653 | * SME API to set significant change |
| 11654 | * |
| 11655 | * hHal |
| 11656 | * pSetSignificantChangeReq: extscan set significant change structure |
| 11657 | * Return QDF_STATUS |
| 11658 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11659 | QDF_STATUS sme_set_significant_change(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11660 | tSirExtScanSetSigChangeReqParams * |
| 11661 | pSetSignificantChangeReq) |
| 11662 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11663 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11664 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11665 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11666 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11667 | |
| 11668 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11669 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11670 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11671 | message.bodyptr = pSetSignificantChangeReq; |
| 11672 | message.type = WMA_EXTSCAN_SET_SIGNF_CHANGE_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11673 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11674 | NO_SESSION, message.type)); |
| 11675 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 11676 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11677 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 11678 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11679 | |
| 11680 | sme_release_global_lock(&pMac->sme); |
| 11681 | } |
| 11682 | return status; |
| 11683 | } |
| 11684 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11685 | /* |
| 11686 | * sme_reset_significant_change |
| 11687 | * SME API to reset significant change |
| 11688 | * |
| 11689 | * hHal |
| 11690 | * pResetReq: extscan reset significant change structure |
| 11691 | * Return QDF_STATUS |
| 11692 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11693 | QDF_STATUS sme_reset_significant_change(tHalHandle hHal, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11694 | tSirExtScanResetSignificantChangeReqParams |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11695 | *pResetReq) |
| 11696 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11697 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11698 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11699 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11700 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11701 | |
| 11702 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11703 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11704 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11705 | message.bodyptr = pResetReq; |
| 11706 | message.type = WMA_EXTSCAN_RESET_SIGNF_CHANGE_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11707 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11708 | NO_SESSION, message.type)); |
| 11709 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 11710 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11711 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 11712 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11713 | |
| 11714 | sme_release_global_lock(&pMac->sme); |
| 11715 | } |
| 11716 | return status; |
| 11717 | } |
| 11718 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11719 | /* |
| 11720 | * sme_get_cached_results() - |
| 11721 | * SME API to get cached results |
| 11722 | * |
| 11723 | * hHal |
| 11724 | * pCachedResultsReq: extscan get cached results structure |
| 11725 | * Return QDF_STATUS |
| 11726 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11727 | QDF_STATUS sme_get_cached_results(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11728 | tSirExtScanGetCachedResultsReqParams * |
| 11729 | pCachedResultsReq) |
| 11730 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11731 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11732 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11733 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11734 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11735 | |
| 11736 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11737 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11738 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11739 | message.bodyptr = pCachedResultsReq; |
| 11740 | message.type = WMA_EXTSCAN_GET_CACHED_RESULTS_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11741 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11742 | NO_SESSION, message.type)); |
| 11743 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 11744 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11745 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 11746 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11747 | |
| 11748 | sme_release_global_lock(&pMac->sme); |
| 11749 | } |
| 11750 | return status; |
| 11751 | } |
| 11752 | |
| 11753 | /** |
| 11754 | * sme_set_epno_list() - set epno network list |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 11755 | * @hal: global hal handle |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11756 | * @input: request message |
| 11757 | * |
| 11758 | * This function constructs the cds message and fill in message type, |
| 11759 | * bodyptr with %input and posts it to WDA queue. |
| 11760 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 11761 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11762 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11763 | QDF_STATUS sme_set_epno_list(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11764 | struct wifi_epno_params *input) |
| 11765 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11766 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11767 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11768 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11769 | struct wifi_epno_params *req_msg; |
| 11770 | int len, i; |
| 11771 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11772 | SME_ENTER(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11773 | len = sizeof(*req_msg) + |
| 11774 | (input->num_networks * sizeof(struct wifi_epno_network)); |
Mukul Sharma | e8c919f | 2016-10-02 20:35:15 +0530 | [diff] [blame] | 11775 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11776 | req_msg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11777 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11778 | sme_err("qdf_mem_malloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11779 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11780 | } |
| 11781 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11782 | req_msg->num_networks = input->num_networks; |
| 11783 | req_msg->request_id = input->request_id; |
| 11784 | req_msg->session_id = input->session_id; |
Mukul Sharma | e8c919f | 2016-10-02 20:35:15 +0530 | [diff] [blame] | 11785 | |
| 11786 | /* Fill only when num_networks are non zero */ |
| 11787 | if (req_msg->num_networks) { |
| 11788 | req_msg->min_5ghz_rssi = input->min_5ghz_rssi; |
| 11789 | req_msg->min_24ghz_rssi = input->min_24ghz_rssi; |
| 11790 | req_msg->initial_score_max = input->initial_score_max; |
| 11791 | req_msg->same_network_bonus = input->same_network_bonus; |
| 11792 | req_msg->secure_bonus = input->secure_bonus; |
| 11793 | req_msg->band_5ghz_bonus = input->band_5ghz_bonus; |
| 11794 | req_msg->current_connection_bonus = |
| 11795 | input->current_connection_bonus; |
| 11796 | |
| 11797 | for (i = 0; i < req_msg->num_networks; i++) { |
| 11798 | req_msg->networks[i].flags = input->networks[i].flags; |
| 11799 | req_msg->networks[i].auth_bit_field = |
| 11800 | input->networks[i].auth_bit_field; |
| 11801 | req_msg->networks[i].ssid.length = |
| 11802 | input->networks[i].ssid.length; |
| 11803 | qdf_mem_copy(req_msg->networks[i].ssid.ssId, |
| 11804 | input->networks[i].ssid.ssId, |
| 11805 | req_msg->networks[i].ssid.length); |
| 11806 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11807 | } |
| 11808 | |
| 11809 | status = sme_acquire_global_lock(&mac->sme); |
Vignesh Viswanathan | cbb5b95 | 2017-08-02 14:32:49 +0530 | [diff] [blame] | 11810 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11811 | sme_err("sme_acquire_global_lock failed!(status=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11812 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11813 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11814 | return status; |
| 11815 | } |
| 11816 | |
| 11817 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11818 | message.bodyptr = req_msg; |
| 11819 | message.type = WMA_SET_EPNO_LIST_REQ; |
| 11820 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11821 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11822 | sme_err("scheduler_post_msg failed!(err=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11823 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11824 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11825 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11826 | } |
| 11827 | sme_release_global_lock(&mac->sme); |
| 11828 | return status; |
| 11829 | } |
| 11830 | |
| 11831 | /** |
| 11832 | * sme_set_passpoint_list() - set passpoint network list |
| 11833 | * @hal: global hal handle |
| 11834 | * @input: request message |
| 11835 | * |
| 11836 | * This function constructs the cds message and fill in message type, |
| 11837 | * bodyptr with @input and posts it to WDA queue. |
| 11838 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 11839 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11840 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11841 | QDF_STATUS sme_set_passpoint_list(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11842 | struct wifi_passpoint_req *input) |
| 11843 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11844 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11845 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11846 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11847 | struct wifi_passpoint_req *req_msg; |
| 11848 | int len, i; |
| 11849 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11850 | SME_ENTER(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11851 | len = sizeof(*req_msg) + |
| 11852 | (input->num_networks * sizeof(struct wifi_passpoint_network)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11853 | req_msg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11854 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11855 | sme_err("qdf_mem_malloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11856 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11857 | } |
| 11858 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11859 | req_msg->num_networks = input->num_networks; |
| 11860 | req_msg->request_id = input->request_id; |
| 11861 | req_msg->session_id = input->session_id; |
| 11862 | for (i = 0; i < req_msg->num_networks; i++) { |
| 11863 | req_msg->networks[i].id = |
| 11864 | input->networks[i].id; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11865 | qdf_mem_copy(req_msg->networks[i].realm, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11866 | input->networks[i].realm, |
| 11867 | strlen(input->networks[i].realm) + 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11868 | qdf_mem_copy(req_msg->networks[i].plmn, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11869 | input->networks[i].plmn, |
| 11870 | SIR_PASSPOINT_PLMN_LEN); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11871 | qdf_mem_copy(req_msg->networks[i].roaming_consortium_ids, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11872 | input->networks[i].roaming_consortium_ids, |
| 11873 | sizeof(req_msg->networks[i].roaming_consortium_ids)); |
| 11874 | } |
| 11875 | |
| 11876 | status = sme_acquire_global_lock(&mac->sme); |
Vignesh Viswanathan | cbb5b95 | 2017-08-02 14:32:49 +0530 | [diff] [blame] | 11877 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11878 | sme_err("sme_acquire_global_lock failed!(status=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11879 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11880 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11881 | return status; |
| 11882 | } |
| 11883 | |
| 11884 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11885 | message.bodyptr = req_msg; |
| 11886 | message.type = WMA_SET_PASSPOINT_LIST_REQ; |
| 11887 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11888 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11889 | sme_err("scheduler_post_msg failed!(err=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11890 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11891 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11892 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11893 | } |
| 11894 | sme_release_global_lock(&mac->sme); |
| 11895 | return status; |
| 11896 | } |
| 11897 | |
| 11898 | /** |
| 11899 | * sme_reset_passpoint_list() - reset passpoint network list |
| 11900 | * @hHal: global hal handle |
| 11901 | * @input: request message |
| 11902 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 11903 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11904 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11905 | QDF_STATUS sme_reset_passpoint_list(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11906 | struct wifi_passpoint_req *input) |
| 11907 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11908 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11909 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11910 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11911 | struct wifi_passpoint_req *req_msg; |
| 11912 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11913 | SME_ENTER(); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11914 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11915 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11916 | sme_err("qdf_mem_malloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11917 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11918 | } |
| 11919 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11920 | req_msg->request_id = input->request_id; |
| 11921 | req_msg->session_id = input->session_id; |
| 11922 | |
| 11923 | status = sme_acquire_global_lock(&mac->sme); |
Vignesh Viswanathan | cbb5b95 | 2017-08-02 14:32:49 +0530 | [diff] [blame] | 11924 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11925 | sme_err("sme_acquire_global_lock failed!(status=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11926 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11927 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11928 | return status; |
| 11929 | } |
| 11930 | |
| 11931 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11932 | message.bodyptr = req_msg; |
| 11933 | message.type = WMA_RESET_PASSPOINT_LIST_REQ; |
| 11934 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11935 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11936 | sme_err("scheduler_post_msg failed!(err=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11937 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11938 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11939 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11940 | } |
| 11941 | sme_release_global_lock(&mac->sme); |
| 11942 | return status; |
| 11943 | } |
| 11944 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11945 | QDF_STATUS sme_ext_scan_register_callback(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11946 | void (*pExtScanIndCb)(void *, |
| 11947 | const uint16_t, |
| 11948 | void *)) |
| 11949 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11950 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11951 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11952 | |
| 11953 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11954 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11955 | pMac->sme.pExtScanIndCb = pExtScanIndCb; |
| 11956 | sme_release_global_lock(&pMac->sme); |
| 11957 | } |
| 11958 | return status; |
| 11959 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11960 | #endif /* FEATURE_WLAN_EXTSCAN */ |
| 11961 | |
| 11962 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 11963 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11964 | /* |
| 11965 | * sme_ll_stats_clear_req() - |
| 11966 | * SME API to clear Link Layer Statistics |
| 11967 | * |
| 11968 | * hHal |
| 11969 | * pclearStatsReq: Link Layer clear stats request params structure |
| 11970 | * Return QDF_STATUS |
| 11971 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11972 | QDF_STATUS sme_ll_stats_clear_req(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11973 | tSirLLStatsClearReq *pclearStatsReq) |
| 11974 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11975 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11976 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11977 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11978 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11979 | tSirLLStatsClearReq *clear_stats_req; |
| 11980 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 11981 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11982 | "staId = %u", pclearStatsReq->staId); |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 11983 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11984 | "statsClearReqMask = 0x%X", |
| 11985 | pclearStatsReq->statsClearReqMask); |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 11986 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11987 | "stopReq = %u", pclearStatsReq->stopReq); |
Deepak Dhamdhere | 6adc08e | 2017-07-27 09:33:22 -0700 | [diff] [blame] | 11988 | if (!sme_is_session_id_valid(hHal, pclearStatsReq->staId)) { |
| 11989 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11990 | "%s: invalid staId %d", |
| 11991 | __func__, pclearStatsReq->staId); |
| 11992 | return QDF_STATUS_E_INVAL; |
| 11993 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11994 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11995 | clear_stats_req = qdf_mem_malloc(sizeof(*clear_stats_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11996 | |
| 11997 | if (!clear_stats_req) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11998 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11999 | "%s: Not able to allocate memory for WMA_LL_STATS_CLEAR_REQ", |
| 12000 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12001 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12002 | } |
| 12003 | |
| 12004 | *clear_stats_req = *pclearStatsReq; |
| 12005 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12006 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12007 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12008 | message.bodyptr = clear_stats_req; |
| 12009 | message.type = WMA_LINK_LAYER_STATS_CLEAR_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 12010 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12011 | NO_SESSION, message.type)); |
| 12012 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 12013 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12014 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12015 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12016 | "%s: not able to post WMA_LL_STATS_CLEAR_REQ", |
| 12017 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12018 | qdf_mem_free(clear_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12019 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12020 | } |
| 12021 | sme_release_global_lock(&pMac->sme); |
| 12022 | } else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12023 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12024 | "%s: sme_acquire_global_lock error", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12025 | qdf_mem_free(clear_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12026 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12027 | } |
| 12028 | |
| 12029 | return status; |
| 12030 | } |
| 12031 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12032 | /* |
| 12033 | * sme_ll_stats_set_req() - |
| 12034 | * SME API to set the Link Layer Statistics |
| 12035 | * |
| 12036 | * hHal |
| 12037 | * psetStatsReq: Link Layer set stats request params structure |
| 12038 | * Return QDF_STATUS |
| 12039 | */ |
| 12040 | QDF_STATUS sme_ll_stats_set_req(tHalHandle hHal, tSirLLStatsSetReq |
| 12041 | *psetStatsReq) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12042 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12043 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12044 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12045 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12046 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12047 | tSirLLStatsSetReq *set_stats_req; |
| 12048 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 12049 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12050 | "%s: MPDU Size = %u", __func__, |
| 12051 | psetStatsReq->mpduSizeThreshold); |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 12052 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12053 | " Aggressive Stats Collections = %u", |
| 12054 | psetStatsReq->aggressiveStatisticsGathering); |
| 12055 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12056 | set_stats_req = qdf_mem_malloc(sizeof(*set_stats_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12057 | |
| 12058 | if (!set_stats_req) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12059 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12060 | "%s: Not able to allocate memory for WMA_LL_STATS_SET_REQ", |
| 12061 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12062 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12063 | } |
| 12064 | |
| 12065 | *set_stats_req = *psetStatsReq; |
| 12066 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12067 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12068 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12069 | message.bodyptr = set_stats_req; |
| 12070 | message.type = WMA_LINK_LAYER_STATS_SET_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 12071 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12072 | NO_SESSION, message.type)); |
| 12073 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 12074 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12075 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12076 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12077 | "%s: not able to post WMA_LL_STATS_SET_REQ", |
| 12078 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12079 | qdf_mem_free(set_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12080 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12081 | } |
| 12082 | sme_release_global_lock(&pMac->sme); |
| 12083 | } else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12084 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12085 | "%s: sme_acquire_global_lock error", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12086 | qdf_mem_free(set_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12087 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12088 | } |
| 12089 | |
| 12090 | return status; |
| 12091 | } |
| 12092 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12093 | /* |
| 12094 | * sme_ll_stats_get_req() - |
| 12095 | * SME API to get the Link Layer Statistics |
| 12096 | * |
| 12097 | * hHal |
| 12098 | * pgetStatsReq: Link Layer get stats request params structure |
| 12099 | * Return QDF_STATUS |
| 12100 | */ |
| 12101 | QDF_STATUS sme_ll_stats_get_req(tHalHandle hHal, tSirLLStatsGetReq |
| 12102 | *pgetStatsReq) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12103 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12104 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12105 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12106 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12107 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12108 | tSirLLStatsGetReq *get_stats_req; |
| 12109 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12110 | get_stats_req = qdf_mem_malloc(sizeof(*get_stats_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12111 | |
| 12112 | if (!get_stats_req) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12113 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12114 | "%s: Not able to allocate memory for WMA_LL_STATS_GET_REQ", |
| 12115 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12116 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12117 | } |
| 12118 | |
| 12119 | *get_stats_req = *pgetStatsReq; |
| 12120 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12121 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12122 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12123 | message.bodyptr = get_stats_req; |
| 12124 | message.type = WMA_LINK_LAYER_STATS_GET_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 12125 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12126 | NO_SESSION, message.type)); |
| 12127 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 12128 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12129 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12130 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12131 | "%s: not able to post WMA_LL_STATS_GET_REQ", |
| 12132 | __func__); |
| 12133 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12134 | qdf_mem_free(get_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12135 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12136 | |
| 12137 | } |
| 12138 | sme_release_global_lock(&pMac->sme); |
| 12139 | } else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12140 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12141 | "%s: sme_acquire_global_lock error", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12142 | qdf_mem_free(get_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12143 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12144 | } |
| 12145 | |
| 12146 | return status; |
| 12147 | } |
| 12148 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12149 | /* |
| 12150 | * sme_set_link_layer_stats_ind_cb() - |
| 12151 | * SME API to trigger the stats are available after get request |
| 12152 | * |
| 12153 | * hHal |
| 12154 | * callback_routine - HDD callback which needs to be invoked after |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12155 | getting status notification from FW |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12156 | * Return QDF_STATUS |
| 12157 | */ |
| 12158 | QDF_STATUS sme_set_link_layer_stats_ind_cb(tHalHandle hHal, |
| 12159 | void (*callback_routine)(void *callbackCtx, int indType, void *pRsp)) |
| 12160 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12161 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12162 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12163 | |
| 12164 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12165 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12166 | pMac->sme.pLinkLayerStatsIndCallback = callback_routine; |
| 12167 | sme_release_global_lock(&pMac->sme); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12168 | } else |
| 12169 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12170 | "%s: sme_acquire_global_lock error", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12171 | |
| 12172 | return status; |
| 12173 | } |
| 12174 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 12175 | /** |
Zhang Qian | a6e9c10 | 2016-12-22 16:47:24 +0800 | [diff] [blame] | 12176 | * sme_set_link_layer_ext_cb() - Register callback for link layer statistics |
| 12177 | * @hal: Mac global handle |
| 12178 | * @ll_stats_ext_cb: HDD callback which needs to be invoked after getting |
| 12179 | * status notification from FW |
| 12180 | * |
| 12181 | * Return: eHalStatus |
| 12182 | */ |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12183 | QDF_STATUS sme_set_link_layer_ext_cb(tHalHandle hal, void (*ll_stats_ext_cb) |
| 12184 | (tHddHandle callback_ctx, tSirLLStatsResults |
| 12185 | *rsp)) |
Zhang Qian | a6e9c10 | 2016-12-22 16:47:24 +0800 | [diff] [blame] | 12186 | { |
| 12187 | QDF_STATUS status; |
| 12188 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 12189 | |
| 12190 | status = sme_acquire_global_lock(&mac->sme); |
| 12191 | if (status == QDF_STATUS_SUCCESS) { |
| 12192 | mac->sme.link_layer_stats_ext_cb = ll_stats_ext_cb; |
| 12193 | sme_release_global_lock(&mac->sme); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12194 | } else |
Zhang Qian | a6e9c10 | 2016-12-22 16:47:24 +0800 | [diff] [blame] | 12195 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12196 | "%s: sme_qcquire_global_lock error", __func__); |
Zhang Qian | a6e9c10 | 2016-12-22 16:47:24 +0800 | [diff] [blame] | 12197 | return status; |
| 12198 | } |
| 12199 | |
| 12200 | /** |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 12201 | * sme_reset_link_layer_stats_ind_cb() - SME API to reset link layer stats |
| 12202 | * indication |
| 12203 | * @h_hal: Hal Handle |
| 12204 | * |
| 12205 | * This function reset's the link layer stats indication |
| 12206 | * |
| 12207 | * Return: QDF_STATUS Enumeration |
| 12208 | */ |
| 12209 | |
| 12210 | QDF_STATUS sme_reset_link_layer_stats_ind_cb(tHalHandle h_hal) |
| 12211 | { |
| 12212 | QDF_STATUS status; |
| 12213 | tpAniSirGlobal pmac; |
| 12214 | |
| 12215 | if (!h_hal) { |
| 12216 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12217 | FL("hHal is not valid")); |
| 12218 | return QDF_STATUS_E_INVAL; |
| 12219 | } |
| 12220 | pmac = PMAC_STRUCT(h_hal); |
| 12221 | |
| 12222 | status = sme_acquire_global_lock(&pmac->sme); |
| 12223 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 12224 | pmac->sme.pLinkLayerStatsIndCallback = NULL; |
| 12225 | sme_release_global_lock(&pmac->sme); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12226 | } else |
| 12227 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12228 | "%s: sme_acquire_global_lock error", __func__); |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 12229 | |
| 12230 | return status; |
| 12231 | } |
| 12232 | |
Zhang Qian | 73c348a | 2017-03-13 16:15:55 +0800 | [diff] [blame] | 12233 | /** |
| 12234 | * sme_ll_stats_set_thresh - set threshold for mac counters |
| 12235 | * @hal, hal layer handle |
| 12236 | * @threshold, threshold for mac counters |
| 12237 | * |
| 12238 | * Return: QDF_STATUS Enumeration |
| 12239 | */ |
| 12240 | QDF_STATUS sme_ll_stats_set_thresh(tHalHandle hal, |
| 12241 | struct sir_ll_ext_stats_threshold *threshold) |
| 12242 | { |
| 12243 | QDF_STATUS status; |
| 12244 | tpAniSirGlobal mac; |
Rajeev Kumar | 658e849 | 2017-12-13 11:35:41 -0800 | [diff] [blame] | 12245 | struct scheduler_msg message = {0}; |
Zhang Qian | 73c348a | 2017-03-13 16:15:55 +0800 | [diff] [blame] | 12246 | struct sir_ll_ext_stats_threshold *thresh; |
| 12247 | |
| 12248 | if (!threshold) { |
| 12249 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12250 | FL("threshold is not valid")); |
| 12251 | return QDF_STATUS_E_INVAL; |
| 12252 | } |
| 12253 | |
| 12254 | if (!hal) { |
| 12255 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12256 | FL("hal is not valid")); |
| 12257 | return QDF_STATUS_E_INVAL; |
| 12258 | } |
| 12259 | mac = PMAC_STRUCT(hal); |
| 12260 | |
| 12261 | thresh = qdf_mem_malloc(sizeof(*thresh)); |
| 12262 | if (!thresh) { |
| 12263 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12264 | "%s: Fail to alloc mem", __func__); |
| 12265 | return QDF_STATUS_E_NOMEM; |
| 12266 | } |
| 12267 | *thresh = *threshold; |
| 12268 | |
| 12269 | status = sme_acquire_global_lock(&mac->sme); |
| 12270 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 12271 | /* Serialize the req through MC thread */ |
| 12272 | message.bodyptr = thresh; |
| 12273 | message.type = WDA_LINK_LAYER_STATS_SET_THRESHOLD; |
| 12274 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 12275 | NO_SESSION, message.type)); |
| 12276 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
| 12277 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 12278 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12279 | "%s: not able to post WDA_LL_STATS_GET_REQ", |
| 12280 | __func__); |
| 12281 | qdf_mem_free(thresh); |
| 12282 | } |
| 12283 | sme_release_global_lock(&mac->sme); |
| 12284 | } else { |
| 12285 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12286 | FL("sme_acquire_global_lock error")); |
| 12287 | qdf_mem_free(thresh); |
| 12288 | } |
| 12289 | return status; |
| 12290 | } |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 12291 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12292 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 12293 | |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 12294 | #ifdef WLAN_POWER_DEBUGFS |
| 12295 | /** |
| 12296 | * sme_power_debug_stats_req() - SME API to collect Power debug stats |
| 12297 | * @callback_fn: Pointer to the callback function for Power stats event |
| 12298 | * @power_stats_context: Pointer to context |
| 12299 | * |
| 12300 | * Return: QDF_STATUS |
| 12301 | */ |
| 12302 | QDF_STATUS sme_power_debug_stats_req(tHalHandle hal, void (*callback_fn) |
| 12303 | (struct power_stats_response *response, |
| 12304 | void *context), void *power_stats_context) |
| 12305 | { |
| 12306 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12307 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12308 | struct scheduler_msg msg = {0}; |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 12309 | |
| 12310 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 12311 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 12312 | if (!callback_fn) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12313 | sme_err("Indication callback did not registered"); |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 12314 | sme_release_global_lock(&mac_ctx->sme); |
| 12315 | return QDF_STATUS_E_FAILURE; |
| 12316 | } |
| 12317 | |
| 12318 | mac_ctx->sme.power_debug_stats_context = power_stats_context; |
| 12319 | mac_ctx->sme.power_stats_resp_callback = callback_fn; |
| 12320 | msg.bodyptr = NULL; |
| 12321 | msg.type = WMA_POWER_DEBUG_STATS_REQ; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12322 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12323 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12324 | sme_err("not able to post WDA_POWER_DEBUG_STATS_REQ"); |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 12325 | sme_release_global_lock(&mac_ctx->sme); |
| 12326 | } |
| 12327 | return status; |
| 12328 | } |
| 12329 | #endif |
| 12330 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12331 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12332 | /* |
| 12333 | * sme_update_roam_offload_enabled() - enable/disable roam offload feaure |
| 12334 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 12335 | * |
| 12336 | * hHal - The handle returned by mac_open. |
| 12337 | * nRoamOffloadEnabled - The bool to update with |
| 12338 | * Return QDF_STATUS_SUCCESS - SME update config successfully. |
| 12339 | * Other status means SME is failed to update. |
| 12340 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12341 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12342 | QDF_STATUS sme_update_roam_offload_enabled(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12343 | bool nRoamOffloadEnabled) |
| 12344 | { |
| 12345 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12346 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12347 | |
| 12348 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12349 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 12350 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12351 | "%s: LFR3:gRoamOffloadEnabled is changed from %d to %d", |
| 12352 | __func__, pMac->roam.configParam.isRoamOffloadEnabled, |
| 12353 | nRoamOffloadEnabled); |
| 12354 | pMac->roam.configParam.isRoamOffloadEnabled = |
| 12355 | nRoamOffloadEnabled; |
| 12356 | sme_release_global_lock(&pMac->sme); |
| 12357 | } |
| 12358 | |
| 12359 | return status; |
| 12360 | } |
| 12361 | |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12362 | /** |
| 12363 | * sme_update_roam_key_mgmt_offload_enabled() - enable/disable key mgmt offload |
| 12364 | * This is a synchronous call |
| 12365 | * @hal_ctx: The handle returned by mac_open. |
| 12366 | * @session_id: Session Identifier |
| 12367 | * @key_mgmt_offload_enabled: key mgmt enable/disable flag |
Deepak Dhamdhere | 828f189 | 2017-02-09 11:51:19 -0800 | [diff] [blame] | 12368 | * @pmkid_modes: PMKID modes of PMKSA caching and OKC |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12369 | * Return: QDF_STATUS_SUCCESS - SME updated config successfully. |
| 12370 | * Other status means SME is failed to update. |
| 12371 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12372 | |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12373 | QDF_STATUS sme_update_roam_key_mgmt_offload_enabled(tHalHandle hal_ctx, |
Deepak Dhamdhere | 828f189 | 2017-02-09 11:51:19 -0800 | [diff] [blame] | 12374 | uint8_t session_id, |
| 12375 | bool key_mgmt_offload_enabled, |
| 12376 | struct pmkid_mode_bits *pmkid_modes) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12377 | { |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12378 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12379 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12380 | |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12381 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12382 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12383 | if (CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 12384 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12385 | "%s: LFR3: key_mgmt_offload_enabled changed to %d", |
| 12386 | __func__, key_mgmt_offload_enabled); |
| 12387 | status = csr_roam_set_key_mgmt_offload(mac_ctx, |
| 12388 | session_id, |
| 12389 | key_mgmt_offload_enabled, |
Deepak Dhamdhere | 828f189 | 2017-02-09 11:51:19 -0800 | [diff] [blame] | 12390 | pmkid_modes); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12391 | } else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12392 | status = QDF_STATUS_E_INVAL; |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12393 | sme_release_global_lock(&mac_ctx->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12394 | } |
| 12395 | |
| 12396 | return status; |
| 12397 | } |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 12398 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12399 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12400 | /* |
| 12401 | * sme_get_temperature() - |
| 12402 | * SME API to get the pdev temperature |
| 12403 | * |
| 12404 | * hHal |
| 12405 | * temperature context |
| 12406 | * pCallbackfn: callback fn with response (temperature) |
| 12407 | * Return QDF_STATUS |
| 12408 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12409 | QDF_STATUS sme_get_temperature(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12410 | void *tempContext, |
| 12411 | void (*pCallbackfn)(int temperature, |
| 12412 | void *pContext)) |
| 12413 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12414 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12415 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12416 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12417 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12418 | |
| 12419 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12420 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12421 | if ((NULL == pCallbackfn) && |
| 12422 | (NULL == pMac->sme.pGetTemperatureCb)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12423 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12424 | "Indication Call back did not registered"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12425 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12426 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12427 | } else if (NULL != pCallbackfn) { |
| 12428 | pMac->sme.pTemperatureCbContext = tempContext; |
| 12429 | pMac->sme.pGetTemperatureCb = pCallbackfn; |
| 12430 | } |
| 12431 | /* serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12432 | message.bodyptr = NULL; |
| 12433 | message.type = WMA_GET_TEMPERATURE_REQ; |
| 12434 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 12435 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12436 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12437 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12438 | FL("Post Get Temperature msg fail")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12439 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12440 | } |
| 12441 | sme_release_global_lock(&pMac->sme); |
| 12442 | } |
| 12443 | return status; |
| 12444 | } |
| 12445 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12446 | /* |
| 12447 | * sme_set_scanning_mac_oui() - |
| 12448 | * SME API to set scanning mac oui |
| 12449 | * |
| 12450 | * hHal |
| 12451 | * pScanMacOui: Scanning Mac Oui (input 3 bytes) |
| 12452 | * Return QDF_STATUS |
| 12453 | */ |
| 12454 | QDF_STATUS sme_set_scanning_mac_oui(tHalHandle hHal, tSirScanMacOui |
| 12455 | *pScanMacOui) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12456 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12457 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12458 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12459 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12460 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12461 | |
| 12462 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12463 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12464 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12465 | message.bodyptr = pScanMacOui; |
| 12466 | message.type = WMA_SET_SCAN_MAC_OUI_REQ; |
| 12467 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 12468 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12469 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12470 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12471 | FL("Msg post Set Scan Mac OUI failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12472 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12473 | } |
| 12474 | sme_release_global_lock(&pMac->sme); |
| 12475 | } |
| 12476 | return status; |
| 12477 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12478 | |
| 12479 | #ifdef DHCP_SERVER_OFFLOAD |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12480 | /* |
| 12481 | * sme_set_dhcp_srv_offload() - |
| 12482 | * SME API to set DHCP server offload info |
| 12483 | * |
| 12484 | * hHal |
| 12485 | * pDhcpSrvInfo : DHCP server offload info struct |
| 12486 | * Return QDF_STATUS |
| 12487 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12488 | QDF_STATUS sme_set_dhcp_srv_offload(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12489 | tSirDhcpSrvOffloadInfo *pDhcpSrvInfo) |
| 12490 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12491 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12492 | tSirDhcpSrvOffloadInfo *pSmeDhcpSrvInfo; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12493 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12494 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12495 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12496 | pSmeDhcpSrvInfo = qdf_mem_malloc(sizeof(*pSmeDhcpSrvInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12497 | |
| 12498 | if (!pSmeDhcpSrvInfo) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12499 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12500 | "%s: Not able to allocate memory for WMA_SET_DHCP_SERVER_OFFLOAD_CMD", |
| 12501 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12502 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12503 | } |
| 12504 | |
| 12505 | *pSmeDhcpSrvInfo = *pDhcpSrvInfo; |
| 12506 | |
| 12507 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12508 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12509 | /* serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12510 | message.type = WMA_SET_DHCP_SERVER_OFFLOAD_CMD; |
| 12511 | message.bodyptr = pSmeDhcpSrvInfo; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12512 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12513 | if (!QDF_IS_STATUS_SUCCESS |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12514 | (scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 12515 | &message))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12516 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 12517 | "%s:WMA_SET_DHCP_SERVER_OFFLOAD_CMD failed", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12518 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12519 | qdf_mem_free(pSmeDhcpSrvInfo); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12520 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12521 | } |
| 12522 | sme_release_global_lock(&pMac->sme); |
| 12523 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12524 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12525 | "%s: sme_acquire_global_lock error!", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12526 | qdf_mem_free(pSmeDhcpSrvInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12527 | } |
| 12528 | |
| 12529 | return status; |
| 12530 | } |
| 12531 | #endif /* DHCP_SERVER_OFFLOAD */ |
| 12532 | |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 12533 | QDF_STATUS sme_send_unit_test_cmd(uint32_t vdev_id, uint32_t module_id, |
| 12534 | uint32_t arg_count, uint32_t *arg) |
| 12535 | { |
| 12536 | return wma_form_unit_test_cmd_and_send(vdev_id, module_id, |
| 12537 | arg_count, arg); |
| 12538 | } |
| 12539 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12540 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12541 | /* |
| 12542 | * sme_set_led_flashing() - |
| 12543 | * API to set the Led flashing parameters. |
| 12544 | * |
| 12545 | * hHal - The handle returned by mac_open. |
| 12546 | * x0, x1 - led flashing parameters |
| 12547 | * Return QDF_STATUS |
| 12548 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12549 | QDF_STATUS sme_set_led_flashing(tHalHandle hHal, uint8_t type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12550 | uint32_t x0, uint32_t x1) |
| 12551 | { |
Jeff Johnson | 5a6b660 | 2017-10-04 14:44:30 -0700 | [diff] [blame] | 12552 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12553 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12554 | struct scheduler_msg message = {0}; |
Jeff Johnson | 5a6b660 | 2017-10-04 14:44:30 -0700 | [diff] [blame] | 12555 | struct flashing_req_params *ledflashing; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12556 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12557 | ledflashing = qdf_mem_malloc(sizeof(*ledflashing)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12558 | if (!ledflashing) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12559 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12560 | "Not able to allocate memory for WMA_LED_TIMING_REQ"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12561 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12562 | } |
| 12563 | |
Jeff Johnson | 5a6b660 | 2017-10-04 14:44:30 -0700 | [diff] [blame] | 12564 | ledflashing->req_id = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12565 | ledflashing->pattern_id = type; |
| 12566 | ledflashing->led_x0 = x0; |
| 12567 | ledflashing->led_x1 = x1; |
| 12568 | |
| 12569 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12570 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12571 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12572 | message.bodyptr = ledflashing; |
| 12573 | message.type = WMA_LED_FLASHING_REQ; |
Jeff Johnson | 5a6b660 | 2017-10-04 14:44:30 -0700 | [diff] [blame] | 12574 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12575 | sme_release_global_lock(&pMac->sme); |
| 12576 | } |
Jeff Johnson | 5a6b660 | 2017-10-04 14:44:30 -0700 | [diff] [blame] | 12577 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 12578 | qdf_mem_free(ledflashing); |
| 12579 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12580 | return status; |
| 12581 | } |
| 12582 | #endif |
| 12583 | |
| 12584 | /** |
| 12585 | * sme_handle_dfS_chan_scan() - handle DFS channel configuration |
| 12586 | * @h_hal: corestack handler |
| 12587 | * @dfs_flag: flag indicating dfs channel enable/disable |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12588 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12589 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12590 | 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] | 12591 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12592 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12593 | tpAniSirGlobal mac = PMAC_STRUCT(h_hal); |
| 12594 | |
| 12595 | status = sme_acquire_global_lock(&mac->sme); |
| 12596 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12597 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12598 | |
| 12599 | mac->scan.fEnableDFSChnlScan = dfs_flag; |
| 12600 | |
| 12601 | /* update the channel list to the firmware */ |
| 12602 | status = csr_update_channel_list(mac); |
| 12603 | |
| 12604 | sme_release_global_lock(&mac->sme); |
| 12605 | } |
| 12606 | |
| 12607 | return status; |
| 12608 | } |
| 12609 | |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 12610 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 12611 | /** |
| 12612 | * sme_validate_sap_channel_switch() - validate target channel switch w.r.t |
| 12613 | * concurreny rules set to avoid channel interference. |
| 12614 | * @hal - Hal context |
| 12615 | * @sap_ch - channel to switch |
| 12616 | * @sap_phy_mode - phy mode of SAP |
| 12617 | * @cc_switch_mode - concurreny switch mode |
| 12618 | * @session_id - sme session id. |
| 12619 | * |
| 12620 | * Return: true if there is no channel interference else return false |
| 12621 | */ |
| 12622 | bool sme_validate_sap_channel_switch(tHalHandle hal, |
| 12623 | uint16_t sap_ch, eCsrPhyMode sap_phy_mode, uint8_t cc_switch_mode, |
| 12624 | uint8_t session_id) |
| 12625 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12626 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 12627 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 12628 | struct csr_roam_session *session = CSR_GET_SESSION(mac, session_id); |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 12629 | uint16_t intf_channel = 0; |
| 12630 | |
| 12631 | if (!session) |
| 12632 | return false; |
| 12633 | |
| 12634 | session->ch_switch_in_progress = true; |
| 12635 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12636 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 12637 | intf_channel = csr_check_concurrent_channel_overlap(mac, sap_ch, |
| 12638 | sap_phy_mode, |
| 12639 | cc_switch_mode); |
| 12640 | sme_release_global_lock(&mac->sme); |
| 12641 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12642 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 12643 | FL("sme_acquire_global_lock error!")); |
| 12644 | session->ch_switch_in_progress = false; |
| 12645 | return false; |
| 12646 | } |
| 12647 | |
| 12648 | session->ch_switch_in_progress = false; |
| 12649 | return (intf_channel == 0) ? true : false; |
| 12650 | } |
| 12651 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12652 | |
| 12653 | /** |
| 12654 | * sme_configure_stats_avg_factor() - function to config avg. stats factor |
| 12655 | * @hal: hal |
| 12656 | * @session_id: session ID |
| 12657 | * @stats_avg_factor: average stats factor |
| 12658 | * |
| 12659 | * This function configures the stats avg factor in firmware |
| 12660 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12661 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12662 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12663 | 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] | 12664 | uint16_t stats_avg_factor) |
| 12665 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12666 | struct scheduler_msg msg = {0}; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12667 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12668 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 12669 | struct sir_stats_avg_factor *stats_factor; |
| 12670 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12671 | stats_factor = qdf_mem_malloc(sizeof(*stats_factor)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12672 | |
| 12673 | if (!stats_factor) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12674 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12675 | "%s: Not able to allocate memory for SIR_HAL_CONFIG_STATS_FACTOR", |
| 12676 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12677 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12678 | } |
| 12679 | |
| 12680 | status = sme_acquire_global_lock(&mac->sme); |
| 12681 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12682 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12683 | |
| 12684 | stats_factor->vdev_id = session_id; |
| 12685 | stats_factor->stats_avg_factor = stats_avg_factor; |
| 12686 | |
| 12687 | /* serialize the req through MC thread */ |
| 12688 | msg.type = SIR_HAL_CONFIG_STATS_FACTOR; |
| 12689 | msg.bodyptr = stats_factor; |
| 12690 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12691 | if (!QDF_IS_STATUS_SUCCESS( |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12692 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12693 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12694 | "%s: Not able to post SIR_HAL_CONFIG_STATS_FACTOR to WMA!", |
| 12695 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12696 | qdf_mem_free(stats_factor); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12697 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12698 | } |
| 12699 | sme_release_global_lock(&mac->sme); |
| 12700 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12701 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12702 | "%s: sme_acquire_global_lock error!", |
| 12703 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12704 | qdf_mem_free(stats_factor); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12705 | } |
| 12706 | |
| 12707 | return status; |
| 12708 | } |
| 12709 | |
| 12710 | /** |
| 12711 | * sme_configure_guard_time() - function to configure guard time |
| 12712 | * @hal: hal |
| 12713 | * @session_id: session id |
| 12714 | * @guard_time: guard time |
| 12715 | * |
| 12716 | * This function configures the guard time in firmware |
| 12717 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12718 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12719 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12720 | QDF_STATUS sme_configure_guard_time(tHalHandle hal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12721 | uint32_t guard_time) |
| 12722 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12723 | struct scheduler_msg msg = {0}; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12724 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12725 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 12726 | struct sir_guard_time_request *g_time; |
| 12727 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12728 | g_time = qdf_mem_malloc(sizeof(*g_time)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12729 | |
| 12730 | if (!g_time) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12731 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12732 | "%s: Not able to allocate memory for SIR_HAL_CONFIG_GUARD_TIME", |
| 12733 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12734 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12735 | } |
| 12736 | |
| 12737 | status = sme_acquire_global_lock(&mac->sme); |
| 12738 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12739 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12740 | |
| 12741 | g_time->vdev_id = session_id; |
| 12742 | g_time->guard_time = guard_time; |
| 12743 | |
| 12744 | /* serialize the req through MC thread */ |
| 12745 | msg.type = SIR_HAL_CONFIG_GUARD_TIME; |
| 12746 | msg.bodyptr = g_time; |
| 12747 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12748 | if (!QDF_IS_STATUS_SUCCESS( |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12749 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12750 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12751 | "%s: Not able to post SIR_HAL_CONFIG_GUARD_TIME to WMA!", |
| 12752 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12753 | qdf_mem_free(g_time); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12754 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12755 | } |
| 12756 | sme_release_global_lock(&mac->sme); |
| 12757 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12758 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12759 | "%s: sme_acquire_global_lock error!", |
| 12760 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12761 | qdf_mem_free(g_time); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12762 | } |
| 12763 | |
| 12764 | return status; |
| 12765 | } |
| 12766 | |
| 12767 | /** |
| 12768 | * sme_configure_modulated_dtim() - function to configure modulated dtim |
| 12769 | * @h_hal: SME API to enable/disable modulated DTIM instantaneously |
| 12770 | * @session_id: session ID |
| 12771 | * @modulated_dtim: modulated dtim value |
| 12772 | * |
| 12773 | * This function configures the modulated dtim in firmware |
| 12774 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12775 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12776 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12777 | 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] | 12778 | uint32_t modulated_dtim) |
| 12779 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12780 | struct scheduler_msg msg = {0}; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12781 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12782 | tpAniSirGlobal mac = PMAC_STRUCT(h_hal); |
| 12783 | wma_cli_set_cmd_t *iwcmd; |
| 12784 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12785 | iwcmd = qdf_mem_malloc(sizeof(*iwcmd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12786 | if (NULL == iwcmd) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12787 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 12788 | QDF_TRACE_LEVEL_FATAL, |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 12789 | "%s: qdf_mem_malloc failed", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12790 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12791 | } |
| 12792 | |
| 12793 | status = sme_acquire_global_lock(&mac->sme); |
| 12794 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12795 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12796 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12797 | iwcmd->param_value = modulated_dtim; |
| 12798 | iwcmd->param_vdev_id = session_id; |
| 12799 | iwcmd->param_id = GEN_PARAM_MODULATED_DTIM; |
| 12800 | iwcmd->param_vp_dev = GEN_CMD; |
| 12801 | msg.type = WMA_CLI_SET_CMD; |
| 12802 | msg.reserved = 0; |
| 12803 | msg.bodyptr = (void *)iwcmd; |
| 12804 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12805 | if (!QDF_IS_STATUS_SUCCESS( |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12806 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12807 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12808 | "%s: Not able to post GEN_PARAM_DYNAMIC_DTIM to WMA!", |
| 12809 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12810 | qdf_mem_free(iwcmd); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12811 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12812 | } |
| 12813 | sme_release_global_lock(&mac->sme); |
| 12814 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12815 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12816 | "%s: sme_acquire_global_lock error!", |
| 12817 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12818 | qdf_mem_free(iwcmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12819 | } |
| 12820 | |
| 12821 | return status; |
| 12822 | } |
| 12823 | |
Mukul Sharma | 6398b25 | 2017-05-01 17:58:12 +0530 | [diff] [blame] | 12824 | /** |
| 12825 | * sme_override_listen_interval() - function to override static LI |
| 12826 | * @h_hal: SME API to override listen interval |
| 12827 | * @session_id: session ID |
| 12828 | * @override_li: new LI value passed by user |
| 12829 | * |
| 12830 | * This function override (enable/disable) static a.k.a ini based LI |
| 12831 | * |
| 12832 | * Return: QDF_STATUS |
| 12833 | */ |
| 12834 | QDF_STATUS sme_override_listen_interval(tHalHandle h_hal, uint8_t session_id, |
| 12835 | uint32_t override_li) |
| 12836 | { |
| 12837 | struct scheduler_msg msg = {0}; |
| 12838 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12839 | tpAniSirGlobal mac = PMAC_STRUCT(h_hal); |
| 12840 | wma_cli_set_cmd_t *iwcmd; |
| 12841 | |
| 12842 | iwcmd = qdf_mem_malloc(sizeof(*iwcmd)); |
| 12843 | if (!iwcmd) { |
| 12844 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 12845 | QDF_TRACE_LEVEL_FATAL, |
| 12846 | "%s: qdf_mem_malloc failed", __func__); |
| 12847 | return QDF_STATUS_E_NOMEM; |
| 12848 | } |
| 12849 | |
| 12850 | status = sme_acquire_global_lock(&mac->sme); |
| 12851 | |
| 12852 | if (status == QDF_STATUS_SUCCESS) { |
| 12853 | |
| 12854 | iwcmd->param_value = override_li; |
| 12855 | iwcmd->param_vdev_id = session_id; |
| 12856 | iwcmd->param_id = GEN_PARAM_LISTEN_INTERVAL; |
| 12857 | iwcmd->param_vp_dev = GEN_CMD; |
| 12858 | msg.type = WMA_CLI_SET_CMD; |
| 12859 | msg.reserved = 0; |
| 12860 | msg.bodyptr = (void *)iwcmd; |
| 12861 | |
| 12862 | if (!QDF_IS_STATUS_SUCCESS( |
| 12863 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) { |
| 12864 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12865 | "%s: Can't post GEN_PARAM_LISTEN_INTERVAL", |
| 12866 | __func__); |
| 12867 | qdf_mem_free(iwcmd); |
| 12868 | status = QDF_STATUS_E_FAILURE; |
| 12869 | } |
| 12870 | sme_release_global_lock(&mac->sme); |
| 12871 | } else { |
| 12872 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12873 | "%s: sme_acquire_global_lock error!", |
| 12874 | __func__); |
| 12875 | qdf_mem_free(iwcmd); |
| 12876 | } |
| 12877 | |
| 12878 | return status; |
| 12879 | } |
| 12880 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12881 | /* |
| 12882 | * sme_wifi_start_logger() - Send the start/stop logging command to WMA |
| 12883 | * to either start/stop logging |
| 12884 | * @hal: HAL context |
| 12885 | * @start_log: Structure containing the wifi start logger params |
| 12886 | * |
| 12887 | * This function sends the start/stop logging command to WMA |
| 12888 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12889 | * Return: QDF_STATUS_SUCCESS on successful posting |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12890 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12891 | QDF_STATUS sme_wifi_start_logger(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12892 | struct sir_wifi_start_log start_log) |
| 12893 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12894 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12895 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12896 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12897 | struct sir_wifi_start_log *req_msg; |
| 12898 | uint32_t len; |
| 12899 | |
| 12900 | len = sizeof(*req_msg); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12901 | req_msg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12902 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12903 | sme_err("qdf_mem_malloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12904 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12905 | } |
| 12906 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12907 | req_msg->verbose_level = start_log.verbose_level; |
Poddar, Siddarth | eefe348 | 2016-09-21 18:12:59 +0530 | [diff] [blame] | 12908 | req_msg->is_iwpriv_command = start_log.is_iwpriv_command; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12909 | req_msg->ring_id = start_log.ring_id; |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 12910 | req_msg->ini_triggered = start_log.ini_triggered; |
| 12911 | req_msg->user_triggered = start_log.user_triggered; |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 12912 | req_msg->size = start_log.size; |
Poddar, Siddarth | ab99a27 | 2017-04-10 12:53:26 +0530 | [diff] [blame] | 12913 | req_msg->is_pktlog_buff_clear = start_log.is_pktlog_buff_clear; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12914 | |
| 12915 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12916 | if (status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12917 | sme_err("sme_acquire_global_lock failed(status=%d)", status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12918 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12919 | return status; |
| 12920 | } |
| 12921 | |
| 12922 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12923 | message.bodyptr = req_msg; |
| 12924 | message.type = SIR_HAL_START_STOP_LOGGING; |
| 12925 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12926 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12927 | sme_err("scheduler_post_msg failed!(err=%d)", status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12928 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12929 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12930 | } |
| 12931 | sme_release_global_lock(&mac->sme); |
| 12932 | |
| 12933 | return status; |
| 12934 | } |
| 12935 | |
| 12936 | /** |
| 12937 | * sme_neighbor_middle_of_roaming() - Function to know if |
| 12938 | * STA is in the middle of roaming states |
| 12939 | * @hal: Handle returned by macOpen |
| 12940 | * @sessionId: sessionId of the STA session |
| 12941 | * |
| 12942 | * This function is a wrapper to call |
| 12943 | * csr_neighbor_middle_of_roaming to know STA is in the |
| 12944 | * middle of roaming states |
| 12945 | * |
| 12946 | * Return: True or False |
| 12947 | * |
| 12948 | */ |
| 12949 | bool sme_neighbor_middle_of_roaming(tHalHandle hHal, uint8_t sessionId) |
| 12950 | { |
Sandeep Puligilla | ca63161 | 2016-11-08 11:53:52 -0800 | [diff] [blame] | 12951 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hHal); |
| 12952 | bool val = false; |
| 12953 | |
| 12954 | if (CSR_IS_SESSION_VALID(mac_ctx, sessionId)) |
| 12955 | val = csr_neighbor_middle_of_roaming(mac_ctx, sessionId); |
| 12956 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12957 | sme_err("Invalid Session: %d", sessionId); |
| 12958 | |
Sandeep Puligilla | ca63161 | 2016-11-08 11:53:52 -0800 | [diff] [blame] | 12959 | return val; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12960 | } |
| 12961 | |
| 12962 | /* |
| 12963 | * sme_send_flush_logs_cmd_to_fw() - Flush FW logs |
| 12964 | * @mac: MAC handle |
| 12965 | * |
| 12966 | * This function is used to send the command that will |
| 12967 | * be used to flush the logs in the firmware |
| 12968 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 12969 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12970 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12971 | QDF_STATUS sme_send_flush_logs_cmd_to_fw(tpAniSirGlobal mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12972 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12973 | QDF_STATUS status; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12974 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12975 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12976 | /* Serialize the req through MC thread */ |
| 12977 | message.bodyptr = NULL; |
| 12978 | message.type = SIR_HAL_FLUSH_LOG_TO_FW; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12979 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12980 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12981 | sme_err("scheduler_post_msg failed!(err=%d)", status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12982 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12983 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12984 | return status; |
| 12985 | } |
| 12986 | |
Jeff Johnson | a1e9261 | 2017-09-24 15:33:44 -0700 | [diff] [blame] | 12987 | QDF_STATUS sme_enable_uapsd_for_ac(uint8_t sta_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12988 | sme_ac_enum_type ac, uint8_t tid, |
| 12989 | uint8_t pri, uint32_t srvc_int, |
| 12990 | uint32_t sus_int, |
Abhishek Singh | 12be60f | 2017-08-11 13:52:42 +0530 | [diff] [blame] | 12991 | enum sme_qos_wmm_dir_type dir, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12992 | uint8_t psb, uint32_t sessionId, |
| 12993 | uint32_t delay_interval) |
| 12994 | { |
| 12995 | void *wma_handle; |
| 12996 | t_wma_trigger_uapsd_params uapsd_params; |
| 12997 | enum uapsd_ac access_category; |
| 12998 | |
| 12999 | if (!psb) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13000 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13001 | "No need to configure auto trigger:psb is 0"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13002 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13003 | } |
| 13004 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 13005 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13006 | if (!wma_handle) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13007 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13008 | "wma_handle is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13009 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13010 | } |
| 13011 | |
| 13012 | switch (ac) { |
| 13013 | case SME_AC_BK: |
| 13014 | access_category = UAPSD_BK; |
| 13015 | break; |
| 13016 | case SME_AC_BE: |
| 13017 | access_category = UAPSD_BE; |
| 13018 | break; |
| 13019 | case SME_AC_VI: |
| 13020 | access_category = UAPSD_VI; |
| 13021 | break; |
| 13022 | case SME_AC_VO: |
| 13023 | access_category = UAPSD_VO; |
| 13024 | break; |
| 13025 | default: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13026 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13027 | } |
| 13028 | |
| 13029 | uapsd_params.wmm_ac = access_category; |
| 13030 | uapsd_params.user_priority = pri; |
| 13031 | uapsd_params.service_interval = srvc_int; |
| 13032 | uapsd_params.delay_interval = delay_interval; |
| 13033 | uapsd_params.suspend_interval = sus_int; |
| 13034 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13035 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13036 | wma_trigger_uapsd_params(wma_handle, sessionId, &uapsd_params)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13037 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13038 | "Failed to Trigger Uapsd params for sessionId %d", |
| 13039 | sessionId); |
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 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13042 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13043 | } |
| 13044 | |
Jeff Johnson | a1e9261 | 2017-09-24 15:33:44 -0700 | [diff] [blame] | 13045 | QDF_STATUS sme_disable_uapsd_for_ac(uint8_t sta_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13046 | sme_ac_enum_type ac, |
| 13047 | uint32_t sessionId) |
| 13048 | { |
| 13049 | void *wma_handle; |
| 13050 | enum uapsd_ac access_category; |
| 13051 | |
| 13052 | switch (ac) { |
| 13053 | case SME_AC_BK: |
| 13054 | access_category = UAPSD_BK; |
| 13055 | break; |
| 13056 | case SME_AC_BE: |
| 13057 | access_category = UAPSD_BE; |
| 13058 | break; |
| 13059 | case SME_AC_VI: |
| 13060 | access_category = UAPSD_VI; |
| 13061 | break; |
| 13062 | case SME_AC_VO: |
| 13063 | access_category = UAPSD_VO; |
| 13064 | break; |
| 13065 | default: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13066 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13067 | } |
| 13068 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 13069 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13070 | if (!wma_handle) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13071 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13072 | "wma handle is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13073 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13074 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13075 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13076 | wma_disable_uapsd_per_ac(wma_handle, sessionId, access_category)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13077 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13078 | "Failed to disable uapsd for ac %d for sessionId %d", |
| 13079 | ac, sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13080 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13081 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13082 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13083 | } |
| 13084 | |
| 13085 | /** |
| 13086 | * sme_update_nss() - SME API to change the number for spatial streams |
| 13087 | * (1 or 2) |
| 13088 | * @hal: Handle returned by mac open |
| 13089 | * @nss: Number of spatial streams |
| 13090 | * |
| 13091 | * This function is used to update the number of spatial streams supported. |
| 13092 | * |
| 13093 | * Return: Success upon successfully changing nss else failure |
| 13094 | * |
| 13095 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13096 | QDF_STATUS sme_update_nss(tHalHandle h_hal, uint8_t nss) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13097 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13098 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13099 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(h_hal); |
| 13100 | uint32_t i, value = 0; |
| 13101 | union { |
| 13102 | uint16_t cfg_value16; |
| 13103 | tSirMacHTCapabilityInfo ht_cap_info; |
| 13104 | } uHTCapabilityInfo; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 13105 | struct csr_roam_session *csr_session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13106 | |
| 13107 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 13108 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13109 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13110 | mac_ctx->roam.configParam.enable2x2 = (nss == 1) ? 0 : 1; |
| 13111 | |
| 13112 | /* get the HT capability info*/ |
| 13113 | sme_cfg_get_int(mac_ctx, WNI_CFG_HT_CAP_INFO, &value); |
| 13114 | uHTCapabilityInfo.cfg_value16 = (0xFFFF & value); |
| 13115 | |
| 13116 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 13117 | if (CSR_IS_SESSION_VALID(mac_ctx, i)) { |
| 13118 | csr_session = &mac_ctx->roam.roamSession[i]; |
| 13119 | csr_session->htConfig.ht_tx_stbc = |
| 13120 | uHTCapabilityInfo.ht_cap_info.txSTBC; |
| 13121 | } |
| 13122 | } |
| 13123 | |
| 13124 | sme_release_global_lock(&mac_ctx->sme); |
| 13125 | } |
| 13126 | return status; |
| 13127 | } |
| 13128 | |
| 13129 | /** |
Archana Ramachandran | 5041b25 | 2016-04-25 14:29:25 -0700 | [diff] [blame] | 13130 | * sme_update_user_configured_nss() - sets the nss based on user request |
| 13131 | * @hal: Pointer to HAL |
| 13132 | * @nss: number of streams |
| 13133 | * |
| 13134 | * Return: None |
| 13135 | */ |
| 13136 | void sme_update_user_configured_nss(tHalHandle hal, uint8_t nss) |
| 13137 | { |
| 13138 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 13139 | |
| 13140 | mac_ctx->user_configured_nss = nss; |
| 13141 | } |
| 13142 | |
Kiran Kumar Lokere | 44a2943 | 2018-01-24 16:10:30 -0800 | [diff] [blame] | 13143 | #ifdef WLAN_FEATURE_11AX |
| 13144 | void sme_update_he_cap_nss(tHalHandle hal, uint8_t session_id, |
| 13145 | uint8_t nss) |
| 13146 | { |
| 13147 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 13148 | struct csr_roam_session *csr_session; |
| 13149 | uint32_t tx_mcs_map = 0; |
| 13150 | uint32_t rx_mcs_map = 0; |
| 13151 | |
| 13152 | if (!nss || (nss > 2)) { |
| 13153 | sme_err("invalid Nss value %d", nss); |
| 13154 | } |
| 13155 | csr_session = CSR_GET_SESSION(mac_ctx, session_id); |
| 13156 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_RX_MCS_MAP_LT_80, &rx_mcs_map); |
| 13157 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_TX_MCS_MAP_LT_80, &tx_mcs_map); |
| 13158 | if (nss == 1) { |
| 13159 | tx_mcs_map = HE_SET_MCS_4_NSS(tx_mcs_map, HE_MCS_DISABLE, 2); |
| 13160 | rx_mcs_map = HE_SET_MCS_4_NSS(rx_mcs_map, HE_MCS_DISABLE, 2); |
| 13161 | } else { |
| 13162 | tx_mcs_map = HE_SET_MCS_4_NSS(tx_mcs_map, HE_MCS_0_11, 2); |
| 13163 | rx_mcs_map = HE_SET_MCS_4_NSS(rx_mcs_map, HE_MCS_0_11, 2); |
| 13164 | } |
| 13165 | sme_info("new HE Nss MCS MAP: Rx 0x%0X, Tx: 0x%0X", |
| 13166 | rx_mcs_map, tx_mcs_map); |
| 13167 | sme_cfg_set_int(mac_ctx, WNI_CFG_HE_RX_MCS_MAP_LT_80, rx_mcs_map); |
| 13168 | sme_cfg_set_int(mac_ctx, WNI_CFG_HE_TX_MCS_MAP_LT_80, tx_mcs_map); |
| 13169 | csr_update_session_he_cap(mac_ctx, csr_session); |
| 13170 | |
| 13171 | } |
Kiran Kumar Lokere | 96246e5 | 2018-01-24 16:44:35 -0800 | [diff] [blame] | 13172 | |
| 13173 | int sme_update_he_mcs(tHalHandle hal, uint8_t session_id, uint16_t he_mcs) |
| 13174 | { |
| 13175 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 13176 | struct csr_roam_session *csr_session; |
| 13177 | uint16_t mcs_val = 0; |
| 13178 | uint16_t mcs_map = HE_MCS_ALL_DISABLED; |
| 13179 | uint32_t wni_cfg_tx_param = 0; |
| 13180 | uint32_t wni_cfg_rx_param = 0; |
| 13181 | |
| 13182 | csr_session = CSR_GET_SESSION(mac_ctx, session_id); |
| 13183 | if (!csr_session) { |
| 13184 | sme_err("No session for id %d", session_id); |
| 13185 | return -EINVAL; |
| 13186 | } |
| 13187 | if ((he_mcs & 0x3) == HE_MCS_DISABLE) { |
| 13188 | sme_err("Invalid HE MCS 0x%0x, can't disable 0-7 for 1ss", |
| 13189 | he_mcs); |
| 13190 | return -EINVAL; |
| 13191 | } |
| 13192 | mcs_val = he_mcs & 0x3; |
| 13193 | switch (he_mcs) { |
| 13194 | case HE_80_MCS0_7: |
| 13195 | case HE_80_MCS0_9: |
| 13196 | case HE_80_MCS0_11: |
| 13197 | if (mac_ctx->roam.configParam.enable2x2) { |
| 13198 | mcs_map = HE_SET_MCS_4_NSS(mcs_map, mcs_val, 1); |
| 13199 | mcs_map = HE_SET_MCS_4_NSS(mcs_map, mcs_val, 2); |
| 13200 | } else { |
| 13201 | mcs_map = HE_SET_MCS_4_NSS(mcs_map, mcs_val, 1); |
| 13202 | } |
| 13203 | wni_cfg_tx_param = WNI_CFG_HE_TX_MCS_MAP_LT_80; |
| 13204 | wni_cfg_rx_param = WNI_CFG_HE_RX_MCS_MAP_LT_80; |
| 13205 | break; |
| 13206 | |
| 13207 | case HE_160_MCS0_7: |
| 13208 | case HE_160_MCS0_9: |
| 13209 | case HE_160_MCS0_11: |
| 13210 | mcs_map = HE_SET_MCS_4_NSS(mcs_map, mcs_val, 1); |
| 13211 | wni_cfg_tx_param = WNI_CFG_HE_TX_MCS_MAP_160; |
| 13212 | wni_cfg_rx_param = WNI_CFG_HE_RX_MCS_MAP_160; |
| 13213 | break; |
| 13214 | |
| 13215 | case HE_80p80_MCS0_7: |
| 13216 | case HE_80p80_MCS0_9: |
| 13217 | case HE_80p80_MCS0_11: |
| 13218 | mcs_map = HE_SET_MCS_4_NSS(mcs_map, mcs_val, 1); |
| 13219 | wni_cfg_tx_param = WNI_CFG_HE_TX_MCS_MAP_80_80; |
| 13220 | wni_cfg_rx_param = WNI_CFG_HE_RX_MCS_MAP_80_80; |
| 13221 | break; |
| 13222 | |
| 13223 | default: |
| 13224 | sme_err("Invalid HE MCS 0x%0x", he_mcs); |
| 13225 | return -EINVAL; |
| 13226 | } |
| 13227 | sme_info("new HE MCS 0x%0x", mcs_map); |
| 13228 | sme_cfg_set_int(mac_ctx, wni_cfg_tx_param, mcs_map); |
| 13229 | sme_cfg_set_int(mac_ctx, wni_cfg_rx_param, mcs_map); |
| 13230 | csr_update_session_he_cap(mac_ctx, csr_session); |
| 13231 | |
| 13232 | return 0; |
| 13233 | } |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13234 | |
| 13235 | static int sme_update_he_cap(tHalHandle hal, uint8_t session_id, |
| 13236 | uint16_t he_cap, int value) |
| 13237 | { |
| 13238 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 13239 | struct csr_roam_session *session; |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13240 | |
| 13241 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 13242 | if (!session) { |
| 13243 | sme_err("No session for id %d", session_id); |
| 13244 | return -EINVAL; |
| 13245 | } |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13246 | sme_cfg_set_int(mac_ctx, he_cap, value); |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13247 | csr_update_session_he_cap(mac_ctx, session); |
| 13248 | |
| 13249 | return 0; |
| 13250 | } |
| 13251 | |
| 13252 | int sme_update_he_tx_stbc_cap(tHalHandle hal, uint8_t session_id, int value) |
| 13253 | { |
| 13254 | int ret; |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13255 | uint32_t he_cap_val = 0; |
| 13256 | |
| 13257 | he_cap_val = value ? 1 : 0; |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13258 | |
| 13259 | ret = sme_update_he_cap(hal, session_id, |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13260 | WNI_CFG_HE_TX_STBC_LT80, he_cap_val); |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13261 | if (ret) |
| 13262 | return ret; |
| 13263 | |
| 13264 | return sme_update_he_cap(hal, session_id, |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13265 | WNI_CFG_HE_TX_STBC_GT80, he_cap_val); |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13266 | } |
| 13267 | |
| 13268 | int sme_update_he_rx_stbc_cap(tHalHandle hal, uint8_t session_id, int value) |
| 13269 | { |
| 13270 | int ret; |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13271 | uint32_t he_cap_val = 0; |
| 13272 | |
| 13273 | he_cap_val = value ? 1 : 0; |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13274 | |
| 13275 | ret = sme_update_he_cap(hal, session_id, |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13276 | WNI_CFG_HE_RX_STBC_LT80, he_cap_val); |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13277 | if (ret) |
| 13278 | return ret; |
| 13279 | |
| 13280 | return sme_update_he_cap(hal, session_id, |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13281 | WNI_CFG_HE_RX_STBC_GT80, he_cap_val); |
| 13282 | } |
| 13283 | |
| 13284 | int sme_update_he_frag_supp(tHalHandle hal, uint8_t session_id, |
| 13285 | uint16_t he_frag) |
| 13286 | { |
| 13287 | return sme_update_he_cap(hal, session_id, |
| 13288 | WNI_CFG_HE_FRAGMENTATION, he_frag); |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13289 | } |
Kiran Kumar Lokere | 44a2943 | 2018-01-24 16:10:30 -0800 | [diff] [blame] | 13290 | #endif |
| 13291 | |
Archana Ramachandran | 5041b25 | 2016-04-25 14:29:25 -0700 | [diff] [blame] | 13292 | /** |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 13293 | * sme_set_nud_debug_stats_cb() - set nud debug stats callback |
| 13294 | * @hal: global hal handle |
| 13295 | * @cb: callback function pointer |
| 13296 | * |
| 13297 | * This function stores nud debug stats callback function. |
| 13298 | * |
| 13299 | * Return: QDF_STATUS enumeration. |
| 13300 | */ |
| 13301 | QDF_STATUS sme_set_nud_debug_stats_cb(tHalHandle hal, |
| 13302 | void (*cb)(void *, struct rsp_stats *)) |
| 13303 | { |
| 13304 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13305 | tpAniSirGlobal mac; |
| 13306 | |
| 13307 | if (!hal) { |
| 13308 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13309 | FL("hal is not valid")); |
| 13310 | return QDF_STATUS_E_INVAL; |
| 13311 | } |
| 13312 | mac = PMAC_STRUCT(hal); |
| 13313 | |
| 13314 | status = sme_acquire_global_lock(&mac->sme); |
| 13315 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 13316 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13317 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 13318 | status); |
| 13319 | return status; |
| 13320 | } |
| 13321 | |
| 13322 | mac->sme.get_arp_stats_cb = cb; |
| 13323 | sme_release_global_lock(&mac->sme); |
| 13324 | return status; |
| 13325 | } |
| 13326 | |
| 13327 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13328 | * sme_set_rssi_threshold_breached_cb() - set rssi threshold breached callback |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 13329 | * @h_hal: global hal handle |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13330 | * @cb: callback function pointer |
| 13331 | * |
| 13332 | * This function stores the rssi threshold breached callback function. |
| 13333 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13334 | * Return: QDF_STATUS enumeration. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13335 | */ |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 13336 | QDF_STATUS sme_set_rssi_threshold_breached_cb(tHalHandle h_hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13337 | void (*cb)(void *, struct rssi_breach_event *)) |
| 13338 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13339 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 13340 | tpAniSirGlobal mac; |
| 13341 | |
| 13342 | if (!h_hal) { |
| 13343 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13344 | FL("hHal is not valid")); |
| 13345 | return QDF_STATUS_E_INVAL; |
| 13346 | } |
| 13347 | mac = PMAC_STRUCT(h_hal); |
| 13348 | |
| 13349 | status = sme_acquire_global_lock(&mac->sme); |
| 13350 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 13351 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13352 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 13353 | status); |
| 13354 | return status; |
| 13355 | } |
| 13356 | |
| 13357 | mac->sme.rssi_threshold_breached_cb = cb; |
| 13358 | sme_release_global_lock(&mac->sme); |
| 13359 | return status; |
| 13360 | } |
| 13361 | |
| 13362 | /** |
| 13363 | * sme_set_rssi_threshold_breached_cb() - Reset rssi threshold breached callback |
| 13364 | * @hal: global hal handle |
| 13365 | * |
| 13366 | * This function de-registers the rssi threshold breached callback function. |
| 13367 | * |
| 13368 | * Return: QDF_STATUS enumeration. |
| 13369 | */ |
| 13370 | QDF_STATUS sme_reset_rssi_threshold_breached_cb(tHalHandle hal) |
| 13371 | { |
| 13372 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13373 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 13374 | |
| 13375 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13376 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13377 | sme_err("sme_acquire_global_lock failed!(status=%d)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13378 | return status; |
| 13379 | } |
| 13380 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 13381 | mac->sme.rssi_threshold_breached_cb = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13382 | sme_release_global_lock(&mac->sme); |
| 13383 | return status; |
| 13384 | } |
| 13385 | |
| 13386 | /** |
| 13387 | * sme_is_any_session_in_connected_state() - SME wrapper API to |
| 13388 | * check if any session is in connected state or not. |
| 13389 | * |
| 13390 | * @hal: Handle returned by mac open |
| 13391 | * |
| 13392 | * This function is used to check if any valid sme session is in |
| 13393 | * connected state or not. |
| 13394 | * |
| 13395 | * Return: true if any session is connected, else false. |
| 13396 | * |
| 13397 | */ |
| 13398 | bool sme_is_any_session_in_connected_state(tHalHandle h_hal) |
| 13399 | { |
| 13400 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(h_hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13401 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13402 | bool ret = false; |
| 13403 | |
| 13404 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13405 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13406 | ret = csr_is_any_session_in_connect_state(mac_ctx); |
| 13407 | sme_release_global_lock(&mac_ctx->sme); |
| 13408 | } |
| 13409 | return ret; |
| 13410 | } |
| 13411 | |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 13412 | QDF_STATUS sme_set_chip_pwr_save_fail_cb(tHalHandle hal, |
| 13413 | void (*cb)(void *, |
| 13414 | struct chip_pwr_save_fail_detected_params *)) { |
| 13415 | |
| 13416 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13417 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 13418 | |
| 13419 | status = sme_acquire_global_lock(&mac->sme); |
| 13420 | if (status != QDF_STATUS_SUCCESS) { |
| 13421 | sme_err("sme_AcquireGlobalLock failed!(status=%d)", status); |
| 13422 | return status; |
| 13423 | } |
| 13424 | mac->sme.chip_power_save_fail_cb = cb; |
| 13425 | sme_release_global_lock(&mac->sme); |
| 13426 | return status; |
| 13427 | } |
| 13428 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13429 | /** |
| 13430 | * sme_set_rssi_monitoring() - set rssi monitoring |
| 13431 | * @hal: global hal handle |
| 13432 | * @input: request message |
| 13433 | * |
| 13434 | * This function constructs the vos message and fill in message type, |
| 13435 | * bodyptr with @input and posts it to WDA queue. |
| 13436 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13437 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13438 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13439 | QDF_STATUS sme_set_rssi_monitoring(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13440 | struct rssi_monitor_req *input) |
| 13441 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13442 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13443 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 13444 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13445 | struct rssi_monitor_req *req_msg; |
| 13446 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13447 | SME_ENTER(); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13448 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13449 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13450 | sme_err("memory allocation failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13451 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13452 | } |
| 13453 | |
| 13454 | *req_msg = *input; |
| 13455 | |
| 13456 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13457 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13458 | sme_err("sme_acquire_global_lock failed!(status=%d)", status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13459 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13460 | return status; |
| 13461 | } |
| 13462 | |
| 13463 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 13464 | message.bodyptr = req_msg; |
| 13465 | message.type = WMA_SET_RSSI_MONITOR_REQ; |
| 13466 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13467 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13468 | sme_err("scheduler_post_msg failed!(err=%d)", status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13469 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13470 | } |
| 13471 | sme_release_global_lock(&mac->sme); |
| 13472 | |
| 13473 | return status; |
| 13474 | } |
| 13475 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13476 | /* |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 13477 | * 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] | 13478 | * @hal: Handle returned by macOpen |
| 13479 | * @msg: PCL channel list and length structure |
| 13480 | * |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 13481 | * 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] | 13482 | * Return: QDF_STATUS_SUCCESS on successful posting |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13483 | */ |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13484 | QDF_STATUS sme_pdev_set_pcl(struct policy_mgr_pcl_list msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13485 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13486 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13487 | tpAniSirGlobal mac = sme_get_mac_context(); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 13488 | struct scheduler_msg message = {0}; |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 13489 | struct wmi_pcl_chan_weights *req_msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13490 | uint32_t len, i; |
| 13491 | |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 13492 | if (!mac) { |
| 13493 | sme_err("mac is NULL"); |
| 13494 | return QDF_STATUS_E_FAILURE; |
| 13495 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13496 | len = sizeof(*req_msg); |
| 13497 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13498 | req_msg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13499 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13500 | sme_err("qdf_mem_malloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13501 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13502 | } |
| 13503 | |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 13504 | for (i = 0; i < msg.pcl_len; i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13505 | req_msg->pcl_list[i] = msg.pcl_list[i]; |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 13506 | req_msg->weight_list[i] = msg.weight_list[i]; |
| 13507 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13508 | |
| 13509 | req_msg->pcl_len = msg.pcl_len; |
| 13510 | |
| 13511 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13512 | if (status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13513 | sme_err("sme_acquire_global_lock failed!(status=%d)", status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13514 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13515 | return status; |
| 13516 | } |
| 13517 | |
| 13518 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 13519 | message.bodyptr = req_msg; |
| 13520 | message.type = SIR_HAL_PDEV_SET_PCL_TO_FW; |
| 13521 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13522 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13523 | sme_err("scheduler_post_msg failed!(err=%d)", status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13524 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13525 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13526 | } |
| 13527 | sme_release_global_lock(&mac->sme); |
| 13528 | |
| 13529 | return status; |
| 13530 | } |
| 13531 | |
| 13532 | /* |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 13533 | * 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] | 13534 | * @hal: Handle returned by macOpen |
| 13535 | * @msg: HW mode structure containing hw mode and callback details |
| 13536 | * |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 13537 | * 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] | 13538 | * Return: QDF_STATUS_SUCCESS on successful posting |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13539 | */ |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13540 | QDF_STATUS sme_pdev_set_hw_mode(struct policy_mgr_hw_mode msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13541 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13542 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13543 | tpAniSirGlobal mac = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13544 | tSmeCmd *cmd = NULL; |
| 13545 | |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 13546 | if (!mac) { |
| 13547 | sme_err("mac is NULL"); |
| 13548 | return QDF_STATUS_E_FAILURE; |
| 13549 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13550 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13551 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13552 | sme_err("Failed to acquire lock"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13553 | return QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13554 | } |
| 13555 | |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 13556 | cmd = csr_get_command_buffer(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13557 | if (!cmd) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13558 | sme_err("Get command buffer failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13559 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13560 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13561 | } |
| 13562 | |
| 13563 | cmd->command = e_sme_command_set_hw_mode; |
Ganesh Kondabattini | ae1c6a2 | 2017-05-02 18:02:11 +0530 | [diff] [blame] | 13564 | cmd->sessionId = msg.session_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13565 | cmd->u.set_hw_mode_cmd.hw_mode_index = msg.hw_mode_index; |
| 13566 | 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] | 13567 | cmd->u.set_hw_mode_cmd.reason = msg.reason; |
| 13568 | cmd->u.set_hw_mode_cmd.session_id = msg.session_id; |
Tushnim Bhattacharyya | eab33dd | 2017-11-15 15:20:02 -0800 | [diff] [blame] | 13569 | cmd->u.set_hw_mode_cmd.next_action = msg.next_action; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13570 | cmd->u.set_hw_mode_cmd.context = msg.context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13571 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13572 | sme_debug("Queuing set hw mode to CSR, session: %d reason: %d", |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 13573 | cmd->u.set_hw_mode_cmd.session_id, |
| 13574 | cmd->u.set_hw_mode_cmd.reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13575 | csr_queue_sme_command(mac, cmd, false); |
| 13576 | |
| 13577 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13578 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13579 | } |
| 13580 | |
| 13581 | /** |
| 13582 | * sme_register_hw_mode_trans_cb() - HW mode transition callback registration |
| 13583 | * @hal: Handle returned by macOpen |
| 13584 | * @callback: HDD callback to be registered |
| 13585 | * |
| 13586 | * Registers the HDD callback with SME. This callback will be invoked when |
| 13587 | * HW mode transition event is received from the FW |
| 13588 | * |
| 13589 | * Return: None |
| 13590 | */ |
| 13591 | void sme_register_hw_mode_trans_cb(tHalHandle hal, |
| 13592 | hw_mode_transition_cb callback) |
| 13593 | { |
| 13594 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 13595 | |
| 13596 | mac->sme.sme_hw_mode_trans_cb = callback; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13597 | } |
| 13598 | |
| 13599 | /** |
| 13600 | * sme_nss_update_request() - Send beacon templete update to FW with new |
| 13601 | * nss value |
| 13602 | * @hal: Handle returned by macOpen |
| 13603 | * @vdev_id: the session id |
| 13604 | * @new_nss: the new nss value |
| 13605 | * @cback: hdd callback |
| 13606 | * @next_action: next action to happen at policy mgr after beacon update |
| 13607 | * |
| 13608 | * Sends the command to CSR to send to PE |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13609 | * Return: QDF_STATUS_SUCCESS on successful posting |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13610 | */ |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13611 | QDF_STATUS sme_nss_update_request(uint32_t vdev_id, |
| 13612 | uint8_t new_nss, policy_mgr_nss_update_cback cback, |
| 13613 | uint8_t next_action, struct wlan_objmgr_psoc *psoc, |
| 13614 | enum policy_mgr_conn_update_reason reason) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13615 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13616 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13617 | tpAniSirGlobal mac = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13618 | tSmeCmd *cmd = NULL; |
| 13619 | |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 13620 | if (!mac) { |
| 13621 | sme_err("mac is null"); |
| 13622 | return status; |
| 13623 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13624 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13625 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 13626 | cmd = csr_get_command_buffer(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13627 | if (!cmd) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13628 | sme_err("Get command buffer failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13629 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13630 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13631 | } |
| 13632 | cmd->command = e_sme_command_nss_update; |
| 13633 | /* Sessionized modules may require this info */ |
| 13634 | cmd->sessionId = vdev_id; |
| 13635 | cmd->u.nss_update_cmd.new_nss = new_nss; |
| 13636 | cmd->u.nss_update_cmd.session_id = vdev_id; |
| 13637 | cmd->u.nss_update_cmd.nss_update_cb = cback; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13638 | cmd->u.nss_update_cmd.context = psoc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13639 | cmd->u.nss_update_cmd.next_action = next_action; |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 13640 | cmd->u.nss_update_cmd.reason = reason; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13641 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13642 | sme_debug("Queuing e_sme_command_nss_update to CSR"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13643 | csr_queue_sme_command(mac, cmd, false); |
| 13644 | sme_release_global_lock(&mac->sme); |
| 13645 | } |
| 13646 | return status; |
| 13647 | } |
| 13648 | |
| 13649 | /** |
| 13650 | * sme_soc_set_dual_mac_config() - Set dual mac configurations |
| 13651 | * @hal: Handle returned by macOpen |
| 13652 | * @msg: Structure containing the dual mac config parameters |
| 13653 | * |
| 13654 | * Queues configuration information to CSR to configure |
| 13655 | * WLAN firmware for the dual MAC features |
| 13656 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13657 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13658 | */ |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13659 | QDF_STATUS sme_soc_set_dual_mac_config(struct policy_mgr_dual_mac_config msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13660 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13661 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13662 | tpAniSirGlobal mac = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13663 | tSmeCmd *cmd; |
| 13664 | |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 13665 | if (!mac) { |
| 13666 | sme_err("mac is null"); |
| 13667 | return QDF_STATUS_E_FAILURE; |
| 13668 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13669 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13670 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13671 | sme_err("Failed to acquire lock"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13672 | return QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13673 | } |
| 13674 | |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 13675 | cmd = csr_get_command_buffer(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13676 | if (!cmd) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13677 | sme_err("Get command buffer failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13678 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13679 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13680 | } |
| 13681 | |
| 13682 | cmd->command = e_sme_command_set_dual_mac_config; |
| 13683 | cmd->u.set_dual_mac_cmd.scan_config = msg.scan_config; |
| 13684 | cmd->u.set_dual_mac_cmd.fw_mode_config = msg.fw_mode_config; |
| 13685 | cmd->u.set_dual_mac_cmd.set_dual_mac_cb = msg.set_dual_mac_cb; |
| 13686 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13687 | sme_debug("set_dual_mac_config scan_config: %x fw_mode_config: %x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13688 | cmd->u.set_dual_mac_cmd.scan_config, |
| 13689 | cmd->u.set_dual_mac_cmd.fw_mode_config); |
| 13690 | csr_queue_sme_command(mac, cmd, false); |
| 13691 | |
| 13692 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13693 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13694 | } |
| 13695 | |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13696 | #ifdef FEATURE_LFR_SUBNET_DETECTION |
| 13697 | /** |
| 13698 | * sme_gateway_param_update() - to update gateway parameters with WMA |
| 13699 | * @Hal: hal handle |
| 13700 | * @gw_params: request parameters from HDD |
| 13701 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13702 | * Return: QDF_STATUS |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13703 | * |
| 13704 | * This routine will update gateway parameters to WMA |
| 13705 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13706 | QDF_STATUS sme_gateway_param_update(tHalHandle Hal, |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13707 | struct gateway_param_update_req *gw_params) |
| 13708 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13709 | QDF_STATUS qdf_status; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 13710 | struct scheduler_msg message = {0}; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13711 | struct gateway_param_update_req *request_buf; |
| 13712 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13713 | request_buf = qdf_mem_malloc(sizeof(*request_buf)); |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13714 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13715 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 13716 | "Not able to allocate memory for gw param update request"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13717 | return QDF_STATUS_E_NOMEM; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13718 | } |
| 13719 | |
| 13720 | *request_buf = *gw_params; |
| 13721 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 13722 | message.type = WMA_GW_PARAM_UPDATE_REQ; |
| 13723 | message.reserved = 0; |
| 13724 | message.bodyptr = request_buf; |
| 13725 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13726 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13727 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 13728 | "Not able to post WMA_GW_PARAM_UPDATE_REQ message to HAL"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13729 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13730 | return QDF_STATUS_E_FAILURE; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13731 | } |
| 13732 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13733 | return QDF_STATUS_SUCCESS; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13734 | } |
| 13735 | #endif /* FEATURE_LFR_SUBNET_DETECTION */ |
| 13736 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13737 | /** |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 13738 | * sme_soc_set_antenna_mode() - set antenna mode |
| 13739 | * @hal: Handle returned by macOpen |
| 13740 | * @msg: Structure containing the antenna mode parameters |
| 13741 | * |
| 13742 | * Send the command to CSR to send |
| 13743 | * WMI_SOC_SET_ANTENNA_MODE_CMDID to FW |
| 13744 | * |
| 13745 | * Return: QDF_STATUS |
| 13746 | */ |
| 13747 | QDF_STATUS sme_soc_set_antenna_mode(tHalHandle hal, |
| 13748 | struct sir_antenna_mode_param *msg) |
| 13749 | { |
| 13750 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13751 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 13752 | tSmeCmd *cmd; |
| 13753 | |
| 13754 | if (NULL == msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13755 | sme_err("antenna mode mesg is NULL"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 13756 | return QDF_STATUS_E_FAILURE; |
| 13757 | } |
| 13758 | |
| 13759 | status = sme_acquire_global_lock(&mac->sme); |
| 13760 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13761 | sme_err("Failed to acquire lock"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 13762 | return QDF_STATUS_E_RESOURCES; |
| 13763 | } |
| 13764 | |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 13765 | cmd = csr_get_command_buffer(mac); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 13766 | if (!cmd) { |
| 13767 | sme_release_global_lock(&mac->sme); |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13768 | sme_err("Get command buffer failed"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 13769 | return QDF_STATUS_E_NULL_VALUE; |
| 13770 | } |
| 13771 | |
| 13772 | cmd->command = e_sme_command_set_antenna_mode; |
| 13773 | cmd->u.set_antenna_mode_cmd = *msg; |
| 13774 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13775 | sme_debug("Antenna mode rx_chains: %d tx_chains: %d", |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 13776 | cmd->u.set_antenna_mode_cmd.num_rx_chains, |
| 13777 | cmd->u.set_antenna_mode_cmd.num_tx_chains); |
| 13778 | |
| 13779 | csr_queue_sme_command(mac, cmd, false); |
| 13780 | sme_release_global_lock(&mac->sme); |
| 13781 | |
| 13782 | return QDF_STATUS_SUCCESS; |
| 13783 | } |
| 13784 | |
| 13785 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13786 | * sme_set_peer_authorized() - call peer authorized callback |
| 13787 | * @peer_addr: peer mac address |
| 13788 | * @auth_cb: auth callback |
| 13789 | * @vdev_id: vdev id |
| 13790 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 13791 | * Return: QDF Status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13792 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13793 | QDF_STATUS sme_set_peer_authorized(uint8_t *peer_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13794 | sme_peer_authorized_fp auth_cb, |
| 13795 | uint32_t vdev_id) |
| 13796 | { |
| 13797 | void *wma_handle; |
| 13798 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 13799 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13800 | if (!wma_handle) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13801 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13802 | "wma handle is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13803 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13804 | } |
| 13805 | |
| 13806 | wma_set_peer_authorized_cb(wma_handle, auth_cb); |
| 13807 | return wma_set_peer_param(wma_handle, peer_addr, WMI_PEER_AUTHORIZE, |
| 13808 | 1, vdev_id); |
| 13809 | } |
| 13810 | |
| 13811 | /* |
Amar Singhal | 7c1e898 | 2016-05-19 15:08:09 -0700 | [diff] [blame] | 13812 | * 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] | 13813 | * @hal: HAL pointer |
Amar Singhal | 83a047a | 2016-05-19 15:56:11 -0700 | [diff] [blame] | 13814 | * @fcc_constraint: flag to enable/disable the constraint |
| 13815 | * @scan_pending: whether there is pending scan |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13816 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13817 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13818 | */ |
Amar Singhal | 83a047a | 2016-05-19 15:56:11 -0700 | [diff] [blame] | 13819 | QDF_STATUS sme_handle_set_fcc_channel(tHalHandle hal, bool fcc_constraint, |
| 13820 | bool scan_pending) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13821 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13822 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13823 | tpAniSirGlobal mac_ptr = PMAC_STRUCT(hal); |
| 13824 | |
| 13825 | status = sme_acquire_global_lock(&mac_ptr->sme); |
| 13826 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13827 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13828 | |
| 13829 | if (fcc_constraint != mac_ptr->scan.fcc_constraint) { |
| 13830 | mac_ptr->scan.fcc_constraint = fcc_constraint; |
Amar Singhal | 83a047a | 2016-05-19 15:56:11 -0700 | [diff] [blame] | 13831 | if (scan_pending) |
| 13832 | mac_ptr->scan.defer_update_channel_list = true; |
| 13833 | else |
| 13834 | status = csr_update_channel_list(mac_ptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13835 | } |
| 13836 | |
| 13837 | sme_release_global_lock(&mac_ptr->sme); |
| 13838 | } |
| 13839 | |
| 13840 | return status; |
| 13841 | } |
| 13842 | /** |
| 13843 | * sme_setdef_dot11mode() - Updates pMac with default dot11mode |
| 13844 | * @hal: Global MAC pointer |
| 13845 | * |
| 13846 | * Return: NULL. |
| 13847 | */ |
| 13848 | void sme_setdef_dot11mode(tHalHandle hal) |
| 13849 | { |
| 13850 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 13851 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13852 | csr_set_default_dot11_mode(mac_ctx); |
| 13853 | } |
| 13854 | |
| 13855 | /** |
| 13856 | * sme_update_roam_scan_hi_rssi_scan_params() - update high rssi scan |
| 13857 | * params |
| 13858 | * @hal_handle - The handle returned by macOpen. |
| 13859 | * @session_id - Session Identifier |
| 13860 | * @notify_id - Identifies 1 of the 4 parameters to be modified |
| 13861 | * @val New value of the parameter |
| 13862 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13863 | * Return: QDF_STATUS - SME update config successful. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13864 | * Other status means SME failed to update |
| 13865 | */ |
| 13866 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13867 | 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] | 13868 | uint8_t session_id, |
| 13869 | uint32_t notify_id, |
| 13870 | int32_t val) |
| 13871 | { |
| 13872 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13873 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 13874 | struct csr_neighbor_roamconfig *nr_config = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13875 | tpCsrNeighborRoamControlInfo nr_info = NULL; |
| 13876 | uint32_t reason = 0; |
| 13877 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 13878 | if (session_id >= CSR_ROAM_SESSION_MAX) { |
| 13879 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13880 | FL("Invalid sme session id: %d"), session_id); |
| 13881 | return QDF_STATUS_E_INVAL; |
| 13882 | } |
| 13883 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13884 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13885 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13886 | nr_config = &mac_ctx->roam.configParam.neighborRoamConfig; |
| 13887 | nr_info = &mac_ctx->roam.neighborRoamInfo[session_id]; |
| 13888 | switch (notify_id) { |
| 13889 | case eCSR_HI_RSSI_SCAN_MAXCOUNT_ID: |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 13890 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13891 | "%s: gRoamScanHirssiMaxCount %d => %d", |
| 13892 | __func__, nr_config->nhi_rssi_scan_max_count, |
| 13893 | val); |
| 13894 | nr_config->nhi_rssi_scan_max_count = val; |
| 13895 | nr_info->cfgParams.hi_rssi_scan_max_count = val; |
| 13896 | reason = REASON_ROAM_SCAN_HI_RSSI_MAXCOUNT_CHANGED; |
| 13897 | break; |
| 13898 | |
| 13899 | case eCSR_HI_RSSI_SCAN_RSSI_DELTA_ID: |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 13900 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13901 | FL("gRoamScanHiRssiDelta %d => %d"), |
| 13902 | nr_config->nhi_rssi_scan_rssi_delta, |
| 13903 | val); |
| 13904 | nr_config->nhi_rssi_scan_rssi_delta = val; |
| 13905 | nr_info->cfgParams.hi_rssi_scan_rssi_delta = val; |
| 13906 | reason = REASON_ROAM_SCAN_HI_RSSI_DELTA_CHANGED; |
| 13907 | break; |
| 13908 | |
| 13909 | case eCSR_HI_RSSI_SCAN_DELAY_ID: |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 13910 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13911 | FL("gRoamScanHiRssiDelay %d => %d"), |
| 13912 | nr_config->nhi_rssi_scan_delay, |
| 13913 | val); |
| 13914 | nr_config->nhi_rssi_scan_delay = val; |
| 13915 | nr_info->cfgParams.hi_rssi_scan_delay = val; |
| 13916 | reason = REASON_ROAM_SCAN_HI_RSSI_DELAY_CHANGED; |
| 13917 | break; |
| 13918 | |
| 13919 | case eCSR_HI_RSSI_SCAN_RSSI_UB_ID: |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 13920 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13921 | FL("gRoamScanHiRssiUpperBound %d => %d"), |
| 13922 | nr_config->nhi_rssi_scan_rssi_ub, |
| 13923 | val); |
| 13924 | nr_config->nhi_rssi_scan_rssi_ub = val; |
| 13925 | nr_info->cfgParams.hi_rssi_scan_rssi_ub = val; |
| 13926 | reason = REASON_ROAM_SCAN_HI_RSSI_UB_CHANGED; |
| 13927 | break; |
| 13928 | |
| 13929 | default: |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 13930 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13931 | FL("invalid parameter notify_id %d"), |
| 13932 | notify_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13933 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13934 | break; |
| 13935 | } |
| 13936 | sme_release_global_lock(&mac_ctx->sme); |
| 13937 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13938 | if (mac_ctx->roam.configParam.isRoamOffloadScanEnabled && |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13939 | status == QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13940 | csr_roam_offload_scan(mac_ctx, session_id, |
| 13941 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, reason); |
| 13942 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13943 | |
| 13944 | return status; |
| 13945 | } |
| 13946 | |
Krishna Kumaar Natarajan | 052c6e6 | 2015-09-28 15:32:55 -0700 | [diff] [blame] | 13947 | /** |
| 13948 | * sme_update_tgt_services() - update the target services config. |
| 13949 | * @hal: HAL pointer. |
| 13950 | * @cfg: wma_tgt_services parameters. |
| 13951 | * |
| 13952 | * update the target services config. |
| 13953 | * |
| 13954 | * Return: None. |
| 13955 | */ |
| 13956 | void sme_update_tgt_services(tHalHandle hal, struct wma_tgt_services *cfg) |
| 13957 | { |
| 13958 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 13959 | |
Krunal Soni | e6a1cda | 2017-09-27 15:23:02 -0700 | [diff] [blame] | 13960 | mac_ctx->lteCoexAntShare = cfg->lte_coex_ant_share; |
Krishna Kumaar Natarajan | 052c6e6 | 2015-09-28 15:32:55 -0700 | [diff] [blame] | 13961 | mac_ctx->beacon_offload = cfg->beacon_offload; |
mukul sharma | 72c8b22 | 2015-09-04 17:02:01 +0530 | [diff] [blame] | 13962 | mac_ctx->pmf_offload = cfg->pmf_offload; |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 13963 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
mukul sharma | 72c8b22 | 2015-09-04 17:02:01 +0530 | [diff] [blame] | 13964 | FL("mac_ctx->pmf_offload: %d"), mac_ctx->pmf_offload); |
Vignesh Viswanathan | 731186f | 2017-09-18 13:47:37 +0530 | [diff] [blame] | 13965 | mac_ctx->is_fils_roaming_supported = |
| 13966 | cfg->is_fils_roaming_supported; |
Vignesh Viswanathan | 694e28e | 2018-01-18 20:53:57 +0530 | [diff] [blame] | 13967 | mac_ctx->is_11k_offload_supported = |
| 13968 | cfg->is_11k_offload_supported; |
| 13969 | sme_debug("pmf_offload: %d fils_roam support %d 11k_offload %d", |
| 13970 | mac_ctx->pmf_offload, mac_ctx->is_fils_roaming_supported, |
| 13971 | mac_ctx->is_11k_offload_supported); |
Krishna Kumaar Natarajan | 052c6e6 | 2015-09-28 15:32:55 -0700 | [diff] [blame] | 13972 | } |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 13973 | |
Chandrasekaran, Manishekar | 2859de4 | 2016-02-11 16:17:38 +0530 | [diff] [blame] | 13974 | /** |
| 13975 | * sme_is_session_id_valid() - Check if the session id is valid |
| 13976 | * @hal: Pointer to HAL |
| 13977 | * @session_id: Session id |
| 13978 | * |
| 13979 | * Checks if the session id is valid or not |
| 13980 | * |
| 13981 | * Return: True is the session id is valid, false otherwise |
| 13982 | */ |
| 13983 | bool sme_is_session_id_valid(tHalHandle hal, uint32_t session_id) |
| 13984 | { |
| 13985 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 13986 | |
Chandrasekaran, Manishekar | 2859de4 | 2016-02-11 16:17:38 +0530 | [diff] [blame] | 13987 | if (!mac) { |
Chandrasekaran, Manishekar | d3cb477 | 2016-02-22 22:21:10 +0530 | [diff] [blame] | 13988 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13989 | "%s: null mac pointer", __func__); |
Chandrasekaran, Manishekar | 2859de4 | 2016-02-11 16:17:38 +0530 | [diff] [blame] | 13990 | return false; |
| 13991 | } |
| 13992 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 13993 | if (CSR_IS_SESSION_VALID(mac, session_id)) |
Chandrasekaran, Manishekar | 2859de4 | 2016-02-11 16:17:38 +0530 | [diff] [blame] | 13994 | return true; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 13995 | |
| 13996 | return false; |
Chandrasekaran, Manishekar | 2859de4 | 2016-02-11 16:17:38 +0530 | [diff] [blame] | 13997 | } |
| 13998 | |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 13999 | #ifdef FEATURE_WLAN_TDLS |
| 14000 | |
| 14001 | /** |
| 14002 | * sme_get_opclass() - determine operating class |
| 14003 | * @hal: Pointer to HAL |
| 14004 | * @channel: channel id |
| 14005 | * @bw_offset: bandwidth offset |
| 14006 | * @opclass: pointer to operating class |
| 14007 | * |
| 14008 | * Function will determine operating class from regdm_get_opclass_from_channel |
| 14009 | * |
| 14010 | * Return: none |
| 14011 | */ |
| 14012 | void sme_get_opclass(tHalHandle hal, uint8_t channel, uint8_t bw_offset, |
| 14013 | uint8_t *opclass) |
| 14014 | { |
| 14015 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14016 | |
| 14017 | /* redgm opclass table contains opclass for 40MHz low primary, |
| 14018 | * 40MHz high primary and 20MHz. No support for 80MHz yet. So |
| 14019 | * first we will check if bit for 40MHz is set and if so find |
| 14020 | * matching opclass either with low primary or high primary |
| 14021 | * (a channel would never be in both) and then search for opclass |
| 14022 | * matching 20MHz, else for any BW. |
| 14023 | */ |
| 14024 | if (bw_offset & (1 << BW_40_OFFSET_BIT)) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 14025 | *opclass = wlan_reg_dmn_get_opclass_from_channel( |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 14026 | mac_ctx->scan.countryCodeCurrent, |
| 14027 | channel, BW40_LOW_PRIMARY); |
| 14028 | if (!(*opclass)) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 14029 | *opclass = wlan_reg_dmn_get_opclass_from_channel( |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 14030 | mac_ctx->scan.countryCodeCurrent, |
| 14031 | channel, BW40_HIGH_PRIMARY); |
| 14032 | } |
| 14033 | } else if (bw_offset & (1 << BW_20_OFFSET_BIT)) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 14034 | *opclass = wlan_reg_dmn_get_opclass_from_channel( |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 14035 | mac_ctx->scan.countryCodeCurrent, |
| 14036 | channel, BW20); |
| 14037 | } else { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 14038 | *opclass = wlan_reg_dmn_get_opclass_from_channel( |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 14039 | mac_ctx->scan.countryCodeCurrent, |
| 14040 | channel, BWALL); |
| 14041 | } |
| 14042 | } |
| 14043 | #endif |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 14044 | |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 14045 | /** |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 14046 | * sme_set_fw_test() - set fw test |
| 14047 | * @fw_test: fw test param |
| 14048 | * |
| 14049 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 14050 | */ |
| 14051 | QDF_STATUS sme_set_fw_test(struct set_fwtest_params *fw_test) |
| 14052 | { |
| 14053 | void *wma_handle; |
| 14054 | |
| 14055 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14056 | if (!wma_handle) { |
| 14057 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14058 | "wma handle is NULL"); |
| 14059 | return QDF_STATUS_E_FAILURE; |
| 14060 | } |
| 14061 | wma_process_fw_test_cmd(wma_handle, fw_test); |
| 14062 | return QDF_STATUS_SUCCESS; |
| 14063 | } |
| 14064 | |
| 14065 | /** |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 14066 | * sme_ht40_stop_obss_scan() - ht40 obss stop scan |
| 14067 | * @hal: mac handel |
| 14068 | * @vdev_id: vdev identifier |
| 14069 | * |
| 14070 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 14071 | */ |
| 14072 | QDF_STATUS sme_ht40_stop_obss_scan(tHalHandle hal, uint32_t vdev_id) |
| 14073 | { |
| 14074 | void *wma_handle; |
| 14075 | |
| 14076 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14077 | if (!wma_handle) { |
| 14078 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14079 | "wma handle is NULL"); |
| 14080 | return QDF_STATUS_E_FAILURE; |
| 14081 | } |
| 14082 | wma_ht40_stop_obss_scan(wma_handle, vdev_id); |
| 14083 | return QDF_STATUS_SUCCESS; |
| 14084 | } |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 14085 | |
| 14086 | /** |
| 14087 | * sme_update_mimo_power_save() - Update MIMO power save |
| 14088 | * configuration |
| 14089 | * @hal: The handle returned by macOpen |
| 14090 | * @is_ht_smps_enabled: enable/disable ht smps |
| 14091 | * @ht_smps_mode: smps mode disabled/static/dynamic |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 14092 | * @send_smps_action: flag to send smps force mode command |
| 14093 | * to FW |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 14094 | * |
| 14095 | * Return: QDF_STATUS if SME update mimo power save |
| 14096 | * configuration sucsess else failue status |
| 14097 | */ |
| 14098 | QDF_STATUS sme_update_mimo_power_save(tHalHandle hal, |
| 14099 | uint8_t is_ht_smps_enabled, |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 14100 | uint8_t ht_smps_mode, |
| 14101 | bool send_smps_action) |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 14102 | { |
| 14103 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 14104 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14105 | sme_debug("SMPS enable: %d mode: %d send action: %d", |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 14106 | is_ht_smps_enabled, ht_smps_mode, |
| 14107 | send_smps_action); |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 14108 | mac_ctx->roam.configParam.enableHtSmps = |
| 14109 | is_ht_smps_enabled; |
| 14110 | mac_ctx->roam.configParam.htSmps = ht_smps_mode; |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 14111 | mac_ctx->roam.configParam.send_smps_action = |
| 14112 | send_smps_action; |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 14113 | |
| 14114 | return QDF_STATUS_SUCCESS; |
| 14115 | } |
| 14116 | |
| 14117 | /** |
| 14118 | * sme_is_sta_smps_allowed() - check if the supported nss for |
| 14119 | * the session is greater than 1x1 to enable sta SMPS |
| 14120 | * @hal: The handle returned by macOpen |
| 14121 | * @session_id: session id |
| 14122 | * |
| 14123 | * Return: bool returns true if supported nss is greater than |
| 14124 | * 1x1 else false |
| 14125 | */ |
| 14126 | bool sme_is_sta_smps_allowed(tHalHandle hal, uint8_t session_id) |
| 14127 | { |
| 14128 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 14129 | struct csr_roam_session *csr_session; |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 14130 | |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 14131 | csr_session = CSR_GET_SESSION(mac_ctx, session_id); |
| 14132 | if (NULL == csr_session) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14133 | sme_err("SME session not valid: %d", session_id); |
Sreelakshmi Konamki | 58697e1 | 2016-05-25 17:30:18 +0530 | [diff] [blame] | 14134 | return false; |
| 14135 | } |
| 14136 | |
| 14137 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14138 | sme_err("CSR session not valid: %d", session_id); |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 14139 | return false; |
| 14140 | } |
| 14141 | |
| 14142 | return (csr_session->supported_nss_1x1 == true) ? false : true; |
| 14143 | } |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 14144 | |
| 14145 | /** |
| 14146 | * sme_add_beacon_filter() - set the beacon filter configuration |
| 14147 | * @hal: The handle returned by macOpen |
| 14148 | * @session_id: session id |
| 14149 | * @ie_map: bitwise array of IEs |
| 14150 | * |
| 14151 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 14152 | */ |
| 14153 | QDF_STATUS sme_add_beacon_filter(tHalHandle hal, |
| 14154 | uint32_t session_id, |
| 14155 | uint32_t *ie_map) |
| 14156 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14157 | struct scheduler_msg message = {0}; |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 14158 | QDF_STATUS qdf_status; |
| 14159 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14160 | struct beacon_filter_param *filter_param; |
| 14161 | |
| 14162 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14163 | sme_err("CSR session not valid: %d", session_id); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 14164 | return QDF_STATUS_E_FAILURE; |
| 14165 | } |
| 14166 | |
| 14167 | filter_param = qdf_mem_malloc(sizeof(*filter_param)); |
| 14168 | if (NULL == filter_param) { |
| 14169 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14170 | "%s: fail to alloc filter_param", __func__); |
| 14171 | return QDF_STATUS_E_FAILURE; |
| 14172 | } |
| 14173 | |
| 14174 | filter_param->vdev_id = session_id; |
| 14175 | |
| 14176 | qdf_mem_copy(filter_param->ie_map, ie_map, |
| 14177 | BCN_FLT_MAX_ELEMS_IE_LIST * sizeof(uint32_t)); |
| 14178 | |
| 14179 | message.type = WMA_ADD_BCN_FILTER_CMDID; |
| 14180 | message.bodyptr = filter_param; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 14181 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 14182 | &message); |
| 14183 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 14184 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14185 | "%s: Not able to post msg to WDA!", |
| 14186 | __func__); |
| 14187 | |
| 14188 | qdf_mem_free(filter_param); |
| 14189 | } |
| 14190 | return qdf_status; |
| 14191 | } |
| 14192 | |
| 14193 | /** |
| 14194 | * sme_remove_beacon_filter() - set the beacon filter configuration |
| 14195 | * @hal: The handle returned by macOpen |
| 14196 | * @session_id: session id |
| 14197 | * |
| 14198 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 14199 | */ |
| 14200 | QDF_STATUS sme_remove_beacon_filter(tHalHandle hal, uint32_t session_id) |
| 14201 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14202 | struct scheduler_msg message = {0}; |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 14203 | QDF_STATUS qdf_status; |
| 14204 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14205 | struct beacon_filter_param *filter_param; |
| 14206 | |
| 14207 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14208 | sme_err("CSR session not valid: %d", session_id); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 14209 | return QDF_STATUS_E_FAILURE; |
| 14210 | } |
| 14211 | |
| 14212 | filter_param = qdf_mem_malloc(sizeof(*filter_param)); |
| 14213 | if (NULL == filter_param) { |
| 14214 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14215 | "%s: fail to alloc filter_param", __func__); |
| 14216 | return QDF_STATUS_E_FAILURE; |
| 14217 | } |
| 14218 | |
| 14219 | filter_param->vdev_id = session_id; |
| 14220 | |
| 14221 | message.type = WMA_REMOVE_BCN_FILTER_CMDID; |
| 14222 | message.bodyptr = filter_param; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 14223 | qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 14224 | &message); |
| 14225 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 14226 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14227 | "%s: Not able to post msg to WDA!", |
| 14228 | __func__); |
| 14229 | |
| 14230 | qdf_mem_free(filter_param); |
| 14231 | } |
| 14232 | return qdf_status; |
| 14233 | } |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14234 | |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14235 | /** |
Kondabattini, Ganesh | 3f2d02c | 2016-09-13 12:23:47 +0530 | [diff] [blame] | 14236 | * sme_send_disassoc_req_frame - send disassoc req |
| 14237 | * @hal: handler to hal |
| 14238 | * @session_id: session id |
| 14239 | * @peer_mac: peer mac address |
| 14240 | * @reason: reason for disassociation |
| 14241 | * wait_for_ack: wait for acknowledgment |
| 14242 | * |
| 14243 | * function to send disassoc request to lim |
| 14244 | * |
| 14245 | * return: none |
| 14246 | */ |
| 14247 | void sme_send_disassoc_req_frame(tHalHandle hal, uint8_t session_id, |
| 14248 | uint8_t *peer_mac, uint16_t reason, uint8_t wait_for_ack) |
| 14249 | { |
| 14250 | struct sme_send_disassoc_frm_req *msg; |
| 14251 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 14252 | A_UINT8 *buf; |
| 14253 | A_UINT16 tmp; |
| 14254 | |
| 14255 | msg = qdf_mem_malloc(sizeof(struct sme_send_disassoc_frm_req)); |
| 14256 | |
| 14257 | if (NULL == msg) |
| 14258 | qdf_status = QDF_STATUS_E_FAILURE; |
| 14259 | else |
| 14260 | qdf_status = QDF_STATUS_SUCCESS; |
| 14261 | |
| 14262 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 14263 | return; |
| 14264 | |
Kondabattini, Ganesh | 3f2d02c | 2016-09-13 12:23:47 +0530 | [diff] [blame] | 14265 | msg->msg_type = (uint16_t) eWNI_SME_SEND_DISASSOC_FRAME; |
| 14266 | |
| 14267 | msg->length = (uint16_t) sizeof(struct sme_send_disassoc_frm_req); |
| 14268 | |
| 14269 | buf = &msg->session_id; |
| 14270 | |
| 14271 | /* session id */ |
| 14272 | *buf = (A_UINT8) session_id; |
| 14273 | buf += sizeof(A_UINT8); |
| 14274 | |
| 14275 | /* transaction id */ |
| 14276 | *buf = 0; |
| 14277 | *(buf + 1) = 0; |
| 14278 | buf += sizeof(A_UINT16); |
| 14279 | |
| 14280 | /* Set the peer MAC address before sending the message to LIM */ |
| 14281 | qdf_mem_copy(buf, peer_mac, QDF_MAC_ADDR_SIZE); |
| 14282 | |
| 14283 | buf += QDF_MAC_ADDR_SIZE; |
| 14284 | |
| 14285 | /* reasoncode */ |
| 14286 | tmp = (uint16_t) reason; |
| 14287 | qdf_mem_copy(buf, &tmp, sizeof(uint16_t)); |
| 14288 | buf += sizeof(uint16_t); |
| 14289 | |
| 14290 | *buf = wait_for_ack; |
| 14291 | buf += sizeof(uint8_t); |
| 14292 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14293 | qdf_status = umac_send_mb_message_to_mac(msg); |
Kondabattini, Ganesh | 3f2d02c | 2016-09-13 12:23:47 +0530 | [diff] [blame] | 14294 | |
| 14295 | if (qdf_status != QDF_STATUS_SUCCESS) |
| 14296 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14297 | FL("cds_send_mb_message Failed")); |
| 14298 | } |
| 14299 | |
Jeff Johnson | a867e0c | 2017-01-26 13:43:51 -0800 | [diff] [blame] | 14300 | QDF_STATUS sme_get_bpf_offload_capabilities(tHalHandle hal, |
| 14301 | bpf_get_offload_cb callback, |
| 14302 | void *context) |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14303 | { |
| 14304 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 14305 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14306 | struct scheduler_msg cds_msg = {0}; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14307 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14308 | SME_ENTER(); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14309 | |
| 14310 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 14311 | if (QDF_STATUS_SUCCESS == status) { |
| 14312 | /* Serialize the req through MC thread */ |
Jeff Johnson | a867e0c | 2017-01-26 13:43:51 -0800 | [diff] [blame] | 14313 | mac_ctx->sme.bpf_get_offload_cb = callback; |
| 14314 | mac_ctx->sme.bpf_get_offload_context = context; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14315 | cds_msg.bodyptr = NULL; |
| 14316 | cds_msg.type = WDA_BPF_GET_CAPABILITIES_REQ; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 14317 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &cds_msg); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14318 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 14319 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14320 | FL("Post bpf get offload msg fail")); |
| 14321 | status = QDF_STATUS_E_FAILURE; |
| 14322 | } |
| 14323 | sme_release_global_lock(&mac_ctx->sme); |
| 14324 | } else { |
| 14325 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14326 | FL("sme_acquire_global_lock error")); |
| 14327 | } |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14328 | SME_EXIT(); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14329 | return status; |
| 14330 | } |
| 14331 | |
| 14332 | |
| 14333 | /** |
| 14334 | * sme_set_bpf_instructions() - Set BPF bpf filter instructions. |
| 14335 | * @hal: HAL handle |
| 14336 | * @bpf_set_offload: struct to set bpf filter instructions. |
| 14337 | * |
| 14338 | * Return: QDF_STATUS enumeration. |
| 14339 | */ |
| 14340 | QDF_STATUS sme_set_bpf_instructions(tHalHandle hal, |
| 14341 | struct sir_bpf_set_offload *req) |
| 14342 | { |
| 14343 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 14344 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14345 | struct scheduler_msg cds_msg = {0}; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14346 | struct sir_bpf_set_offload *set_offload; |
| 14347 | |
Arun Khandavalli | ca198b5 | 2016-04-26 20:53:35 +0530 | [diff] [blame] | 14348 | set_offload = qdf_mem_malloc(sizeof(*set_offload) + |
| 14349 | req->current_length); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14350 | |
| 14351 | if (NULL == set_offload) { |
| 14352 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14353 | FL("Failed to alloc set_offload")); |
| 14354 | return QDF_STATUS_E_NOMEM; |
| 14355 | } |
| 14356 | |
| 14357 | set_offload->session_id = req->session_id; |
| 14358 | set_offload->filter_id = req->filter_id; |
| 14359 | set_offload->current_offset = req->current_offset; |
| 14360 | set_offload->total_length = req->total_length; |
Rajeev Kumar | e5a1682 | 2016-07-27 13:11:42 -0700 | [diff] [blame] | 14361 | set_offload->current_length = req->current_length; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14362 | if (set_offload->total_length) { |
Arun Khandavalli | ca198b5 | 2016-04-26 20:53:35 +0530 | [diff] [blame] | 14363 | set_offload->program = ((uint8_t *)set_offload) + |
| 14364 | sizeof(*set_offload); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14365 | qdf_mem_copy(set_offload->program, req->program, |
| 14366 | set_offload->current_length); |
| 14367 | } |
| 14368 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 14369 | if (QDF_STATUS_SUCCESS == status) { |
| 14370 | /* Serialize the req through MC thread */ |
| 14371 | cds_msg.bodyptr = set_offload; |
| 14372 | cds_msg.type = WDA_BPF_SET_INSTRUCTIONS_REQ; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 14373 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &cds_msg); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14374 | |
| 14375 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 14376 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14377 | FL("Post BPF set offload msg fail")); |
| 14378 | status = QDF_STATUS_E_FAILURE; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14379 | qdf_mem_free(set_offload); |
| 14380 | } |
| 14381 | sme_release_global_lock(&mac_ctx->sme); |
| 14382 | } else { |
| 14383 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14384 | FL("sme_acquire_global_lock failed")); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14385 | qdf_mem_free(set_offload); |
| 14386 | } |
| 14387 | return status; |
| 14388 | } |
| 14389 | |
| 14390 | /** |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 14391 | * sme_get_wni_dot11_mode() - return configured wni dot11mode |
| 14392 | * @hal: hal pointer |
| 14393 | * |
| 14394 | * Return: wni dot11 mode. |
| 14395 | */ |
| 14396 | uint32_t sme_get_wni_dot11_mode(tHalHandle hal) |
| 14397 | { |
| 14398 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14399 | |
| 14400 | return csr_translate_to_wni_cfg_dot11_mode(mac_ctx, |
| 14401 | mac_ctx->roam.configParam.uCfgDot11Mode); |
| 14402 | } |
| 14403 | |
| 14404 | /** |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 14405 | * sme_create_mon_session() - post message to create PE session for monitormode |
| 14406 | * operation |
| 14407 | * @hal_handle: Handle to the HAL |
| 14408 | * @bssid: pointer to bssid |
| 14409 | * |
| 14410 | * Return: QDF_STATUS_SUCCESS on success, non-zero error code on failure. |
| 14411 | */ |
| 14412 | QDF_STATUS sme_create_mon_session(tHalHandle hal_handle, tSirMacAddr bss_id) |
| 14413 | { |
| 14414 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 14415 | struct sir_create_session *msg; |
| 14416 | |
| 14417 | msg = qdf_mem_malloc(sizeof(*msg)); |
| 14418 | if (NULL != msg) { |
| 14419 | msg->type = eWNI_SME_MON_INIT_SESSION; |
| 14420 | msg->msg_len = sizeof(*msg); |
| 14421 | qdf_mem_copy(msg->bss_id.bytes, bss_id, QDF_MAC_ADDR_SIZE); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14422 | status = umac_send_mb_message_to_mac(msg); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 14423 | } |
| 14424 | return status; |
| 14425 | } |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 14426 | |
Kapil Gupta | 4f0c0c1 | 2017-02-07 15:21:15 +0530 | [diff] [blame] | 14427 | void sme_set_chan_info_callback(tHalHandle hal_handle, |
| 14428 | void (*callback)(struct scan_chan_info *chan_info)) |
| 14429 | { |
| 14430 | tpAniSirGlobal mac; |
| 14431 | |
| 14432 | if (hal_handle == NULL) { |
| 14433 | QDF_ASSERT(0); |
| 14434 | return; |
| 14435 | } |
| 14436 | mac = PMAC_STRUCT(hal_handle); |
| 14437 | mac->chan_info_cb = callback; |
| 14438 | } |
| 14439 | |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 14440 | /** |
| 14441 | * sme_set_adaptive_dwelltime_config() - Update Adaptive dwelltime configuration |
| 14442 | * @hal: The handle returned by macOpen |
| 14443 | * @params: adaptive_dwelltime_params config |
| 14444 | * |
| 14445 | * Return: QDF_STATUS if adaptive dwell time update |
| 14446 | * configuration sucsess else failure status |
| 14447 | */ |
| 14448 | QDF_STATUS sme_set_adaptive_dwelltime_config(tHalHandle hal, |
| 14449 | struct adaptive_dwelltime_params *params) |
| 14450 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14451 | struct scheduler_msg message = {0}; |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 14452 | QDF_STATUS status; |
| 14453 | struct adaptive_dwelltime_params *dwelltime_params; |
| 14454 | |
| 14455 | dwelltime_params = qdf_mem_malloc(sizeof(*dwelltime_params)); |
| 14456 | if (NULL == dwelltime_params) { |
| 14457 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14458 | "%s: fail to alloc dwelltime_params", __func__); |
| 14459 | return QDF_STATUS_E_NOMEM; |
| 14460 | } |
| 14461 | |
| 14462 | dwelltime_params->is_enabled = params->is_enabled; |
| 14463 | dwelltime_params->dwelltime_mode = params->dwelltime_mode; |
| 14464 | dwelltime_params->lpf_weight = params->lpf_weight; |
| 14465 | dwelltime_params->passive_mon_intval = params->passive_mon_intval; |
| 14466 | dwelltime_params->wifi_act_threshold = params->wifi_act_threshold; |
| 14467 | |
| 14468 | message.type = WMA_SET_ADAPT_DWELLTIME_CONF_PARAMS; |
| 14469 | message.bodyptr = dwelltime_params; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 14470 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 14471 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 14472 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14473 | "%s: Not able to post msg to WMA!", __func__); |
| 14474 | |
| 14475 | qdf_mem_free(dwelltime_params); |
| 14476 | } |
| 14477 | return status; |
| 14478 | } |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 14479 | |
| 14480 | /** |
| 14481 | * sme_set_vdev_ies_per_band() - sends the per band IEs to vdev |
| 14482 | * @hal: Pointer to HAL |
| 14483 | * @vdev_id: vdev_id for which IE is targeted |
| 14484 | * |
| 14485 | * Return: None |
| 14486 | */ |
| 14487 | void sme_set_vdev_ies_per_band(tHalHandle hal, uint8_t vdev_id) |
| 14488 | { |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 14489 | struct sir_set_vdev_ies_per_band *p_msg; |
| 14490 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 14491 | |
| 14492 | p_msg = qdf_mem_malloc(sizeof(*p_msg)); |
| 14493 | if (NULL == p_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14494 | sme_err("mem alloc failed for sme msg"); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 14495 | return; |
| 14496 | } |
| 14497 | |
| 14498 | p_msg->vdev_id = vdev_id; |
| 14499 | p_msg->msg_type = eWNI_SME_SET_VDEV_IES_PER_BAND; |
| 14500 | p_msg->len = sizeof(*p_msg); |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14501 | sme_debug("sending eWNI_SME_SET_VDEV_IES_PER_BAND: vdev_id: %d", |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 14502 | vdev_id); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14503 | status = umac_send_mb_message_to_mac(p_msg); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 14504 | if (QDF_STATUS_SUCCESS != status) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14505 | sme_err("Send eWNI_SME_SET_VDEV_IES_PER_BAND fail"); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 14506 | } |
| 14507 | |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14508 | /** |
| 14509 | * sme_set_pdev_ht_vht_ies() - sends the set pdev IE req |
| 14510 | * @hal: Pointer to HAL |
| 14511 | * @enable2x2: 1x1 or 2x2 mode. |
| 14512 | * |
| 14513 | * Sends the set pdev IE req with Nss value. |
| 14514 | * |
| 14515 | * Return: None |
| 14516 | */ |
| 14517 | void sme_set_pdev_ht_vht_ies(tHalHandle hal, bool enable2x2) |
| 14518 | { |
| 14519 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14520 | struct sir_set_ht_vht_cfg *ht_vht_cfg; |
| 14521 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 14522 | |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14523 | if (!((mac_ctx->roam.configParam.uCfgDot11Mode == |
| 14524 | eCSR_CFG_DOT11_MODE_AUTO) || |
| 14525 | (mac_ctx->roam.configParam.uCfgDot11Mode == |
| 14526 | eCSR_CFG_DOT11_MODE_11N) || |
| 14527 | (mac_ctx->roam.configParam.uCfgDot11Mode == |
| 14528 | eCSR_CFG_DOT11_MODE_11N_ONLY) || |
| 14529 | (mac_ctx->roam.configParam.uCfgDot11Mode == |
| 14530 | eCSR_CFG_DOT11_MODE_11AC) || |
| 14531 | (mac_ctx->roam.configParam.uCfgDot11Mode == |
| 14532 | eCSR_CFG_DOT11_MODE_11AC_ONLY))) |
| 14533 | return; |
| 14534 | |
| 14535 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 14536 | if (QDF_STATUS_SUCCESS == status) { |
| 14537 | ht_vht_cfg = qdf_mem_malloc(sizeof(*ht_vht_cfg)); |
| 14538 | if (NULL == ht_vht_cfg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14539 | sme_err("mem alloc failed for ht_vht_cfg"); |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14540 | sme_release_global_lock(&mac_ctx->sme); |
| 14541 | return; |
| 14542 | } |
| 14543 | |
| 14544 | ht_vht_cfg->pdev_id = 0; |
| 14545 | if (enable2x2) |
| 14546 | ht_vht_cfg->nss = 2; |
| 14547 | else |
| 14548 | ht_vht_cfg->nss = 1; |
| 14549 | ht_vht_cfg->dot11mode = |
| 14550 | (uint8_t)csr_translate_to_wni_cfg_dot11_mode(mac_ctx, |
| 14551 | mac_ctx->roam.configParam.uCfgDot11Mode); |
| 14552 | |
| 14553 | ht_vht_cfg->msg_type = eWNI_SME_PDEV_SET_HT_VHT_IE; |
| 14554 | ht_vht_cfg->len = sizeof(*ht_vht_cfg); |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14555 | sme_debug("SET_HT_VHT_IE with nss: %d, dot11mode: %d", |
| 14556 | ht_vht_cfg->nss, |
| 14557 | ht_vht_cfg->dot11mode); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14558 | status = umac_send_mb_message_to_mac(ht_vht_cfg); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 14559 | if (QDF_STATUS_SUCCESS != status) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14560 | sme_err("Send SME_PDEV_SET_HT_VHT_IE fail"); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 14561 | |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14562 | sme_release_global_lock(&mac_ctx->sme); |
| 14563 | } |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14564 | } |
| 14565 | |
| 14566 | /** |
| 14567 | * sme_update_vdev_type_nss() - sets the nss per vdev type |
| 14568 | * @hal: Pointer to HAL |
| 14569 | * @max_supp_nss: max_supported Nss |
| 14570 | * @band: 5G or 2.4G band |
| 14571 | * |
| 14572 | * Sets the per band Nss for each vdev type based on INI and configured |
| 14573 | * chain mask value. |
| 14574 | * |
| 14575 | * Return: None |
| 14576 | */ |
| 14577 | void sme_update_vdev_type_nss(tHalHandle hal, uint8_t max_supp_nss, |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 14578 | uint32_t vdev_type_nss, enum band_info band) |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14579 | { |
| 14580 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14581 | struct vdev_type_nss *vdev_nss; |
| 14582 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 14583 | if (BAND_5G == band) |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14584 | vdev_nss = &mac_ctx->vdev_type_nss_5g; |
| 14585 | else |
| 14586 | vdev_nss = &mac_ctx->vdev_type_nss_2g; |
| 14587 | |
| 14588 | vdev_nss->sta = QDF_MIN(max_supp_nss, CFG_STA_NSS(vdev_type_nss)); |
| 14589 | vdev_nss->sap = QDF_MIN(max_supp_nss, CFG_SAP_NSS(vdev_type_nss)); |
| 14590 | vdev_nss->p2p_go = QDF_MIN(max_supp_nss, |
| 14591 | CFG_P2P_GO_NSS(vdev_type_nss)); |
| 14592 | vdev_nss->p2p_cli = QDF_MIN(max_supp_nss, |
| 14593 | CFG_P2P_CLI_NSS(vdev_type_nss)); |
| 14594 | vdev_nss->p2p_dev = QDF_MIN(max_supp_nss, |
| 14595 | CFG_P2P_DEV_NSS(vdev_type_nss)); |
| 14596 | vdev_nss->ibss = QDF_MIN(max_supp_nss, CFG_IBSS_NSS(vdev_type_nss)); |
| 14597 | vdev_nss->tdls = QDF_MIN(max_supp_nss, CFG_TDLS_NSS(vdev_type_nss)); |
| 14598 | vdev_nss->ocb = QDF_MIN(max_supp_nss, CFG_OCB_NSS(vdev_type_nss)); |
| 14599 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14600 | sme_debug("band %d NSS:sta %d sap %d cli %d go %d dev %d ibss %d tdls %d ocb %d", |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14601 | band, vdev_nss->sta, vdev_nss->sap, vdev_nss->p2p_cli, |
| 14602 | vdev_nss->p2p_go, vdev_nss->p2p_dev, vdev_nss->ibss, |
| 14603 | vdev_nss->tdls, vdev_nss->ocb); |
| 14604 | } |
Peng Xu | 8fdaa49 | 2016-06-22 10:20:47 -0700 | [diff] [blame] | 14605 | |
Kiran Kumar Lokere | e6476b2 | 2017-10-16 23:40:32 -0700 | [diff] [blame] | 14606 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
| 14607 | #define MAX_BSS_COLOR_VAL 63 |
| 14608 | #define MIN_BSS_COLOR_VAL 1 |
| 14609 | |
| 14610 | QDF_STATUS sme_set_he_bss_color(tHalHandle hal, uint8_t session_id, |
| 14611 | uint8_t bss_color) |
| 14612 | |
| 14613 | { |
| 14614 | struct sir_set_he_bss_color *bss_color_msg; |
| 14615 | uint8_t len; |
| 14616 | |
| 14617 | if (!hal) { |
| 14618 | sme_err("Invalid hal pointer"); |
| 14619 | return QDF_STATUS_E_FAULT; |
| 14620 | } |
| 14621 | |
| 14622 | sme_debug("Set HE bss_color %d", bss_color); |
| 14623 | |
| 14624 | if (bss_color < MIN_BSS_COLOR_VAL || bss_color > MAX_BSS_COLOR_VAL) { |
| 14625 | sme_debug("Invalid HE bss_color %d", bss_color); |
| 14626 | return QDF_STATUS_E_INVAL; |
| 14627 | } |
| 14628 | len = sizeof(*bss_color_msg); |
| 14629 | bss_color_msg = qdf_mem_malloc(len); |
| 14630 | if (!bss_color_msg) { |
| 14631 | sme_err("mem alloc failed"); |
| 14632 | return QDF_STATUS_E_NOMEM; |
| 14633 | } |
| 14634 | bss_color_msg->message_type = eWNI_SME_SET_HE_BSS_COLOR; |
| 14635 | bss_color_msg->length = len; |
| 14636 | bss_color_msg->session_id = session_id; |
| 14637 | bss_color_msg->bss_color = bss_color; |
| 14638 | return umac_send_mb_message_to_mac(bss_color_msg); |
| 14639 | } |
| 14640 | #endif |
| 14641 | |
Peng Xu | 8fdaa49 | 2016-06-22 10:20:47 -0700 | [diff] [blame] | 14642 | /** |
Nitesh Shah | db5ea0d | 2017-03-22 15:17:47 +0530 | [diff] [blame] | 14643 | * sme_update_hw_dbs_capable() - sets the HW DBS capability |
| 14644 | * @hal: Pointer to HAL |
| 14645 | * @hw_dbs_capable: HW DBS capability |
| 14646 | * |
| 14647 | * Sets HW DBS capability based on INI and fw capability. |
| 14648 | * |
| 14649 | * Return: None |
| 14650 | */ |
| 14651 | void sme_update_hw_dbs_capable(tHalHandle hal, uint8_t hw_dbs_capable) |
| 14652 | { |
| 14653 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 14654 | |
Nitesh Shah | db5ea0d | 2017-03-22 15:17:47 +0530 | [diff] [blame] | 14655 | mac_ctx->hw_dbs_capable = hw_dbs_capable; |
| 14656 | } |
| 14657 | |
| 14658 | /** |
Peng Xu | 8fdaa49 | 2016-06-22 10:20:47 -0700 | [diff] [blame] | 14659 | * sme_register_p2p_lo_event() - Register for the p2p lo event |
| 14660 | * @hHal: reference to the HAL |
| 14661 | * @context: the context of the call |
| 14662 | * @callback: the callback to hdd |
| 14663 | * |
| 14664 | * This function registers the callback function for P2P listen |
| 14665 | * offload stop event. |
| 14666 | * |
| 14667 | * Return: none |
| 14668 | */ |
| 14669 | void sme_register_p2p_lo_event(tHalHandle hHal, void *context, |
| 14670 | p2p_lo_callback callback) |
| 14671 | { |
| 14672 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 14673 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 14674 | |
| 14675 | status = sme_acquire_global_lock(&pMac->sme); |
| 14676 | pMac->sme.p2p_lo_event_callback = callback; |
| 14677 | pMac->sme.p2p_lo_event_context = context; |
| 14678 | sme_release_global_lock(&pMac->sme); |
| 14679 | } |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 14680 | |
| 14681 | /** |
| 14682 | * sme_process_mac_pwr_dbg_cmd() - enable mac pwr debugging |
| 14683 | * @hal: The handle returned by macOpen |
| 14684 | * @session_id: session id |
| 14685 | * @dbg_args: args for mac pwr debug command |
| 14686 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 14687 | */ |
| 14688 | QDF_STATUS sme_process_mac_pwr_dbg_cmd(tHalHandle hal, uint32_t session_id, |
| 14689 | struct sir_mac_pwr_dbg_cmd* |
| 14690 | dbg_args) |
| 14691 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14692 | struct scheduler_msg message = {0}; |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 14693 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14694 | struct sir_mac_pwr_dbg_cmd *req; |
| 14695 | int i; |
| 14696 | |
| 14697 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14698 | sme_err("CSR session not valid: %d", session_id); |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 14699 | return QDF_STATUS_E_FAILURE; |
| 14700 | } |
| 14701 | |
| 14702 | req = qdf_mem_malloc(sizeof(*req)); |
| 14703 | if (NULL == req) { |
| 14704 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14705 | "%s: fail to alloc mac_pwr_dbg_args", __func__); |
| 14706 | return QDF_STATUS_E_FAILURE; |
| 14707 | } |
| 14708 | req->module_id = dbg_args->module_id; |
| 14709 | req->pdev_id = dbg_args->pdev_id; |
| 14710 | req->num_args = dbg_args->num_args; |
| 14711 | for (i = 0; i < req->num_args; i++) |
| 14712 | req->args[i] = dbg_args->args[i]; |
| 14713 | |
| 14714 | message.type = SIR_HAL_POWER_DBG_CMD; |
| 14715 | message.bodyptr = req; |
| 14716 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 14717 | if (!QDF_IS_STATUS_SUCCESS(scheduler_post_msg |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 14718 | (QDF_MODULE_ID_WMA, &message))) { |
| 14719 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14720 | "%s: Not able to post msg to WDA!", |
| 14721 | __func__); |
| 14722 | qdf_mem_free(req); |
| 14723 | } |
| 14724 | return QDF_STATUS_SUCCESS; |
| 14725 | } |
Tushnim Bhattacharyya | f44a9d8 | 2016-07-05 10:52:06 -0700 | [diff] [blame] | 14726 | /** |
| 14727 | * sme_get_vdev_type_nss() - gets the nss per vdev type |
Tushnim Bhattacharyya | f44a9d8 | 2016-07-05 10:52:06 -0700 | [diff] [blame] | 14728 | * @dev_mode: connection type. |
| 14729 | * @nss2g: Pointer to the 2G Nss parameter. |
| 14730 | * @nss5g: Pointer to the 5G Nss parameter. |
| 14731 | * |
| 14732 | * Fills the 2G and 5G Nss values based on connection type. |
| 14733 | * |
| 14734 | * Return: None |
| 14735 | */ |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 14736 | void sme_get_vdev_type_nss(enum QDF_OPMODE dev_mode, |
| 14737 | uint8_t *nss_2g, uint8_t *nss_5g) |
Tushnim Bhattacharyya | f44a9d8 | 2016-07-05 10:52:06 -0700 | [diff] [blame] | 14738 | { |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 14739 | tpAniSirGlobal mac_ctx = sme_get_mac_context(); |
| 14740 | |
| 14741 | if (NULL == mac_ctx) { |
| 14742 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14743 | FL("Invalid MAC context")); |
| 14744 | return; |
| 14745 | } |
Tushnim Bhattacharyya | f44a9d8 | 2016-07-05 10:52:06 -0700 | [diff] [blame] | 14746 | csr_get_vdev_type_nss(mac_ctx, dev_mode, nss_2g, nss_5g); |
| 14747 | } |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14748 | |
| 14749 | /** |
| 14750 | * sme_update_sta_roam_policy() - update sta roam policy for |
| 14751 | * unsafe and DFS channels. |
| 14752 | * @hal_handle: hal handle for getting global mac struct |
| 14753 | * @dfs_mode: dfs mode which tell if dfs channel needs to be |
| 14754 | * skipped or not |
| 14755 | * @skip_unsafe_channels: Param to tell if driver needs to |
| 14756 | * skip unsafe channels or not. |
| 14757 | * @param session_id: sme_session_id |
Agrawal, Ashish | 9f84c40 | 2016-11-30 16:19:44 +0530 | [diff] [blame] | 14758 | * @sap_operating_band: Band on which SAP is operating |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14759 | * |
| 14760 | * sme_update_sta_roam_policy update sta rome policies to csr |
| 14761 | * this function will call csrUpdateChannelList as well |
| 14762 | * to include/exclude DFS channels and unsafe channels. |
| 14763 | * |
| 14764 | * Return: eHAL_STATUS_SUCCESS or non-zero on failure. |
| 14765 | */ |
| 14766 | QDF_STATUS sme_update_sta_roam_policy(tHalHandle hal_handle, |
| 14767 | enum sta_roam_policy_dfs_mode dfs_mode, |
| 14768 | bool skip_unsafe_channels, |
Agrawal, Ashish | 9f84c40 | 2016-11-30 16:19:44 +0530 | [diff] [blame] | 14769 | uint8_t session_id, uint8_t sap_operating_band) |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14770 | { |
| 14771 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
| 14772 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 14773 | tSmeConfigParams *sme_config; |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14774 | |
| 14775 | if (!mac_ctx) { |
| 14776 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
| 14777 | "%s: mac_ctx is null", __func__); |
| 14778 | return QDF_STATUS_E_FAILURE; |
| 14779 | } |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14780 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 14781 | sme_config = qdf_mem_malloc(sizeof(*sme_config)); |
| 14782 | if (!sme_config) { |
| 14783 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14784 | FL("failed to allocate memory for sme_config")); |
| 14785 | return QDF_STATUS_E_FAILURE; |
| 14786 | } |
| 14787 | qdf_mem_zero(sme_config, sizeof(*sme_config)); |
| 14788 | sme_get_config_param(hal_handle, sme_config); |
| 14789 | |
| 14790 | sme_config->csrConfig.sta_roam_policy_params.dfs_mode = |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14791 | dfs_mode; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 14792 | sme_config->csrConfig.sta_roam_policy_params.skip_unsafe_channels = |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14793 | skip_unsafe_channels; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 14794 | sme_config->csrConfig.sta_roam_policy_params.sap_operating_band = |
Agrawal, Ashish | 9f84c40 | 2016-11-30 16:19:44 +0530 | [diff] [blame] | 14795 | sap_operating_band; |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14796 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 14797 | sme_update_config(hal_handle, sme_config); |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14798 | |
| 14799 | status = csr_update_channel_list(mac_ctx); |
| 14800 | if (QDF_STATUS_SUCCESS != status) { |
| 14801 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14802 | FL("failed to update the supported channel list")); |
| 14803 | } |
| 14804 | if (mac_ctx->roam.configParam.isRoamOffloadScanEnabled) |
| 14805 | csr_roam_offload_scan(mac_ctx, session_id, |
| 14806 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 14807 | REASON_ROAM_SCAN_STA_ROAM_POLICY_CHANGED); |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 14808 | |
| 14809 | qdf_mem_free(sme_config); |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 14810 | return status; |
| 14811 | } |
| 14812 | |
| 14813 | /** |
| 14814 | * sme_enable_disable_chanavoidind_event - configure ca event ind |
| 14815 | * @hal: handler to hal |
| 14816 | * @set_value: enable/disable |
| 14817 | * |
| 14818 | * function to enable/disable chan avoidance indication |
| 14819 | * |
| 14820 | * Return: QDF_STATUS |
| 14821 | */ |
| 14822 | QDF_STATUS sme_enable_disable_chanavoidind_event(tHalHandle hal, |
| 14823 | uint8_t set_value) |
| 14824 | { |
| 14825 | QDF_STATUS status; |
| 14826 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14827 | struct scheduler_msg msg = {0}; |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 14828 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14829 | sme_debug("set_value: %d", set_value); |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 14830 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 14831 | if (QDF_STATUS_SUCCESS == status) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 14832 | qdf_mem_zero(&msg, sizeof(struct scheduler_msg)); |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 14833 | msg.type = WMA_SEND_FREQ_RANGE_CONTROL_IND; |
| 14834 | msg.bodyval = set_value; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 14835 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 14836 | sme_release_global_lock(&mac_ctx->sme); |
| 14837 | return status; |
| 14838 | } |
Deepak Dhamdhere | b106ae5 | 2016-08-10 20:55:30 +0530 | [diff] [blame] | 14839 | return status; |
| 14840 | } |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14841 | |
Deepak Dhamdhere | b106ae5 | 2016-08-10 20:55:30 +0530 | [diff] [blame] | 14842 | /* |
| 14843 | * sme_set_default_scan_ie() - API to send default scan IE to LIM |
| 14844 | * @hal: reference to the HAL |
| 14845 | * @session_id: current session ID |
| 14846 | * @ie_data: Pointer to Scan IE data |
| 14847 | * @ie_len: Length of @ie_data |
| 14848 | * |
| 14849 | * Return: QDF_STATUS |
| 14850 | */ |
| 14851 | QDF_STATUS sme_set_default_scan_ie(tHalHandle hal, uint16_t session_id, |
| 14852 | uint8_t *ie_data, uint16_t ie_len) |
| 14853 | { |
| 14854 | QDF_STATUS status; |
| 14855 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14856 | struct hdd_default_scan_ie *set_ie_params; |
| 14857 | |
Rajeev Kumar | 5d17dd5 | 2017-12-19 16:17:42 -0800 | [diff] [blame] | 14858 | if (!ie_data) |
| 14859 | return QDF_STATUS_E_INVAL; |
| 14860 | |
Deepak Dhamdhere | b106ae5 | 2016-08-10 20:55:30 +0530 | [diff] [blame] | 14861 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 14862 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 14863 | set_ie_params = qdf_mem_malloc(sizeof(*set_ie_params)); |
| 14864 | if (!set_ie_params) |
| 14865 | status = QDF_STATUS_E_NOMEM; |
| 14866 | else { |
| 14867 | set_ie_params->message_type = eWNI_SME_DEFAULT_SCAN_IE; |
| 14868 | set_ie_params->length = sizeof(*set_ie_params); |
| 14869 | set_ie_params->session_id = session_id; |
| 14870 | set_ie_params->ie_len = ie_len; |
| 14871 | qdf_mem_copy(set_ie_params->ie_data, ie_data, ie_len); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14872 | status = umac_send_mb_message_to_mac(set_ie_params); |
Deepak Dhamdhere | b106ae5 | 2016-08-10 20:55:30 +0530 | [diff] [blame] | 14873 | } |
| 14874 | sme_release_global_lock(&mac_ctx->sme); |
| 14875 | } |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14876 | return status; |
| 14877 | } |
Padma, Santhosh Kumar | d7cc079 | 2016-06-28 18:54:12 +0530 | [diff] [blame] | 14878 | |
Jeff Johnson | f0e54b0 | 2017-12-18 15:22:25 -0800 | [diff] [blame] | 14879 | QDF_STATUS sme_get_sar_power_limits(tHalHandle hal, |
| 14880 | wma_sar_cb callback, void *context) |
| 14881 | { |
| 14882 | void *wma_handle; |
| 14883 | |
| 14884 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14885 | if (!wma_handle) { |
| 14886 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14887 | "wma handle is NULL"); |
| 14888 | return QDF_STATUS_E_FAILURE; |
| 14889 | } |
| 14890 | |
| 14891 | return wma_get_sar_limit(wma_handle, callback, context); |
| 14892 | } |
| 14893 | |
Kabilan Kannan | 3c0a735 | 2016-12-02 18:49:38 -0800 | [diff] [blame] | 14894 | QDF_STATUS sme_set_sar_power_limits(tHalHandle hal, |
| 14895 | struct sar_limit_cmd_params *sar_limit_cmd) |
| 14896 | { |
| 14897 | void *wma_handle; |
| 14898 | |
| 14899 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14900 | if (!wma_handle) { |
| 14901 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14902 | "wma handle is NULL"); |
| 14903 | return QDF_STATUS_E_FAILURE; |
| 14904 | } |
| 14905 | |
| 14906 | return wma_set_sar_limit(wma_handle, sar_limit_cmd); |
| 14907 | } |
| 14908 | |
Jeff Johnson | 6136fb9 | 2017-03-30 15:21:49 -0700 | [diff] [blame] | 14909 | #ifdef WLAN_FEATURE_FIPS |
| 14910 | QDF_STATUS sme_fips_request(tHalHandle hal, struct fips_params *param, |
| 14911 | wma_fips_cb callback, void *context) |
| 14912 | { |
| 14913 | void *wma_handle; |
| 14914 | |
| 14915 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14916 | if (!wma_handle) { |
| 14917 | sme_err("wma handle is NULL"); |
| 14918 | return QDF_STATUS_E_FAILURE; |
| 14919 | } |
| 14920 | |
| 14921 | return wma_fips_request(wma_handle, param, callback, context); |
| 14922 | } |
| 14923 | #endif |
| 14924 | |
Agrawal Ashish | b2d1a45 | 2016-05-05 12:23:58 +0530 | [diff] [blame] | 14925 | QDF_STATUS sme_set_cts2self_for_p2p_go(tHalHandle hal_handle) |
| 14926 | { |
Agrawal Ashish | b2d1a45 | 2016-05-05 12:23:58 +0530 | [diff] [blame] | 14927 | void *wma_handle; |
| 14928 | |
| 14929 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14930 | if (!wma_handle) { |
| 14931 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14932 | "wma_handle is NULL"); |
| 14933 | return QDF_STATUS_E_FAILURE; |
| 14934 | } |
Agrawal Ashish | b2d1a45 | 2016-05-05 12:23:58 +0530 | [diff] [blame] | 14935 | if (QDF_STATUS_SUCCESS != |
| 14936 | wma_set_cts2self_for_p2p_go(wma_handle, true)) { |
| 14937 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14938 | "%s: Failed to set cts2self for p2p GO to firmware", |
| 14939 | __func__); |
| 14940 | return QDF_STATUS_E_FAILURE; |
| 14941 | } |
| 14942 | return QDF_STATUS_SUCCESS; |
| 14943 | } |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 14944 | |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14945 | /** |
| 14946 | * sme_update_tx_fail_cnt_threshold() - update tx fail count Threshold |
| 14947 | * @hal: Handle returned by mac_open |
| 14948 | * @session_id: Session ID on which tx fail count needs to be updated to FW |
| 14949 | * @tx_fail_count: Count for tx fail threshold after which FW will disconnect |
| 14950 | * |
| 14951 | * This function is used to set tx fail count threshold to firmware. |
| 14952 | * firmware will issue disocnnect with peer device once this threshold is |
| 14953 | * reached. |
| 14954 | * |
| 14955 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 14956 | */ |
| 14957 | QDF_STATUS sme_update_tx_fail_cnt_threshold(tHalHandle hal_handle, |
| 14958 | uint8_t session_id, uint32_t tx_fail_count) |
| 14959 | { |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14960 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 14961 | struct sme_tx_fail_cnt_threshold *tx_fail_cnt; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14962 | struct scheduler_msg msg = {0}; |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14963 | |
| 14964 | tx_fail_cnt = qdf_mem_malloc(sizeof(*tx_fail_cnt)); |
| 14965 | if (NULL == tx_fail_cnt) { |
| 14966 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14967 | "%s: fail to alloc filter_param", __func__); |
| 14968 | return QDF_STATUS_E_FAILURE; |
| 14969 | } |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14970 | sme_debug("session_id: %d tx_fail_count: %d", |
| 14971 | session_id, tx_fail_count); |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14972 | tx_fail_cnt->session_id = session_id; |
| 14973 | tx_fail_cnt->tx_fail_cnt_threshold = tx_fail_count; |
| 14974 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 14975 | qdf_mem_zero(&msg, sizeof(struct scheduler_msg)); |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14976 | msg.type = SIR_HAL_UPDATE_TX_FAIL_CNT_TH; |
| 14977 | msg.reserved = 0; |
| 14978 | msg.bodyptr = tx_fail_cnt; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 14979 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14980 | |
| 14981 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 14982 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 14983 | FL("Not able to post Tx fail count message to WDA")); |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14984 | qdf_mem_free(tx_fail_cnt); |
| 14985 | } |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 14986 | return status; |
| 14987 | } |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14988 | |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 14989 | QDF_STATUS sme_set_lost_link_info_cb(tHalHandle hal, |
| 14990 | void (*cb)(void *, struct sir_lost_link_info *)) |
| 14991 | { |
| 14992 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 14993 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 14994 | |
| 14995 | status = sme_acquire_global_lock(&mac->sme); |
| 14996 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 14997 | mac->sme.lost_link_info_cb = cb; |
| 14998 | sme_release_global_lock(&mac->sme); |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 14999 | } else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 15000 | sme_err("sme_acquire_global_lock error status: %d", status); |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 15001 | } |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 15002 | |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 15003 | return status; |
| 15004 | } |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 15005 | |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 15006 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 15007 | bool sme_roam_is_ese_assoc(struct csr_roam_info *roam_info) |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 15008 | { |
| 15009 | return roam_info->isESEAssoc; |
| 15010 | } |
Manjeet Singh | 2f78506 | 2017-03-08 18:14:18 +0530 | [diff] [blame] | 15011 | #endif |
Manjeet Singh | a9cae43 | 2017-02-28 11:58:22 +0530 | [diff] [blame] | 15012 | /** |
Manjeet Singh | 2f78506 | 2017-03-08 18:14:18 +0530 | [diff] [blame] | 15013 | * sme_set_5g_band_pref(): If 5G preference is enabled,set boost/drop |
Manjeet Singh | a9cae43 | 2017-02-28 11:58:22 +0530 | [diff] [blame] | 15014 | * params from ini. |
| 15015 | * @hal_handle: Handle returned by mac_open |
| 15016 | * @5g_pref_params: pref params from ini. |
| 15017 | * |
| 15018 | * Returns: None |
| 15019 | */ |
| 15020 | void sme_set_5g_band_pref(tHalHandle hal_handle, |
| 15021 | struct sme_5g_band_pref_params *pref_params) |
| 15022 | { |
| 15023 | |
| 15024 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
| 15025 | struct roam_ext_params *roam_params; |
| 15026 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15027 | |
| 15028 | if (!pref_params) { |
| 15029 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15030 | "Invalid 5G pref params!"); |
| 15031 | return; |
| 15032 | } |
| 15033 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 15034 | if (QDF_STATUS_SUCCESS == status) { |
| 15035 | roam_params = &mac_ctx->roam.configParam.roam_params; |
| 15036 | roam_params->raise_rssi_thresh_5g = |
| 15037 | pref_params->rssi_boost_threshold_5g; |
| 15038 | roam_params->raise_factor_5g = |
| 15039 | pref_params->rssi_boost_factor_5g; |
| 15040 | roam_params->max_raise_rssi_5g = |
| 15041 | pref_params->max_rssi_boost_5g; |
| 15042 | roam_params->drop_rssi_thresh_5g = |
| 15043 | pref_params->rssi_penalize_threshold_5g; |
| 15044 | roam_params->drop_factor_5g = |
| 15045 | pref_params->rssi_penalize_factor_5g; |
| 15046 | roam_params->max_drop_rssi_5g = |
| 15047 | pref_params->max_rssi_penalize_5g; |
| 15048 | |
| 15049 | sme_release_global_lock(&mac_ctx->sme); |
| 15050 | } else |
| 15051 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15052 | "Unable to acquire global sme lock"); |
| 15053 | } |
| 15054 | |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 15055 | |
| 15056 | bool sme_neighbor_roam_is11r_assoc(tHalHandle hal_ctx, uint8_t session_id) |
| 15057 | { |
| 15058 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 15059 | |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 15060 | return csr_neighbor_roam_is11r_assoc(mac_ctx, session_id); |
| 15061 | } |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 15062 | |
| 15063 | #ifdef WLAN_FEATURE_WOW_PULSE |
| 15064 | /** |
| 15065 | * sme_set_wow_pulse() - set wow pulse info |
| 15066 | * @wow_pulse_set_info: wow_pulse_mode structure pointer |
| 15067 | * |
| 15068 | * Return: QDF_STATUS |
| 15069 | */ |
| 15070 | QDF_STATUS sme_set_wow_pulse(struct wow_pulse_mode *wow_pulse_set_info) |
| 15071 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 15072 | struct scheduler_msg message = {0}; |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 15073 | QDF_STATUS status; |
| 15074 | struct wow_pulse_mode *wow_pulse_set_cmd; |
| 15075 | |
| 15076 | if (!wow_pulse_set_info) { |
| 15077 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15078 | "%s: invalid wow_pulse_set_info pointer", __func__); |
| 15079 | return QDF_STATUS_E_FAILURE; |
| 15080 | } |
| 15081 | |
| 15082 | wow_pulse_set_cmd = qdf_mem_malloc(sizeof(*wow_pulse_set_cmd)); |
| 15083 | if (NULL == wow_pulse_set_cmd) { |
| 15084 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15085 | "%s: fail to alloc wow_pulse_set_cmd", __func__); |
| 15086 | return QDF_STATUS_E_NOMEM; |
| 15087 | } |
| 15088 | |
| 15089 | *wow_pulse_set_cmd = *wow_pulse_set_info; |
| 15090 | |
| 15091 | message.type = WMA_SET_WOW_PULSE_CMD; |
| 15092 | message.bodyptr = wow_pulse_set_cmd; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 15093 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 15094 | &message); |
| 15095 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 15096 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15097 | "%s: Not able to post msg to WDA!", |
| 15098 | __func__); |
| 15099 | qdf_mem_free(wow_pulse_set_cmd); |
| 15100 | status = QDF_STATUS_E_FAILURE; |
| 15101 | } |
| 15102 | |
| 15103 | return status; |
| 15104 | } |
| 15105 | #endif |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15106 | |
| 15107 | /** |
| 15108 | * sme_prepare_beacon_from_bss_descp() - prepares beacon frame by populating |
| 15109 | * different fields and IEs from bss descriptor. |
| 15110 | * @frame_buf: frame buffer to populate |
| 15111 | * @bss_descp: bss descriptor |
| 15112 | * @bssid: bssid of the beacon frame to populate |
| 15113 | * @ie_len: length of IE fields |
| 15114 | * |
| 15115 | * Return: None |
| 15116 | */ |
| 15117 | static void sme_prepare_beacon_from_bss_descp(uint8_t *frame_buf, |
| 15118 | tSirBssDescription *bss_descp, |
| 15119 | const tSirMacAddr bssid, |
Naveen Rawat | 6dabf4e | 2017-02-08 15:55:49 -0800 | [diff] [blame] | 15120 | uint32_t ie_len) |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15121 | { |
| 15122 | tDot11fBeacon1 *bcn_fixed; |
| 15123 | tpSirMacMgmtHdr mac_hdr = (tpSirMacMgmtHdr)frame_buf; |
| 15124 | |
| 15125 | /* populate mac header first to indicate beacon */ |
| 15126 | mac_hdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 15127 | mac_hdr->fc.type = SIR_MAC_MGMT_FRAME; |
| 15128 | mac_hdr->fc.subType = SIR_MAC_MGMT_BEACON; |
| 15129 | qdf_mem_copy((uint8_t *) mac_hdr->da, |
| 15130 | (uint8_t *) "\xFF\xFF\xFF\xFF\xFF\xFF", |
| 15131 | sizeof(struct qdf_mac_addr)); |
| 15132 | qdf_mem_copy((uint8_t *) mac_hdr->sa, bssid, |
| 15133 | sizeof(struct qdf_mac_addr)); |
| 15134 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, bssid, |
| 15135 | sizeof(struct qdf_mac_addr)); |
| 15136 | |
| 15137 | /* now populate fixed params */ |
| 15138 | bcn_fixed = (tDot11fBeacon1 *)(frame_buf + SIR_MAC_HDR_LEN_3A); |
| 15139 | /* populate timestamp */ |
| 15140 | qdf_mem_copy(&bcn_fixed->TimeStamp.timestamp, &bss_descp->timeStamp, |
| 15141 | sizeof(bss_descp->timeStamp)); |
| 15142 | /* populate beacon interval */ |
| 15143 | bcn_fixed->BeaconInterval.interval = bss_descp->beaconInterval; |
| 15144 | /* populate capability */ |
| 15145 | qdf_mem_copy(&bcn_fixed->Capabilities, &bss_descp->capabilityInfo, |
| 15146 | sizeof(bss_descp->capabilityInfo)); |
| 15147 | |
| 15148 | /* copy IEs now */ |
| 15149 | qdf_mem_copy(frame_buf + SIR_MAC_HDR_LEN_3A |
| 15150 | + SIR_MAC_B_PR_SSID_OFFSET, |
| 15151 | &bss_descp->ieFields, ie_len); |
| 15152 | } |
| 15153 | |
Hanumanth Reddy Pothula | 9005178 | 2017-05-04 22:14:43 +0530 | [diff] [blame] | 15154 | QDF_STATUS sme_get_rssi_snr_by_bssid(tHalHandle hal, |
| 15155 | tCsrRoamProfile *profile, |
| 15156 | const uint8_t *bssid, |
| 15157 | int8_t *rssi, int8_t *snr) |
| 15158 | { |
| 15159 | tSirBssDescription *bss_descp; |
| 15160 | tCsrScanResultFilter *scan_filter; |
| 15161 | struct scan_result_list *bss_list; |
| 15162 | tScanResultHandle result_handle = NULL; |
| 15163 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15164 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15165 | |
| 15166 | scan_filter = qdf_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 15167 | if (NULL == scan_filter) { |
| 15168 | sme_err("memory allocation failed"); |
| 15169 | status = QDF_STATUS_E_NOMEM; |
| 15170 | goto free_scan_flter; |
| 15171 | } |
| 15172 | |
| 15173 | status = csr_roam_prepare_filter_from_profile(mac_ctx, |
| 15174 | profile, scan_filter); |
| 15175 | if (QDF_STATUS_SUCCESS != status) { |
| 15176 | sme_err("prepare_filter failed"); |
| 15177 | goto free_scan_flter; |
| 15178 | } |
| 15179 | |
| 15180 | /* update filter to get scan result with just target BSSID */ |
| 15181 | if (NULL == scan_filter->BSSIDs.bssid) { |
| 15182 | scan_filter->BSSIDs.bssid = |
| 15183 | qdf_mem_malloc(sizeof(struct qdf_mac_addr)); |
| 15184 | if (scan_filter->BSSIDs.bssid == NULL) { |
| 15185 | sme_err("malloc failed"); |
| 15186 | status = QDF_STATUS_E_NOMEM; |
| 15187 | goto free_scan_flter; |
| 15188 | } |
| 15189 | } |
| 15190 | |
| 15191 | scan_filter->BSSIDs.numOfBSSIDs = 1; |
| 15192 | qdf_mem_copy(scan_filter->BSSIDs.bssid[0].bytes, |
| 15193 | bssid, sizeof(struct qdf_mac_addr)); |
| 15194 | |
| 15195 | status = csr_scan_get_result(mac_ctx, scan_filter, &result_handle); |
| 15196 | if (QDF_STATUS_SUCCESS != status) { |
| 15197 | sme_err("parse_scan_result failed"); |
| 15198 | goto free_scan_flter; |
| 15199 | } |
| 15200 | |
| 15201 | bss_list = (struct scan_result_list *)result_handle; |
| 15202 | bss_descp = csr_get_fst_bssdescr_ptr(bss_list); |
| 15203 | if (!bss_descp) { |
| 15204 | sme_err("unable to fetch bss descriptor"); |
| 15205 | status = QDF_STATUS_E_FAULT; |
| 15206 | goto free_scan_flter; |
| 15207 | } |
| 15208 | |
| 15209 | sme_debug("snr: %d, rssi: %d, raw_rssi: %d", |
| 15210 | bss_descp->sinr, bss_descp->rssi, bss_descp->rssi_raw); |
| 15211 | |
| 15212 | if (rssi) |
| 15213 | *rssi = bss_descp->rssi; |
| 15214 | if (snr) |
| 15215 | *snr = bss_descp->sinr; |
| 15216 | |
| 15217 | free_scan_flter: |
| 15218 | /* free scan filter and exit */ |
| 15219 | if (scan_filter) { |
| 15220 | csr_free_scan_filter(mac_ctx, scan_filter); |
| 15221 | qdf_mem_free(scan_filter); |
| 15222 | } |
| 15223 | |
| 15224 | if (result_handle) |
| 15225 | csr_scan_result_purge(mac_ctx, result_handle); |
| 15226 | |
| 15227 | return status; |
| 15228 | } |
| 15229 | |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15230 | QDF_STATUS sme_get_beacon_frm(tHalHandle hal, tCsrRoamProfile *profile, |
| 15231 | const tSirMacAddr bssid, |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15232 | uint8_t **frame_buf, uint32_t *frame_len, |
| 15233 | int *channel) |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15234 | { |
| 15235 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Naveen Rawat | 56b4de8 | 2017-02-17 14:38:49 -0800 | [diff] [blame] | 15236 | tScanResultHandle result_handle = NULL; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15237 | tCsrScanResultFilter *scan_filter; |
| 15238 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15239 | tSirBssDescription *bss_descp; |
Yeshwanth Sriram Guntuka | 36c0990 | 2017-09-26 11:34:26 +0530 | [diff] [blame] | 15240 | struct scan_result_list *bss_list; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15241 | uint32_t ie_len; |
| 15242 | |
| 15243 | scan_filter = qdf_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 15244 | if (NULL == scan_filter) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 15245 | sme_err("memory allocation failed"); |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15246 | status = QDF_STATUS_E_NOMEM; |
| 15247 | goto free_scan_flter; |
| 15248 | } |
| 15249 | status = csr_roam_prepare_filter_from_profile(mac_ctx, |
| 15250 | profile, scan_filter); |
| 15251 | if (QDF_IS_STATUS_ERROR(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 15252 | sme_err("prepare_filter failed"); |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15253 | status = QDF_STATUS_E_FAULT; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15254 | goto free_scan_flter; |
| 15255 | } |
| 15256 | |
| 15257 | /* update filter to get scan result with just target BSSID */ |
| 15258 | if (NULL == scan_filter->BSSIDs.bssid) { |
| 15259 | scan_filter->BSSIDs.bssid = |
| 15260 | qdf_mem_malloc(sizeof(struct qdf_mac_addr)); |
| 15261 | if (scan_filter->BSSIDs.bssid == NULL) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 15262 | sme_err("malloc failed"); |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15263 | status = QDF_STATUS_E_NOMEM; |
| 15264 | goto free_scan_flter; |
| 15265 | } |
| 15266 | } |
| 15267 | scan_filter->BSSIDs.numOfBSSIDs = 1; |
| 15268 | qdf_mem_copy(scan_filter->BSSIDs.bssid[0].bytes, |
| 15269 | bssid, sizeof(struct qdf_mac_addr)); |
| 15270 | |
| 15271 | status = csr_scan_get_result(mac_ctx, scan_filter, &result_handle); |
| 15272 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 15273 | sme_err("parse_scan_result failed"); |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15274 | status = QDF_STATUS_E_FAULT; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15275 | goto free_scan_flter; |
| 15276 | } |
| 15277 | |
Yeshwanth Sriram Guntuka | 36c0990 | 2017-09-26 11:34:26 +0530 | [diff] [blame] | 15278 | bss_list = (struct scan_result_list *)result_handle; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15279 | bss_descp = csr_get_fst_bssdescr_ptr(bss_list); |
Naveen Rawat | ae0aaa8 | 2017-02-17 14:41:19 -0800 | [diff] [blame] | 15280 | if (!bss_descp) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 15281 | sme_err("unable to fetch bss descriptor"); |
Naveen Rawat | ae0aaa8 | 2017-02-17 14:41:19 -0800 | [diff] [blame] | 15282 | status = QDF_STATUS_E_FAULT; |
| 15283 | goto free_scan_flter; |
| 15284 | } |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15285 | |
Naveen Rawat | 81f058c | 2017-06-02 16:02:39 -0700 | [diff] [blame] | 15286 | /** |
| 15287 | * Length of BSS descriptor is without length of |
| 15288 | * length itself and length of pointer that holds ieFields. |
| 15289 | * |
| 15290 | * tSirBssDescription |
| 15291 | * +--------+---------------------------------+---------------+ |
| 15292 | * | length | other fields | pointer to IEs| |
| 15293 | * +--------+---------------------------------+---------------+ |
| 15294 | * ^ |
| 15295 | * ieFields |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15296 | */ |
Naveen Rawat | 81f058c | 2017-06-02 16:02:39 -0700 | [diff] [blame] | 15297 | ie_len = bss_descp->length + sizeof(bss_descp->length) |
| 15298 | - (uint16_t)(offsetof(tSirBssDescription, ieFields[0])); |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15299 | sme_debug("found bss_descriptor ie_len: %d channel %d", |
| 15300 | ie_len, bss_descp->channelId); |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15301 | |
| 15302 | /* include mac header and fixed params along with IEs in frame */ |
| 15303 | *frame_len = SIR_MAC_HDR_LEN_3A + SIR_MAC_B_PR_SSID_OFFSET + ie_len; |
| 15304 | *frame_buf = qdf_mem_malloc(*frame_len); |
| 15305 | if (NULL == *frame_buf) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 15306 | sme_err("memory allocation failed"); |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15307 | status = QDF_STATUS_E_NOMEM; |
| 15308 | goto free_scan_flter; |
| 15309 | } |
| 15310 | |
| 15311 | sme_prepare_beacon_from_bss_descp(*frame_buf, bss_descp, bssid, ie_len); |
| 15312 | |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15313 | if (!*channel) |
| 15314 | *channel = bss_descp->channelId; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15315 | free_scan_flter: |
| 15316 | /* free scan filter and exit */ |
| 15317 | if (scan_filter) { |
| 15318 | csr_free_scan_filter(mac_ctx, scan_filter); |
| 15319 | qdf_mem_free(scan_filter); |
| 15320 | } |
Arif Hussain | fdb25e2 | 2017-02-05 17:38:16 -0800 | [diff] [blame] | 15321 | if (result_handle) |
| 15322 | csr_scan_result_purge(mac_ctx, result_handle); |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15323 | |
Naveen Rawat | ae0aaa8 | 2017-02-17 14:41:19 -0800 | [diff] [blame] | 15324 | return status; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15325 | } |
| 15326 | |
Paul Zhang | c3fc0a8 | 2018-01-09 16:38:20 +0800 | [diff] [blame] | 15327 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15328 | QDF_STATUS sme_fast_reassoc(tHalHandle hal, tCsrRoamProfile *profile, |
| 15329 | const tSirMacAddr bssid, int channel, |
Krunal Soni | 332f4af | 2017-06-01 14:36:17 -0700 | [diff] [blame] | 15330 | uint8_t vdev_id, const tSirMacAddr connected_bssid) |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15331 | { |
| 15332 | QDF_STATUS status; |
| 15333 | struct wma_roam_invoke_cmd *fastreassoc; |
| 15334 | struct scheduler_msg msg = {0}; |
Padma, Santhosh Kumar | 5bc0c24 | 2017-11-29 15:44:27 +0530 | [diff] [blame] | 15335 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15336 | |
| 15337 | fastreassoc = qdf_mem_malloc(sizeof(*fastreassoc)); |
| 15338 | if (NULL == fastreassoc) { |
| 15339 | sme_err("qdf_mem_malloc failed for fastreassoc"); |
| 15340 | return QDF_STATUS_E_NOMEM; |
| 15341 | } |
Krunal Soni | 332f4af | 2017-06-01 14:36:17 -0700 | [diff] [blame] | 15342 | /* if both are same then set the flag */ |
| 15343 | if (!qdf_mem_cmp(connected_bssid, bssid, ETH_ALEN)) { |
| 15344 | fastreassoc->is_same_bssid = true; |
| 15345 | sme_debug("bssid same, bssid[%pM]", bssid); |
| 15346 | } |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15347 | fastreassoc->vdev_id = vdev_id; |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15348 | fastreassoc->bssid[0] = bssid[0]; |
| 15349 | fastreassoc->bssid[1] = bssid[1]; |
| 15350 | fastreassoc->bssid[2] = bssid[2]; |
| 15351 | fastreassoc->bssid[3] = bssid[3]; |
| 15352 | fastreassoc->bssid[4] = bssid[4]; |
| 15353 | fastreassoc->bssid[5] = bssid[5]; |
| 15354 | |
| 15355 | status = sme_get_beacon_frm(hal, profile, bssid, |
| 15356 | &fastreassoc->frame_buf, |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15357 | &fastreassoc->frame_len, |
| 15358 | &channel); |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15359 | |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15360 | if (!channel) { |
| 15361 | sme_err("channel retrieval from BSS desc fails!"); |
| 15362 | qdf_mem_free(fastreassoc); |
| 15363 | return QDF_STATUS_E_FAULT; |
| 15364 | } |
| 15365 | |
| 15366 | fastreassoc->channel = channel; |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15367 | if (QDF_STATUS_SUCCESS != status) { |
| 15368 | sme_warn("sme_get_beacon_frm failed"); |
| 15369 | fastreassoc->frame_buf = NULL; |
| 15370 | fastreassoc->frame_len = 0; |
| 15371 | } |
| 15372 | |
Padma, Santhosh Kumar | 5bc0c24 | 2017-11-29 15:44:27 +0530 | [diff] [blame] | 15373 | if (csr_is_auth_type_ese(mac_ctx->roam.roamSession[vdev_id]. |
| 15374 | connectedProfile.AuthType)) { |
| 15375 | sme_debug("Beacon is not required for ESE"); |
| 15376 | if (fastreassoc->frame_len) { |
| 15377 | qdf_mem_free(fastreassoc->frame_buf); |
| 15378 | fastreassoc->frame_buf = NULL; |
| 15379 | fastreassoc->frame_len = 0; |
| 15380 | } |
| 15381 | } |
| 15382 | |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15383 | msg.type = SIR_HAL_ROAM_INVOKE; |
| 15384 | msg.reserved = 0; |
| 15385 | msg.bodyptr = fastreassoc; |
| 15386 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
| 15387 | if (QDF_STATUS_SUCCESS != status) { |
| 15388 | sme_err("Not able to post ROAM_INVOKE_CMD message to WMA"); |
| 15389 | qdf_mem_free(fastreassoc); |
| 15390 | } |
| 15391 | |
| 15392 | return status; |
| 15393 | } |
Paul Zhang | c3fc0a8 | 2018-01-09 16:38:20 +0800 | [diff] [blame] | 15394 | #endif |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15395 | |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 15396 | QDF_STATUS sme_set_del_pmkid_cache(tHalHandle hal, uint8_t session_id, |
| 15397 | tPmkidCacheInfo *pmk_cache_info, |
| 15398 | bool is_add) |
| 15399 | { |
| 15400 | struct wmi_unified_pmk_cache *pmk_cache; |
| 15401 | struct scheduler_msg msg; |
| 15402 | |
| 15403 | pmk_cache = qdf_mem_malloc(sizeof(*pmk_cache)); |
| 15404 | if (!pmk_cache) { |
| 15405 | sme_err("Memory allocation failure"); |
| 15406 | return QDF_STATUS_E_NOMEM; |
| 15407 | } |
| 15408 | |
Vignesh Viswanathan | e8a26b2 | 2017-10-11 20:38:47 +0530 | [diff] [blame] | 15409 | qdf_mem_set(pmk_cache, sizeof(*pmk_cache), 0); |
| 15410 | |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 15411 | pmk_cache->session_id = session_id; |
| 15412 | |
Vignesh Viswanathan | e8a26b2 | 2017-10-11 20:38:47 +0530 | [diff] [blame] | 15413 | if (!pmk_cache_info) |
| 15414 | goto send_flush_cmd; |
| 15415 | |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 15416 | if (!pmk_cache_info->ssid_len) { |
| 15417 | pmk_cache->cat_flag = WMI_PMK_CACHE_CAT_FLAG_BSSID; |
| 15418 | WMI_CHAR_ARRAY_TO_MAC_ADDR(pmk_cache_info->BSSID.bytes, |
| 15419 | &pmk_cache->bssid); |
| 15420 | } else { |
| 15421 | pmk_cache->cat_flag = WMI_PMK_CACHE_CAT_FLAG_SSID_CACHE_ID; |
| 15422 | pmk_cache->ssid.length = pmk_cache_info->ssid_len; |
| 15423 | qdf_mem_copy(pmk_cache->ssid.mac_ssid, |
| 15424 | pmk_cache_info->ssid, |
| 15425 | pmk_cache->ssid.length); |
| 15426 | } |
| 15427 | pmk_cache->cache_id = (uint32_t) (pmk_cache_info->cache_id[0] << 8 | |
| 15428 | pmk_cache_info->cache_id[1]); |
| 15429 | |
| 15430 | if (is_add) |
| 15431 | pmk_cache->action_flag = WMI_PMK_CACHE_ACTION_FLAG_ADD_ENTRY; |
| 15432 | else |
| 15433 | pmk_cache->action_flag = WMI_PMK_CACHE_ACTION_FLAG_DEL_ENTRY; |
| 15434 | |
| 15435 | pmk_cache->pmkid_len = CSR_RSN_PMKID_SIZE; |
| 15436 | qdf_mem_copy(pmk_cache->pmkid, pmk_cache_info->PMKID, |
| 15437 | CSR_RSN_PMKID_SIZE); |
| 15438 | |
| 15439 | pmk_cache->pmk_len = pmk_cache_info->pmk_len; |
| 15440 | qdf_mem_copy(pmk_cache->pmk, pmk_cache_info->pmk, |
| 15441 | pmk_cache->pmk_len); |
| 15442 | |
Vignesh Viswanathan | e8a26b2 | 2017-10-11 20:38:47 +0530 | [diff] [blame] | 15443 | send_flush_cmd: |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 15444 | msg.type = SIR_HAL_SET_DEL_PMKID_CACHE; |
| 15445 | msg.reserved = 0; |
| 15446 | msg.bodyptr = pmk_cache; |
| 15447 | if (QDF_STATUS_SUCCESS != |
| 15448 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg)) { |
| 15449 | sme_err("Not able to post message to WDA"); |
| 15450 | qdf_mem_free(pmk_cache); |
| 15451 | return QDF_STATUS_E_FAILURE; |
| 15452 | } |
| 15453 | |
| 15454 | return QDF_STATUS_SUCCESS; |
| 15455 | } |
| 15456 | |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 15457 | /* ARP DEBUG STATS */ |
| 15458 | |
| 15459 | /** |
| 15460 | * sme_set_nud_debug_stats() - sme api to set nud debug stats |
| 15461 | * @hal: handle to hal |
| 15462 | * @set_stats_param: pointer to set stats param |
| 15463 | * |
| 15464 | * Return: Return QDF_STATUS. |
| 15465 | */ |
| 15466 | QDF_STATUS sme_set_nud_debug_stats(tHalHandle hal, |
| 15467 | struct set_arp_stats_params |
| 15468 | *set_stats_param) |
| 15469 | { |
| 15470 | struct set_arp_stats_params *arp_set_param; |
| 15471 | struct scheduler_msg msg; |
| 15472 | |
| 15473 | arp_set_param = qdf_mem_malloc(sizeof(*arp_set_param)); |
| 15474 | if (arp_set_param == NULL) { |
| 15475 | sme_err("Memory allocation failure"); |
| 15476 | return QDF_STATUS_E_NOMEM; |
| 15477 | } |
| 15478 | |
| 15479 | qdf_mem_copy(arp_set_param, set_stats_param, sizeof(*arp_set_param)); |
| 15480 | |
| 15481 | msg.type = WMA_SET_ARP_STATS_REQ; |
| 15482 | msg.reserved = 0; |
| 15483 | msg.bodyptr = arp_set_param; |
| 15484 | |
| 15485 | if (QDF_STATUS_SUCCESS != |
| 15486 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg)) { |
| 15487 | sme_err("Not able to post message to WDA"); |
| 15488 | qdf_mem_free(arp_set_param); |
| 15489 | return QDF_STATUS_E_FAILURE; |
| 15490 | } |
| 15491 | |
| 15492 | return QDF_STATUS_SUCCESS; |
| 15493 | } |
| 15494 | |
| 15495 | /** |
| 15496 | * sme_get_nud_debug_stats() - sme api to get nud debug stats |
| 15497 | * @hal: handle to hal |
| 15498 | * @get_stats_param: pointer to set stats param |
| 15499 | * |
| 15500 | * Return: Return QDF_STATUS. |
| 15501 | */ |
| 15502 | QDF_STATUS sme_get_nud_debug_stats(tHalHandle hal, |
| 15503 | struct get_arp_stats_params |
| 15504 | *get_stats_param) |
| 15505 | { |
| 15506 | struct get_arp_stats_params *arp_get_param; |
| 15507 | struct scheduler_msg msg; |
| 15508 | |
| 15509 | arp_get_param = qdf_mem_malloc(sizeof(*arp_get_param)); |
| 15510 | if (arp_get_param == NULL) { |
| 15511 | sme_err("Memory allocation failure"); |
| 15512 | return QDF_STATUS_E_NOMEM; |
| 15513 | } |
| 15514 | |
| 15515 | qdf_mem_copy(arp_get_param, get_stats_param, sizeof(*arp_get_param)); |
| 15516 | |
| 15517 | msg.type = WMA_GET_ARP_STATS_REQ; |
| 15518 | msg.reserved = 0; |
| 15519 | msg.bodyptr = arp_get_param; |
| 15520 | |
| 15521 | if (QDF_STATUS_SUCCESS != |
| 15522 | scheduler_post_msg(QDF_MODULE_ID_WMA, &msg)) { |
| 15523 | sme_err("Not able to post message to WDA"); |
| 15524 | qdf_mem_free(arp_get_param); |
| 15525 | return QDF_STATUS_E_FAILURE; |
| 15526 | } |
| 15527 | |
| 15528 | return QDF_STATUS_SUCCESS; |
| 15529 | } |
| 15530 | |
Krishna Kumaar Natarajan | f1581df | 2017-02-21 13:42:08 -0800 | [diff] [blame] | 15531 | QDF_STATUS sme_set_peer_param(uint8_t *peer_addr, uint32_t param_id, |
| 15532 | uint32_t param_value, uint32_t vdev_id) |
| 15533 | { |
| 15534 | void *wma_handle; |
| 15535 | |
| 15536 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 15537 | if (!wma_handle) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 15538 | sme_err("wma handle is NULL"); |
Krishna Kumaar Natarajan | f1581df | 2017-02-21 13:42:08 -0800 | [diff] [blame] | 15539 | return QDF_STATUS_E_FAILURE; |
| 15540 | } |
| 15541 | |
| 15542 | return wma_set_peer_param(wma_handle, peer_addr, param_id, |
| 15543 | param_value, vdev_id); |
| 15544 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 15545 | |
| 15546 | QDF_STATUS sme_register_set_connection_info_cb(tHalHandle hHal, |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 15547 | bool (*set_connection_info_cb)(bool), |
| 15548 | bool (*get_connection_info_cb)(uint8_t *session_id, |
| 15549 | enum scan_reject_states *reason)) |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 15550 | { |
| 15551 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15552 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 15553 | |
| 15554 | status = sme_acquire_global_lock(&pMac->sme); |
| 15555 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 15556 | pMac->sme.set_connection_info_cb = set_connection_info_cb; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 15557 | pMac->sme.get_connection_info_cb = get_connection_info_cb; |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 15558 | sme_release_global_lock(&pMac->sme); |
| 15559 | } |
| 15560 | return status; |
| 15561 | } |
Sreelakshmi Konamki | 88a2a41 | 2017-04-14 15:11:55 +0530 | [diff] [blame] | 15562 | |
| 15563 | QDF_STATUS sme_rso_cmd_status_cb(tHalHandle hal, |
| 15564 | void (*cb)(void *, struct rso_cmd_status *)) |
| 15565 | { |
| 15566 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15567 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 15568 | |
| 15569 | mac->sme.rso_cmd_status_cb = cb; |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 15570 | sme_debug("Registered RSO command status callback"); |
Sreelakshmi Konamki | 88a2a41 | 2017-04-14 15:11:55 +0530 | [diff] [blame] | 15571 | return status; |
| 15572 | } |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 15573 | |
Nitesh Shah | f9a09ff | 2017-05-22 15:46:25 +0530 | [diff] [blame] | 15574 | QDF_STATUS sme_set_dbs_scan_selection_config(tHalHandle hal, |
| 15575 | struct wmi_dbs_scan_sel_params *params) |
| 15576 | { |
| 15577 | struct scheduler_msg message = {0}; |
| 15578 | QDF_STATUS status; |
| 15579 | struct wmi_dbs_scan_sel_params *dbs_scan_params; |
| 15580 | uint32_t i; |
| 15581 | |
| 15582 | if (0 == params->num_clients) { |
| 15583 | sme_err("Num of clients is 0"); |
| 15584 | return QDF_STATUS_E_FAILURE; |
| 15585 | } |
| 15586 | |
| 15587 | dbs_scan_params = qdf_mem_malloc(sizeof(*dbs_scan_params)); |
| 15588 | if (!dbs_scan_params) { |
| 15589 | sme_err("fail to alloc dbs_scan_params"); |
| 15590 | return QDF_STATUS_E_NOMEM; |
| 15591 | } |
| 15592 | |
| 15593 | dbs_scan_params->num_clients = params->num_clients; |
| 15594 | dbs_scan_params->pdev_id = params->pdev_id; |
| 15595 | for (i = 0; i < params->num_clients; i++) { |
| 15596 | dbs_scan_params->module_id[i] = params->module_id[i]; |
| 15597 | dbs_scan_params->num_dbs_scans[i] = params->num_dbs_scans[i]; |
| 15598 | dbs_scan_params->num_non_dbs_scans[i] = |
| 15599 | params->num_non_dbs_scans[i]; |
| 15600 | } |
| 15601 | message.type = WMA_SET_DBS_SCAN_SEL_CONF_PARAMS; |
| 15602 | message.bodyptr = dbs_scan_params; |
| 15603 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); |
| 15604 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 15605 | sme_err("Not able to post msg to WMA!"); |
| 15606 | qdf_mem_free(dbs_scan_params); |
| 15607 | } |
| 15608 | |
| 15609 | return status; |
| 15610 | } |
| 15611 | |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 15612 | QDF_STATUS sme_get_rcpi(tHalHandle hal, struct sme_rcpi_req *rcpi) |
| 15613 | { |
| 15614 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 15615 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
Naveen Rawat | b7be1ed | 2017-11-16 16:52:08 -0800 | [diff] [blame] | 15616 | struct scheduler_msg msg = {0}; |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 15617 | struct sme_rcpi_req *rcpi_req; |
| 15618 | |
| 15619 | rcpi_req = qdf_mem_malloc(sizeof(*rcpi_req)); |
| 15620 | if (rcpi_req == NULL) { |
| 15621 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15622 | "%s: Not able to allocate memory for rcpi req", |
| 15623 | __func__); |
| 15624 | return QDF_STATUS_E_NOMEM; |
| 15625 | } |
| 15626 | qdf_mem_copy(rcpi_req, rcpi, sizeof(*rcpi_req)); |
| 15627 | |
| 15628 | status = sme_acquire_global_lock(&pMac->sme); |
| 15629 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 15630 | msg.bodyptr = rcpi_req; |
| 15631 | msg.type = WMA_GET_RCPI_REQ; |
| 15632 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
| 15633 | sme_release_global_lock(&pMac->sme); |
| 15634 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 15635 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15636 | FL("post get rcpi req failed")); |
| 15637 | status = QDF_STATUS_E_FAILURE; |
| 15638 | qdf_mem_free(rcpi_req); |
| 15639 | } |
| 15640 | } else { |
| 15641 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15642 | FL("sme_acquire_global_lock failed")); |
| 15643 | qdf_mem_free(rcpi_req); |
| 15644 | } |
| 15645 | |
| 15646 | return status; |
| 15647 | } |
| 15648 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 15649 | void sme_store_pdev(tHalHandle hal, struct wlan_objmgr_pdev *pdev) |
| 15650 | { |
| 15651 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15652 | void *wma_handle; |
| 15653 | QDF_STATUS status; |
| 15654 | |
Kiran Kumar Lokere | f089a3a | 2017-04-20 21:39:26 -0700 | [diff] [blame] | 15655 | status = wlan_objmgr_pdev_try_get_ref(pdev, WLAN_LEGACY_MAC_ID); |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 15656 | if (QDF_STATUS_SUCCESS != status) { |
| 15657 | mac_ctx->pdev = NULL; |
| 15658 | return; |
| 15659 | } |
| 15660 | mac_ctx->pdev = pdev; |
| 15661 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 15662 | if (!wma_handle) { |
| 15663 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | f089a3a | 2017-04-20 21:39:26 -0700 | [diff] [blame] | 15664 | FL("wma handle is NULL")); |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 15665 | return; |
| 15666 | } |
| 15667 | wma_store_pdev(wma_handle, pdev); |
| 15668 | } |
| 15669 | |
Padma, Santhosh Kumar | 16dacfb | 2017-03-21 19:05:40 +0530 | [diff] [blame] | 15670 | QDF_STATUS sme_congestion_register_callback(tHalHandle hal, |
| 15671 | void (*congestion_cb)(void *, uint32_t congestion, uint32_t vdev_id)) |
| 15672 | { |
| 15673 | QDF_STATUS status; |
| 15674 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 15675 | |
| 15676 | status = sme_acquire_global_lock(&mac->sme); |
| 15677 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 15678 | mac->sme.congestion_cb = congestion_cb; |
| 15679 | sme_release_global_lock(&mac->sme); |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 15680 | sme_debug("congestion callback set"); |
Padma, Santhosh Kumar | 16dacfb | 2017-03-21 19:05:40 +0530 | [diff] [blame] | 15681 | } else { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 15682 | sme_err("Aquiring lock failed %d", status); |
Padma, Santhosh Kumar | 16dacfb | 2017-03-21 19:05:40 +0530 | [diff] [blame] | 15683 | } |
| 15684 | |
| 15685 | return status; |
| 15686 | } |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 15687 | |
Varun Reddy Yeturu | 076eaa8 | 2018-01-16 12:16:14 -0800 | [diff] [blame] | 15688 | QDF_STATUS sme_register_tx_queue_cb(tHalHandle hal, |
| 15689 | void (*tx_queue_cb)(void *, |
| 15690 | uint32_t vdev_id, |
| 15691 | enum netif_action_type action, |
| 15692 | enum netif_reason_type reason)) |
| 15693 | { |
| 15694 | QDF_STATUS status; |
| 15695 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 15696 | |
| 15697 | status = sme_acquire_global_lock(&mac->sme); |
| 15698 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 15699 | mac->sme.tx_queue_cb = tx_queue_cb; |
| 15700 | sme_release_global_lock(&mac->sme); |
| 15701 | sme_debug("Tx queue callback set"); |
| 15702 | } else { |
| 15703 | sme_err("Aquiring lock failed %d", status); |
| 15704 | } |
| 15705 | |
| 15706 | return status; |
| 15707 | } |
| 15708 | |
| 15709 | QDF_STATUS sme_deregister_tx_queue_cb(tHalHandle hal) |
| 15710 | { |
| 15711 | return sme_register_tx_queue_cb(hal, NULL); |
| 15712 | } |
| 15713 | |
Ashish Kumar Dhanotiya | b28338c | 2017-07-21 20:12:34 +0530 | [diff] [blame] | 15714 | QDF_STATUS sme_set_smps_cfg(uint32_t vdev_id, uint32_t param_id, |
| 15715 | uint32_t param_val) |
| 15716 | { |
| 15717 | return wma_configure_smps_params(vdev_id, param_id, param_val); |
| 15718 | } |
| 15719 | |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 15720 | QDF_STATUS sme_ipa_uc_stat_request(tHalHandle hal, uint32_t vdev_id, |
| 15721 | uint32_t param_id, uint32_t param_val, uint32_t req_cat) |
| 15722 | { |
Sandeep Puligilla | e64099d | 2017-05-11 16:38:27 -0700 | [diff] [blame] | 15723 | wma_cli_set_cmd_t *iwcmd; |
| 15724 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 15725 | |
Sandeep Puligilla | e64099d | 2017-05-11 16:38:27 -0700 | [diff] [blame] | 15726 | iwcmd = qdf_mem_malloc(sizeof(*iwcmd)); |
| 15727 | if (!iwcmd) { |
| 15728 | sme_err("Failed alloc memory for iwcmd"); |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 15729 | return QDF_STATUS_E_NOMEM; |
| 15730 | } |
Sandeep Puligilla | e64099d | 2017-05-11 16:38:27 -0700 | [diff] [blame] | 15731 | |
| 15732 | qdf_mem_zero(iwcmd, sizeof(*iwcmd)); |
| 15733 | iwcmd->param_sec_value = 0; |
| 15734 | iwcmd->param_vdev_id = vdev_id; |
| 15735 | iwcmd->param_id = param_id; |
| 15736 | iwcmd->param_vp_dev = req_cat; |
| 15737 | iwcmd->param_value = param_val; |
| 15738 | wma_ipa_uc_stat_request(iwcmd); |
| 15739 | qdf_mem_free(iwcmd); |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 15740 | |
| 15741 | return status; |
| 15742 | } |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 15743 | |
| 15744 | QDF_STATUS sme_set_reorder_timeout(tHalHandle hal, |
| 15745 | struct sir_set_rx_reorder_timeout_val *req) |
| 15746 | { |
| 15747 | QDF_STATUS status; |
| 15748 | |
| 15749 | status = wma_set_rx_reorder_timeout_val(hal, req); |
| 15750 | |
| 15751 | return status; |
| 15752 | } |
| 15753 | |
| 15754 | QDF_STATUS sme_set_rx_set_blocksize(tHalHandle hal, |
| 15755 | struct sir_peer_set_rx_blocksize *req) |
| 15756 | { |
| 15757 | QDF_STATUS status; |
| 15758 | |
| 15759 | status = wma_set_rx_blocksize(hal, req); |
| 15760 | |
| 15761 | return status; |
| 15762 | } |
Naveen Rawat | 247a868 | 2017-06-05 15:00:31 -0700 | [diff] [blame] | 15763 | |
| 15764 | int sme_cli_set_command(int vdev_id, int param_id, int sval, int vpdev) |
| 15765 | { |
| 15766 | return wma_cli_set_command(vdev_id, param_id, sval, vpdev); |
| 15767 | } |
Vidyullatha Kanchanapally | be0ebb3 | 2017-03-23 14:36:21 +0530 | [diff] [blame] | 15768 | |
| 15769 | QDF_STATUS sme_set_bt_activity_info_cb(tHalHandle hal, |
| 15770 | void (*cb)(void *, uint32_t bt_activity)) |
| 15771 | { |
| 15772 | QDF_STATUS status; |
| 15773 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 15774 | |
| 15775 | status = sme_acquire_global_lock(&mac->sme); |
| 15776 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 15777 | mac->sme.bt_activity_info_cb = cb; |
| 15778 | sme_release_global_lock(&mac->sme); |
| 15779 | sme_debug("bt activity info callback set"); |
| 15780 | } else { |
| 15781 | sme_debug("sme_acquire_global_lock failed %d", status); |
| 15782 | } |
| 15783 | |
| 15784 | return status; |
| 15785 | } |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 15786 | |
| 15787 | QDF_STATUS sme_get_chain_rssi(tHalHandle hal, |
| 15788 | struct get_chain_rssi_req_params *input, |
| 15789 | get_chain_rssi_callback callback, |
| 15790 | void *context) |
| 15791 | { |
| 15792 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15793 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15794 | |
| 15795 | SME_ENTER(); |
| 15796 | |
| 15797 | if (NULL == input) { |
| 15798 | sme_err("Invalid req params"); |
| 15799 | return QDF_STATUS_E_INVAL; |
| 15800 | } |
| 15801 | |
| 15802 | mac_ctx->sme.get_chain_rssi_cb = callback; |
| 15803 | mac_ctx->sme.get_chain_rssi_context = context; |
| 15804 | wma_get_chain_rssi(hal, input); |
| 15805 | |
| 15806 | SME_EXIT(); |
| 15807 | return status; |
| 15808 | } |
Vignesh Viswanathan | 66c951d | 2017-09-06 12:23:42 +0530 | [diff] [blame] | 15809 | |
Sandeep Puligilla | 1426d61 | 2017-04-12 18:22:06 -0700 | [diff] [blame] | 15810 | QDF_STATUS sme_process_msg_callback(tHalHandle hal, |
| 15811 | struct scheduler_msg *msg) |
| 15812 | { |
| 15813 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 15814 | |
| 15815 | if (msg == NULL) { |
| 15816 | sme_err("Empty message for SME Msg callback"); |
| 15817 | return status; |
| 15818 | } |
| 15819 | status = sme_process_msg(hal, msg); |
| 15820 | return status; |
| 15821 | } |
| 15822 | |
Vignesh Viswanathan | 66c951d | 2017-09-06 12:23:42 +0530 | [diff] [blame] | 15823 | void sme_display_disconnect_stats(tHalHandle hal, uint8_t session_id) |
| 15824 | { |
| 15825 | struct csr_roam_session *session; |
| 15826 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15827 | |
| 15828 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
| 15829 | sme_err("%s Invalid session id: %d", __func__, session_id); |
| 15830 | return; |
| 15831 | } |
| 15832 | |
| 15833 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 15834 | if (!session) { |
| 15835 | sme_err("%s Failed to get session for id: %d", |
| 15836 | __func__, session_id); |
| 15837 | return; |
| 15838 | } |
| 15839 | |
| 15840 | sme_debug("Total No. of Disconnections: %d", |
| 15841 | session->disconnect_stats.disconnection_cnt); |
| 15842 | |
| 15843 | sme_debug("No. of Diconnects Triggered by Application: %d", |
| 15844 | session->disconnect_stats.disconnection_by_app); |
| 15845 | |
| 15846 | sme_debug("No. of Disassoc Sent by Peer: %d", |
| 15847 | session->disconnect_stats.disassoc_by_peer); |
| 15848 | |
| 15849 | sme_debug("No. of Deauth Sent by Peer: %d", |
| 15850 | session->disconnect_stats.deauth_by_peer); |
| 15851 | |
| 15852 | sme_debug("No. of Disconnections due to Beacon Miss: %d", |
| 15853 | session->disconnect_stats.bmiss); |
| 15854 | |
| 15855 | sme_debug("No. of Disconnections due to Peer Kickout: %d", |
| 15856 | session->disconnect_stats.peer_kickout); |
| 15857 | } |
Nachiket Kukade | aaf8a71 | 2017-07-27 19:15:36 +0530 | [diff] [blame] | 15858 | |
Nachiket Kukade | 8983cf6 | 2017-10-12 18:14:48 +0530 | [diff] [blame] | 15859 | /** |
| 15860 | * sme_set_vc_mode_config() - Set voltage corner config to FW |
| 15861 | * @bitmap: Bitmap that referes to voltage corner config with |
| 15862 | * different phymode and bw configuration |
| 15863 | * |
| 15864 | * Return: QDF_STATUS |
| 15865 | */ |
| 15866 | QDF_STATUS sme_set_vc_mode_config(uint32_t vc_bitmap) |
| 15867 | { |
| 15868 | void *wma_handle; |
| 15869 | |
| 15870 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 15871 | if (!wma_handle) { |
| 15872 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15873 | "wma_handle is NULL"); |
| 15874 | return QDF_STATUS_E_FAILURE; |
| 15875 | } |
| 15876 | if (QDF_STATUS_SUCCESS != |
| 15877 | wma_set_vc_mode_config(wma_handle, vc_bitmap)) { |
| 15878 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15879 | "%s: Failed to set Voltage Control config to FW", |
| 15880 | __func__); |
| 15881 | return QDF_STATUS_E_FAILURE; |
| 15882 | } |
| 15883 | return QDF_STATUS_SUCCESS; |
| 15884 | } |
| 15885 | |
Nachiket Kukade | aaf8a71 | 2017-07-27 19:15:36 +0530 | [diff] [blame] | 15886 | /** |
| 15887 | * sme_set_bmiss_bcnt() - set bmiss config parameters |
| 15888 | * @vdev_id: virtual device for the command |
| 15889 | * @first_cnt: bmiss first value |
| 15890 | * @final_cnt: bmiss final value |
| 15891 | * |
| 15892 | * Return: QDF_STATUS_SUCCESS or non-zero on failure |
| 15893 | */ |
| 15894 | QDF_STATUS sme_set_bmiss_bcnt(uint32_t vdev_id, uint32_t first_cnt, |
| 15895 | uint32_t final_cnt) |
| 15896 | { |
| 15897 | return wma_config_bmiss_bcnt_params(vdev_id, first_cnt, final_cnt); |
| 15898 | } |
Ganesh Kondabattini | 479a8ae | 2017-10-03 16:49:24 +0530 | [diff] [blame] | 15899 | |
| 15900 | QDF_STATUS sme_send_limit_off_channel_params(tHalHandle hal, uint8_t vdev_id, |
| 15901 | bool is_tos_active, uint32_t max_off_chan_time, |
| 15902 | uint32_t rest_time, bool skip_dfs_chan) |
| 15903 | { |
| 15904 | struct sir_limit_off_chan *cmd; |
| 15905 | struct scheduler_msg msg = {0}; |
| 15906 | |
| 15907 | cmd = qdf_mem_malloc(sizeof(*cmd)); |
| 15908 | if (!cmd) { |
| 15909 | sme_err("qdf_mem_malloc failed for limit off channel"); |
| 15910 | return QDF_STATUS_E_NOMEM; |
| 15911 | } |
| 15912 | |
| 15913 | cmd->vdev_id = vdev_id; |
| 15914 | cmd->is_tos_active = is_tos_active; |
| 15915 | cmd->max_off_chan_time = max_off_chan_time; |
| 15916 | cmd->rest_time = rest_time; |
| 15917 | cmd->skip_dfs_chans = skip_dfs_chan; |
| 15918 | |
| 15919 | msg.type = WMA_SET_LIMIT_OFF_CHAN; |
| 15920 | msg.reserved = 0; |
| 15921 | msg.bodyptr = cmd; |
| 15922 | |
| 15923 | if (!QDF_IS_STATUS_SUCCESS(scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 15924 | &msg))) { |
| 15925 | sme_err("Not able to post WMA_SET_LIMIT_OFF_CHAN to WMA"); |
| 15926 | qdf_mem_free(cmd); |
| 15927 | return QDF_STATUS_E_FAILURE; |
| 15928 | } |
| 15929 | |
| 15930 | return QDF_STATUS_SUCCESS; |
| 15931 | } |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 15932 | |
| 15933 | /** |
| 15934 | * sme_get_status_for_candidate() - Get bss transition status for candidate |
| 15935 | * @hal: Handle for HAL |
| 15936 | * @conn_bss_desc: connected bss descriptor |
| 15937 | * @bss_desc: candidate bss descriptor |
| 15938 | * @info: candiadate bss information |
| 15939 | * @trans_reason: transition reason code |
| 15940 | * @is_bt_in_progress: bt activity indicator |
| 15941 | * |
| 15942 | * Return : true if candidate is rejected and reject reason is filled |
| 15943 | * @info->status. Otherwise returns false. |
| 15944 | */ |
| 15945 | static bool sme_get_status_for_candidate(tHalHandle *hal, |
| 15946 | tSirBssDescription *conn_bss_desc, |
| 15947 | tSirBssDescription *bss_desc, |
| 15948 | struct bss_candidate_info *info, |
| 15949 | uint8_t trans_reason, |
| 15950 | bool is_bt_in_progress) |
| 15951 | { |
| 15952 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15953 | |
| 15954 | /* |
| 15955 | * Low RSSI based rejection |
| 15956 | * If candidate rssi is less than mbo_candidate_rssi_thres and connected |
| 15957 | * bss rssi is greater than mbo_current_rssi_thres, then reject the |
| 15958 | * candidate with MBO reason code 4. |
| 15959 | */ |
| 15960 | if ((bss_desc->rssi < mac_ctx->roam.configParam.mbo_thresholds. |
| 15961 | mbo_candidate_rssi_thres) && |
| 15962 | (conn_bss_desc->rssi > mac_ctx->roam.configParam.mbo_thresholds. |
| 15963 | mbo_current_rssi_thres)) { |
| 15964 | sme_err("Candidate BSS "MAC_ADDRESS_STR" has LOW RSSI(%d), hence reject", |
| 15965 | MAC_ADDR_ARRAY(bss_desc->bssId), bss_desc->rssi); |
| 15966 | info->status = QCA_STATUS_REJECT_LOW_RSSI; |
| 15967 | return true; |
| 15968 | } |
| 15969 | |
| 15970 | if (trans_reason == MBO_TRANSITION_REASON_LOAD_BALANCING || |
| 15971 | trans_reason == MBO_TRANSITION_REASON_TRANSITIONING_TO_PREMIUM_AP) { |
| 15972 | /* |
| 15973 | * MCC rejection |
| 15974 | * If moving to candidate's channel will result in MCC scenario |
| 15975 | * and the rssi of connected bss is greater than |
| 15976 | * mbo_current_rssi_mss_thres, then reject the candidate with |
| 15977 | * MBO reason code 3. |
| 15978 | */ |
| 15979 | if ((conn_bss_desc->rssi > |
| 15980 | mac_ctx->roam.configParam.mbo_thresholds. |
| 15981 | mbo_current_rssi_mcc_thres) && |
| 15982 | csr_is_mcc_channel(hal, bss_desc->channelId)) { |
| 15983 | sme_err("Candidate BSS "MAC_ADDRESS_STR" causes MCC, hence reject", |
| 15984 | MAC_ADDR_ARRAY(bss_desc->bssId)); |
| 15985 | info->status = |
| 15986 | QCA_STATUS_REJECT_INSUFFICIENT_QOS_CAPACITY; |
| 15987 | return true; |
| 15988 | } |
| 15989 | |
| 15990 | /* |
| 15991 | * BT coex rejection |
| 15992 | * If AP is trying to move the client from 5G to 2.4G and moving |
| 15993 | * to 2.4G will result in BT coex and candidate channel rssi is |
| 15994 | * less than mbo_candidate_rssi_btc_thres, then reject the |
| 15995 | * candidate with MBO reason code 2. |
| 15996 | */ |
| 15997 | if (WLAN_REG_IS_5GHZ_CH(conn_bss_desc->channelId) && |
| 15998 | WLAN_REG_IS_24GHZ_CH(bss_desc->channelId) && |
| 15999 | is_bt_in_progress && |
| 16000 | (bss_desc->rssi < |
| 16001 | mac_ctx->roam.configParam.mbo_thresholds. |
| 16002 | mbo_candidate_rssi_btc_thres)) { |
| 16003 | sme_err("Candidate BSS "MAC_ADDRESS_STR" causes BT coex, hence reject", |
| 16004 | MAC_ADDR_ARRAY(bss_desc->bssId)); |
| 16005 | info->status = |
| 16006 | QCA_STATUS_REJECT_EXCESSIVE_DELAY_EXPECTED; |
| 16007 | return true; |
| 16008 | } |
| 16009 | |
| 16010 | /* |
| 16011 | * LTE coex rejection |
| 16012 | * If moving to candidate's channel can cause LTE coex, then |
| 16013 | * reject the candidate with MBO reason code 5. |
| 16014 | */ |
| 16015 | if (policy_mgr_is_safe_channel(mac_ctx->psoc, |
| 16016 | conn_bss_desc->channelId) && |
| 16017 | !(policy_mgr_is_safe_channel(mac_ctx->psoc, |
| 16018 | bss_desc->channelId))) { |
| 16019 | sme_err("High interference expected if transitioned to BSS " |
| 16020 | MAC_ADDRESS_STR" hence reject", |
| 16021 | MAC_ADDR_ARRAY(bss_desc->bssId)); |
| 16022 | info->status = |
| 16023 | QCA_STATUS_REJECT_HIGH_INTERFERENCE; |
| 16024 | return true; |
| 16025 | } |
| 16026 | } |
| 16027 | |
| 16028 | return false; |
| 16029 | } |
| 16030 | |
Abhishek Singh | 7dcb85b | 2017-12-27 15:15:01 +0530 | [diff] [blame] | 16031 | uint32_t sme_unpack_rsn_ie(tHalHandle hal, uint8_t *buf, |
| 16032 | uint8_t buf_len, tDot11fIERSN *rsn_ie, |
| 16033 | bool append_ie) |
| 16034 | { |
| 16035 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16036 | |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 16037 | return dot11f_unpack_ie_rsn(mac_ctx, buf, buf_len, rsn_ie, append_ie); |
Abhishek Singh | 7dcb85b | 2017-12-27 15:15:01 +0530 | [diff] [blame] | 16038 | } |
| 16039 | |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 16040 | /** |
| 16041 | * wlan_hdd_get_bss_transition_status() - get bss transition status all cadidates |
| 16042 | * @adapter : Pointer to adapter |
| 16043 | * @transition_reason : Transition reason |
| 16044 | * @info : bss candidate information |
| 16045 | * @n_candidates : number of candidates |
| 16046 | * |
| 16047 | * Return : 0 on success otherwise errno |
| 16048 | */ |
| 16049 | int sme_get_bss_transition_status(tHalHandle hal, |
| 16050 | uint8_t transition_reason, |
| 16051 | struct qdf_mac_addr *bssid, |
| 16052 | struct bss_candidate_info *info, |
| 16053 | uint16_t n_candidates, |
| 16054 | bool is_bt_in_progress) |
| 16055 | { |
| 16056 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 16057 | tSirBssDescription *bss_desc, *conn_bss_desc; |
| 16058 | tCsrScanResultInfo *res, *conn_res; |
| 16059 | uint16_t i; |
| 16060 | |
| 16061 | if (!n_candidates || !info) { |
| 16062 | sme_err("No candidate info available"); |
| 16063 | return QDF_STATUS_E_INVAL; |
| 16064 | } |
| 16065 | |
| 16066 | conn_res = qdf_mem_malloc(sizeof(tCsrScanResultInfo)); |
| 16067 | if (!conn_res) { |
| 16068 | sme_err("Failed to allocate memory for conn_res"); |
| 16069 | return QDF_STATUS_E_NOMEM; |
| 16070 | } |
| 16071 | |
| 16072 | res = qdf_mem_malloc(sizeof(tCsrScanResultInfo)); |
| 16073 | if (!res) { |
| 16074 | sme_err("Failed to allocate memory for conn_res"); |
| 16075 | status = QDF_STATUS_E_NOMEM; |
| 16076 | goto free; |
| 16077 | } |
| 16078 | |
| 16079 | /* Get the connected BSS descriptor */ |
| 16080 | status = sme_scan_get_result_for_bssid(hal, bssid, conn_res); |
| 16081 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 16082 | sme_err("Failed to find connected BSS in scan list"); |
| 16083 | goto free; |
| 16084 | } |
| 16085 | conn_bss_desc = &conn_res->BssDescriptor; |
| 16086 | |
| 16087 | for (i = 0; i < n_candidates; i++) { |
| 16088 | /* Get candidate BSS descriptors */ |
| 16089 | status = sme_scan_get_result_for_bssid(hal, &info[i].bssid, |
| 16090 | res); |
| 16091 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 16092 | sme_err("BSS "MAC_ADDRESS_STR" not present in scan list", |
| 16093 | MAC_ADDR_ARRAY(info[i].bssid.bytes)); |
| 16094 | info[i].status = QCA_STATUS_REJECT_UNKNOWN; |
| 16095 | continue; |
| 16096 | } |
| 16097 | |
| 16098 | bss_desc = &res->BssDescriptor; |
| 16099 | if (!sme_get_status_for_candidate(hal, conn_bss_desc, bss_desc, |
| 16100 | &info[i], transition_reason, is_bt_in_progress)) { |
| 16101 | /* |
| 16102 | * If status is not over written, it means it is a |
| 16103 | * candidate for accept. |
| 16104 | */ |
| 16105 | info[i].status = QCA_STATUS_ACCEPT; |
| 16106 | } |
| 16107 | } |
| 16108 | |
| 16109 | /* success */ |
| 16110 | status = QDF_STATUS_SUCCESS; |
| 16111 | |
| 16112 | free: |
| 16113 | /* free allocated memory */ |
| 16114 | if (conn_res) |
| 16115 | qdf_mem_free(conn_res); |
| 16116 | if (res) |
| 16117 | qdf_mem_free(res); |
| 16118 | |
| 16119 | return status; |
| 16120 | } |
| 16121 | |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 16122 | void sme_enable_roaming_on_connected_sta(tHalHandle hal) |
| 16123 | { |
| 16124 | uint8_t session_id; |
| 16125 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16126 | QDF_STATUS status; |
| 16127 | |
| 16128 | session_id = csr_get_roam_enabled_sta_sessionid(mac_ctx); |
| 16129 | if (session_id != CSR_SESSION_ID_INVALID) |
| 16130 | return; |
| 16131 | |
| 16132 | session_id = csr_get_connected_infra(mac_ctx); |
| 16133 | if (session_id == CSR_SESSION_ID_INVALID) { |
| 16134 | sme_debug("No STA in conencted state"); |
| 16135 | return; |
| 16136 | } |
| 16137 | |
| 16138 | sme_debug("Roaming not enabled on any STA, enable roaming on session %d", |
| 16139 | session_id); |
| 16140 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 16141 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 16142 | csr_roam_offload_scan(mac_ctx, session_id, |
| 16143 | ROAM_SCAN_OFFLOAD_START, |
| 16144 | REASON_CTX_INIT); |
| 16145 | sme_release_global_lock(&mac_ctx->sme); |
| 16146 | } |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 16147 | } |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 16148 | |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 16149 | int16_t sme_get_oper_chan_freq(struct wlan_objmgr_vdev *vdev) |
| 16150 | { |
| 16151 | uint8_t vdev_id, chan; |
| 16152 | struct csr_roam_session *session; |
| 16153 | tpAniSirGlobal mac_ctx; |
| 16154 | tHalHandle h_hal; |
| 16155 | int16_t freq = 0; |
| 16156 | |
| 16157 | if (vdev == NULL) { |
| 16158 | sme_err("Invalid vdev id is passed"); |
| 16159 | return 0; |
| 16160 | } |
| 16161 | |
| 16162 | h_hal = cds_get_context(QDF_MODULE_ID_SME); |
| 16163 | mac_ctx = PMAC_STRUCT(h_hal); |
| 16164 | vdev_id = wlan_vdev_get_id(vdev); |
| 16165 | if (!CSR_IS_SESSION_VALID(mac_ctx, vdev_id)) { |
| 16166 | sme_err("Invalid vdev id is passed"); |
| 16167 | return 0; |
| 16168 | } |
| 16169 | |
| 16170 | session = CSR_GET_SESSION(mac_ctx, vdev_id); |
| 16171 | chan = csr_get_infra_operation_channel(mac_ctx, vdev_id); |
| 16172 | if (chan) |
| 16173 | freq = cds_chan_to_freq(chan); |
| 16174 | |
| 16175 | return freq; |
| 16176 | } |
| 16177 | |
| 16178 | enum phy_ch_width sme_get_oper_ch_width(struct wlan_objmgr_vdev *vdev) |
| 16179 | { |
| 16180 | uint8_t vdev_id; |
| 16181 | struct csr_roam_session *session; |
| 16182 | tpAniSirGlobal mac_ctx; |
| 16183 | tHalHandle h_hal; |
| 16184 | enum phy_ch_width ch_width = CH_WIDTH_20MHZ; |
| 16185 | |
| 16186 | if (vdev == NULL) { |
| 16187 | sme_err("Invalid vdev id is passed"); |
| 16188 | return CH_WIDTH_INVALID; |
| 16189 | } |
| 16190 | |
| 16191 | h_hal = cds_get_context(QDF_MODULE_ID_SME); |
| 16192 | mac_ctx = PMAC_STRUCT(h_hal); |
| 16193 | vdev_id = wlan_vdev_get_id(vdev); |
| 16194 | if (!CSR_IS_SESSION_VALID(mac_ctx, vdev_id)) { |
| 16195 | sme_err("Invalid vdev id is passed"); |
| 16196 | return CH_WIDTH_INVALID; |
| 16197 | } |
| 16198 | |
| 16199 | session = CSR_GET_SESSION(mac_ctx, vdev_id); |
| 16200 | |
| 16201 | if (csr_is_conn_state_connected(mac_ctx, vdev_id)) |
| 16202 | ch_width = session->connectedProfile.vht_channel_width; |
| 16203 | |
| 16204 | return ch_width; |
| 16205 | } |
| 16206 | |
| 16207 | int sme_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev, |
| 16208 | uint16_t *sec20chan_freq) |
| 16209 | { |
| 16210 | uint8_t vdev_id; |
| 16211 | |
| 16212 | vdev_id = wlan_vdev_get_id(vdev); |
| 16213 | /* Need to extend */ |
| 16214 | return 0; |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 16215 | } |
| 16216 | |
Padma, Santhosh Kumar | dd3f485 | 2018-01-16 18:51:51 +0530 | [diff] [blame] | 16217 | #ifdef WLAN_FEATURE_SAE |
| 16218 | QDF_STATUS sme_handle_sae_msg(tHalHandle hal, uint8_t session_id, |
| 16219 | uint8_t sae_status) |
| 16220 | { |
| 16221 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 16222 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 16223 | struct sir_sae_msg *sae_msg; |
| 16224 | struct scheduler_msg sch_msg = {0}; |
| 16225 | |
| 16226 | qdf_status = sme_acquire_global_lock(&mac->sme); |
| 16227 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 16228 | sae_msg = qdf_mem_malloc(sizeof(*sae_msg)); |
| 16229 | if (!sae_msg) { |
| 16230 | qdf_status = QDF_STATUS_E_NOMEM; |
| 16231 | sme_err("SAE: memory allocation failed"); |
| 16232 | } else { |
| 16233 | sae_msg->message_type = eWNI_SME_SEND_SAE_MSG; |
| 16234 | sae_msg->length = sizeof(*sae_msg); |
| 16235 | sae_msg->session_id = session_id; |
| 16236 | sae_msg->sae_status = sae_status; |
| 16237 | sme_debug("SAE: sae_status %d session_id %d", |
| 16238 | sae_msg->sae_status, |
| 16239 | sae_msg->session_id); |
| 16240 | |
| 16241 | sch_msg.type = eWNI_SME_SEND_SAE_MSG; |
| 16242 | sch_msg.bodyptr = sae_msg; |
| 16243 | |
| 16244 | qdf_status = |
| 16245 | scheduler_post_msg(QDF_MODULE_ID_PE, &sch_msg); |
| 16246 | } |
| 16247 | sme_release_global_lock(&mac->sme); |
| 16248 | } |
| 16249 | |
| 16250 | return qdf_status; |
| 16251 | } |
| 16252 | #endif |
Vignesh Viswanathan | 0a56929 | 2018-02-14 15:34:47 +0530 | [diff] [blame] | 16253 | |
| 16254 | bool sme_is_sta_key_exchange_in_progress(tHalHandle hal, uint8_t session_id) |
| 16255 | { |
| 16256 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16257 | |
| 16258 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
| 16259 | sme_err("Invalid session id: %d", session_id); |
| 16260 | return false; |
| 16261 | } |
| 16262 | |
| 16263 | return CSR_IS_WAIT_FOR_KEY(mac_ctx, session_id); |
| 16264 | } |