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 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | /* |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 20 | * DOC: smeApi.c |
| 21 | * |
| 22 | * Definitions for SME APIs |
| 23 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 24 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 25 | /* Include Files */ |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 26 | #include <sir_common.h> |
| 27 | #include <ani_global.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 28 | #include "sme_api.h" |
| 29 | #include "csr_inside_api.h" |
| 30 | #include "sme_inside.h" |
| 31 | #include "csr_internal.h" |
| 32 | #include "wma_types.h" |
| 33 | #include "wma_if.h" |
Jeff Johnson | 6136fb9 | 2017-03-30 15:21:49 -0700 | [diff] [blame] | 34 | #include "wma_fips_api.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 35 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 36 | #include "sme_trace.h" |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 37 | #include "qdf_types.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 38 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 39 | #include "cds_utils.h" |
| 40 | #include "sap_api.h" |
| 41 | #include "mac_trace.h" |
| 42 | #ifdef WLAN_FEATURE_NAN |
| 43 | #include "nan_api.h" |
| 44 | #endif |
Naveen Rawat | 3b6068c | 2016-04-14 19:01:06 -0700 | [diff] [blame] | 45 | #include "cds_regdomain.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | #include "cfg_api.h" |
| 47 | #include "sme_power_save_api.h" |
| 48 | #include "wma.h" |
Naveen Rawat | b4d3762 | 2015-11-13 16:15:25 -0800 | [diff] [blame] | 49 | #include "sch_api.h" |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 50 | #include "sme_nan_datapath.h" |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 51 | #include "csr_api.h" |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 52 | #include "wlan_reg_services_api.h" |
Abhishek Singh | 158fe25 | 2017-03-23 11:09:34 +0530 | [diff] [blame] | 53 | #include <wlan_scan_ucfg_api.h> |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 54 | #include "wlan_reg_ucfg_api.h" |
Arif Hussain | ee67701 | 2017-01-26 17:50:13 -0800 | [diff] [blame] | 55 | #include "ol_txrx.h" |
Naveen Rawat | d2657be | 2017-10-10 14:31:23 -0700 | [diff] [blame] | 56 | #include "wifi_pos_api.h" |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 57 | #include "net/cfg80211.h" |
| 58 | #include <qca_vendor.h> |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 59 | #include <wlan_spectral_utils_api.h> |
Vignesh Viswanathan | 21c58cb | 2018-05-24 15:53:58 +0530 | [diff] [blame] | 60 | #include "wlan_mlme_public_struct.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 61 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 62 | static tSelfRecoveryStats g_self_recovery_stats; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 63 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 64 | static QDF_STATUS init_sme_cmd_list(tpAniSirGlobal pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 65 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 66 | static void sme_disconnect_connected_sessions(tpAniSirGlobal pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 67 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 68 | static QDF_STATUS sme_handle_generic_change_country_code(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 69 | void *pMsgBuf); |
| 70 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 71 | 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] | 72 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 73 | /* Channel Change Response Indication Handler */ |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 74 | static QDF_STATUS sme_process_channel_change_resp(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 75 | uint16_t msg_type, void *pMsgBuf); |
| 76 | |
Jeff Johnson | fdecd51 | 2018-06-10 09:18:32 -0700 | [diff] [blame] | 77 | static QDF_STATUS sme_stats_ext_event(tpAniSirGlobal mac, |
Jeff Johnson | 4584365 | 2018-07-04 12:47:34 -0700 | [diff] [blame] | 78 | struct stats_ext_event *msg); |
Jeff Johnson | fdecd51 | 2018-06-10 09:18:32 -0700 | [diff] [blame] | 79 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 80 | /* Internal SME APIs */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 81 | QDF_STATUS sme_acquire_global_lock(tSmeStruct *psSme) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 82 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 83 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 84 | |
| 85 | if (psSme) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 86 | if (QDF_IS_STATUS_SUCCESS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 87 | (qdf_mutex_acquire(&psSme->lkSmeGlobalLock))) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 88 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | return status; |
| 92 | } |
| 93 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 94 | QDF_STATUS sme_release_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_release(&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 | |
Tushnim Bhattacharyya | 518e80f | 2017-08-30 17:35:33 -0700 | [diff] [blame] | 107 | tpAniSirGlobal sme_get_mac_context(void) |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 108 | { |
| 109 | tpAniSirGlobal mac_ctx; |
| 110 | tHalHandle h_hal; |
| 111 | |
| 112 | h_hal = cds_get_context(QDF_MODULE_ID_SME); |
| 113 | if (NULL == h_hal) { |
| 114 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
| 115 | FL("invalid h_hal")); |
| 116 | return NULL; |
| 117 | } |
| 118 | |
| 119 | mac_ctx = PMAC_STRUCT(h_hal); |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 120 | |
| 121 | return mac_ctx; |
| 122 | } |
| 123 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 124 | /** |
| 125 | * sme_process_set_hw_mode_resp() - Process set HW mode response |
| 126 | * @mac: Global MAC pointer |
| 127 | * @msg: HW mode response |
| 128 | * |
| 129 | * Processes the HW mode response and invokes the HDD callback |
| 130 | * to process further |
| 131 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 132 | 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] | 133 | { |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 134 | tListElem *entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 135 | tSmeCmd *command = NULL; |
| 136 | bool found; |
Tushnim Bhattacharyya | eab33dd | 2017-11-15 15:20:02 -0800 | [diff] [blame] | 137 | policy_mgr_pdev_set_hw_mode_cback callback = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 138 | struct sir_set_hw_mode_resp *param; |
Tushnim Bhattacharyya | 3b99f4b | 2018-03-26 14:19:24 -0700 | [diff] [blame] | 139 | enum policy_mgr_conn_update_reason reason; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 140 | struct csr_roam_session *session; |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 141 | uint32_t session_id; |
Sandeep Puligilla | 344d725 | 2017-09-15 16:23:33 -0700 | [diff] [blame] | 142 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 143 | param = (struct sir_set_hw_mode_resp *)msg; |
| 144 | if (!param) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 145 | sme_err("HW mode resp param is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 146 | /* Not returning. Need to check if active command list |
| 147 | * needs to be freed |
| 148 | */ |
| 149 | } |
| 150 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 151 | entry = csr_nonscan_active_ll_peek_head(mac, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 152 | if (!entry) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 153 | sme_err("No cmd found in active list"); |
Tushnim Bhattacharyya | 4a03db8 | 2017-11-10 17:58:28 -0800 | [diff] [blame] | 154 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 158 | if (!command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 159 | sme_err("Base address is NULL"); |
Tushnim Bhattacharyya | 4a03db8 | 2017-11-10 17:58:28 -0800 | [diff] [blame] | 160 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | if (e_sme_command_set_hw_mode != command->command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 164 | sme_err("Command mismatch!"); |
Tushnim Bhattacharyya | 4a03db8 | 2017-11-10 17:58:28 -0800 | [diff] [blame] | 165 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | callback = command->u.set_hw_mode_cmd.set_hw_mode_cb; |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 169 | reason = command->u.set_hw_mode_cmd.reason; |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 170 | session_id = command->u.set_hw_mode_cmd.session_id; |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 171 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 172 | sme_debug("reason: %d session: %d", |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 173 | command->u.set_hw_mode_cmd.reason, |
| 174 | command->u.set_hw_mode_cmd.session_id); |
| 175 | |
Chandrasekaran, Manishekar | 4dd215e | 2016-04-16 18:48:34 -0700 | [diff] [blame] | 176 | if (!callback) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 177 | sme_err("Callback does not exist"); |
Chandrasekaran, Manishekar | 4dd215e | 2016-04-16 18:48:34 -0700 | [diff] [blame] | 178 | goto end; |
| 179 | } |
| 180 | |
| 181 | if (!param) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 182 | sme_err("Callback failed since HW mode params is NULL"); |
Chandrasekaran, Manishekar | 4dd215e | 2016-04-16 18:48:34 -0700 | [diff] [blame] | 183 | goto end; |
| 184 | } |
| 185 | |
| 186 | /* Irrespective of the reason for which the hw mode change request |
| 187 | * was issued, the policy manager connection table needs to be updated |
| 188 | * with the new vdev-mac id mapping, tx/rx spatial streams etc., if the |
| 189 | * set hw mode was successful. |
| 190 | */ |
| 191 | callback(param->status, |
| 192 | param->cfgd_hw_mode_index, |
| 193 | param->num_vdev_mac_entries, |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 194 | param->vdev_mac_map, |
Tushnim Bhattacharyya | eab33dd | 2017-11-15 15:20:02 -0800 | [diff] [blame] | 195 | command->u.set_hw_mode_cmd.next_action, |
| 196 | command->u.set_hw_mode_cmd.reason, |
| 197 | command->u.set_hw_mode_cmd.session_id, |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 198 | command->u.set_hw_mode_cmd.context); |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 199 | if (!CSR_IS_SESSION_VALID(mac, session_id)) { |
| 200 | sme_err("session %d is invalid", session_id); |
| 201 | goto end; |
| 202 | } |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 203 | session = CSR_GET_SESSION(mac, session_id); |
Tushnim Bhattacharyya | 3b99f4b | 2018-03-26 14:19:24 -0700 | [diff] [blame] | 204 | if (reason == POLICY_MGR_UPDATE_REASON_HIDDEN_STA) { |
Chandrasekaran, Manishekar | 4dd215e | 2016-04-16 18:48:34 -0700 | [diff] [blame] | 205 | /* In the case of hidden SSID, connection update |
| 206 | * (set hw mode) is done after the scan with reason |
| 207 | * code eCsrScanForSsid completes. The connect/failure |
| 208 | * needs to be handled after the response of set hw |
| 209 | * mode |
| 210 | */ |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 211 | if (param->status == SET_HW_MODE_STATUS_OK) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 212 | sme_debug("search for ssid success"); |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 213 | csr_scan_handle_search_for_ssid(mac, |
| 214 | session_id); |
| 215 | } else { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 216 | sme_debug("search for ssid failure"); |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 217 | csr_scan_handle_search_for_ssid_failure(mac, |
| 218 | session_id); |
| 219 | } |
Deepak Dhamdhere | 6f7fbbe | 2017-02-28 13:35:52 -0800 | [diff] [blame] | 220 | csr_saved_scan_cmd_free_fields(mac, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 221 | } |
| 222 | |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 223 | end: |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 224 | found = csr_nonscan_active_ll_remove_entry(mac, entry, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 225 | LL_ACCESS_LOCK); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 226 | if (found) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 227 | /* Now put this command back on the avilable command list */ |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 228 | csr_release_command(mac, command); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 229 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 230 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 231 | } |
| 232 | |
| 233 | /** |
| 234 | * sme_process_hw_mode_trans_ind() - Process HW mode transition indication |
| 235 | * @mac: Global MAC pointer |
| 236 | * @msg: HW mode transition response |
| 237 | * |
| 238 | * Processes the HW mode transition indication and invoke the HDD callback |
| 239 | * to process further |
| 240 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 241 | static QDF_STATUS sme_process_hw_mode_trans_ind(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 242 | uint8_t *msg) |
| 243 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 244 | struct sir_hw_mode_trans_ind *param; |
| 245 | |
| 246 | param = (struct sir_hw_mode_trans_ind *)msg; |
| 247 | if (!param) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 248 | sme_err("HW mode trans ind param is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 249 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 250 | } |
| 251 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 252 | policy_mgr_hw_mode_transition_cb(param->old_hw_mode_index, |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 253 | param->new_hw_mode_index, |
| 254 | param->num_vdev_mac_entries, |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 255 | param->vdev_mac_map, mac->psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 256 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 257 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 258 | } |
| 259 | |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 260 | /** |
| 261 | * free_sme_cmds() - This function frees memory allocated for SME commands |
| 262 | * @mac_ctx: Pointer to Global MAC structure |
| 263 | * |
| 264 | * This function frees memory allocated for SME commands |
| 265 | * |
| 266 | * @Return: void |
| 267 | */ |
| 268 | static void free_sme_cmds(tpAniSirGlobal mac_ctx) |
| 269 | { |
| 270 | uint32_t idx; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 271 | |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 272 | if (NULL == mac_ctx->sme.pSmeCmdBufAddr) |
| 273 | return; |
| 274 | |
| 275 | for (idx = 0; idx < mac_ctx->sme.totalSmeCmd; idx++) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 276 | qdf_mem_free(mac_ctx->sme.pSmeCmdBufAddr[idx]); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 277 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 278 | qdf_mem_free(mac_ctx->sme.pSmeCmdBufAddr); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 279 | mac_ctx->sme.pSmeCmdBufAddr = NULL; |
| 280 | } |
| 281 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 282 | static QDF_STATUS init_sme_cmd_list(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 283 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 284 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 285 | tSmeCmd *pCmd; |
| 286 | uint32_t cmd_idx; |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 287 | uint32_t sme_cmd_ptr_ary_sz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 288 | |
| 289 | pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND; |
| 290 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 291 | |
Jeff Johnson | 616417f | 2018-06-27 10:20:53 -0700 | [diff] [blame] | 292 | status = csr_ll_open(&pMac->sme.smeCmdFreeList); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 293 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 294 | goto end; |
| 295 | |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 296 | /* following pointer contains array of pointers for tSmeCmd* */ |
| 297 | sme_cmd_ptr_ary_sz = sizeof(void *) * pMac->sme.totalSmeCmd; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 298 | pMac->sme.pSmeCmdBufAddr = qdf_mem_malloc(sme_cmd_ptr_ary_sz); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 299 | if (NULL == pMac->sme.pSmeCmdBufAddr) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 300 | status = QDF_STATUS_E_NOMEM; |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 301 | goto end; |
| 302 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 303 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 304 | status = QDF_STATUS_SUCCESS; |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 305 | for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++) { |
| 306 | /* |
| 307 | * Since total size of all commands together can be huge chunk |
| 308 | * of memory, allocate SME cmd individually. These SME CMDs are |
| 309 | * moved between pending and active queues. And these freeing of |
| 310 | * these queues just manipulates the list but does not actually |
| 311 | * frees SME CMD pointers. Hence store each SME CMD address in |
| 312 | * the array, sme.pSmeCmdBufAddr. This will later facilitate |
| 313 | * freeing up of all SME CMDs with just a for loop. |
| 314 | */ |
| 315 | pMac->sme.pSmeCmdBufAddr[cmd_idx] = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 316 | qdf_mem_malloc(sizeof(tSmeCmd)); |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 317 | if (NULL == pMac->sme.pSmeCmdBufAddr[cmd_idx]) { |
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 | free_sme_cmds(pMac); |
| 320 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 321 | } |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 322 | pCmd = (tSmeCmd *)pMac->sme.pSmeCmdBufAddr[cmd_idx]; |
| 323 | csr_ll_insert_tail(&pMac->sme.smeCmdFreeList, |
| 324 | &pCmd->Link, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 325 | } |
| 326 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 327 | end: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 328 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 329 | sme_err("Failed to initialize sme command list: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 330 | |
| 331 | return status; |
| 332 | } |
| 333 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 334 | void sme_release_command(tpAniSirGlobal mac_ctx, tSmeCmd *sme_cmd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 335 | { |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 336 | sme_cmd->command = eSmeNoCommand; |
| 337 | csr_ll_insert_tail(&mac_ctx->sme.smeCmdFreeList, &sme_cmd->Link, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 338 | LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 339 | } |
| 340 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 341 | static QDF_STATUS free_sme_cmd_list(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 342 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 343 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 344 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 345 | csr_ll_close(&pMac->sme.smeCmdFreeList); |
| 346 | |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 347 | status = qdf_mutex_acquire(&pMac->sme.lkSmeGlobalLock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 348 | if (status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 349 | sme_err("Failed to acquire the lock status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 350 | goto done; |
| 351 | } |
| 352 | |
Naveen Rawat | e7d8605 | 2015-11-13 12:01:43 -0800 | [diff] [blame] | 353 | free_sme_cmds(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 354 | |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 355 | status = qdf_mutex_release(&pMac->sme.lkSmeGlobalLock); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 356 | if (status != QDF_STATUS_SUCCESS) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 357 | sme_err("Failed to release the lock status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 358 | done: |
| 359 | return status; |
| 360 | } |
| 361 | |
Jeff Johnson | 49c02f9 | 2016-10-07 10:29:09 -0700 | [diff] [blame] | 362 | static void dump_csr_command_info(tpAniSirGlobal pMac, tSmeCmd *pCmd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 363 | { |
| 364 | switch (pCmd->command) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 365 | case eSmeCommandRoam: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 366 | sme_debug("roam command reason is %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 367 | pCmd->u.roamCmd.roamReason); |
| 368 | break; |
| 369 | |
| 370 | case eSmeCommandWmStatusChange: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 371 | sme_debug("WMStatusChange command type is %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 372 | pCmd->u.wmStatusChangeCmd.Type); |
| 373 | break; |
| 374 | |
Pragaspathi Thilagaraj | b37dad3 | 2018-07-01 16:48:01 +0530 | [diff] [blame] | 375 | case e_sme_command_del_sta_session: |
| 376 | sme_debug("Issue del STA command for session:%d", |
| 377 | pCmd->sessionId); |
| 378 | break; |
| 379 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 380 | default: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 381 | sme_debug("default: Unhandled command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 382 | pCmd->command); |
| 383 | break; |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | tSmeCmd *sme_get_command_buffer(tpAniSirGlobal pMac) |
| 388 | { |
| 389 | tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL; |
| 390 | tListElem *pEntry; |
| 391 | static int sme_command_queue_full; |
| 392 | |
| 393 | pEntry = csr_ll_remove_head(&pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK); |
| 394 | |
| 395 | /* If we can get another MS Msg buffer, then we are ok. Just link */ |
| 396 | /* the entry onto the linked list. (We are using the linked list */ |
| 397 | /* to keep track of tfhe message buffers). */ |
| 398 | if (pEntry) { |
| 399 | pRetCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 400 | /* reset when free list is available */ |
| 401 | sme_command_queue_full = 0; |
| 402 | } else { |
| 403 | int idx = 1; |
| 404 | |
| 405 | /* Cannot change pRetCmd here since it needs to return later. */ |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 406 | pEntry = csr_nonscan_active_ll_peek_head(pMac, LL_ACCESS_LOCK); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 407 | if (pEntry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 408 | pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 409 | |
| 410 | sme_err("Out of command buffer.... command (0x%X) stuck", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 411 | (pTempCmd) ? pTempCmd->command : eSmeNoCommand); |
| 412 | if (pTempCmd) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 413 | if (eSmeCsrCommandMask & pTempCmd->command) |
| 414 | /* CSR command is stuck. See what the reason |
| 415 | * code is for that command |
| 416 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 417 | dump_csr_command_info(pMac, pTempCmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 418 | } /* if(pTempCmd) */ |
| 419 | |
| 420 | /* dump what is in the pending queue */ |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 421 | csr_nonscan_pending_ll_lock(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 422 | pEntry = |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 423 | csr_nonscan_pending_ll_peek_head(pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 424 | LL_ACCESS_NOLOCK); |
| 425 | while (pEntry && !sme_command_queue_full) { |
| 426 | pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 427 | /* Print only 1st five commands from pending queue. */ |
| 428 | if (idx <= 5) |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 429 | sme_err("Out of command buffer.... SME pending command #%d (0x%X)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 430 | idx, pTempCmd->command); |
| 431 | idx++; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 432 | if (eSmeCsrCommandMask & pTempCmd->command) |
| 433 | /* CSR command is stuck. See what the reason |
| 434 | * code is for that command |
| 435 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 436 | dump_csr_command_info(pMac, pTempCmd); |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 437 | pEntry = csr_nonscan_pending_ll_next(pMac, pEntry, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 438 | LL_ACCESS_NOLOCK); |
| 439 | } |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 440 | csr_nonscan_pending_ll_unlock(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 441 | |
Vignesh Viswanathan | a1f3a1a | 2018-10-04 13:10:46 +0530 | [diff] [blame] | 442 | if (pMac->mlme_cfg->gen.fatal_event_trigger) |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 443 | cds_flush_logs(WLAN_LOG_TYPE_FATAL, |
| 444 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 445 | WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF, |
| 446 | false, |
Vignesh Viswanathan | a1f3a1a | 2018-10-04 13:10:46 +0530 | [diff] [blame] | 447 | pMac->mlme_cfg->gen.self_recovery); |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 448 | else |
Anurag Chouhan | 4085ff7 | 2017-10-05 18:09:56 +0530 | [diff] [blame] | 449 | cds_trigger_recovery(QDF_GET_MSG_BUFF_FAILURE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 450 | } |
| 451 | |
| 452 | /* memset to zero */ |
| 453 | if (pRetCmd) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 454 | qdf_mem_set((uint8_t *)&pRetCmd->command, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 455 | sizeof(pRetCmd->command), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 456 | qdf_mem_set((uint8_t *)&pRetCmd->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 457 | sizeof(pRetCmd->sessionId), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 458 | qdf_mem_set((uint8_t *)&pRetCmd->u, sizeof(pRetCmd->u), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 459 | } |
| 460 | |
| 461 | return pRetCmd; |
| 462 | } |
| 463 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 464 | /** |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 465 | * sme_ser_handle_active_cmd() - handle command activation callback from |
| 466 | * new serialization module |
| 467 | * @cmd: pointer to new serialization command |
| 468 | * |
| 469 | * This API is to handle command activation callback from new serialization |
| 470 | * callback |
| 471 | * |
| 472 | * Return: QDF_STATUS_SUCCESS |
| 473 | */ |
| 474 | static |
| 475 | QDF_STATUS sme_ser_handle_active_cmd(struct wlan_serialization_command *cmd) |
| 476 | { |
| 477 | tSmeCmd *sme_cmd; |
| 478 | tHalHandle hal; |
| 479 | tpAniSirGlobal mac_ctx; |
| 480 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 481 | bool do_continue; |
| 482 | |
| 483 | if (!cmd) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 484 | sme_err("No serialization command found"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 485 | return QDF_STATUS_E_FAILURE; |
| 486 | } |
| 487 | |
| 488 | hal = cds_get_context(QDF_MODULE_ID_SME); |
Pragaspathi Thilagaraj | b11dbe4 | 2018-07-23 16:42:17 +0530 | [diff] [blame] | 489 | if (NULL != hal) { |
| 490 | mac_ctx = PMAC_STRUCT(hal); |
| 491 | } else { |
| 492 | sme_err("No hal found"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 493 | return QDF_STATUS_E_FAILURE; |
| 494 | } |
| 495 | sme_cmd = cmd->umac_cmd; |
| 496 | if (!sme_cmd) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 497 | sme_err("No SME command found"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 498 | return QDF_STATUS_E_FAILURE; |
| 499 | } |
| 500 | |
| 501 | switch (sme_cmd->command) { |
| 502 | case eSmeCommandRoam: |
| 503 | status = csr_roam_process_command(mac_ctx, sme_cmd); |
| 504 | break; |
| 505 | case eSmeCommandWmStatusChange: |
| 506 | csr_roam_process_wm_status_change_command(mac_ctx, |
| 507 | sme_cmd); |
| 508 | break; |
Pragaspathi Thilagaraj | b37dad3 | 2018-07-01 16:48:01 +0530 | [diff] [blame] | 509 | case e_sme_command_del_sta_session: |
| 510 | csr_process_del_sta_session_command(mac_ctx, sme_cmd); |
| 511 | break; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 512 | case eSmeCommandAddTs: |
| 513 | case eSmeCommandDelTs: |
| 514 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 515 | do_continue = qos_process_command(mac_ctx, sme_cmd); |
| 516 | if (do_continue) |
| 517 | status = QDF_STATUS_E_FAILURE; |
| 518 | #endif |
| 519 | break; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 520 | case e_sme_command_set_hw_mode: |
| 521 | csr_process_set_hw_mode(mac_ctx, sme_cmd); |
| 522 | break; |
| 523 | case e_sme_command_nss_update: |
| 524 | csr_process_nss_update_req(mac_ctx, sme_cmd); |
| 525 | break; |
| 526 | case e_sme_command_set_dual_mac_config: |
| 527 | csr_process_set_dual_mac_config(mac_ctx, sme_cmd); |
| 528 | break; |
| 529 | case e_sme_command_set_antenna_mode: |
| 530 | csr_process_set_antenna_mode(mac_ctx, sme_cmd); |
| 531 | break; |
| 532 | default: |
| 533 | /* something is wrong */ |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 534 | sme_err("unknown command %d", sme_cmd->command); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 535 | status = QDF_STATUS_E_FAILURE; |
| 536 | break; |
| 537 | } |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 538 | return status; |
| 539 | } |
| 540 | |
| 541 | QDF_STATUS sme_ser_cmd_callback(void *buf, |
| 542 | enum wlan_serialization_cb_reason reason) |
| 543 | { |
| 544 | struct wlan_serialization_command *cmd = buf; |
| 545 | tHalHandle hal; |
| 546 | tpAniSirGlobal mac_ctx; |
| 547 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 548 | tSmeCmd *sme_cmd; |
| 549 | |
| 550 | hal = cds_get_context(QDF_MODULE_ID_SME); |
Pragaspathi Thilagaraj | b11dbe4 | 2018-07-23 16:42:17 +0530 | [diff] [blame] | 551 | if (hal != NULL) { |
| 552 | mac_ctx = PMAC_STRUCT(hal); |
| 553 | } else { |
| 554 | sme_err("hal is null"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 555 | return QDF_STATUS_E_FAILURE; |
| 556 | } |
| 557 | /* |
| 558 | * Do not acquire lock here as sme global lock is already acquired in |
| 559 | * caller or MC thread context |
| 560 | */ |
| 561 | if (!cmd) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 562 | sme_err("serialization command is null"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 563 | return QDF_STATUS_E_FAILURE; |
| 564 | } |
| 565 | |
| 566 | switch (reason) { |
| 567 | case WLAN_SER_CB_ACTIVATE_CMD: |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 568 | sme_debug("WLAN_SER_CB_ACTIVATE_CMD callback"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 569 | status = sme_ser_handle_active_cmd(cmd); |
| 570 | break; |
| 571 | case WLAN_SER_CB_CANCEL_CMD: |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 572 | sme_debug("WLAN_SER_CB_CANCEL_CMD callback"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 573 | break; |
| 574 | case WLAN_SER_CB_RELEASE_MEM_CMD: |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 575 | sme_debug("WLAN_SER_CB_RELEASE_MEM_CMD callback"); |
Vignesh Viswanathan | 062b516 | 2018-10-11 17:18:41 +0530 | [diff] [blame] | 576 | if (cmd->vdev) |
| 577 | wlan_objmgr_vdev_release_ref(cmd->vdev, |
| 578 | WLAN_LEGACY_SME_ID); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 579 | sme_cmd = cmd->umac_cmd; |
| 580 | csr_release_command_buffer(mac_ctx, sme_cmd); |
| 581 | break; |
| 582 | case WLAN_SER_CB_ACTIVE_CMD_TIMEOUT: |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 583 | sme_debug("WLAN_SER_CB_ACTIVE_CMD_TIMEOUT callback"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 584 | break; |
| 585 | default: |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 586 | sme_debug("STOP: unknown reason code"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 587 | return QDF_STATUS_E_FAILURE; |
| 588 | } |
| 589 | return status; |
| 590 | } |
| 591 | |
Wen Gong | 3f00338 | 2018-05-14 14:26:37 +0800 | [diff] [blame] | 592 | #ifdef WLAN_FEATURE_MEMDUMP_ENABLE |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 593 | /** |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 594 | * sme_get_sessionid_from_activelist() - gets session id |
| 595 | * @mac: mac context |
| 596 | * |
| 597 | * This function is used to get session id from sme command |
| 598 | * active list |
| 599 | * |
| 600 | * Return: returns session id |
| 601 | */ |
Jeff Johnson | 49c02f9 | 2016-10-07 10:29:09 -0700 | [diff] [blame] | 602 | static uint32_t sme_get_sessionid_from_activelist(tpAniSirGlobal mac) |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 603 | { |
| 604 | tListElem *entry; |
| 605 | tSmeCmd *command; |
| 606 | uint32_t session_id = CSR_SESSION_ID_INVALID; |
| 607 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 608 | entry = csr_nonscan_active_ll_peek_head(mac, LL_ACCESS_LOCK); |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 609 | if (entry) { |
| 610 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 611 | session_id = command->sessionId; |
| 612 | } |
| 613 | |
| 614 | return session_id; |
| 615 | } |
| 616 | |
| 617 | /** |
| 618 | * sme_state_info_dump() - prints state information of sme layer |
| 619 | * @buf: buffer pointer |
| 620 | * @size: size of buffer to be filled |
| 621 | * |
| 622 | * This function is used to dump state information of sme layer |
| 623 | * |
| 624 | * Return: None |
| 625 | */ |
| 626 | static void sme_state_info_dump(char **buf_ptr, uint16_t *size) |
| 627 | { |
| 628 | uint32_t session_id, active_session_id; |
| 629 | tHalHandle hal; |
| 630 | tpAniSirGlobal mac; |
| 631 | uint16_t len = 0; |
| 632 | char *buf = *buf_ptr; |
| 633 | eCsrConnectState connect_state; |
| 634 | |
| 635 | hal = cds_get_context(QDF_MODULE_ID_SME); |
| 636 | if (hal == NULL) { |
| 637 | QDF_ASSERT(0); |
| 638 | return; |
| 639 | } |
| 640 | |
| 641 | mac = PMAC_STRUCT(hal); |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 642 | |
| 643 | active_session_id = sme_get_sessionid_from_activelist(mac); |
| 644 | if (active_session_id != CSR_SESSION_ID_INVALID) { |
| 645 | len += qdf_scnprintf(buf + len, *size - len, |
| 646 | "\n active command sessionid %d", active_session_id); |
| 647 | } |
| 648 | |
| 649 | for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) { |
| 650 | if (CSR_IS_SESSION_VALID(mac, session_id)) { |
| 651 | connect_state = |
| 652 | mac->roam.roamSession[session_id].connectState; |
| 653 | if ((eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED == |
| 654 | connect_state) |
| 655 | || (eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED == |
| 656 | connect_state)) { |
| 657 | len += qdf_scnprintf(buf + len, *size - len, |
| 658 | "\n NeighborRoamState: %d", |
| 659 | mac->roam.neighborRoamInfo[session_id]. |
| 660 | neighborRoamState); |
| 661 | len += qdf_scnprintf(buf + len, *size - len, |
| 662 | "\n RoamState: %d", mac->roam. |
| 663 | curState[session_id]); |
| 664 | len += qdf_scnprintf(buf + len, *size - len, |
| 665 | "\n RoamSubState: %d", mac->roam. |
| 666 | curSubState[session_id]); |
| 667 | len += qdf_scnprintf(buf + len, *size - len, |
| 668 | "\n ConnectState: %d", |
| 669 | connect_state); |
| 670 | } |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | *size -= len; |
| 675 | *buf_ptr += len; |
| 676 | } |
| 677 | |
| 678 | /** |
| 679 | * sme_register_debug_callback() - registration function sme layer |
| 680 | * to print sme state information |
| 681 | * |
| 682 | * Return: None |
| 683 | */ |
| 684 | static void sme_register_debug_callback(void) |
| 685 | { |
| 686 | qdf_register_debug_callback(QDF_MODULE_ID_SME, &sme_state_info_dump); |
| 687 | } |
Wen Gong | 3f00338 | 2018-05-14 14:26:37 +0800 | [diff] [blame] | 688 | #else /* WLAN_FEATURE_MEMDUMP_ENABLE */ |
Wen Gong | aa6d55d | 2018-04-26 16:33:21 +0800 | [diff] [blame] | 689 | static void sme_register_debug_callback(void) |
| 690 | { |
| 691 | } |
Wen Gong | 3f00338 | 2018-05-14 14:26:37 +0800 | [diff] [blame] | 692 | #endif /* WLAN_FEATURE_MEMDUMP_ENABLE */ |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 693 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 694 | /* Global APIs */ |
| 695 | |
| 696 | /** |
| 697 | * sme_open() - Initialze all SME modules and put them at idle state |
| 698 | * @hHal: The handle returned by mac_open |
| 699 | * |
| 700 | * The function initializes each module inside SME, PMC, CSR, etc. Upon |
| 701 | * successfully return, all modules are at idle state ready to start. |
| 702 | * smeOpen must be called before any other SME APIs can be involved. |
| 703 | * smeOpen must be called after mac_open. |
| 704 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 705 | * Return: QDF_STATUS_SUCCESS - SME is successfully initialized. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 706 | * Other status means SME is failed to be initialized |
| 707 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 708 | QDF_STATUS sme_open(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 709 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 710 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 711 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 712 | |
| 713 | pMac->sme.state = SME_STATE_STOP; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 714 | pMac->sme.currDeviceMode = QDF_STA_MODE; |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 715 | if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_create( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 716 | &pMac->sme.lkSmeGlobalLock))) { |
Srinivas Girigowda | 09625b0 | 2018-09-10 15:28:09 -0700 | [diff] [blame] | 717 | sme_err("Init lock failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 718 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 719 | } |
| 720 | status = csr_open(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 721 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 722 | sme_err("csr_open failed, status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 723 | return status; |
| 724 | } |
| 725 | |
| 726 | status = sme_ps_open(hHal); |
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("sme_ps_open failed with status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 729 | return status; |
| 730 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 731 | |
| 732 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 733 | status = sme_qos_open(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 734 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 735 | sme_err("Qos open, status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 736 | return status; |
| 737 | } |
| 738 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 739 | status = init_sme_cmd_list(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 740 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 741 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 742 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 743 | status = rrm_open(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 744 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 745 | sme_err("rrm_open failed, status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 746 | return status; |
| 747 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 748 | sme_trace_init(pMac); |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 749 | sme_register_debug_callback(); |
Krunal Soni | 3378790 | 2017-08-29 11:39:28 -0700 | [diff] [blame] | 750 | wlan_serialization_legacy_init_callback(); |
| 751 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 752 | return status; |
| 753 | } |
| 754 | |
| 755 | /* |
| 756 | * sme_init_chan_list, triggers channel setup based on country code. |
| 757 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 758 | QDF_STATUS sme_init_chan_list(tHalHandle hal, uint8_t *alpha2, |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 759 | enum country_src cc_src) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 760 | { |
| 761 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 762 | |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 763 | if ((cc_src == SOURCE_USERSPACE) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 764 | (pmac->roam.configParam.fSupplicantCountryCodeHasPriority)) { |
| 765 | pmac->roam.configParam.Is11dSupportEnabled = false; |
| 766 | } |
| 767 | |
| 768 | return csr_init_chan_list(pmac, alpha2); |
| 769 | } |
| 770 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 771 | /* |
| 772 | * sme_set11dinfo() - Set the 11d information about valid channels |
| 773 | * and there power using information from nvRAM |
| 774 | * This function is called only for AP. |
| 775 | * |
| 776 | * This is a synchronous call |
| 777 | * |
| 778 | * hHal - The handle returned by mac_open. |
| 779 | * pSmeConfigParams - a pointer to a caller allocated object of |
| 780 | * typedef struct _smeConfigParams. |
| 781 | * |
| 782 | * Return QDF_STATUS_SUCCESS - SME update the config parameters successfully. |
| 783 | * |
| 784 | * Other status means SME is failed to update the config parameters. |
| 785 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 786 | |
Jeff Johnson | ff26c61 | 2018-06-10 20:57:13 -0700 | [diff] [blame] | 787 | QDF_STATUS sme_set11dinfo(tHalHandle hal, tpSmeConfigParams pSmeConfigParams) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 788 | { |
Jeff Johnson | ff26c61 | 2018-06-10 20:57:13 -0700 | [diff] [blame] | 789 | tpAniSirGlobal mac_ctx = MAC_CONTEXT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 790 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 791 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 792 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 793 | TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0)); |
| 794 | if (NULL == pSmeConfigParams) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 795 | sme_err("SME config params empty"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 796 | return status; |
| 797 | } |
| 798 | |
Jeff Johnson | ff26c61 | 2018-06-10 20:57:13 -0700 | [diff] [blame] | 799 | status = csr_set_channels(mac_ctx, &pSmeConfigParams->csrConfig); |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 800 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 801 | sme_err("csr_set_channels failed with status: %d", status); |
| 802 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 803 | return status; |
| 804 | } |
| 805 | |
| 806 | /** |
| 807 | * sme_set_scan_disable() - Dynamically enable/disable scan |
| 808 | * @h_hal: Handle to HAL |
| 809 | * |
| 810 | * This command gives the user an option to dynamically |
| 811 | * enable or disable scans. |
| 812 | * |
| 813 | * Return: None |
| 814 | */ |
| 815 | void sme_set_scan_disable(tHalHandle h_hal, int value) |
| 816 | { |
| 817 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(h_hal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 818 | |
Sandeep Puligilla | 24b7aa7 | 2017-10-13 18:05:14 -0700 | [diff] [blame] | 819 | sme_info("scan disable %d", value); |
Abhishek Singh | caebce0 | 2017-10-12 11:07:57 +0530 | [diff] [blame] | 820 | ucfg_scan_set_enable(mac_ctx->psoc, !value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 821 | } |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 822 | /* |
| 823 | * sme_get_soft_ap_domain() - Get the current regulatory domain of softAp. |
| 824 | * This is a synchronous call |
| 825 | * |
| 826 | * hHal - The handle returned by HostapdAdapter. |
| 827 | * v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp. |
| 828 | * Return QDF_STATUS_SUCCESS - SME successfully completed the request. |
| 829 | * Other status means, failed to get the current regulatory domain. |
| 830 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 831 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 832 | QDF_STATUS sme_get_soft_ap_domain(tHalHandle hHal, v_REGDOMAIN_t |
| 833 | *domainIdSoftAp) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 834 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 835 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 836 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 837 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 838 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 839 | TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, |
| 840 | NO_SESSION, 0)); |
| 841 | if (NULL == domainIdSoftAp) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 842 | sme_err("Uninitialized domain Id"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 843 | return status; |
| 844 | } |
| 845 | |
| 846 | *domainIdSoftAp = pMac->scan.domainIdCurrent; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 847 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 848 | |
| 849 | return status; |
| 850 | } |
| 851 | |
Krunal Soni | e353194 | 2016-04-12 17:43:53 -0700 | [diff] [blame] | 852 | /** |
| 853 | * sme_update_fine_time_measurement_capab() - Update the FTM capabitlies from |
| 854 | * incoming val |
| 855 | * @hal: Handle for Hal layer |
| 856 | * @val: New FTM capability value |
| 857 | * |
| 858 | * Return: None |
| 859 | */ |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 860 | void sme_update_fine_time_measurement_capab(tHalHandle hal, uint8_t session_id, |
| 861 | uint32_t val) |
Krunal Soni | e353194 | 2016-04-12 17:43:53 -0700 | [diff] [blame] | 862 | { |
| 863 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 864 | QDF_STATUS status; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 865 | |
Naveen Rawat | d2657be | 2017-10-10 14:31:23 -0700 | [diff] [blame] | 866 | ucfg_wifi_pos_set_ftm_cap(mac_ctx->psoc, val); |
Krunal Soni | e353194 | 2016-04-12 17:43:53 -0700 | [diff] [blame] | 867 | |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 868 | if (!val) { |
Krunal Soni | e353194 | 2016-04-12 17:43:53 -0700 | [diff] [blame] | 869 | mac_ctx->rrm.rrmPEContext.rrmEnabledCaps.fine_time_meas_rpt = 0; |
| 870 | ((tpRRMCaps)mac_ctx->rrm.rrmSmeContext. |
| 871 | rrmConfig.rm_capability)->fine_time_meas_rpt = 0; |
| 872 | } else { |
| 873 | mac_ctx->rrm.rrmPEContext.rrmEnabledCaps.fine_time_meas_rpt = 1; |
| 874 | ((tpRRMCaps)mac_ctx->rrm.rrmSmeContext. |
| 875 | rrmConfig.rm_capability)->fine_time_meas_rpt = 1; |
| 876 | } |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 877 | |
| 878 | /* Inform this RRM IE change to FW */ |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 879 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 880 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 881 | csr_roam_offload_scan(mac_ctx, session_id, |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 882 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 883 | REASON_CONNECT_IES_CHANGED); |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 884 | sme_release_global_lock(&mac_ctx->sme); |
| 885 | } else { |
| 886 | sme_err("Failed to acquire SME lock"); |
| 887 | } |
Krunal Soni | e353194 | 2016-04-12 17:43:53 -0700 | [diff] [blame] | 888 | } |
| 889 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 890 | /* |
| 891 | * sme_update_config() - Change configurations for all SME moduels |
| 892 | * The function updates some configuration for modules in SME, CSR, etc |
| 893 | * during SMEs close open sequence. |
| 894 | * Modules inside SME apply the new configuration at the next transaction. |
| 895 | * This is a synchronous call |
| 896 | * |
| 897 | * hHal - The handle returned by mac_open. |
| 898 | * pSmeConfigParams - a pointer to a caller allocated object of |
| 899 | * typedef struct _smeConfigParams. |
| 900 | * Return QDF_STATUS_SUCCESS - SME update the config parameters successfully. |
| 901 | * Other status means SME is failed to update the config parameters. |
| 902 | */ |
| 903 | QDF_STATUS sme_update_config(tHalHandle hHal, tpSmeConfigParams |
| 904 | pSmeConfigParams) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 905 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 906 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 907 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 908 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 909 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 910 | TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, |
| 911 | 0)); |
| 912 | if (NULL == pSmeConfigParams) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 913 | sme_err("SME config params empty"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 914 | return status; |
| 915 | } |
| 916 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 917 | status = csr_change_default_config_param(pMac, &pSmeConfigParams-> |
| 918 | csrConfig); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 919 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 920 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 921 | sme_err("csr_change_default_config_param failed status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 922 | status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 923 | |
Jeff Johnson | 711fe94 | 2018-06-09 23:37:01 -0700 | [diff] [blame] | 924 | status = rrm_change_default_config_param(pMac, &pSmeConfigParams-> |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 925 | rrmConfig); |
| 926 | |
| 927 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 928 | sme_err("rrm_change_default_config_param failed status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 929 | status); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 930 | |
| 931 | /* For SOC, CFG is set before start We don't want to apply global CFG |
| 932 | * in connect state because that may cause some side affect |
| 933 | */ |
| 934 | if (csr_is_all_session_disconnected(pMac)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 935 | csr_set_global_cfgs(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 936 | |
| 937 | /* |
| 938 | * If scan offload is enabled then lim has allow the sending of |
| 939 | * scan request to firmware even in powersave mode. The firmware has |
| 940 | * to take care of exiting from power save mode |
| 941 | */ |
| 942 | status = sme_cfg_set_int(hHal, WNI_CFG_SCAN_IN_POWERSAVE, true); |
| 943 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 944 | if (QDF_STATUS_SUCCESS != status) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 945 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 946 | "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CFG"); |
Kapil Gupta | 4f0c0c1 | 2017-02-07 15:21:15 +0530 | [diff] [blame] | 947 | |
| 948 | pMac->snr_monitor_enabled = pSmeConfigParams->snr_monitor_enabled; |
| 949 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 950 | return status; |
| 951 | } |
| 952 | |
| 953 | /** |
Abhishek Singh | 158fe25 | 2017-03-23 11:09:34 +0530 | [diff] [blame] | 954 | * sme_update_scan_roam_params() - Update the scan roaming params |
| 955 | * @mac_ctx: mac ctx |
| 956 | * |
| 957 | * Return: void. |
| 958 | */ |
| 959 | static void sme_update_scan_roam_params(tpAniSirGlobal mac_ctx) |
| 960 | { |
| 961 | struct roam_filter_params scan_params = {0}; |
| 962 | struct roam_ext_params *roam_params_src; |
| 963 | uint8_t i; |
| 964 | QDF_STATUS status; |
| 965 | |
| 966 | roam_params_src = &mac_ctx->roam.configParam.roam_params; |
| 967 | |
| 968 | scan_params.num_bssid_avoid_list = |
| 969 | roam_params_src->num_bssid_avoid_list; |
Abhishek Singh | 158fe25 | 2017-03-23 11:09:34 +0530 | [diff] [blame] | 970 | |
| 971 | if (scan_params.num_bssid_avoid_list > |
| 972 | MAX_AVOID_LIST_BSSID) |
| 973 | scan_params.num_bssid_avoid_list = |
| 974 | MAX_AVOID_LIST_BSSID; |
| 975 | |
| 976 | for (i = 0; i < scan_params.num_bssid_avoid_list; i++) { |
| 977 | qdf_copy_macaddr(&scan_params.bssid_avoid_list[i], |
| 978 | &roam_params_src->bssid_avoid_list[i]); |
| 979 | } |
| 980 | |
| 981 | status = ucfg_scan_update_roam_params(mac_ctx->psoc, &scan_params); |
| 982 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 983 | sme_err("ailed to update scan roam params with status=%d", |
Abhishek Singh | 158fe25 | 2017-03-23 11:09:34 +0530 | [diff] [blame] | 984 | status); |
| 985 | } |
| 986 | |
| 987 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 988 | * sme_update_roam_params() - Store/Update the roaming params |
| 989 | * @hal: Handle for Hal layer |
| 990 | * @session_id: SME Session ID |
| 991 | * @roam_params_src: The source buffer to copy |
| 992 | * @update_param: Type of parameter to be updated |
| 993 | * |
| 994 | * Return: Return the status of the updation. |
| 995 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 996 | QDF_STATUS sme_update_roam_params(tHalHandle hal, |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 997 | uint8_t session_id, struct roam_ext_params *roam_params_src, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 998 | int update_param) |
| 999 | { |
| 1000 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 1001 | struct roam_ext_params *roam_params_dst; |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 1002 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1003 | uint8_t i; |
| 1004 | |
| 1005 | roam_params_dst = &mac_ctx->roam.configParam.roam_params; |
| 1006 | switch (update_param) { |
| 1007 | case REASON_ROAM_EXT_SCAN_PARAMS_CHANGED: |
Wu Gao | ca416ff | 2018-09-17 11:05:07 +0800 | [diff] [blame] | 1008 | mac_ctx->mlme_cfg->lfr.rssi_boost_threshold_5g = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1009 | roam_params_src->raise_rssi_thresh_5g; |
Wu Gao | ca416ff | 2018-09-17 11:05:07 +0800 | [diff] [blame] | 1010 | mac_ctx->mlme_cfg->lfr.rssi_penalize_threshold_5g = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1011 | roam_params_src->drop_rssi_thresh_5g; |
Wu Gao | ca416ff | 2018-09-17 11:05:07 +0800 | [diff] [blame] | 1012 | mac_ctx->mlme_cfg->lfr.rssi_boost_factor_5g = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1013 | roam_params_src->raise_factor_5g; |
Wu Gao | ca416ff | 2018-09-17 11:05:07 +0800 | [diff] [blame] | 1014 | mac_ctx->mlme_cfg->lfr.rssi_penalize_factor_5g = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1015 | roam_params_src->drop_factor_5g; |
Wu Gao | ca416ff | 2018-09-17 11:05:07 +0800 | [diff] [blame] | 1016 | mac_ctx->mlme_cfg->lfr.max_rssi_boost_5g = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1017 | roam_params_src->max_raise_rssi_5g; |
Wu Gao | ca416ff | 2018-09-17 11:05:07 +0800 | [diff] [blame] | 1018 | mac_ctx->mlme_cfg->lfr.max_rssi_penalize_5g = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1019 | roam_params_src->max_drop_rssi_5g; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1020 | roam_params_dst->alert_rssi_threshold = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1021 | roam_params_src->alert_rssi_threshold; |
Wu Gao | ca416ff | 2018-09-17 11:05:07 +0800 | [diff] [blame] | 1022 | mac_ctx->mlme_cfg->lfr.enable_5g_band_pref = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1023 | break; |
| 1024 | case REASON_ROAM_SET_SSID_ALLOWED: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1025 | qdf_mem_set(&roam_params_dst->ssid_allowed_list, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1026 | sizeof(tSirMacSSid) * MAX_SSID_ALLOWED_LIST); |
| 1027 | roam_params_dst->num_ssid_allowed_list = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1028 | roam_params_src->num_ssid_allowed_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1029 | for (i = 0; i < roam_params_dst->num_ssid_allowed_list; i++) { |
| 1030 | roam_params_dst->ssid_allowed_list[i].length = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1031 | roam_params_src->ssid_allowed_list[i].length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1032 | qdf_mem_copy(roam_params_dst->ssid_allowed_list[i].ssId, |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1033 | roam_params_src->ssid_allowed_list[i].ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1034 | roam_params_dst->ssid_allowed_list[i].length); |
| 1035 | } |
| 1036 | break; |
| 1037 | case REASON_ROAM_SET_FAVORED_BSSID: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1038 | qdf_mem_set(&roam_params_dst->bssid_favored, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1039 | sizeof(tSirMacAddr) * MAX_BSSID_FAVORED); |
| 1040 | roam_params_dst->num_bssid_favored = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1041 | roam_params_src->num_bssid_favored; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1042 | for (i = 0; i < roam_params_dst->num_bssid_favored; i++) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1043 | qdf_mem_copy(&roam_params_dst->bssid_favored[i], |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1044 | &roam_params_src->bssid_favored[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1045 | sizeof(tSirMacAddr)); |
| 1046 | roam_params_dst->bssid_favored_factor[i] = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1047 | roam_params_src->bssid_favored_factor[i]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1048 | } |
| 1049 | break; |
| 1050 | case REASON_ROAM_SET_BLACKLIST_BSSID: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1051 | qdf_mem_set(&roam_params_dst->bssid_avoid_list, 0, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1052 | QDF_MAC_ADDR_SIZE * MAX_BSSID_AVOID_LIST); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1053 | roam_params_dst->num_bssid_avoid_list = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1054 | roam_params_src->num_bssid_avoid_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1055 | for (i = 0; i < roam_params_dst->num_bssid_avoid_list; i++) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1056 | qdf_copy_macaddr(&roam_params_dst->bssid_avoid_list[i], |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1057 | &roam_params_src->bssid_avoid_list[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1058 | } |
| 1059 | break; |
| 1060 | case REASON_ROAM_GOOD_RSSI_CHANGED: |
| 1061 | roam_params_dst->good_rssi_roam = |
Srinivas Girigowda | 72f3039 | 2017-07-13 18:55:09 -0700 | [diff] [blame] | 1062 | roam_params_src->good_rssi_roam; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1063 | break; |
| 1064 | default: |
| 1065 | break; |
| 1066 | } |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 1067 | |
| 1068 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 1069 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 1070 | csr_roam_offload_scan(mac_ctx, session_id, |
| 1071 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 1072 | update_param); |
| 1073 | sme_release_global_lock(&mac_ctx->sme); |
| 1074 | } else { |
| 1075 | sme_err("Failed to acquire SME lock"); |
| 1076 | } |
Abhishek Singh | 158fe25 | 2017-03-23 11:09:34 +0530 | [diff] [blame] | 1077 | |
| 1078 | sme_update_scan_roam_params(mac_ctx); |
| 1079 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1080 | return 0; |
| 1081 | } |
| 1082 | |
Jeff Johnson | 8131a9d | 2018-06-10 08:53:09 -0700 | [diff] [blame] | 1083 | /** |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1084 | * sme_process_ready_to_suspend() - |
Jeff Johnson | 8131a9d | 2018-06-10 08:53:09 -0700 | [diff] [blame] | 1085 | * @mac: Global MAC context |
| 1086 | * @pReadyToSuspend: Parameter received along with ready to suspend |
| 1087 | * indication from WMA. |
| 1088 | * |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1089 | * On getting ready to suspend indication, this function calls |
| 1090 | * callback registered (HDD callbacks) with SME to inform ready |
| 1091 | * to suspend indication. |
| 1092 | * |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1093 | * Return: None |
| 1094 | */ |
Jeff Johnson | 8131a9d | 2018-06-10 08:53:09 -0700 | [diff] [blame] | 1095 | static void sme_process_ready_to_suspend(tpAniSirGlobal mac, |
Jeff Johnson | 49c02f9 | 2016-10-07 10:29:09 -0700 | [diff] [blame] | 1096 | tpSirReadyToSuspendInd pReadyToSuspend) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1097 | { |
Jeff Johnson | 8131a9d | 2018-06-10 08:53:09 -0700 | [diff] [blame] | 1098 | if (NULL == mac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1099 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Jeff Johnson | 8131a9d | 2018-06-10 08:53:09 -0700 | [diff] [blame] | 1100 | "%s: mac is null", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1101 | return; |
| 1102 | } |
| 1103 | |
Jeff Johnson | 8131a9d | 2018-06-10 08:53:09 -0700 | [diff] [blame] | 1104 | if (NULL != mac->readyToSuspendCallback) { |
| 1105 | mac->readyToSuspendCallback(mac->readyToSuspendContext, |
| 1106 | pReadyToSuspend->suspended); |
| 1107 | mac->readyToSuspendCallback = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | #ifdef WLAN_FEATURE_EXTWOW_SUPPORT |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1112 | |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 1113 | /** |
| 1114 | * sme_process_ready_to_ext_wow() - inform ready to ExtWoW indication. |
Jeff Johnson | 9d7c99e | 2018-06-28 15:36:00 -0700 | [diff] [blame] | 1115 | * @mac: Global MAC context |
| 1116 | * @indication: ready to Ext WoW indication from lower layer |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 1117 | * |
| 1118 | * On getting ready to Ext WoW indication, this function calls callback |
Jeff Johnson | 9d7c99e | 2018-06-28 15:36:00 -0700 | [diff] [blame] | 1119 | * registered (HDD callback) with SME to inform ready to ExtWoW indication. |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 1120 | * |
| 1121 | * Return: None |
| 1122 | */ |
Jeff Johnson | 9d7c99e | 2018-06-28 15:36:00 -0700 | [diff] [blame] | 1123 | static void sme_process_ready_to_ext_wow(tpAniSirGlobal mac, |
| 1124 | tpSirReadyToExtWoWInd indication) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1125 | { |
Jeff Johnson | 9d7c99e | 2018-06-28 15:36:00 -0700 | [diff] [blame] | 1126 | if (!mac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1127 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Jeff Johnson | 9d7c99e | 2018-06-28 15:36:00 -0700 | [diff] [blame] | 1128 | "%s: mac is null", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1129 | return; |
| 1130 | } |
| 1131 | |
Jeff Johnson | 9d7c99e | 2018-06-28 15:36:00 -0700 | [diff] [blame] | 1132 | if (NULL != mac->readyToExtWoWCallback) { |
| 1133 | mac->readyToExtWoWCallback(mac->readyToExtWoWContext, |
| 1134 | indication->status); |
| 1135 | mac->readyToExtWoWCallback = NULL; |
| 1136 | mac->readyToExtWoWContext = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1137 | } |
| 1138 | |
| 1139 | } |
| 1140 | #endif |
| 1141 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1142 | /* |
| 1143 | * sme_hdd_ready_ind() - SME sends eWNI_SME_SYS_READY_IND to PE to inform |
| 1144 | * that the NIC is ready tio run. |
| 1145 | * The function is called by HDD at the end of initialization stage so PE/HAL |
| 1146 | * can enable the NIC to running state. |
| 1147 | * This is a synchronous call |
| 1148 | * |
| 1149 | * @hHal - The handle returned by mac_open. |
| 1150 | * Return QDF_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE |
| 1151 | * successfully. |
| 1152 | * Other status means SME failed to send the message to PE. |
| 1153 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1154 | QDF_STATUS sme_hdd_ready_ind(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1155 | { |
Abhishek Singh | de410b7 | 2017-05-22 15:25:39 +0530 | [diff] [blame] | 1156 | tSirSmeReadyReq *msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1157 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1158 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1159 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1160 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1161 | TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0)); |
| 1162 | do { |
| 1163 | |
Abhishek Singh | de410b7 | 2017-05-22 15:25:39 +0530 | [diff] [blame] | 1164 | msg = qdf_mem_malloc(sizeof(*msg)); |
| 1165 | if (!msg) { |
| 1166 | sme_err("Memory allocation failed! for msg"); |
| 1167 | return QDF_STATUS_E_NOMEM; |
| 1168 | } |
| 1169 | msg->messageType = eWNI_SME_SYS_READY_IND; |
| 1170 | msg->length = sizeof(*msg); |
Abhishek Singh | de410b7 | 2017-05-22 15:25:39 +0530 | [diff] [blame] | 1171 | msg->csr_roam_synch_cb = csr_roam_synch_callback; |
Sandeep Puligilla | 1426d61 | 2017-04-12 18:22:06 -0700 | [diff] [blame] | 1172 | msg->sme_msg_cb = sme_process_msg_callback; |
Vignesh Viswanathan | 3d47803 | 2018-08-02 20:18:53 +0530 | [diff] [blame] | 1173 | msg->stop_roaming_cb = sme_stop_roaming; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1174 | |
Jeff Johnson | c09caa4 | 2018-06-07 22:58:55 -0700 | [diff] [blame] | 1175 | status = u_mac_post_ctrl_msg(hHal, (tSirMbMsg *)msg); |
| 1176 | if (QDF_IS_STATUS_ERROR(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1177 | 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] | 1178 | break; |
| 1179 | } |
| 1180 | |
| 1181 | status = csr_ready(pMac); |
Jeff Johnson | c09caa4 | 2018-06-07 22:58:55 -0700 | [diff] [blame] | 1182 | if (QDF_IS_STATUS_ERROR(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1183 | sme_err("csr_ready failed with status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1184 | break; |
| 1185 | } |
| 1186 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1187 | pMac->sme.state = SME_STATE_READY; |
| 1188 | } while (0); |
| 1189 | |
| 1190 | return status; |
| 1191 | } |
| 1192 | |
Tushnim Bhattacharyya | c3c375e | 2017-08-04 23:39:55 -0700 | [diff] [blame] | 1193 | QDF_STATUS sme_get_valid_channels(uint8_t *chan_list, uint32_t *list_len) |
| 1194 | { |
| 1195 | tpAniSirGlobal mac_ctx = sme_get_mac_context(); |
Tushnim Bhattacharyya | c3c375e | 2017-08-04 23:39:55 -0700 | [diff] [blame] | 1196 | |
| 1197 | if (NULL == mac_ctx) { |
| 1198 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 1199 | FL("Invalid MAC context")); |
| 1200 | return QDF_STATUS_E_FAILURE; |
| 1201 | } |
| 1202 | |
Jeff Johnson | c09caa4 | 2018-06-07 22:58:55 -0700 | [diff] [blame] | 1203 | return wlan_cfg_get_str(mac_ctx, WNI_CFG_VALID_CHANNEL_LIST, |
| 1204 | chan_list, list_len); |
Tushnim Bhattacharyya | c3c375e | 2017-08-04 23:39:55 -0700 | [diff] [blame] | 1205 | } |
| 1206 | |
Sandeep Puligilla | 8e89d57 | 2018-04-02 18:07:45 -0700 | [diff] [blame] | 1207 | #ifdef WLAN_CONV_SPECTRAL_ENABLE |
| 1208 | static QDF_STATUS sme_register_spectral_cb(tpAniSirGlobal mac_ctx) |
| 1209 | { |
| 1210 | struct spectral_legacy_cbacks spectral_cb; |
| 1211 | QDF_STATUS status; |
| 1212 | |
| 1213 | spectral_cb.vdev_get_chan_freq = sme_get_oper_chan_freq; |
| 1214 | spectral_cb.vdev_get_ch_width = sme_get_oper_ch_width; |
| 1215 | spectral_cb.vdev_get_sec20chan_freq_mhz = sme_get_sec20chan_freq_mhz; |
| 1216 | status = spectral_register_legacy_cb(mac_ctx->psoc, &spectral_cb); |
| 1217 | |
| 1218 | return status; |
| 1219 | } |
| 1220 | #else |
| 1221 | static QDF_STATUS sme_register_spectral_cb(tpAniSirGlobal mac_ctx) |
| 1222 | { |
| 1223 | return QDF_STATUS_SUCCESS; |
| 1224 | } |
| 1225 | #endif |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1226 | /* |
| 1227 | * sme_start() - Put all SME modules at ready state. |
| 1228 | * The function starts each module in SME, PMC, CSR, etc. . Upon |
| 1229 | * successfully return, all modules are ready to run. |
| 1230 | * This is a synchronous call |
| 1231 | * |
| 1232 | * hHal - The handle returned by mac_open. |
| 1233 | * Return QDF_STATUS_SUCCESS - SME is ready. |
| 1234 | * Other status means SME is failed to start |
| 1235 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1236 | QDF_STATUS sme_start(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1237 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1238 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1239 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 1240 | struct policy_mgr_sme_cbacks sme_cbacks; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1241 | |
| 1242 | do { |
| 1243 | status = csr_start(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1244 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1245 | sme_err("csr_start failed status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1246 | break; |
| 1247 | } |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 1248 | sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss; |
Tushnim Bhattacharyya | c3c375e | 2017-08-04 23:39:55 -0700 | [diff] [blame] | 1249 | sme_cbacks.sme_get_valid_channels = sme_get_valid_channels; |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 1250 | sme_cbacks.sme_nss_update_request = sme_nss_update_request; |
| 1251 | sme_cbacks.sme_pdev_set_hw_mode = sme_pdev_set_hw_mode; |
| 1252 | sme_cbacks.sme_pdev_set_pcl = sme_pdev_set_pcl; |
| 1253 | sme_cbacks.sme_soc_set_dual_mac_config = |
| 1254 | sme_soc_set_dual_mac_config; |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 1255 | sme_cbacks.sme_change_mcc_beacon_interval = |
| 1256 | sme_change_mcc_beacon_interval; |
| 1257 | sme_cbacks.sme_get_ap_channel_from_scan = |
| 1258 | sme_get_ap_channel_from_scan; |
| 1259 | sme_cbacks.sme_scan_result_purge = sme_scan_result_purge; |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 1260 | status = policy_mgr_register_sme_cb(pMac->psoc, &sme_cbacks); |
| 1261 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 1262 | sme_err("Failed to register sme cb with Policy Manager: %d", |
Tushnim Bhattacharyya | 9104963 | 2017-03-17 17:31:27 -0700 | [diff] [blame] | 1263 | status); |
| 1264 | break; |
| 1265 | } |
Sandeep Puligilla | 8e89d57 | 2018-04-02 18:07:45 -0700 | [diff] [blame] | 1266 | sme_register_spectral_cb(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1267 | pMac->sme.state = SME_STATE_START; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1268 | |
Sandeep Puligilla | 66d09c4 | 2017-09-06 17:10:27 -0700 | [diff] [blame] | 1269 | /* START RRM */ |
| 1270 | status = rrm_start(pMac); |
| 1271 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1272 | sme_err("Failed to start RRM"); |
| 1273 | break; |
| 1274 | } |
| 1275 | } while (0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1276 | return status; |
| 1277 | } |
| 1278 | |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 1279 | static QDF_STATUS dfs_msg_processor(tpAniSirGlobal mac, |
| 1280 | struct scheduler_msg *msg) |
| 1281 | { |
| 1282 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1283 | struct csr_roam_info roam_info = { 0 }; |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 1284 | tSirSmeCSAIeTxCompleteRsp *csa_ie_tx_complete_rsp; |
| 1285 | uint32_t session_id = 0; |
| 1286 | eRoamCmdStatus roam_status; |
| 1287 | eCsrRoamResult roam_result; |
| 1288 | |
| 1289 | switch (msg->type) { |
| 1290 | case eWNI_SME_DFS_RADAR_FOUND: |
| 1291 | { |
| 1292 | session_id = msg->bodyval; |
| 1293 | roam_status = eCSR_ROAM_DFS_RADAR_IND; |
| 1294 | roam_result = eCSR_ROAM_RESULT_DFS_RADAR_FOUND_IND; |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1295 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 1296 | "sapdfs: Radar indication event occurred"); |
| 1297 | break; |
| 1298 | } |
| 1299 | case eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND: |
| 1300 | { |
| 1301 | csa_ie_tx_complete_rsp = |
| 1302 | (tSirSmeCSAIeTxCompleteRsp *) msg->bodyptr; |
| 1303 | if (!csa_ie_tx_complete_rsp) { |
| 1304 | sme_err("eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND null msg"); |
| 1305 | return QDF_STATUS_E_FAILURE; |
| 1306 | } |
| 1307 | session_id = csa_ie_tx_complete_rsp->sessionId; |
| 1308 | roam_status = eCSR_ROAM_DFS_CHAN_SW_NOTIFY; |
| 1309 | roam_result = eCSR_ROAM_RESULT_DFS_CHANSW_UPDATE_SUCCESS; |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1310 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 1311 | "eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND session=%d", |
| 1312 | session_id); |
| 1313 | break; |
| 1314 | } |
| 1315 | case eWNI_SME_DFS_CAC_COMPLETE: |
| 1316 | { |
| 1317 | session_id = msg->bodyval; |
| 1318 | roam_status = eCSR_ROAM_CAC_COMPLETE_IND; |
| 1319 | roam_result = eCSR_ROAM_RESULT_CAC_END_IND; |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1320 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 1321 | "sapdfs: Received eWNI_SME_DFS_CAC_COMPLETE vdevid%d", |
| 1322 | session_id); |
| 1323 | break; |
| 1324 | } |
Abhishek Singh | 20a8e44 | 2018-09-12 15:50:44 +0530 | [diff] [blame] | 1325 | case eWNI_SME_CSA_RESTART_RSP: |
| 1326 | { |
| 1327 | session_id = msg->bodyval; |
| 1328 | roam_status = 0; |
| 1329 | roam_result = eCSR_ROAM_RESULT_CSA_RESTART_RSP; |
| 1330 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 1331 | "sapdfs: Received eCSR_ROAM_RESULT_DFS_CHANSW_UPDATE_REQ vdevid%d", |
| 1332 | session_id); |
| 1333 | break; |
| 1334 | } |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 1335 | default: |
| 1336 | { |
| 1337 | sme_err("Invalid DFS message: 0x%x", msg->type); |
| 1338 | status = QDF_STATUS_E_FAILURE; |
| 1339 | return status; |
| 1340 | } |
| 1341 | } |
| 1342 | |
| 1343 | /* Indicate Radar Event to SAP */ |
| 1344 | csr_roam_call_callback(mac, session_id, &roam_info, 0, |
| 1345 | roam_status, roam_result); |
| 1346 | return status; |
| 1347 | } |
| 1348 | |
| 1349 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1350 | #ifdef WLAN_FEATURE_11W |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1351 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1352 | * Handle the unprotected management frame indication from LIM and |
| 1353 | * forward it to HDD. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1354 | */ |
Jeff Johnson | 2ef4744 | 2018-06-09 23:43:40 -0700 | [diff] [blame] | 1355 | static QDF_STATUS |
| 1356 | sme_unprotected_mgmt_frm_ind(tpAniSirGlobal mac, |
| 1357 | tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1358 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1359 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1360 | struct csr_roam_info roam_info = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1361 | uint32_t SessionId = pSmeMgmtFrm->sessionId; |
| 1362 | |
Jeff Johnson | eddf544 | 2017-10-04 10:55:53 -0700 | [diff] [blame] | 1363 | roam_info.nFrameLength = pSmeMgmtFrm->frameLen; |
| 1364 | roam_info.pbFrames = pSmeMgmtFrm->frameBuf; |
| 1365 | roam_info.frameType = pSmeMgmtFrm->frameType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1366 | |
| 1367 | /* forward the mgmt frame to HDD */ |
Jeff Johnson | 2ef4744 | 2018-06-09 23:43:40 -0700 | [diff] [blame] | 1368 | csr_roam_call_callback(mac, SessionId, &roam_info, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1369 | eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0); |
| 1370 | |
| 1371 | return status; |
| 1372 | } |
| 1373 | #endif |
| 1374 | |
Kapil Gupta | 8878ad9 | 2017-02-13 11:56:04 +0530 | [diff] [blame] | 1375 | QDF_STATUS sme_update_new_channel_event(tHalHandle hal, uint8_t session_id) |
| 1376 | { |
| 1377 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1378 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1379 | struct csr_roam_info *roamInfo; |
Kapil Gupta | 8878ad9 | 2017-02-13 11:56:04 +0530 | [diff] [blame] | 1380 | eRoamCmdStatus roamStatus; |
| 1381 | eCsrRoamResult roamResult; |
| 1382 | |
| 1383 | roamInfo = qdf_mem_malloc(sizeof(*roamInfo)); |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 1384 | if (!roamInfo) { |
| 1385 | sme_err("mem alloc failed for roam info"); |
| 1386 | return QDF_STATUS_E_FAILURE; |
| 1387 | } |
Kapil Gupta | 8878ad9 | 2017-02-13 11:56:04 +0530 | [diff] [blame] | 1388 | roamInfo->dfs_event.sessionId = session_id; |
| 1389 | |
| 1390 | roamStatus = eCSR_ROAM_CHANNEL_COMPLETE_IND; |
| 1391 | roamResult = eCSR_ROAM_RESULT_DFS_RADAR_FOUND_IND; |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1392 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Kapil Gupta | 8878ad9 | 2017-02-13 11:56:04 +0530 | [diff] [blame] | 1393 | "sapdfs: Updated new channel event"); |
| 1394 | |
| 1395 | /* Indicate channel Event to SAP */ |
| 1396 | csr_roam_call_callback(mac, session_id, roamInfo, 0, |
| 1397 | roamStatus, roamResult); |
| 1398 | |
| 1399 | qdf_mem_free(roamInfo); |
| 1400 | return status; |
| 1401 | } |
| 1402 | |
| 1403 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1404 | /** |
| 1405 | * sme_extended_change_channel_ind()- function to indicate ECSA |
| 1406 | * action frame is received in lim to SAP |
| 1407 | * @mac_ctx: pointer to global mac structure |
| 1408 | * @msg_buf: contain new channel and session id. |
| 1409 | * |
| 1410 | * This function is called to post ECSA action frame |
| 1411 | * receive event to SAP. |
| 1412 | * |
| 1413 | * Return: success if msg indicated to SAP else return failure |
| 1414 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1415 | static QDF_STATUS sme_extended_change_channel_ind(tpAniSirGlobal mac_ctx, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1416 | void *msg_buf) |
| 1417 | { |
| 1418 | struct sir_sme_ext_cng_chan_ind *ext_chan_ind; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1419 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1420 | uint32_t session_id = 0; |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1421 | struct csr_roam_info roamInfo = {0}; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1422 | eRoamCmdStatus roam_status; |
| 1423 | eCsrRoamResult roam_result; |
| 1424 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1425 | ext_chan_ind = msg_buf; |
| 1426 | if (NULL == ext_chan_ind) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1427 | sme_err("ext_chan_ind is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1428 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1429 | } |
| 1430 | session_id = ext_chan_ind->session_id; |
| 1431 | roamInfo.target_channel = ext_chan_ind->new_channel; |
| 1432 | roam_status = eCSR_ROAM_EXT_CHG_CHNL_IND; |
| 1433 | roam_result = eCSR_ROAM_EXT_CHG_CHNL_UPDATE_IND; |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1434 | sme_debug("sapdfs: Received eWNI_SME_EXT_CHANGE_CHANNEL_IND for session id [%d]", |
| 1435 | session_id); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1436 | |
| 1437 | /* Indicate Ext Channel Change event to SAP */ |
| 1438 | csr_roam_call_callback(mac_ctx, session_id, &roamInfo, 0, |
| 1439 | roam_status, roam_result); |
| 1440 | return status; |
| 1441 | } |
| 1442 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1443 | #ifdef FEATURE_WLAN_ESE |
| 1444 | /** |
| 1445 | * sme_update_is_ese_feature_enabled() - enable/disable ESE support at runtime |
| 1446 | * @hHal: HAL handle |
| 1447 | * @sessionId: session id |
| 1448 | * @isEseIniFeatureEnabled: ese ini enabled |
| 1449 | * |
| 1450 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 1451 | * isEseIniFeatureEnabled. This is a synchronous call |
| 1452 | * |
| 1453 | * Return: QDF_STATUS enumeration |
| 1454 | */ |
| 1455 | QDF_STATUS sme_update_is_ese_feature_enabled(tHalHandle hHal, |
| 1456 | uint8_t sessionId, const bool isEseIniFeatureEnabled) |
| 1457 | { |
| 1458 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 1459 | QDF_STATUS status; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1460 | |
| 1461 | if (pMac->roam.configParam.isEseIniFeatureEnabled == |
| 1462 | isEseIniFeatureEnabled) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1463 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1464 | "%s: ESE Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", |
| 1465 | __func__, |
| 1466 | pMac->roam.configParam.isEseIniFeatureEnabled, |
| 1467 | isEseIniFeatureEnabled); |
| 1468 | return QDF_STATUS_SUCCESS; |
| 1469 | } |
| 1470 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1471 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1472 | "%s: EseEnabled is changed from %d to %d", __func__, |
| 1473 | pMac->roam.configParam.isEseIniFeatureEnabled, |
| 1474 | isEseIniFeatureEnabled); |
| 1475 | pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled; |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 1476 | csr_neighbor_roam_update_fast_roaming_enabled( |
| 1477 | pMac, sessionId, isEseIniFeatureEnabled); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1478 | |
| 1479 | if (true == isEseIniFeatureEnabled) |
| 1480 | sme_update_fast_transition_enabled(hHal, true); |
| 1481 | |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 1482 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 1483 | status = sme_acquire_global_lock(&pMac->sme); |
| 1484 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 1485 | csr_roam_offload_scan(pMac, sessionId, |
| 1486 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 1487 | REASON_ESE_INI_CFG_CHANGED); |
| 1488 | sme_release_global_lock(&pMac->sme); |
| 1489 | } else { |
| 1490 | sme_err("Failed to acquire SME lock"); |
| 1491 | return status; |
| 1492 | } |
| 1493 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1494 | return QDF_STATUS_SUCCESS; |
| 1495 | } |
| 1496 | |
| 1497 | /** |
| 1498 | * sme_set_plm_request() - set plm request |
| 1499 | * @hHal: HAL handle |
| 1500 | * @pPlmReq: Pointer to input plm request |
| 1501 | * |
| 1502 | * Return: QDF_STATUS enumeration |
| 1503 | */ |
| 1504 | QDF_STATUS sme_set_plm_request(tHalHandle hHal, tpSirPlmReq pPlmReq) |
| 1505 | { |
| 1506 | QDF_STATUS status; |
| 1507 | bool ret = false; |
| 1508 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Varun Reddy Yeturu | 87c8ad8 | 2017-10-03 17:48:12 -0700 | [diff] [blame] | 1509 | uint8_t ch_list[WNI_CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1510 | uint8_t count, valid_count = 0; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1511 | struct scheduler_msg msg = {0}; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 1512 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, |
| 1513 | pPlmReq->sessionId); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1514 | |
| 1515 | status = sme_acquire_global_lock(&pMac->sme); |
| 1516 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 1517 | return status; |
| 1518 | |
| 1519 | if (!pSession) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1520 | sme_err("session %d not found", pPlmReq->sessionId); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1521 | sme_release_global_lock(&pMac->sme); |
| 1522 | return QDF_STATUS_E_FAILURE; |
| 1523 | } |
| 1524 | |
| 1525 | if (!pSession->sessionActive) { |
| 1526 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 1527 | FL("Invalid Sessionid")); |
| 1528 | sme_release_global_lock(&pMac->sme); |
| 1529 | return QDF_STATUS_E_FAILURE; |
| 1530 | } |
| 1531 | |
| 1532 | if (!pPlmReq->enable) |
| 1533 | goto send_plm_start; |
| 1534 | /* validating channel numbers */ |
| 1535 | for (count = 0; count < pPlmReq->plmNumCh; count++) { |
| 1536 | ret = csr_is_supported_channel(pMac, pPlmReq->plmChList[count]); |
| 1537 | if (ret && pPlmReq->plmChList[count] > 14) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 1538 | if (CHANNEL_STATE_DFS == wlan_reg_get_channel_state( |
| 1539 | pMac->pdev, |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1540 | pPlmReq->plmChList[count])) { |
| 1541 | /* DFS channel is provided, no PLM bursts can be |
| 1542 | * transmitted. Ignoring these channels. |
| 1543 | */ |
| 1544 | QDF_TRACE(QDF_MODULE_ID_SME, |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1545 | QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1546 | FL("DFS channel %d ignored for PLM"), |
| 1547 | pPlmReq->plmChList[count]); |
| 1548 | continue; |
| 1549 | } |
| 1550 | } else if (!ret) { |
| 1551 | /* Not supported, ignore the channel */ |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 1552 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1553 | FL("Unsupported channel %d ignored for PLM"), |
| 1554 | pPlmReq->plmChList[count]); |
| 1555 | continue; |
| 1556 | } |
| 1557 | ch_list[valid_count] = pPlmReq->plmChList[count]; |
| 1558 | valid_count++; |
| 1559 | } /* End of for () */ |
| 1560 | |
| 1561 | /* Copying back the valid channel list to plm struct */ |
| 1562 | qdf_mem_set((void *)pPlmReq->plmChList, |
| 1563 | pPlmReq->plmNumCh, 0); |
| 1564 | if (valid_count) |
| 1565 | qdf_mem_copy(pPlmReq->plmChList, ch_list, |
| 1566 | valid_count); |
| 1567 | /* All are invalid channels, FW need to send the PLM |
| 1568 | * report with "incapable" bit set. |
| 1569 | */ |
| 1570 | pPlmReq->plmNumCh = valid_count; |
| 1571 | |
| 1572 | send_plm_start: |
| 1573 | /* PLM START */ |
| 1574 | msg.type = WMA_SET_PLM_REQ; |
| 1575 | msg.reserved = 0; |
| 1576 | msg.bodyptr = pPlmReq; |
| 1577 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 1578 | if (!QDF_IS_STATUS_SUCCESS(scheduler_post_message(QDF_MODULE_ID_SME, |
| 1579 | QDF_MODULE_ID_WMA, |
| 1580 | QDF_MODULE_ID_WMA, |
| 1581 | &msg))) { |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1582 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 1583 | FL("Not able to post WMA_SET_PLM_REQ to WMA")); |
| 1584 | sme_release_global_lock(&pMac->sme); |
| 1585 | return QDF_STATUS_E_FAILURE; |
| 1586 | } |
| 1587 | |
| 1588 | sme_release_global_lock(&pMac->sme); |
| 1589 | return status; |
| 1590 | } |
| 1591 | |
| 1592 | /** |
| 1593 | * sme_tsm_ie_ind() - sme tsm ie indication |
Jeff Johnson | 24e65b5 | 2018-06-10 08:45:26 -0700 | [diff] [blame] | 1594 | * @mac: Global mac context |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1595 | * @pSmeTsmIeInd: Pointer to tsm ie indication |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1596 | * |
| 1597 | * Handle the tsm ie indication from LIM and forward it to HDD. |
| 1598 | * |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1599 | * Return: QDF_STATUS enumeration |
| 1600 | */ |
Jeff Johnson | 24e65b5 | 2018-06-10 08:45:26 -0700 | [diff] [blame] | 1601 | static QDF_STATUS sme_tsm_ie_ind(tpAniSirGlobal mac, |
| 1602 | tSirSmeTsmIEInd *pSmeTsmIeInd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1603 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1604 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1605 | struct csr_roam_info roam_info = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1606 | uint32_t SessionId = pSmeTsmIeInd->sessionId; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1607 | |
Jeff Johnson | eddf544 | 2017-10-04 10:55:53 -0700 | [diff] [blame] | 1608 | roam_info.tsmIe.tsid = pSmeTsmIeInd->tsmIe.tsid; |
| 1609 | roam_info.tsmIe.state = pSmeTsmIeInd->tsmIe.state; |
| 1610 | roam_info.tsmIe.msmt_interval = pSmeTsmIeInd->tsmIe.msmt_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1611 | /* forward the tsm ie information to HDD */ |
Jeff Johnson | 24e65b5 | 2018-06-10 08:45:26 -0700 | [diff] [blame] | 1612 | csr_roam_call_callback(mac, SessionId, &roam_info, 0, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1613 | eCSR_ROAM_TSM_IE_IND, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1614 | return status; |
| 1615 | } |
| 1616 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1617 | /** |
| 1618 | * sme_set_cckm_ie() - set cckm ie |
| 1619 | * @hHal: HAL handle |
| 1620 | * @sessionId: session id |
| 1621 | * @pCckmIe: Pointer to CCKM Ie |
| 1622 | * @cckmIeLen: Length of @pCckmIe |
| 1623 | * |
| 1624 | * Function to store the CCKM IE passed from supplicant and use |
| 1625 | * it while packing reassociation request. |
| 1626 | * |
| 1627 | * Return: QDF_STATUS enumeration |
| 1628 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1629 | QDF_STATUS sme_set_cckm_ie(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1630 | uint8_t *pCckmIe, uint8_t cckmIeLen) |
| 1631 | { |
| 1632 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1633 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1634 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1635 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1636 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1637 | csr_set_cckm_ie(pMac, sessionId, pCckmIe, cckmIeLen); |
| 1638 | sme_release_global_lock(&pMac->sme); |
| 1639 | } |
| 1640 | return status; |
| 1641 | } |
| 1642 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1643 | /** |
| 1644 | * sme_set_ese_beacon_request() - set ese beacon request |
| 1645 | * @hHal: HAL handle |
| 1646 | * @sessionId: session id |
| 1647 | * @pEseBcnReq: Ese beacon report |
| 1648 | * |
| 1649 | * function to set ESE beacon request parameters |
| 1650 | * |
| 1651 | * Return: QDF_STATUS enumeration |
| 1652 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1653 | 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] | 1654 | const tCsrEseBeaconReq *pEseBcnReq) |
| 1655 | { |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 1656 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1657 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1658 | tpSirBeaconReportReqInd pSmeBcnReportReq = NULL; |
| 1659 | tCsrEseBeaconReqParams *pBeaconReq = NULL; |
| 1660 | uint8_t counter = 0; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 1661 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1662 | tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext; |
| 1663 | |
| 1664 | if (pSmeRrmContext->eseBcnReqInProgress == true) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1665 | sme_err("A Beacon Report Req is already in progress"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1666 | return QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1667 | } |
| 1668 | |
| 1669 | /* Store the info in RRM context */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1670 | qdf_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1671 | sizeof(tCsrEseBeaconReq)); |
| 1672 | |
| 1673 | /* Prepare the request to send to SME. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1674 | pSmeBcnReportReq = qdf_mem_malloc(sizeof(tSirBeaconReportReqInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1675 | if (NULL == pSmeBcnReportReq) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1676 | sme_err("Memory Allocation Failure!!! ESE BcnReq Ind to SME"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1677 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1678 | } |
| 1679 | |
| 1680 | pSmeRrmContext->eseBcnReqInProgress = true; |
| 1681 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1682 | sme_debug("Sending Beacon Report Req to SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1683 | |
| 1684 | pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND; |
| 1685 | pSmeBcnReportReq->length = sizeof(tSirBeaconReportReqInd); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1686 | qdf_mem_copy(pSmeBcnReportReq->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1687 | pSession->connectedProfile.bssid.bytes, |
| 1688 | sizeof(tSirMacAddr)); |
| 1689 | pSmeBcnReportReq->channelInfo.channelNum = 255; |
| 1690 | pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe; |
| 1691 | pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD; |
| 1692 | |
| 1693 | for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++) { |
| 1694 | pBeaconReq = |
| 1695 | (tCsrEseBeaconReqParams *) &pEseBcnReq->bcnReq[counter]; |
| 1696 | pSmeBcnReportReq->fMeasurementtype[counter] = |
| 1697 | pBeaconReq->scanMode; |
| 1698 | pSmeBcnReportReq->measurementDuration[counter] = |
| 1699 | SYS_TU_TO_MS(pBeaconReq->measurementDuration); |
| 1700 | pSmeBcnReportReq->channelList.channelNumber[counter] = |
| 1701 | pBeaconReq->channel; |
| 1702 | } |
| 1703 | |
| 1704 | status = sme_rrm_process_beacon_report_req_ind(pMac, pSmeBcnReportReq); |
| 1705 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1706 | if (status != QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1707 | pSmeRrmContext->eseBcnReqInProgress = false; |
| 1708 | |
Hanumanth Reddy Pothula | 7f7a271 | 2016-09-07 18:44:47 +0530 | [diff] [blame] | 1709 | qdf_mem_free(pSmeBcnReportReq); |
| 1710 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1711 | return status; |
| 1712 | } |
| 1713 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1714 | /** |
| 1715 | * sme_get_tsm_stats() - SME get tsm stats |
| 1716 | * @hHal: HAL handle |
| 1717 | * @callback: SME sends back the requested stats using the callback |
| 1718 | * @staId: The station ID for which the stats is requested for |
| 1719 | * @bssId: bssid |
| 1720 | * @pContext: user context to be passed back along with the callback |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1721 | * @tid: Traffic id |
| 1722 | * |
| 1723 | * API register a callback to get TSM Stats. |
| 1724 | * |
| 1725 | * Return: QDF_STATUS enumeration |
| 1726 | */ |
| 1727 | QDF_STATUS sme_get_tsm_stats(tHalHandle hHal, |
| 1728 | tCsrTsmStatsCallback callback, |
| 1729 | uint8_t staId, struct qdf_mac_addr bssId, |
Jeff Johnson | 30f8455 | 2017-09-13 14:55:25 -0700 | [diff] [blame] | 1730 | void *pContext, uint8_t tid) |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1731 | { |
| 1732 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 1733 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1734 | |
| 1735 | status = sme_acquire_global_lock(&pMac->sme); |
| 1736 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 1737 | status = csr_get_tsm_stats(pMac, callback, |
| 1738 | staId, bssId, pContext, |
Jeff Johnson | 30f8455 | 2017-09-13 14:55:25 -0700 | [diff] [blame] | 1739 | tid); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1740 | sme_release_global_lock(&pMac->sme); |
| 1741 | } |
| 1742 | return status; |
| 1743 | } |
| 1744 | |
| 1745 | /** |
| 1746 | * sme_set_ese_roam_scan_channel_list() - To set ese roam scan channel list |
| 1747 | * @hHal: pointer HAL handle returned by mac_open |
| 1748 | * @sessionId: sme session id |
| 1749 | * @pChannelList: Output channel list |
| 1750 | * @numChannels: Output number of channels |
| 1751 | * |
| 1752 | * This routine is called to set ese roam scan channel list. |
| 1753 | * This is a synchronous call |
| 1754 | * |
| 1755 | * Return: QDF_STATUS |
| 1756 | */ |
| 1757 | QDF_STATUS sme_set_ese_roam_scan_channel_list(tHalHandle hHal, |
| 1758 | uint8_t sessionId, |
| 1759 | uint8_t *pChannelList, |
| 1760 | uint8_t numChannels) |
| 1761 | { |
| 1762 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1763 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 1764 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 1765 | tpCsrChannelInfo curchnl_list_info = NULL; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1766 | uint8_t oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN * 2] = { 0 }; |
| 1767 | uint8_t newChannelList[128] = { 0 }; |
| 1768 | uint8_t i = 0, j = 0; |
| 1769 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 1770 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 1771 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 1772 | FL("Invalid sme session id: %d"), sessionId); |
| 1773 | return QDF_STATUS_E_INVAL; |
| 1774 | } |
| 1775 | |
| 1776 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
| 1777 | curchnl_list_info = |
| 1778 | &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
| 1779 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1780 | status = sme_acquire_global_lock(&pMac->sme); |
| 1781 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 1782 | sme_err("Failed to acquire SME lock"); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1783 | return status; |
| 1784 | } |
| 1785 | if (NULL != curchnl_list_info->ChannelList) { |
| 1786 | for (i = 0; i < curchnl_list_info->numOfChannels; i++) { |
| 1787 | j += snprintf(oldChannelList + j, |
| 1788 | sizeof(oldChannelList) - j, "%d", |
| 1789 | curchnl_list_info->ChannelList[i]); |
| 1790 | } |
| 1791 | } |
| 1792 | status = csr_create_roam_scan_channel_list(pMac, sessionId, |
| 1793 | pChannelList, numChannels, |
| 1794 | csr_get_current_band(hHal)); |
| 1795 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 1796 | if (NULL != curchnl_list_info->ChannelList) { |
| 1797 | j = 0; |
| 1798 | for (i = 0; i < curchnl_list_info->numOfChannels; i++) { |
| 1799 | j += snprintf(newChannelList + j, |
| 1800 | sizeof(newChannelList) - j, "%d", |
| 1801 | curchnl_list_info->ChannelList[i]); |
| 1802 | } |
| 1803 | } |
| 1804 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 1805 | "ESE roam scan chnl list successfully set to %s-old value is %s-roam state is %d", |
| 1806 | newChannelList, oldChannelList, |
| 1807 | pNeighborRoamInfo->neighborRoamState); |
| 1808 | } |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 1809 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1810 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 1811 | csr_roam_offload_scan(pMac, sessionId, |
| 1812 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 1813 | REASON_CHANNEL_LIST_CHANGED); |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 1814 | |
| 1815 | sme_release_global_lock(&pMac->sme); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1816 | return status; |
| 1817 | } |
| 1818 | |
| 1819 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1820 | |
Jeff Johnson | 49c02f9 | 2016-10-07 10:29:09 -0700 | [diff] [blame] | 1821 | static |
Jeff Johnson | bfc58a1 | 2018-06-10 08:49:08 -0700 | [diff] [blame] | 1822 | QDF_STATUS sme_ibss_peer_info_response_handler(tpAniSirGlobal pMac, |
Jeff Johnson | 49c02f9 | 2016-10-07 10:29:09 -0700 | [diff] [blame] | 1823 | tpSirIbssGetPeerInfoRspParams |
| 1824 | pIbssPeerInfoParams) |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1825 | { |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 1826 | if (NULL == pMac) { |
| 1827 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
| 1828 | "%s: pMac is null", __func__); |
| 1829 | return QDF_STATUS_E_FAILURE; |
| 1830 | } |
| 1831 | if (pMac->sme.peerInfoParams.peerInfoCbk == NULL) { |
| 1832 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 1833 | "%s: HDD callback is null", __func__); |
| 1834 | return QDF_STATUS_E_FAILURE; |
| 1835 | } |
| 1836 | pMac->sme.peerInfoParams.peerInfoCbk(pMac->sme.peerInfoParams.pUserData, |
| 1837 | &pIbssPeerInfoParams-> |
| 1838 | ibssPeerInfoRspParams); |
| 1839 | return QDF_STATUS_SUCCESS; |
| 1840 | } |
| 1841 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1842 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1843 | * sme_process_dual_mac_config_resp() - Process set Dual mac config response |
| 1844 | * @mac: Global MAC pointer |
| 1845 | * @msg: Dual mac config response |
| 1846 | * |
| 1847 | * Processes the dual mac configuration response and invokes the HDD callback |
| 1848 | * to process further |
| 1849 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1850 | static QDF_STATUS sme_process_dual_mac_config_resp(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1851 | uint8_t *msg) |
| 1852 | { |
| 1853 | tListElem *entry = NULL; |
| 1854 | tSmeCmd *command = NULL; |
| 1855 | bool found; |
| 1856 | dual_mac_cb callback = NULL; |
| 1857 | struct sir_dual_mac_config_resp *param; |
| 1858 | |
| 1859 | param = (struct sir_dual_mac_config_resp *)msg; |
| 1860 | if (!param) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1861 | sme_err("Dual mac config resp param is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1862 | /* Not returning. Need to check if active command list |
| 1863 | * needs to be freed |
| 1864 | */ |
| 1865 | } |
| 1866 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 1867 | entry = csr_nonscan_active_ll_peek_head(mac, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1868 | if (!entry) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1869 | sme_err("No cmd found in active list"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1870 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1871 | } |
| 1872 | |
| 1873 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 1874 | if (!command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1875 | sme_err("Base address is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1876 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1877 | } |
| 1878 | |
| 1879 | if (e_sme_command_set_dual_mac_config != command->command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1880 | sme_err("Command mismatch!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1881 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1882 | } |
| 1883 | |
| 1884 | callback = command->u.set_dual_mac_cmd.set_dual_mac_cb; |
| 1885 | if (callback) { |
| 1886 | if (!param) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1887 | sme_err("Callback failed-Dual mac config is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1888 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1889 | sme_debug("Calling HDD callback for Dual mac config"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1890 | callback(param->status, |
| 1891 | command->u.set_dual_mac_cmd.scan_config, |
| 1892 | command->u.set_dual_mac_cmd.fw_mode_config); |
| 1893 | } |
| 1894 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1895 | sme_err("Callback does not exist"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1896 | } |
| 1897 | |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 1898 | found = csr_nonscan_active_ll_remove_entry(mac, entry, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1899 | if (found) |
| 1900 | /* Now put this command back on the available command list */ |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 1901 | csr_release_command(mac, command); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1902 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1903 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1904 | } |
| 1905 | |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1906 | /** |
| 1907 | * sme_process_antenna_mode_resp() - Process set antenna mode |
| 1908 | * response |
| 1909 | * @mac: Global MAC pointer |
| 1910 | * @msg: antenna mode response |
| 1911 | * |
| 1912 | * Processes the antenna mode response and invokes the HDD |
| 1913 | * callback to process further |
| 1914 | */ |
| 1915 | static QDF_STATUS sme_process_antenna_mode_resp(tpAniSirGlobal mac, |
| 1916 | uint8_t *msg) |
| 1917 | { |
| 1918 | tListElem *entry; |
| 1919 | tSmeCmd *command; |
| 1920 | bool found; |
Dundi Raviteja | 6bb9e32 | 2018-05-16 17:04:41 +0530 | [diff] [blame] | 1921 | void *context = NULL; |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1922 | antenna_mode_cb callback; |
| 1923 | struct sir_antenna_mode_resp *param; |
| 1924 | |
| 1925 | param = (struct sir_antenna_mode_resp *)msg; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1926 | if (!param) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1927 | sme_err("set antenna mode resp is NULL"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1928 | /* Not returning. Need to check if active command list |
| 1929 | * needs to be freed |
| 1930 | */ |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1931 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 1932 | entry = csr_nonscan_active_ll_peek_head(mac, LL_ACCESS_LOCK); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1933 | if (!entry) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1934 | sme_err("No cmd found in active list"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1935 | return QDF_STATUS_E_FAILURE; |
| 1936 | } |
| 1937 | |
| 1938 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 1939 | if (!command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1940 | sme_err("Base address is NULL"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1941 | return QDF_STATUS_E_FAILURE; |
| 1942 | } |
| 1943 | |
| 1944 | if (e_sme_command_set_antenna_mode != command->command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1945 | sme_err("Command mismatch!"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1946 | return QDF_STATUS_E_FAILURE; |
| 1947 | } |
| 1948 | |
Dundi Raviteja | 6bb9e32 | 2018-05-16 17:04:41 +0530 | [diff] [blame] | 1949 | context = command->u.set_antenna_mode_cmd.set_antenna_mode_ctx; |
| 1950 | callback = command->u.set_antenna_mode_cmd.set_antenna_mode_resp; |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1951 | if (callback) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1952 | if (!param) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1953 | sme_err("Set antenna mode call back is NULL"); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 1954 | else |
Dundi Raviteja | 6bb9e32 | 2018-05-16 17:04:41 +0530 | [diff] [blame] | 1955 | callback(param->status, context); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1956 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1957 | sme_err("Callback does not exist"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1958 | } |
| 1959 | |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 1960 | found = csr_nonscan_active_ll_remove_entry(mac, entry, LL_ACCESS_LOCK); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1961 | if (found) |
| 1962 | /* Now put this command back on the available command list */ |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 1963 | csr_release_command(mac, command); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1964 | |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 1965 | return QDF_STATUS_SUCCESS; |
| 1966 | } |
| 1967 | |
Jeff Johnson | 5f9ce2d | 2018-06-09 21:20:45 -0700 | [diff] [blame] | 1968 | QDF_STATUS sme_process_msg(tpAniSirGlobal pMac, struct scheduler_msg *pMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1969 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1970 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 1971 | struct sir_peer_info *peer_stats; |
| 1972 | struct sir_peer_info_resp *peer_info_rsp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1973 | |
| 1974 | if (pMsg == NULL) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1975 | sme_err("Empty message for SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1976 | return status; |
| 1977 | } |
| 1978 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1979 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 1980 | sme_warn("Locking failed, bailing out"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1981 | if (pMsg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1982 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1983 | return status; |
| 1984 | } |
| 1985 | if (!SME_IS_START(pMac)) { |
Rajeev Kumar | 3887f9b | 2018-01-10 11:24:01 -0800 | [diff] [blame] | 1986 | sme_debug("message type %d in stop state ignored", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1987 | if (pMsg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1988 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1989 | goto release_lock; |
| 1990 | } |
| 1991 | switch (pMsg->type) { |
| 1992 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1993 | case eWNI_SME_HO_FAIL_IND: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1994 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1995 | FL("LFR3: Rcvd eWNI_SME_HO_FAIL_IND")); |
| 1996 | csr_process_ho_fail_ind(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1997 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1998 | break; |
| 1999 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2000 | case WNI_CFG_SET_CNF: |
| 2001 | case WNI_CFG_DNLD_CNF: |
| 2002 | case WNI_CFG_GET_RSP: |
| 2003 | case WNI_CFG_ADD_GRP_ADDR_CNF: |
| 2004 | case WNI_CFG_DEL_GRP_ADDR_CNF: |
| 2005 | break; |
| 2006 | case eWNI_SME_ADDTS_RSP: |
| 2007 | case eWNI_SME_DELTS_RSP: |
| 2008 | case eWNI_SME_DELTS_IND: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2009 | case eWNI_SME_FT_AGGR_QOS_RSP: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2010 | /* QoS */ |
| 2011 | if (pMsg->bodyptr) { |
| 2012 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 2013 | status = sme_qos_msg_processor(pMac, pMsg->type, |
| 2014 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2015 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2016 | #endif |
| 2017 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2018 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2019 | } |
| 2020 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2021 | case eWNI_SME_NEIGHBOR_REPORT_IND: |
| 2022 | case eWNI_SME_BEACON_REPORT_REQ_IND: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2023 | if (pMsg->bodyptr) { |
| 2024 | status = sme_rrm_msg_processor(pMac, pMsg->type, |
| 2025 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2026 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2027 | } else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2028 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2029 | } |
| 2030 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2031 | case eWNI_SME_ADD_STA_SELF_RSP: |
| 2032 | if (pMsg->bodyptr) { |
| 2033 | status = csr_process_add_sta_session_rsp(pMac, |
| 2034 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2035 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2036 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2037 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2038 | } |
| 2039 | break; |
| 2040 | case eWNI_SME_DEL_STA_SELF_RSP: |
| 2041 | if (pMsg->bodyptr) { |
| 2042 | status = csr_process_del_sta_session_rsp(pMac, |
| 2043 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2044 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2045 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2046 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2047 | } |
| 2048 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2049 | case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE: |
| 2050 | if (pMsg->bodyptr) { |
| 2051 | status = sme_handle_generic_change_country_code( |
| 2052 | (void *)pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2053 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2054 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2055 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2056 | } |
| 2057 | break; |
Sandeep Puligilla | 8d6011b | 2017-11-08 00:06:18 -0800 | [diff] [blame] | 2058 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2059 | #ifdef WLAN_FEATURE_11W |
| 2060 | case eWNI_SME_UNPROT_MGMT_FRM_IND: |
| 2061 | if (pMsg->bodyptr) { |
| 2062 | sme_unprotected_mgmt_frm_ind(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2063 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2064 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2065 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2066 | } |
| 2067 | break; |
| 2068 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 2069 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2070 | case eWNI_SME_TSM_IE_IND: |
| 2071 | if (pMsg->bodyptr) { |
| 2072 | sme_tsm_ie_ind(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2073 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2074 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2075 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2076 | } |
| 2077 | break; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 2078 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2079 | case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP: |
| 2080 | status = csr_roam_offload_scan_rsp_hdlr((void *)pMac, |
| 2081 | 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 | break; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 2084 | case eWNI_SME_IBSS_PEER_INFO_RSP: |
| 2085 | if (pMsg->bodyptr) { |
Jeff Johnson | 49c02f9 | 2016-10-07 10:29:09 -0700 | [diff] [blame] | 2086 | sme_ibss_peer_info_response_handler(pMac, |
| 2087 | pMsg->bodyptr); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 2088 | qdf_mem_free(pMsg->bodyptr); |
| 2089 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2090 | sme_err("Empty message for: %d", pMsg->type); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 2091 | } |
| 2092 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2093 | case eWNI_SME_READY_TO_SUSPEND_IND: |
| 2094 | if (pMsg->bodyptr) { |
| 2095 | sme_process_ready_to_suspend(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2096 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2097 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2098 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2099 | } |
| 2100 | break; |
| 2101 | #ifdef WLAN_FEATURE_EXTWOW_SUPPORT |
| 2102 | case eWNI_SME_READY_TO_EXTWOW_IND: |
| 2103 | if (pMsg->bodyptr) { |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 2104 | sme_process_ready_to_ext_wow(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2105 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2106 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2107 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2108 | } |
| 2109 | break; |
| 2110 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2111 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 2112 | case eWNI_SME_AUTO_SHUTDOWN_IND: |
| 2113 | if (pMac->sme.pAutoShutdownNotificationCb) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 2114 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2115 | FL("Auto shutdown notification")); |
| 2116 | pMac->sme.pAutoShutdownNotificationCb(); |
| 2117 | } |
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 | break; |
| 2120 | #endif |
| 2121 | case eWNI_SME_DFS_RADAR_FOUND: |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 2122 | case eWNI_SME_DFS_CAC_COMPLETE: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2123 | case eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND: |
Abhishek Singh | 20a8e44 | 2018-09-12 15:50:44 +0530 | [diff] [blame] | 2124 | case eWNI_SME_CSA_RESTART_RSP: |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 2125 | status = dfs_msg_processor(pMac, pMsg); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2126 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2127 | break; |
| 2128 | case eWNI_SME_CHANNEL_CHANGE_RSP: |
| 2129 | if (pMsg->bodyptr) { |
| 2130 | status = sme_process_channel_change_resp(pMac, |
| 2131 | pMsg->type, |
| 2132 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2133 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2134 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2135 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2136 | } |
| 2137 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2138 | case eWNI_SME_STATS_EXT_EVENT: |
Jeff Johnson | fdecd51 | 2018-06-10 09:18:32 -0700 | [diff] [blame] | 2139 | status = sme_stats_ext_event(pMac, pMsg->bodyptr); |
| 2140 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2141 | break; |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 2142 | case eWNI_SME_GET_PEER_INFO_IND: |
| 2143 | if (pMac->sme.pget_peer_info_ind_cb) |
| 2144 | pMac->sme.pget_peer_info_ind_cb(pMsg->bodyptr, |
| 2145 | pMac->sme.pget_peer_info_cb_context); |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2146 | if (pMsg->bodyptr) { |
| 2147 | peer_info_rsp = (struct sir_peer_info_resp *) |
| 2148 | (pMsg->bodyptr); |
| 2149 | peer_stats = (struct sir_peer_info *) |
| 2150 | (peer_info_rsp->info); |
| 2151 | if (peer_stats) { |
| 2152 | pMac->peer_rssi = peer_stats[0].rssi; |
| 2153 | pMac->peer_txrate = peer_stats[0].tx_rate; |
| 2154 | pMac->peer_rxrate = peer_stats[0].rx_rate; |
| 2155 | } |
| 2156 | } |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 2157 | qdf_mem_free(pMsg->bodyptr); |
| 2158 | break; |
| 2159 | case eWNI_SME_GET_PEER_INFO_EXT_IND: |
| 2160 | if (pMac->sme.pget_peer_info_ext_ind_cb) |
| 2161 | pMac->sme.pget_peer_info_ext_ind_cb(pMsg->bodyptr, |
| 2162 | pMac->sme.pget_peer_info_ext_cb_context); |
| 2163 | qdf_mem_free(pMsg->bodyptr); |
| 2164 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2165 | case eWNI_SME_CSA_OFFLOAD_EVENT: |
| 2166 | if (pMsg->bodyptr) { |
| 2167 | csr_scan_flush_bss_entry(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2168 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2169 | } |
| 2170 | break; |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 2171 | case eWNI_SME_TSF_EVENT: |
| 2172 | if (pMac->sme.get_tsf_cb) { |
| 2173 | pMac->sme.get_tsf_cb(pMac->sme.get_tsf_cxt, |
| 2174 | (struct stsf *)pMsg->bodyptr); |
| 2175 | } |
| 2176 | if (pMsg->bodyptr) |
| 2177 | qdf_mem_free(pMsg->bodyptr); |
| 2178 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2179 | #ifdef WLAN_FEATURE_NAN |
| 2180 | case eWNI_SME_NAN_EVENT: |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 2181 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_WMA_MSG, |
| 2182 | NO_SESSION, pMsg->type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2183 | if (pMsg->bodyptr) { |
Jeff Johnson | 5f9ce2d | 2018-06-09 21:20:45 -0700 | [diff] [blame] | 2184 | sme_nan_event(MAC_HANDLE(pMac), pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2185 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2186 | } |
| 2187 | break; |
| 2188 | #endif /* WLAN_FEATURE_NAN */ |
| 2189 | case eWNI_SME_LINK_STATUS_IND: |
| 2190 | { |
| 2191 | tAniGetLinkStatus *pLinkStatus = |
| 2192 | (tAniGetLinkStatus *) pMsg->bodyptr; |
| 2193 | if (pLinkStatus) { |
Jeff Johnson | ca7a716 | 2018-07-07 12:56:54 -0700 | [diff] [blame] | 2194 | if (pMac->sme.link_status_callback) |
| 2195 | pMac->sme.link_status_callback( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2196 | pLinkStatus->linkStatus, |
Jeff Johnson | ca7a716 | 2018-07-07 12:56:54 -0700 | [diff] [blame] | 2197 | pMac->sme.link_status_context); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2198 | |
Jeff Johnson | ca7a716 | 2018-07-07 12:56:54 -0700 | [diff] [blame] | 2199 | pMac->sme.link_status_callback = NULL; |
| 2200 | pMac->sme.link_status_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2201 | qdf_mem_free(pLinkStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2202 | } |
| 2203 | break; |
| 2204 | } |
| 2205 | case eWNI_SME_MSG_GET_TEMPERATURE_IND: |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2206 | if (pMac->sme.pGetTemperatureCb) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2207 | pMac->sme.pGetTemperatureCb(pMsg->bodyval, |
| 2208 | pMac->sme.pTemperatureCbContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2209 | break; |
| 2210 | case eWNI_SME_SNR_IND: |
| 2211 | { |
| 2212 | tAniGetSnrReq *pSnrReq = (tAniGetSnrReq *) pMsg->bodyptr; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2213 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2214 | if (pSnrReq) { |
| 2215 | if (pSnrReq->snrCallback) { |
| 2216 | ((tCsrSnrCallback) |
| 2217 | (pSnrReq->snrCallback)) |
| 2218 | (pSnrReq->snr, pSnrReq->staId, |
| 2219 | pSnrReq->pDevContext); |
| 2220 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2221 | qdf_mem_free(pSnrReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2222 | } |
| 2223 | break; |
| 2224 | } |
| 2225 | #ifdef FEATURE_WLAN_EXTSCAN |
| 2226 | case eWNI_SME_EXTSCAN_FULL_SCAN_RESULT_IND: |
Jeff Johnson | 17b1239 | 2018-07-03 22:21:15 -0700 | [diff] [blame] | 2227 | if (pMac->sme.ext_scan_ind_cb) |
| 2228 | pMac->sme.ext_scan_ind_cb(pMac->hdd_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2229 | eSIR_EXTSCAN_FULL_SCAN_RESULT_IND, |
| 2230 | pMsg->bodyptr); |
| 2231 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2232 | sme_err("callback not registered to process: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2233 | pMsg->type); |
| 2234 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2235 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2236 | break; |
| 2237 | case eWNI_SME_EPNO_NETWORK_FOUND_IND: |
Jeff Johnson | 17b1239 | 2018-07-03 22:21:15 -0700 | [diff] [blame] | 2238 | if (pMac->sme.ext_scan_ind_cb) |
| 2239 | pMac->sme.ext_scan_ind_cb(pMac->hdd_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2240 | eSIR_EPNO_NETWORK_FOUND_IND, |
| 2241 | pMsg->bodyptr); |
| 2242 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2243 | sme_err("callback not registered to process: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2244 | pMsg->type); |
| 2245 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2246 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2247 | break; |
| 2248 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2249 | case eWNI_SME_SET_HW_MODE_RESP: |
| 2250 | if (pMsg->bodyptr) { |
| 2251 | status = sme_process_set_hw_mode_resp(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_HW_MODE_TRANS_IND: |
| 2259 | if (pMsg->bodyptr) { |
| 2260 | status = sme_process_hw_mode_trans_ind(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_NSS_UPDATE_RSP: |
| 2268 | if (pMsg->bodyptr) { |
| 2269 | status = sme_process_nss_update_resp(pMac, |
| 2270 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2271 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2272 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2273 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2274 | } |
| 2275 | break; |
Nirav Shah | 575282c | 2018-07-08 22:48:00 +0530 | [diff] [blame] | 2276 | #ifdef WLAN_FEATURE_DSRC |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2277 | case eWNI_SME_OCB_SET_CONFIG_RSP: |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2278 | if (pMac->sme.ocb_set_config_callback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2279 | pMac->sme.ocb_set_config_callback( |
| 2280 | pMac->sme.ocb_set_config_context, |
| 2281 | pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2282 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2283 | sme_err("No callback for Msg type: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2284 | pMac->sme.ocb_set_config_callback = NULL; |
| 2285 | pMac->sme.ocb_set_config_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2286 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2287 | break; |
| 2288 | case eWNI_SME_OCB_GET_TSF_TIMER_RSP: |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2289 | if (pMac->sme.ocb_get_tsf_timer_callback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2290 | pMac->sme.ocb_get_tsf_timer_callback( |
| 2291 | pMac->sme.ocb_get_tsf_timer_context, |
| 2292 | pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2293 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2294 | sme_err("No callback for Msg type: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2295 | pMac->sme.ocb_get_tsf_timer_callback = NULL; |
| 2296 | pMac->sme.ocb_get_tsf_timer_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2297 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2298 | break; |
| 2299 | case eWNI_SME_DCC_GET_STATS_RSP: |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2300 | if (pMac->sme.dcc_get_stats_callback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2301 | pMac->sme.dcc_get_stats_callback( |
| 2302 | pMac->sme.dcc_get_stats_context, |
| 2303 | pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2304 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2305 | sme_err("No callback for Msg type: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2306 | pMac->sme.dcc_get_stats_callback = NULL; |
| 2307 | pMac->sme.dcc_get_stats_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2308 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2309 | break; |
| 2310 | case eWNI_SME_DCC_UPDATE_NDL_RSP: |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2311 | if (pMac->sme.dcc_update_ndl_callback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2312 | pMac->sme.dcc_update_ndl_callback( |
| 2313 | pMac->sme.dcc_update_ndl_context, |
| 2314 | pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2315 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2316 | sme_err("No callback for Msg type: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2317 | pMac->sme.dcc_update_ndl_callback = NULL; |
| 2318 | pMac->sme.dcc_update_ndl_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2319 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2320 | break; |
| 2321 | case eWNI_SME_DCC_STATS_EVENT: |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2322 | if (pMac->sme.dcc_stats_event_callback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2323 | pMac->sme.dcc_stats_event_callback( |
| 2324 | pMac->sme.dcc_stats_event_context, |
| 2325 | pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2326 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2327 | sme_err("No callback for Msg type: %d", pMsg->type); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2328 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2329 | break; |
Nirav Shah | 575282c | 2018-07-08 22:48:00 +0530 | [diff] [blame] | 2330 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2331 | case eWNI_SME_SET_DUAL_MAC_CFG_RESP: |
| 2332 | if (pMsg->bodyptr) { |
| 2333 | status = sme_process_dual_mac_config_resp(pMac, |
| 2334 | pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2335 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2336 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2337 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2338 | } |
gaurank kathpalia | ebe3fc8 | 2018-05-07 09:39:46 +0530 | [diff] [blame] | 2339 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2340 | case eWNI_SME_SET_THERMAL_LEVEL_IND: |
| 2341 | if (pMac->sme.set_thermal_level_cb) |
Jeff Johnson | 6aaaa99 | 2018-06-30 10:43:04 -0700 | [diff] [blame] | 2342 | pMac->sme.set_thermal_level_cb(pMac->hdd_handle, |
| 2343 | pMsg->bodyval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2344 | break; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 2345 | case eWNI_SME_EXT_CHANGE_CHANNEL_IND: |
| 2346 | status = sme_extended_change_channel_ind(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2347 | qdf_mem_free(pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2348 | break; |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 2349 | case eWNI_SME_SET_ANTENNA_MODE_RESP: |
| 2350 | if (pMsg->bodyptr) { |
| 2351 | status = sme_process_antenna_mode_resp(pMac, |
| 2352 | pMsg->bodyptr); |
| 2353 | qdf_mem_free(pMsg->bodyptr); |
| 2354 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2355 | sme_err("Empty message for: %d", pMsg->type); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 2356 | } |
| 2357 | break; |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 2358 | case eWNI_SME_LOST_LINK_INFO_IND: |
| 2359 | if (pMac->sme.lost_link_info_cb) |
Jeff Johnson | 6aaaa99 | 2018-06-30 10:43:04 -0700 | [diff] [blame] | 2360 | pMac->sme.lost_link_info_cb(pMac->hdd_handle, |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 2361 | (struct sir_lost_link_info *)pMsg->bodyptr); |
| 2362 | qdf_mem_free(pMsg->bodyptr); |
| 2363 | break; |
Sreelakshmi Konamki | 88a2a41 | 2017-04-14 15:11:55 +0530 | [diff] [blame] | 2364 | case eWNI_SME_RSO_CMD_STATUS_IND: |
| 2365 | if (pMac->sme.rso_cmd_status_cb) |
Jeff Johnson | 6aaaa99 | 2018-06-30 10:43:04 -0700 | [diff] [blame] | 2366 | pMac->sme.rso_cmd_status_cb(pMac->hdd_handle, |
| 2367 | pMsg->bodyptr); |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 2368 | qdf_mem_free(pMsg->bodyptr); |
| 2369 | break; |
Zhang Qian | a6e9c10 | 2016-12-22 16:47:24 +0800 | [diff] [blame] | 2370 | case eWMI_SME_LL_STATS_IND: |
| 2371 | if (pMac->sme.link_layer_stats_ext_cb) |
Jeff Johnson | 6aaaa99 | 2018-06-30 10:43:04 -0700 | [diff] [blame] | 2372 | pMac->sme.link_layer_stats_ext_cb(pMac->hdd_handle, |
Zhang Qian | a6e9c10 | 2016-12-22 16:47:24 +0800 | [diff] [blame] | 2373 | pMsg->bodyptr); |
Sreelakshmi Konamki | 88a2a41 | 2017-04-14 15:11:55 +0530 | [diff] [blame] | 2374 | qdf_mem_free(pMsg->bodyptr); |
| 2375 | break; |
Vidyullatha Kanchanapally | be0ebb3 | 2017-03-23 14:36:21 +0530 | [diff] [blame] | 2376 | case eWNI_SME_BT_ACTIVITY_INFO_IND: |
| 2377 | if (pMac->sme.bt_activity_info_cb) |
Jeff Johnson | 6aaaa99 | 2018-06-30 10:43:04 -0700 | [diff] [blame] | 2378 | pMac->sme.bt_activity_info_cb(pMac->hdd_handle, |
Vidyullatha Kanchanapally | be0ebb3 | 2017-03-23 14:36:21 +0530 | [diff] [blame] | 2379 | pMsg->bodyval); |
| 2380 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2381 | default: |
| 2382 | |
| 2383 | if ((pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN) |
| 2384 | && (pMsg->type <= eWNI_SME_MSG_TYPES_END)) { |
| 2385 | /* CSR */ |
| 2386 | if (pMsg->bodyptr) { |
Jeff Johnson | e0349a0 | 2018-06-10 11:31:06 -0700 | [diff] [blame] | 2387 | status = csr_msg_processor(pMac, pMsg->bodyptr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2388 | qdf_mem_free(pMsg->bodyptr); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2389 | } else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2390 | sme_err("Empty message for: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2391 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2392 | sme_warn("Unknown message type: %d", pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2393 | if (pMsg->bodyptr) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2394 | qdf_mem_free(pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2395 | } |
| 2396 | } /* switch */ |
| 2397 | release_lock: |
| 2398 | sme_release_global_lock(&pMac->sme); |
| 2399 | return status; |
| 2400 | } |
| 2401 | |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 2402 | QDF_STATUS sme_mc_process_handler(struct scheduler_msg *msg) |
| 2403 | { |
| 2404 | tpAniSirGlobal mac_ctx = cds_get_context(QDF_MODULE_ID_SME); |
| 2405 | |
| 2406 | if (mac_ctx == NULL) { |
| 2407 | QDF_ASSERT(0); |
| 2408 | return QDF_STATUS_E_FAILURE; |
| 2409 | } |
| 2410 | |
Jeff Johnson | 5f9ce2d | 2018-06-09 21:20:45 -0700 | [diff] [blame] | 2411 | return sme_process_msg(mac_ctx, msg); |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 2412 | } |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 2413 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2414 | /** |
| 2415 | * sme_process_nss_update_resp() - Process nss update response |
| 2416 | * @mac: Global MAC pointer |
| 2417 | * @msg: nss update response |
| 2418 | * |
| 2419 | * Processes the nss update response and invokes the HDD |
| 2420 | * callback to process further |
| 2421 | */ |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2422 | 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] | 2423 | { |
| 2424 | tListElem *entry = NULL; |
| 2425 | tSmeCmd *command = NULL; |
| 2426 | bool found; |
Tushnim Bhattacharyya | eab33dd | 2017-11-15 15:20:02 -0800 | [diff] [blame] | 2427 | policy_mgr_nss_update_cback callback = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2428 | struct sir_beacon_tx_complete_rsp *param; |
| 2429 | |
| 2430 | param = (struct sir_beacon_tx_complete_rsp *)msg; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2431 | if (!param) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2432 | sme_err("nss update resp param is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2433 | /* Not returning. Need to check if active command list |
| 2434 | * needs to be freed |
| 2435 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2436 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 2437 | entry = csr_nonscan_active_ll_peek_head(mac, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2438 | if (!entry) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2439 | sme_err("No cmd found in active list"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2440 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2441 | } |
| 2442 | |
| 2443 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 2444 | if (!command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2445 | sme_err("Base address is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2446 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2447 | } |
| 2448 | |
| 2449 | if (e_sme_command_nss_update != command->command) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2450 | sme_err("Command mismatch!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2451 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2452 | } |
| 2453 | |
| 2454 | callback = command->u.nss_update_cmd.nss_update_cb; |
| 2455 | if (callback) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2456 | if (!param) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2457 | sme_err("Callback failed since nss update params is NULL"); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2458 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2459 | callback(command->u.nss_update_cmd.context, |
| 2460 | param->tx_status, |
| 2461 | param->session_id, |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 2462 | command->u.nss_update_cmd.next_action, |
| 2463 | command->u.nss_update_cmd.reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2464 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2465 | sme_err("Callback does not exisit"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2466 | } |
| 2467 | |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 2468 | found = csr_nonscan_active_ll_remove_entry(mac, entry, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2469 | if (found) { |
| 2470 | /* Now put this command back on the avilable command list */ |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 2471 | csr_release_command(mac, command); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2472 | } |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 2473 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2474 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2475 | } |
| 2476 | |
Jeff Johnson | 62cd680 | 2018-07-20 12:38:25 -0700 | [diff] [blame] | 2477 | QDF_STATUS sme_stop(mac_handle_t mac_handle) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2478 | { |
Jeff Johnson | 62cd680 | 2018-07-20 12:38:25 -0700 | [diff] [blame] | 2479 | QDF_STATUS status; |
| 2480 | QDF_STATUS ret_status = QDF_STATUS_SUCCESS; |
| 2481 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2482 | |
Jeff Johnson | 62cd680 | 2018-07-20 12:38:25 -0700 | [diff] [blame] | 2483 | status = rrm_stop(mac); |
| 2484 | if (QDF_IS_STATUS_ERROR(status)) { |
| 2485 | ret_status = status; |
Sandeep Puligilla | 66d09c4 | 2017-09-06 17:10:27 -0700 | [diff] [blame] | 2486 | sme_err("rrm_stop failed with status: %d", status); |
| 2487 | } |
| 2488 | |
Jeff Johnson | 62cd680 | 2018-07-20 12:38:25 -0700 | [diff] [blame] | 2489 | status = csr_stop(mac); |
| 2490 | if (QDF_IS_STATUS_ERROR(status)) { |
| 2491 | ret_status = status; |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2492 | sme_err("csr_stop failed with status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2493 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2494 | |
Jeff Johnson | 62cd680 | 2018-07-20 12:38:25 -0700 | [diff] [blame] | 2495 | mac->sme.state = SME_STATE_STOP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2496 | |
Jeff Johnson | 62cd680 | 2018-07-20 12:38:25 -0700 | [diff] [blame] | 2497 | return ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2498 | } |
| 2499 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2500 | /* |
| 2501 | * sme_close() - Release all SME modules and their resources. |
| 2502 | * The function release each module in SME, PMC, CSR, etc. . Upon |
| 2503 | * return, all modules are at closed state. |
| 2504 | * |
| 2505 | * No SME APIs can be involved after smeClose except smeOpen. |
| 2506 | * smeClose must be called before mac_close. |
| 2507 | * This is a synchronous call |
| 2508 | * |
| 2509 | * hHal - The handle returned by mac_open |
| 2510 | * Return QDF_STATUS_SUCCESS - SME is successfully close. |
| 2511 | * |
| 2512 | * Other status means SME is failed to be closed but caller still cannot |
| 2513 | * call any other SME functions except smeOpen. |
| 2514 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2515 | QDF_STATUS sme_close(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2516 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2517 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 2518 | QDF_STATUS fail_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2519 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2520 | |
| 2521 | if (!pMac) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2522 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2523 | |
| 2524 | /* Note: pSession will be invalid from here on, do not access */ |
| 2525 | status = csr_close(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2526 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2527 | sme_err("csr_close failed with status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2528 | fail_status = status; |
| 2529 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2530 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 2531 | status = sme_qos_close(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2532 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2533 | sme_err("Qos close failed with status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2534 | fail_status = status; |
| 2535 | } |
| 2536 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2537 | status = sme_ps_close(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2538 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2539 | sme_err("sme_ps_close failed status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2540 | fail_status = status; |
| 2541 | } |
| 2542 | |
Jeff Johnson | 3639a64 | 2018-06-09 23:47:44 -0700 | [diff] [blame] | 2543 | status = rrm_close(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2544 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 2545 | sme_err("RRM close failed with status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2546 | fail_status = status; |
| 2547 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2548 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2549 | free_sme_cmd_list(pMac); |
| 2550 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2551 | if (!QDF_IS_STATUS_SUCCESS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2552 | (qdf_mutex_destroy(&pMac->sme.lkSmeGlobalLock))) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2553 | fail_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2554 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2555 | if (!QDF_IS_STATUS_SUCCESS(fail_status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2556 | status = fail_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2557 | |
| 2558 | pMac->sme.state = SME_STATE_STOP; |
| 2559 | |
| 2560 | return status; |
| 2561 | } |
| 2562 | |
| 2563 | /** |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 2564 | * sme_remove_bssid_from_scan_list() - wrapper to remove the bssid from |
| 2565 | * scan list |
| 2566 | * @hal: hal context. |
| 2567 | * @bssid: bssid to be removed |
| 2568 | * |
| 2569 | * This function remove the given bssid from scan list. |
| 2570 | * |
| 2571 | * Return: QDF status. |
| 2572 | */ |
| 2573 | QDF_STATUS sme_remove_bssid_from_scan_list(tHalHandle hal, |
| 2574 | tSirMacAddr bssid) |
| 2575 | { |
| 2576 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 2577 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 2578 | |
| 2579 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 2580 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 2581 | csr_remove_bssid_from_scan_list(mac_ctx, bssid); |
| 2582 | sme_release_global_lock(&mac_ctx->sme); |
| 2583 | } |
| 2584 | |
| 2585 | return status; |
| 2586 | } |
| 2587 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2588 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2589 | /* |
| 2590 | * sme_scan_get_result |
| 2591 | * A wrapper function to request scan results from CSR. |
| 2592 | * This is a synchronous call |
| 2593 | * |
| 2594 | * pFilter - If pFilter is NULL, all cached results are returned |
| 2595 | * phResult - an object for the result. |
| 2596 | * Return QDF_STATUS |
| 2597 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2598 | QDF_STATUS sme_scan_get_result(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2599 | tCsrScanResultFilter *pFilter, |
| 2600 | tScanResultHandle *phResult) |
| 2601 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2602 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2603 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2604 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2605 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2606 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId, |
| 2607 | 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2608 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2609 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | adf800d | 2018-06-10 18:00:00 -0700 | [diff] [blame] | 2610 | status = csr_scan_get_result(pMac, pFilter, phResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2611 | sme_release_global_lock(&pMac->sme); |
| 2612 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2613 | |
| 2614 | return status; |
| 2615 | } |
| 2616 | |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 2617 | QDF_STATUS sme_scan_get_result_for_bssid(tHalHandle hal_handle, |
| 2618 | struct qdf_mac_addr *bssid, |
| 2619 | tCsrScanResultInfo *res) |
| 2620 | { |
| 2621 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
| 2622 | QDF_STATUS status; |
| 2623 | |
| 2624 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 2625 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 1b56f6b | 2018-06-10 18:17:10 -0700 | [diff] [blame] | 2626 | status = csr_scan_get_result_for_bssid(mac_ctx, bssid, res); |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 2627 | sme_release_global_lock(&mac_ctx->sme); |
| 2628 | } |
| 2629 | |
| 2630 | return status; |
| 2631 | } |
| 2632 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2633 | /** |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 2634 | * sme_get_ap_channel_from_scan() - a wrapper function to get |
Srinivas Girigowda | 828ef23 | 2017-10-13 22:31:27 -0700 | [diff] [blame] | 2635 | * AP's channel id from |
| 2636 | * CSR by filtering the |
| 2637 | * result which matches |
| 2638 | * our roam profile. |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 2639 | * @profile: SAP profile |
| 2640 | * @ap_chnl_id: pointer to channel id of SAP. Fill the value after finding the |
| 2641 | * best ap from scan cache. |
| 2642 | * |
| 2643 | * This function is written to get AP's channel id from CSR by filtering |
| 2644 | * the result which matches our roam profile. This is a synchronous call. |
| 2645 | * |
| 2646 | * Return: QDF_STATUS. |
| 2647 | */ |
| 2648 | QDF_STATUS sme_get_ap_channel_from_scan(void *profile, |
| 2649 | tScanResultHandle *scan_cache, |
| 2650 | uint8_t *ap_chnl_id) |
| 2651 | { |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 2652 | return sme_get_ap_channel_from_scan_cache((struct csr_roam_profile *) |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 2653 | profile, |
| 2654 | scan_cache, |
| 2655 | ap_chnl_id); |
| 2656 | } |
| 2657 | |
| 2658 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2659 | * sme_get_ap_channel_from_scan_cache() - a wrapper function to get AP's |
| 2660 | * channel id from CSR by filtering the |
| 2661 | * result which matches our roam profile. |
| 2662 | * @profile: SAP adapter |
| 2663 | * @ap_chnl_id: pointer to channel id of SAP. Fill the value after finding the |
| 2664 | * best ap from scan cache. |
| 2665 | * |
| 2666 | * This function is written to get AP's channel id from CSR by filtering |
| 2667 | * the result which matches our roam profile. This is a synchronous call. |
| 2668 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2669 | * Return: QDF_STATUS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2670 | */ |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 2671 | QDF_STATUS sme_get_ap_channel_from_scan_cache( |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 2672 | struct csr_roam_profile *profile, tScanResultHandle *scan_cache, |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 2673 | uint8_t *ap_chnl_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2674 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2675 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 2676 | tpAniSirGlobal mac_ctx = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2677 | tCsrScanResultFilter *scan_filter = NULL; |
| 2678 | tScanResultHandle filtered_scan_result = NULL; |
| 2679 | tSirBssDescription first_ap_profile; |
| 2680 | |
| 2681 | if (NULL == mac_ctx) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2682 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2683 | FL("mac_ctx is NULL")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2684 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2685 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2686 | scan_filter = qdf_mem_malloc(sizeof(tCsrScanResultFilter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2687 | if (NULL == scan_filter) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2688 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2689 | FL("scan_filter mem alloc failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2690 | return QDF_STATUS_E_FAILURE; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2691 | } |
| 2692 | qdf_mem_set(&first_ap_profile, sizeof(tSirBssDescription), 0); |
| 2693 | if (NULL == profile) { |
| 2694 | scan_filter->EncryptionType.numEntries = 1; |
| 2695 | scan_filter->EncryptionType.encryptionType[0] |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2696 | = eCSR_ENCRYPT_TYPE_NONE; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2697 | } else { |
| 2698 | /* Here is the profile we need to connect to */ |
| 2699 | status = csr_roam_prepare_filter_from_profile(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2700 | profile, |
| 2701 | scan_filter); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2702 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2703 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2704 | if (QDF_STATUS_SUCCESS == status) { |
| 2705 | /* Save the WPS info */ |
| 2706 | if (NULL != profile) { |
| 2707 | scan_filter->bWPSAssociation = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2708 | profile->bWPSAssociation; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2709 | scan_filter->bOSENAssociation = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2710 | profile->bOSENAssociation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2711 | } else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2712 | scan_filter->bWPSAssociation = 0; |
| 2713 | scan_filter->bOSENAssociation = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2714 | } |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2715 | } else { |
| 2716 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 2717 | FL("Preparing the profile filter failed")); |
| 2718 | qdf_mem_free(scan_filter); |
| 2719 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2720 | } |
| 2721 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2722 | if (QDF_STATUS_SUCCESS == status) { |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 2723 | status = csr_scan_get_result(mac_ctx, scan_filter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2724 | &filtered_scan_result); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2725 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2726 | csr_get_bssdescr_from_scan_handle(filtered_scan_result, |
| 2727 | &first_ap_profile); |
| 2728 | *scan_cache = filtered_scan_result; |
| 2729 | if (0 != first_ap_profile.channelId) { |
| 2730 | *ap_chnl_id = first_ap_profile.channelId; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2731 | QDF_TRACE(QDF_MODULE_ID_SME, |
Abhishek Singh | 5d8d733 | 2017-08-10 15:15:24 +0530 | [diff] [blame] | 2732 | QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2733 | FL("Found best AP & its on chnl[%d]"), |
| 2734 | first_ap_profile.channelId); |
| 2735 | } else { |
| 2736 | /* |
| 2737 | * This means scan result is empty |
| 2738 | * so set the channel to zero, caller should |
| 2739 | * take of zero channel id case. |
| 2740 | */ |
| 2741 | *ap_chnl_id = 0; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2742 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 2743 | QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2744 | FL("Scan is empty, set chnl to 0")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2745 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2746 | } |
| 2747 | } else { |
Sandeep Puligilla | 1f1e400 | 2018-08-18 12:15:01 -0700 | [diff] [blame] | 2748 | sme_err("Failed to get scan get result"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2749 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2750 | } |
| 2751 | csr_free_scan_filter(mac_ctx, scan_filter); |
| 2752 | sme_release_global_lock(&mac_ctx->sme); |
| 2753 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2754 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2755 | FL("Aquiring lock failed")); |
Krunal Soni | f988222 | 2016-01-22 17:16:50 -0800 | [diff] [blame] | 2756 | csr_free_scan_filter(mac_ctx, scan_filter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2757 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2758 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2759 | qdf_mem_free(scan_filter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2760 | return status; |
| 2761 | } |
| 2762 | |
| 2763 | /** |
| 2764 | * sme_store_joinreq_param() - This function will pass station's join |
| 2765 | * request to store to csr. |
| 2766 | * @hal_handle: pointer to hal context. |
| 2767 | * @profile: pointer to station's roam profile. |
| 2768 | * @scan_cache: pointer to station's scan cache. |
| 2769 | * @roam_id: reference to roam_id variable being passed. |
| 2770 | * @session_id: station's session id. |
| 2771 | * |
| 2772 | * This function will pass station's join request further down to csr |
| 2773 | * to store it. this stored parameter will be used later. |
| 2774 | * |
| 2775 | * Return: true or false based on function's overall success. |
| 2776 | **/ |
| 2777 | bool sme_store_joinreq_param(tHalHandle hal_handle, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 2778 | struct csr_roam_profile *profile, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2779 | tScanResultHandle scan_cache, |
| 2780 | uint32_t *roam_id, |
| 2781 | uint32_t session_id) |
| 2782 | { |
| 2783 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2784 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2785 | bool ret_status = true; |
| 2786 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2787 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2788 | TRACE_CODE_SME_RX_HDD_STORE_JOIN_REQ, |
| 2789 | session_id, 0)); |
| 2790 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2791 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2792 | if (false == csr_store_joinreq_param(mac_ctx, profile, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2793 | scan_cache, roam_id, session_id)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2794 | ret_status = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2795 | sme_release_global_lock(&mac_ctx->sme); |
| 2796 | } else { |
| 2797 | ret_status = false; |
| 2798 | } |
| 2799 | |
| 2800 | return ret_status; |
| 2801 | } |
| 2802 | |
| 2803 | /** |
| 2804 | * sme_clear_joinreq_param() - This function will pass station's clear |
| 2805 | * the join request to csr. |
| 2806 | * @hal_handle: pointer to hal context. |
| 2807 | * @session_id: station's session id. |
| 2808 | * |
| 2809 | * This function will pass station's clear join request further down to csr |
| 2810 | * to cleanup. |
| 2811 | * |
| 2812 | * Return: true or false based on function's overall success. |
| 2813 | **/ |
| 2814 | bool sme_clear_joinreq_param(tHalHandle hal_handle, |
| 2815 | uint32_t session_id) |
| 2816 | { |
| 2817 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2818 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2819 | bool ret_status = true; |
| 2820 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2821 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2822 | TRACE_CODE_SME_RX_HDD_CLEAR_JOIN_REQ, |
| 2823 | session_id, 0)); |
| 2824 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2825 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2826 | if (false == csr_clear_joinreq_param(mac_ctx, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2827 | session_id)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2828 | ret_status = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2829 | sme_release_global_lock(&mac_ctx->sme); |
| 2830 | } else { |
| 2831 | ret_status = false; |
| 2832 | } |
| 2833 | |
| 2834 | return ret_status; |
| 2835 | } |
| 2836 | |
| 2837 | /** |
| 2838 | * sme_issue_stored_joinreq() - This function will issues station's stored |
| 2839 | * the join request to csr. |
| 2840 | * @hal_handle: pointer to hal context. |
| 2841 | * @roam_id: reference to roam_id variable being passed. |
| 2842 | * @session_id: station's session id. |
| 2843 | * |
| 2844 | * This function will issue station's stored join request further down to csr |
| 2845 | * to proceed forward. |
| 2846 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2847 | * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2848 | **/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2849 | QDF_STATUS sme_issue_stored_joinreq(tHalHandle hal_handle, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2850 | uint32_t *roam_id, |
| 2851 | uint32_t session_id) |
| 2852 | { |
| 2853 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2854 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 2855 | QDF_STATUS ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2856 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2857 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2858 | TRACE_CODE_SME_RX_HDD_ISSUE_JOIN_REQ, |
| 2859 | session_id, 0)); |
| 2860 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2861 | if (QDF_STATUS_SUCCESS == status) { |
| 2862 | if (QDF_STATUS_SUCCESS != csr_issue_stored_joinreq(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2863 | roam_id, |
| 2864 | session_id)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2865 | ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2866 | } |
| 2867 | sme_release_global_lock(&mac_ctx->sme); |
| 2868 | } else { |
| 2869 | csr_clear_joinreq_param(mac_ctx, session_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2870 | ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2871 | } |
| 2872 | return ret_status; |
| 2873 | } |
| 2874 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2875 | /* |
| 2876 | * sme_scan_flush_result() - |
| 2877 | * A wrapper function to request CSR to clear scan results. |
| 2878 | * This is a synchronous call |
| 2879 | * |
| 2880 | * Return QDF_STATUS |
| 2881 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2882 | QDF_STATUS sme_scan_flush_result(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2883 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2884 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2885 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2886 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2887 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2888 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, |
| 2889 | 0, 0)); |
| 2890 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2891 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | a1a3651 | 2018-06-10 18:20:55 -0700 | [diff] [blame] | 2892 | status = csr_scan_flush_result(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2893 | sme_release_global_lock(&pMac->sme); |
| 2894 | } |
| 2895 | |
| 2896 | return status; |
| 2897 | } |
| 2898 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2899 | /* |
| 2900 | * sme_filter_scan_results() - |
| 2901 | * A wrapper function to request CSR to clear scan results. |
| 2902 | * This is a synchronous call |
| 2903 | * |
| 2904 | * tHalHandle - HAL context handle |
| 2905 | * sessionId - session id |
| 2906 | * Return QDF_STATUS |
| 2907 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2908 | QDF_STATUS sme_filter_scan_results(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2909 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2910 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2911 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2912 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2913 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2914 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, |
| 2915 | sessionId, 0)); |
| 2916 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2917 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2918 | csr_scan_filter_results(pMac); |
| 2919 | sme_release_global_lock(&pMac->sme); |
| 2920 | } |
| 2921 | |
| 2922 | return status; |
| 2923 | } |
| 2924 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2925 | QDF_STATUS sme_scan_flush_p2p_result(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2926 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2927 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2928 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2929 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2930 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2931 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, |
| 2932 | sessionId, 0)); |
| 2933 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2934 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 1d3f867 | 2018-06-10 18:24:15 -0700 | [diff] [blame] | 2935 | status = csr_scan_flush_selective_result(pMac, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2936 | sme_release_global_lock(&pMac->sme); |
| 2937 | } |
| 2938 | |
| 2939 | return status; |
| 2940 | } |
| 2941 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2942 | /* |
| 2943 | * sme_scan_result_get_first() - |
| 2944 | * A wrapper function to request CSR to returns the first element of |
| 2945 | * scan result. |
| 2946 | * This is a synchronous call |
| 2947 | * |
| 2948 | * hScanResult - returned from csr_scan_get_result |
| 2949 | * Return tCsrScanResultInfo * - NULL if no result |
| 2950 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2951 | tCsrScanResultInfo *sme_scan_result_get_first(tHalHandle hHal, |
| 2952 | tScanResultHandle hScanResult) |
| 2953 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2954 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2955 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2956 | tCsrScanResultInfo *pRet = NULL; |
| 2957 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2958 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2959 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, |
| 2960 | NO_SESSION, 0)); |
| 2961 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2962 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2963 | pRet = csr_scan_result_get_first(pMac, hScanResult); |
| 2964 | sme_release_global_lock(&pMac->sme); |
| 2965 | } |
| 2966 | |
| 2967 | return pRet; |
| 2968 | } |
| 2969 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2970 | /* |
| 2971 | * sme_scan_result_get_next() - |
| 2972 | * A wrapper function to request CSR to returns the next element of |
| 2973 | * scan result. It can be called without calling csr_scan_result_get_first first |
| 2974 | * This is a synchronous call |
| 2975 | * |
| 2976 | * hScanResult - returned from csr_scan_get_result |
| 2977 | * Return Null if no result or reach the end |
| 2978 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2979 | tCsrScanResultInfo *sme_scan_result_get_next(tHalHandle hHal, |
| 2980 | tScanResultHandle hScanResult) |
| 2981 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2982 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2983 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2984 | tCsrScanResultInfo *pRet = NULL; |
| 2985 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2986 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2987 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2988 | pRet = csr_scan_result_get_next(pMac, hScanResult); |
| 2989 | sme_release_global_lock(&pMac->sme); |
| 2990 | } |
| 2991 | |
| 2992 | return pRet; |
| 2993 | } |
| 2994 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 2995 | /* |
| 2996 | * sme_scan_result_purge() - |
| 2997 | * A wrapper function to request CSR to remove all items(tCsrScanResult) |
| 2998 | * in the list and free memory for each item |
| 2999 | * This is a synchronous call |
| 3000 | * |
| 3001 | * hScanResult - returned from csr_scan_get_result. hScanResult is |
| 3002 | * considered gone by |
| 3003 | * calling this function and even before this function reutrns. |
| 3004 | * Return QDF_STATUS |
| 3005 | */ |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 3006 | QDF_STATUS sme_scan_result_purge(tScanResultHandle hScanResult) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3007 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3008 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 3009 | tpAniSirGlobal mac_ctx = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3010 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3011 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3012 | TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, |
| 3013 | NO_SESSION, 0)); |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 3014 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3015 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 3016 | status = csr_scan_result_purge(mac_ctx, hScanResult); |
| 3017 | sme_release_global_lock(&mac_ctx->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3018 | } |
| 3019 | |
| 3020 | return status; |
| 3021 | } |
| 3022 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3023 | eCsrPhyMode sme_get_phy_mode(tHalHandle hHal) |
| 3024 | { |
| 3025 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3026 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3027 | return pMac->roam.configParam.phyMode; |
| 3028 | } |
| 3029 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3030 | /* |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3031 | * 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] | 3032 | * |
| 3033 | * hHal - HAL handle |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3034 | * mode - channel bonding mode |
| 3035 | * |
| 3036 | * Return QDF_STATUS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3037 | */ |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3038 | 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] | 3039 | { |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3040 | tSmeConfigParams *smeConfig; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3041 | |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3042 | if (!mode) { |
| 3043 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3044 | "%s: invalid mode", __func__); |
| 3045 | return QDF_STATUS_E_FAILURE; |
| 3046 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3047 | |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3048 | smeConfig = qdf_mem_malloc(sizeof(*smeConfig)); |
| 3049 | if (!smeConfig) { |
| 3050 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3051 | "%s: failed to alloc smeConfig", __func__); |
| 3052 | return QDF_STATUS_E_NOMEM; |
| 3053 | } |
| 3054 | |
Jeff Johnson | 0a38afe | 2018-06-09 23:11:27 -0700 | [diff] [blame] | 3055 | if (sme_get_config_param(hHal, smeConfig) != QDF_STATUS_SUCCESS) { |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3056 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3057 | "%s: sme_get_config_param failed", __func__); |
| 3058 | qdf_mem_free(smeConfig); |
| 3059 | return QDF_STATUS_E_FAILURE; |
| 3060 | } |
| 3061 | |
| 3062 | *mode = smeConfig->csrConfig.channelBondingMode5GHz; |
| 3063 | qdf_mem_free(smeConfig); |
| 3064 | |
| 3065 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3066 | } |
| 3067 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3068 | /* |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3069 | * sme_get_channel_bonding_mode24_g() - get the channel bonding mode for 2.4G |
| 3070 | * band |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3071 | * |
| 3072 | * hHal - HAL handle |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3073 | * mode - channel bonding mode |
| 3074 | * |
| 3075 | * Return QDF_STATUS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3076 | */ |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3077 | 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] | 3078 | { |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3079 | tSmeConfigParams *smeConfig; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3080 | |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3081 | if (!mode) { |
| 3082 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3083 | "%s: invalid mode", __func__); |
| 3084 | return QDF_STATUS_E_FAILURE; |
| 3085 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3086 | |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3087 | smeConfig = qdf_mem_malloc(sizeof(*smeConfig)); |
| 3088 | if (!smeConfig) { |
| 3089 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3090 | "%s: failed to alloc smeConfig", __func__); |
| 3091 | return QDF_STATUS_E_NOMEM; |
| 3092 | } |
| 3093 | |
Jeff Johnson | 0a38afe | 2018-06-09 23:11:27 -0700 | [diff] [blame] | 3094 | if (sme_get_config_param(hHal, smeConfig) != QDF_STATUS_SUCCESS) { |
jiad | bdefb25 | 2018-01-03 14:27:06 +0800 | [diff] [blame] | 3095 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3096 | "%s: sme_get_config_param failed", __func__); |
| 3097 | qdf_mem_free(smeConfig); |
| 3098 | return QDF_STATUS_E_FAILURE; |
| 3099 | } |
| 3100 | |
| 3101 | *mode = smeConfig->csrConfig.channelBondingMode24GHz; |
| 3102 | qdf_mem_free(smeConfig); |
| 3103 | |
| 3104 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3105 | } |
| 3106 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3107 | /* |
| 3108 | * sme_roam_connect() - |
| 3109 | * A wrapper function to request CSR to inititiate an association |
| 3110 | * This is an asynchronous call. |
| 3111 | * |
| 3112 | * sessionId - the sessionId returned by sme_open_session. |
| 3113 | * pProfile - description of the network to which to connect |
| 3114 | * hBssListIn - a list of BSS descriptor to roam to. It is returned |
| 3115 | * from csr_scan_get_result |
| 3116 | * pRoamId - to get back the request ID |
| 3117 | * Return QDF_STATUS |
| 3118 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3119 | QDF_STATUS sme_roam_connect(tHalHandle hHal, uint8_t sessionId, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 3120 | struct csr_roam_profile *pProfile, |
| 3121 | uint32_t *pRoamId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3122 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3123 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3124 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3125 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3126 | if (!pMac) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3127 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3128 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3129 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3130 | TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3131 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3132 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3133 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 3134 | status = |
| 3135 | csr_roam_connect(pMac, sessionId, pProfile, |
| 3136 | pRoamId); |
| 3137 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 3138 | sme_err("Invalid sessionID: %d", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3139 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3140 | } |
| 3141 | sme_release_global_lock(&pMac->sme); |
| 3142 | } else { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 3143 | sme_err("sme_acquire_global_lock failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3144 | } |
| 3145 | |
| 3146 | return status; |
| 3147 | } |
| 3148 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3149 | /* |
| 3150 | * sme_set_phy_mode() - |
| 3151 | * Changes the PhyMode. |
| 3152 | * |
| 3153 | * hHal - The handle returned by mac_open. |
| 3154 | * phyMode new phyMode which is to set |
| 3155 | * Return QDF_STATUS SUCCESS. |
| 3156 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3157 | QDF_STATUS sme_set_phy_mode(tHalHandle hHal, eCsrPhyMode phyMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3158 | { |
| 3159 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3160 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3161 | pMac->roam.configParam.phyMode = phyMode; |
| 3162 | pMac->roam.configParam.uCfgDot11Mode = |
| 3163 | csr_get_cfg_dot11_mode_from_csr_phy_mode(NULL, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3164 | pMac->roam.configParam.phyMode, |
| 3165 | pMac->roam.configParam. |
| 3166 | ProprietaryRatesEnabled); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3167 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3168 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3169 | } |
| 3170 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3171 | /* |
| 3172 | * sme_roam_reassoc() - |
| 3173 | * A wrapper function to request CSR to inititiate a re-association |
| 3174 | * |
| 3175 | * pProfile - can be NULL to join the currently connected AP. In that |
| 3176 | * case modProfileFields should carry the modified field(s) which could trigger |
| 3177 | * reassoc |
| 3178 | * modProfileFields - fields which are part of tCsrRoamConnectedProfile |
| 3179 | * that might need modification dynamically once STA is up & running and this |
| 3180 | * could trigger a reassoc |
| 3181 | * pRoamId - to get back the request ID |
| 3182 | * Return QDF_STATUS |
| 3183 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3184 | QDF_STATUS sme_roam_reassoc(tHalHandle hHal, uint8_t sessionId, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 3185 | struct csr_roam_profile *pProfile, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3186 | tCsrRoamModifyProfileFields modProfileFields, |
| 3187 | uint32_t *pRoamId, bool fForce) |
| 3188 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3189 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3190 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3191 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3192 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3193 | TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3194 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3195 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3196 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3197 | if ((NULL == pProfile) && (fForce == 1)) |
| 3198 | status = csr_reassoc(pMac, sessionId, |
| 3199 | &modProfileFields, pRoamId, |
| 3200 | fForce); |
| 3201 | else |
| 3202 | status = csr_roam_reassoc(pMac, sessionId, |
| 3203 | pProfile, |
| 3204 | modProfileFields, pRoamId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3205 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3206 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3207 | } |
| 3208 | sme_release_global_lock(&pMac->sme); |
| 3209 | } |
| 3210 | |
| 3211 | return status; |
| 3212 | } |
| 3213 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3214 | /* |
| 3215 | * sme_roam_connect_to_last_profile() - |
| 3216 | * A wrapper function to request CSR to disconnect and reconnect with |
| 3217 | * the same profile |
| 3218 | * This is an asynchronous call. |
| 3219 | * |
| 3220 | * Return QDF_STATUS. It returns fail if currently connected |
| 3221 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3222 | 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] | 3223 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3224 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3225 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3226 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3227 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3228 | TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, |
| 3229 | sessionId, 0)); |
| 3230 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3231 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3232 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3233 | status = csr_roam_connect_to_last_profile(pMac, |
| 3234 | sessionId); |
| 3235 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3236 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3237 | sme_release_global_lock(&pMac->sme); |
| 3238 | } |
| 3239 | |
| 3240 | return status; |
| 3241 | } |
| 3242 | |
Varun Reddy Yeturu | 363809c | 2018-06-27 14:12:52 -0700 | [diff] [blame] | 3243 | QDF_STATUS sme_roam_disconnect(tHalHandle hal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3244 | eCsrRoamDisconnectReason reason) |
| 3245 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3246 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Varun Reddy Yeturu | 363809c | 2018-06-27 14:12:52 -0700 | [diff] [blame] | 3247 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3248 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3249 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Varun Reddy Yeturu | 363809c | 2018-06-27 14:12:52 -0700 | [diff] [blame] | 3250 | TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3251 | reason)); |
Varun Reddy Yeturu | 363809c | 2018-06-27 14:12:52 -0700 | [diff] [blame] | 3252 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3253 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | 363809c | 2018-06-27 14:12:52 -0700 | [diff] [blame] | 3254 | if (CSR_IS_SESSION_VALID(mac_ctx, session_id)) |
| 3255 | status = csr_roam_disconnect(mac_ctx, session_id, |
| 3256 | reason); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3257 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3258 | status = QDF_STATUS_E_INVAL; |
Varun Reddy Yeturu | 363809c | 2018-06-27 14:12:52 -0700 | [diff] [blame] | 3259 | sme_release_global_lock(&mac_ctx->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3260 | } |
| 3261 | |
| 3262 | return status; |
| 3263 | } |
| 3264 | |
Abhishek Singh | ca40803 | 2016-09-13 15:26:12 +0530 | [diff] [blame] | 3265 | /* sme_dhcp_done_ind() - send dhcp done ind |
| 3266 | * @hal: hal context |
| 3267 | * @session_id: session id |
| 3268 | * |
| 3269 | * Return: void. |
| 3270 | */ |
| 3271 | void sme_dhcp_done_ind(tHalHandle hal, uint8_t session_id) |
| 3272 | { |
| 3273 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 3274 | struct csr_roam_session *session; |
Abhishek Singh | ca40803 | 2016-09-13 15:26:12 +0530 | [diff] [blame] | 3275 | |
| 3276 | if (!mac_ctx) |
| 3277 | return; |
| 3278 | |
| 3279 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 3280 | if (!session) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 3281 | sme_err("Session: %d not found", session_id); |
Abhishek Singh | ca40803 | 2016-09-13 15:26:12 +0530 | [diff] [blame] | 3282 | return; |
| 3283 | } |
| 3284 | session->dhcp_done = true; |
| 3285 | } |
| 3286 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3287 | /* |
| 3288 | * sme_roam_stop_bss() - |
| 3289 | * To stop BSS for Soft AP. This is an asynchronous API. |
| 3290 | * |
| 3291 | * hHal - Global structure |
| 3292 | * sessionId - sessionId of SoftAP |
| 3293 | * Return QDF_STATUS SUCCESS Roam callback will be called to indicate |
| 3294 | * actual results |
| 3295 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3296 | QDF_STATUS sme_roam_stop_bss(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3297 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3298 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3299 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3300 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3301 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3302 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3303 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3304 | status = csr_roam_issue_stop_bss_cmd(pMac, sessionId, |
Himanshu Agarwal | 75c8d79 | 2017-12-19 18:31:04 +0530 | [diff] [blame] | 3305 | false); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3306 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3307 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3308 | sme_release_global_lock(&pMac->sme); |
| 3309 | } |
| 3310 | |
| 3311 | return status; |
| 3312 | } |
| 3313 | |
Deepthi Gowri | b3bfefd | 2016-09-13 15:14:34 +0530 | [diff] [blame] | 3314 | /** |
| 3315 | * sme_roam_disconnect_sta() - disassociate a station |
| 3316 | * @hHal: Global structure |
| 3317 | * @sessionId: SessionId of SoftAP |
| 3318 | * @p_del_sta_params: Pointer to parameters of the station to disassoc |
| 3319 | * |
| 3320 | * To disassociate a station. This is an asynchronous API. |
| 3321 | * |
| 3322 | * Return: QDF_STATUS_SUCCESS on success.Roam callback will |
| 3323 | * be called to indicate actual result. |
| 3324 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3325 | QDF_STATUS sme_roam_disconnect_sta(tHalHandle hHal, uint8_t sessionId, |
Jeff Johnson | e6bf719 | 2017-11-07 15:16:09 -0800 | [diff] [blame] | 3326 | struct csr_del_sta_params *p_del_sta_params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3327 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3328 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3329 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3330 | |
| 3331 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3332 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3333 | return status; |
| 3334 | } |
| 3335 | |
| 3336 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3337 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3338 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3339 | status = csr_roam_issue_disassociate_sta_cmd(pMac, |
Deepthi Gowri | b3bfefd | 2016-09-13 15:14:34 +0530 | [diff] [blame] | 3340 | sessionId, p_del_sta_params); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3341 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3342 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3343 | sme_release_global_lock(&pMac->sme); |
| 3344 | } |
| 3345 | |
| 3346 | return status; |
| 3347 | } |
| 3348 | |
| 3349 | /** |
| 3350 | * sme_roam_deauth_sta() - deauthenticate a station |
| 3351 | * @hHal: Global structure |
| 3352 | * @sessionId: SessionId of SoftAP |
| 3353 | * @pDelStaParams: Pointer to parameters of the station to deauthenticate |
| 3354 | * |
| 3355 | * To disassociate a station. This is an asynchronous API. |
| 3356 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3357 | * Return: QDF_STATUS_SUCCESS on success or another QDF_STATUS error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3358 | * code on error. Roam callback will be called to indicate actual |
| 3359 | * result |
| 3360 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3361 | QDF_STATUS sme_roam_deauth_sta(tHalHandle hHal, uint8_t sessionId, |
Jeff Johnson | e6bf719 | 2017-11-07 15:16:09 -0800 | [diff] [blame] | 3362 | struct csr_del_sta_params *pDelStaParams) |
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 | |
| 3367 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3368 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3369 | return status; |
| 3370 | } |
| 3371 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3372 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 3373 | TRACE_CODE_SME_RX_HDD_MSG_DEAUTH_STA, |
| 3374 | sessionId, pDelStaParams->reason_code)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3375 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3376 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3377 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3378 | status = |
| 3379 | csr_roam_issue_deauth_sta_cmd(pMac, sessionId, |
| 3380 | pDelStaParams); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3381 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3382 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3383 | sme_release_global_lock(&pMac->sme); |
| 3384 | } |
| 3385 | |
| 3386 | return status; |
| 3387 | } |
| 3388 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3389 | /* |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3390 | * sme_roam_get_associated_stas() - |
| 3391 | * To probe the list of associated stations from various modules |
| 3392 | * of CORE stack. |
| 3393 | * This is an asynchronous API. |
| 3394 | * |
| 3395 | * sessionId - sessionId of SoftAP |
| 3396 | * modId - Module from whom list of associtated stations is |
| 3397 | * to be probed. If an invalid module is passed then |
| 3398 | * by default QDF_MODULE_ID_PE will be probed. |
| 3399 | * pUsrContext - Opaque HDD context |
| 3400 | * pfnSapEventCallback - Sap event callback in HDD |
| 3401 | * pAssocBuf - Caller allocated memory to be filled with associatd |
| 3402 | * stations info |
| 3403 | * Return QDF_STATUS |
| 3404 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3405 | QDF_STATUS sme_roam_get_associated_stas(tHalHandle hHal, uint8_t sessionId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3406 | QDF_MODULE_ID modId, void *pUsrContext, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3407 | void *pfnSapEventCallback, |
| 3408 | uint8_t *pAssocStasBuf) |
| 3409 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3410 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3411 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3412 | |
| 3413 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3414 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3415 | return status; |
| 3416 | } |
| 3417 | |
| 3418 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3419 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3420 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3421 | status = |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3422 | csr_roam_get_associated_stas(pMac, sessionId, |
| 3423 | modId, |
| 3424 | pUsrContext, |
| 3425 | pfnSapEventCallback, |
| 3426 | pAssocStasBuf); |
| 3427 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3428 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3429 | sme_release_global_lock(&pMac->sme); |
| 3430 | } |
| 3431 | |
| 3432 | return status; |
| 3433 | } |
| 3434 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3435 | /* |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3436 | * sme_roam_get_connect_state() - |
| 3437 | * A wrapper function to request CSR to return the current connect state |
| 3438 | * of Roaming |
| 3439 | * This is a synchronous call. |
| 3440 | * |
| 3441 | * Return QDF_STATUS |
| 3442 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3443 | QDF_STATUS sme_roam_get_connect_state(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3444 | eCsrConnectState *pState) |
| 3445 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3446 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3447 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3448 | |
| 3449 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3450 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3451 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3452 | status = csr_roam_get_connect_state(pMac, sessionId, |
| 3453 | pState); |
| 3454 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3455 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3456 | sme_release_global_lock(&pMac->sme); |
| 3457 | } |
| 3458 | |
| 3459 | return status; |
| 3460 | } |
| 3461 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3462 | /* |
| 3463 | * sme_roam_get_connect_profile() - |
| 3464 | * A wrapper function to request CSR to return the current connect |
| 3465 | * profile. Caller must call csr_roam_free_connect_profile after it is done |
| 3466 | * and before reuse for another csr_roam_get_connect_profile call. |
| 3467 | * This is a synchronous call. |
| 3468 | * |
| 3469 | * pProfile - pointer to a caller allocated structure |
| 3470 | * tCsrRoamConnectedProfile |
| 3471 | * eturn QDF_STATUS. Failure if not connected |
| 3472 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3473 | QDF_STATUS sme_roam_get_connect_profile(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3474 | tCsrRoamConnectedProfile *pProfile) |
| 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 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3479 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3480 | TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, |
| 3481 | sessionId, 0)); |
| 3482 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3483 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3484 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3485 | status = csr_roam_get_connect_profile(pMac, sessionId, |
| 3486 | pProfile); |
| 3487 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3488 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3489 | sme_release_global_lock(&pMac->sme); |
| 3490 | } |
| 3491 | |
| 3492 | return status; |
| 3493 | } |
| 3494 | |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 3495 | /** |
| 3496 | * sme_roam_free_connect_profile - a wrapper function to request CSR to free and |
| 3497 | * reinitialize the profile returned previously by csr_roam_get_connect_profile. |
| 3498 | * |
| 3499 | * @profile - pointer to a caller allocated structure tCsrRoamConnectedProfile |
| 3500 | * |
| 3501 | * Return: none |
| 3502 | */ |
| 3503 | void sme_roam_free_connect_profile(tCsrRoamConnectedProfile *profile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3504 | { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3505 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3506 | TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, |
| 3507 | NO_SESSION, 0)); |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 3508 | csr_roam_free_connect_profile(profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3509 | } |
| 3510 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3511 | /* |
| 3512 | * sme_roam_set_pmkid_cache() - |
| 3513 | * A wrapper function to request CSR to return the PMKID candidate list |
| 3514 | * This is a synchronous call. |
| 3515 | |
| 3516 | * pPMKIDCache - caller allocated buffer point to an array of |
| 3517 | * tPmkidCacheInfo |
| 3518 | * numItems - a variable that has the number of tPmkidCacheInfo |
| 3519 | * allocated when retruning, this is either the number needed |
| 3520 | * or number of items put into pPMKIDCache |
| 3521 | * update_entire_cache - this bool value specifies if the entire pmkid |
| 3522 | * cache should be overwritten or should it be |
| 3523 | * updated entry by entry. |
| 3524 | * Return QDF_STATUS - when fail, it usually means the buffer allocated is not |
| 3525 | * big enough and pNumItems has the number of |
| 3526 | * tPmkidCacheInfo. |
| 3527 | * \Note: pNumItems is a number of tPmkidCacheInfo, |
| 3528 | * not sizeof(tPmkidCacheInfo) * something |
| 3529 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3530 | QDF_STATUS sme_roam_set_pmkid_cache(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3531 | tPmkidCacheInfo *pPMKIDCache, |
| 3532 | uint32_t numItems, bool update_entire_cache) |
| 3533 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3534 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3535 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3536 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3537 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3538 | TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, |
| 3539 | numItems)); |
| 3540 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3541 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3542 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3543 | status = csr_roam_set_pmkid_cache(pMac, sessionId, |
| 3544 | pPMKIDCache, |
| 3545 | numItems, update_entire_cache); |
| 3546 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3547 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3548 | sme_release_global_lock(&pMac->sme); |
| 3549 | } |
| 3550 | |
| 3551 | return status; |
| 3552 | } |
| 3553 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3554 | 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] | 3555 | tPmkidCacheInfo *pmksa, |
| 3556 | bool flush_cache) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3557 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3558 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3559 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 3560 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3561 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Sreelakshmi Konamki | 6744cff | 2015-09-07 12:10:39 +0530 | [diff] [blame] | 3562 | TRACE_CODE_SME_RX_HDD_ROAM_DEL_PMKIDCACHE, |
| 3563 | sessionId, flush_cache)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3564 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3565 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3566 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3567 | status = csr_roam_del_pmkid_from_cache(pMac, sessionId, |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3568 | pmksa, flush_cache); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3569 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3570 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3571 | sme_release_global_lock(&pMac->sme); |
| 3572 | } |
| 3573 | return status; |
| 3574 | } |
| 3575 | |
Abhinav Kumar | 7830d9c | 2018-06-27 17:57:48 +0530 | [diff] [blame] | 3576 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
gaurank kathpalia | 99d06c1 | 2018-05-16 16:28:35 +0530 | [diff] [blame] | 3577 | void sme_get_pmk_info(tHalHandle hal, uint8_t session_id, |
| 3578 | tPmkidCacheInfo *pmk_cache) |
| 3579 | { |
| 3580 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 3581 | QDF_STATUS status = sme_acquire_global_lock(&mac_ctx->sme); |
| 3582 | |
| 3583 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 3584 | if (CSR_IS_SESSION_VALID(mac_ctx, session_id)) |
| 3585 | csr_get_pmk_info(mac_ctx, session_id, pmk_cache); |
| 3586 | sme_release_global_lock(&mac_ctx->sme); |
| 3587 | } |
| 3588 | } |
Abhinav Kumar | 7830d9c | 2018-06-27 17:57:48 +0530 | [diff] [blame] | 3589 | #else |
| 3590 | static inline |
| 3591 | void sme_get_pmk_info(tHalHandle hal, uint8_t session_id, |
| 3592 | tPmkidCacheInfo *pmk_cache) |
| 3593 | {} |
| 3594 | #endif |
| 3595 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3596 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3597 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3598 | * \fn sme_roam_set_psk_pmk |
| 3599 | * \brief a wrapper function to request CSR to save PSK/PMK |
| 3600 | * This is a synchronous call. |
| 3601 | * \param hHal - Global structure |
| 3602 | * \param sessionId - SME sessionId |
| 3603 | * \param pPSK_PMK - pointer to an array of Psk[]/Pmk |
| 3604 | * \param pmk_len - Length could be only 16 bytes in case if LEAP |
| 3605 | * connections. Need to pass this information to |
| 3606 | * firmware. |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3607 | * \return QDF_STATUS -status whether PSK/PMK is set or not |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3608 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3609 | QDF_STATUS sme_roam_set_psk_pmk(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3610 | uint8_t *pPSK_PMK, size_t pmk_len) |
| 3611 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3612 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3613 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3614 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3615 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3616 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3617 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3618 | status = csr_roam_set_psk_pmk(pMac, sessionId, pPSK_PMK, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3619 | pmk_len); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3620 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3621 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3622 | sme_release_global_lock(&pMac->sme); |
| 3623 | } |
| 3624 | return status; |
| 3625 | } |
| 3626 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3627 | |
Jeff Johnson | 0a078b5 | 2018-06-01 16:15:54 -0700 | [diff] [blame] | 3628 | QDF_STATUS sme_roam_get_wpa_rsn_req_ie(tHalHandle hal, uint8_t session_id, |
| 3629 | uint32_t *len, uint8_t *buf) |
| 3630 | { |
| 3631 | QDF_STATUS status; |
| 3632 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 3633 | |
| 3634 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3635 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 0a078b5 | 2018-06-01 16:15:54 -0700 | [diff] [blame] | 3636 | if (CSR_IS_SESSION_VALID(mac, session_id)) |
| 3637 | status = csr_roam_get_wpa_rsn_req_ie(mac, session_id, |
| 3638 | len, buf); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3639 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3640 | status = QDF_STATUS_E_INVAL; |
Jeff Johnson | 0a078b5 | 2018-06-01 16:15:54 -0700 | [diff] [blame] | 3641 | sme_release_global_lock(&mac->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3642 | } |
| 3643 | |
| 3644 | return status; |
| 3645 | } |
| 3646 | |
Jeff Johnson | 0a078b5 | 2018-06-01 16:15:54 -0700 | [diff] [blame] | 3647 | QDF_STATUS sme_roam_get_wpa_rsn_rsp_ie(tHalHandle hal, uint8_t session_id, |
| 3648 | uint32_t *len, uint8_t *buf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3649 | { |
Jeff Johnson | 0a078b5 | 2018-06-01 16:15:54 -0700 | [diff] [blame] | 3650 | QDF_STATUS status; |
| 3651 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3652 | |
Jeff Johnson | 0a078b5 | 2018-06-01 16:15:54 -0700 | [diff] [blame] | 3653 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3654 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 0a078b5 | 2018-06-01 16:15:54 -0700 | [diff] [blame] | 3655 | if (CSR_IS_SESSION_VALID(mac, session_id)) |
| 3656 | status = csr_roam_get_wpa_rsn_rsp_ie(mac, session_id, |
| 3657 | len, buf); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3658 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3659 | status = QDF_STATUS_E_INVAL; |
Jeff Johnson | 0a078b5 | 2018-06-01 16:15:54 -0700 | [diff] [blame] | 3660 | sme_release_global_lock(&mac->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3661 | } |
| 3662 | |
| 3663 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3664 | } |
| 3665 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3666 | /* |
| 3667 | * sme_roam_get_num_pmkid_cache() - |
| 3668 | * A wrapper function to request CSR to return number of PMKID cache |
| 3669 | * entries |
| 3670 | * This is a synchronous call. |
| 3671 | * |
| 3672 | * Return uint32_t - the number of PMKID cache entries |
| 3673 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3674 | uint32_t sme_roam_get_num_pmkid_cache(tHalHandle hHal, uint8_t sessionId) |
| 3675 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3676 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3677 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3678 | uint32_t numPmkidCache = 0; |
| 3679 | |
| 3680 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3681 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3682 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 3683 | numPmkidCache = |
| 3684 | csr_roam_get_num_pmkid_cache(pMac, sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3685 | status = QDF_STATUS_SUCCESS; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3686 | } else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3687 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3688 | sme_release_global_lock(&pMac->sme); |
| 3689 | } |
| 3690 | |
| 3691 | return numPmkidCache; |
| 3692 | } |
| 3693 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3694 | /* |
| 3695 | * sme_roam_get_pmkid_cache() - |
| 3696 | * A wrapper function to request CSR to return PMKID cache from CSR |
| 3697 | * This is a synchronous call. |
| 3698 | * |
| 3699 | * pNum - caller allocated memory that has the space of the number of |
| 3700 | * pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the |
| 3701 | * needed or actually number in tPmkidCacheInfo. |
| 3702 | * pPmkidCache - Caller allocated memory that contains PMKID cache, if |
| 3703 | * any, upon return |
| 3704 | * Return QDF_STATUS - when fail, it usually means the buffer allocated is not |
| 3705 | * big enough |
| 3706 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3707 | 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] | 3708 | uint32_t *pNum, tPmkidCacheInfo *pPmkidCache) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3709 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3710 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3711 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3712 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3713 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3714 | TRACE_CODE_SME_RX_HDD_ROAM_GET_PMKIDCACHE, sessionId, |
| 3715 | 0)); |
| 3716 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3717 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3718 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3719 | status = csr_roam_get_pmkid_cache(pMac, sessionId, pNum, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3720 | pPmkidCache); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3721 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3722 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3723 | sme_release_global_lock(&pMac->sme); |
| 3724 | } |
| 3725 | |
| 3726 | return status; |
| 3727 | } |
| 3728 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3729 | /* |
| 3730 | * sme_get_config_param() - |
| 3731 | * A wrapper function that HDD calls to get the global settings |
| 3732 | * currently maintained by CSR. |
| 3733 | * This is a synchronous call. |
| 3734 | * |
| 3735 | * pParam - caller allocated memory |
| 3736 | * Return QDF_STATUS |
| 3737 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3738 | QDF_STATUS sme_get_config_param(tHalHandle hHal, tSmeConfigParams *pParam) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3739 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3740 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3741 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3742 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3743 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3744 | TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0)); |
| 3745 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3746 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3747 | status = csr_get_config_param(pMac, &pParam->csrConfig); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3748 | if (status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 3749 | sme_err("csr_get_config_param failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3750 | sme_release_global_lock(&pMac->sme); |
| 3751 | return status; |
| 3752 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3753 | qdf_mem_copy(&pParam->rrmConfig, |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 3754 | &pMac->rrm.rrmSmeContext.rrmConfig, |
| 3755 | sizeof(pMac->rrm.rrmSmeContext.rrmConfig)); |
Kapil Gupta | ab7961d | 2017-06-06 13:54:09 +0530 | [diff] [blame] | 3756 | pParam->snr_monitor_enabled = pMac->snr_monitor_enabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3757 | sme_release_global_lock(&pMac->sme); |
| 3758 | } |
| 3759 | |
| 3760 | return status; |
| 3761 | } |
| 3762 | |
| 3763 | /** |
| 3764 | * sme_cfg_set_int() - Sets the cfg parameter value. |
| 3765 | * @hal: Handle to hal. |
| 3766 | * @cfg_id: Configuration parameter ID. |
Jeff Johnson | 560dc56 | 2017-03-17 15:19:31 -0700 | [diff] [blame] | 3767 | * @value: value to be saved in the cfg parameter. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3768 | * |
| 3769 | * This function sets the string value in cfg parameter. |
| 3770 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3771 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3772 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3773 | 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] | 3774 | { |
| 3775 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3776 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3777 | |
Jeff Johnson | c09caa4 | 2018-06-07 22:58:55 -0700 | [diff] [blame] | 3778 | if (QDF_STATUS_SUCCESS != cfg_set_int(pmac, cfg_id, value)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3779 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3780 | |
| 3781 | return status; |
| 3782 | } |
| 3783 | |
| 3784 | /** |
| 3785 | * sme_cfg_set_str() - Sets the cfg parameter string. |
| 3786 | * @hal: Handle to hal. |
| 3787 | * @cfg_id: Configuration parameter ID. |
| 3788 | * @str: Pointer to the string buffer. |
| 3789 | * @length: Length of the string. |
| 3790 | * |
| 3791 | * This function sets the string value in cfg parameter. |
| 3792 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3793 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3794 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3795 | 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] | 3796 | uint32_t length) |
| 3797 | { |
| 3798 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3799 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3800 | |
Jeff Johnson | c09caa4 | 2018-06-07 22:58:55 -0700 | [diff] [blame] | 3801 | if (QDF_STATUS_SUCCESS != cfg_set_str(pmac, cfg_id, str, length)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3802 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3803 | |
| 3804 | return status; |
| 3805 | } |
| 3806 | |
| 3807 | /** |
| 3808 | * sme_cfg_get_int() - Gets the cfg parameter value. |
| 3809 | * @hal: Handle to hal. |
| 3810 | * @cfg_id: Configuration parameter ID. |
| 3811 | * @cfg_value: Pointer to variable in which cfg value |
Jeff Johnson | 560dc56 | 2017-03-17 15:19:31 -0700 | [diff] [blame] | 3812 | * will be saved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3813 | * |
| 3814 | * This function gets the value of the cfg parameter. |
| 3815 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3816 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3817 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3818 | 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] | 3819 | { |
| 3820 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3821 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3822 | |
Jeff Johnson | c09caa4 | 2018-06-07 22:58:55 -0700 | [diff] [blame] | 3823 | if (QDF_STATUS_SUCCESS != wlan_cfg_get_int(pmac, cfg_id, cfg_value)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3824 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3825 | |
| 3826 | return status; |
| 3827 | } |
| 3828 | |
| 3829 | /** |
| 3830 | * sme_cfg_get_str() - Gets the cfg parameter string. |
| 3831 | * @hal: Handle to hal. |
| 3832 | * @cfg_id: Configuration parameter ID. |
| 3833 | * @str: Pointer to the string buffer. |
| 3834 | * @length: Pointer to length of the string. |
| 3835 | * |
| 3836 | * This function gets the string value of the cfg parameter. |
| 3837 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3838 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3839 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3840 | 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] | 3841 | uint32_t *length) |
| 3842 | { |
| 3843 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3844 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3845 | |
Jeff Johnson | c09caa4 | 2018-06-07 22:58:55 -0700 | [diff] [blame] | 3846 | if (QDF_STATUS_SUCCESS != wlan_cfg_get_str(pmac, cfg_id, str, length)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3847 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3848 | |
| 3849 | return status; |
| 3850 | } |
| 3851 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3852 | /* |
| 3853 | * sme_get_modify_profile_fields() - |
| 3854 | * HDD or SME - QOS calls this function to get the current values of |
| 3855 | * connected profile fields, changing which can cause reassoc. |
| 3856 | * This function must be called after CFG is downloaded and STA is in connected |
| 3857 | * state. Also, make sure to call this function to get the current profile |
| 3858 | * fields before calling the reassoc. So that pModifyProfileFields will have |
| 3859 | * all the latest values plus the one(s) has been updated as part of reassoc |
| 3860 | * request. |
| 3861 | * |
| 3862 | * pModifyProfileFields - pointer to the connected profile fields |
| 3863 | * changing which can cause reassoc |
| 3864 | * Return QDF_STATUS |
| 3865 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3866 | QDF_STATUS sme_get_modify_profile_fields(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3867 | tCsrRoamModifyProfileFields * |
| 3868 | pModifyProfileFields) |
| 3869 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3870 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3871 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3872 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3873 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3874 | TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, |
| 3875 | 0)); |
| 3876 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3877 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3878 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 3879 | status = csr_get_modify_profile_fields(pMac, sessionId, |
| 3880 | pModifyProfileFields); |
| 3881 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3882 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3883 | sme_release_global_lock(&pMac->sme); |
| 3884 | } |
| 3885 | |
| 3886 | return status; |
| 3887 | } |
| 3888 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 3889 | /* |
| 3890 | * sme_set_dhcp_till_power_active_flag() - |
| 3891 | * Sets/Clears DHCP related flag to disable/enable auto PS |
| 3892 | * |
| 3893 | * hal - The handle returned by mac_open. |
| 3894 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3895 | void sme_set_dhcp_till_power_active_flag(tHalHandle hal, uint8_t flag) |
| 3896 | { |
| 3897 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 3898 | struct ps_global_info *ps_global_info = &mac->sme.ps_global_info; |
| 3899 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3900 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3901 | TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, |
| 3902 | flag)); |
| 3903 | /* Set/Clear the DHCP flag which will disable/enable auto PS */ |
| 3904 | ps_global_info->remain_in_power_active_till_dhcp = flag; |
| 3905 | } |
| 3906 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3907 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 3908 | /** |
| 3909 | * sme_register_oem_data_rsp_callback() - Register a routine of |
| 3910 | * type send_oem_data_rsp_msg |
| 3911 | * @h_hal: Handle returned by mac_open. |
| 3912 | * @callback: Callback to send response |
| 3913 | * to oem application. |
| 3914 | * |
| 3915 | * sme_oem_data_rsp_callback is used to register sme_send_oem_data_rsp_msg |
| 3916 | * callback function. |
| 3917 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3918 | * Return: QDF_STATUS. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3919 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3920 | QDF_STATUS sme_register_oem_data_rsp_callback(tHalHandle h_hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3921 | sme_send_oem_data_rsp_msg callback) |
| 3922 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3923 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3924 | tpAniSirGlobal pmac = PMAC_STRUCT(h_hal); |
| 3925 | |
Krishna Kumaar Natarajan | bbbf2ef | 2016-08-03 14:06:26 -0700 | [diff] [blame] | 3926 | pmac->sme.oem_data_rsp_callback = callback; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3927 | |
| 3928 | return status; |
| 3929 | |
| 3930 | } |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 3931 | |
| 3932 | /** |
| 3933 | * sme_deregister_oem_data_rsp_callback() - De-register OEM datarsp callback |
| 3934 | * @h_hal: Handler return by mac_open |
| 3935 | * This function De-registers the OEM data response callback to SME |
| 3936 | * |
| 3937 | * Return: None |
| 3938 | */ |
| 3939 | void sme_deregister_oem_data_rsp_callback(tHalHandle h_hal) |
| 3940 | { |
| 3941 | tpAniSirGlobal pmac; |
| 3942 | |
| 3943 | if (!h_hal) { |
| 3944 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 3945 | FL("hHal is not valid")); |
| 3946 | return; |
| 3947 | } |
| 3948 | pmac = PMAC_STRUCT(h_hal); |
| 3949 | |
Krishna Kumaar Natarajan | bbbf2ef | 2016-08-03 14:06:26 -0700 | [diff] [blame] | 3950 | pmac->sme.oem_data_rsp_callback = NULL; |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 3951 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3952 | |
| 3953 | /** |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 3954 | * sme_oem_update_capability() - update UMAC's oem related capability. |
| 3955 | * @hal: Handle returned by mac_open |
| 3956 | * @oem_cap: pointer to oem_capability |
| 3957 | * |
| 3958 | * This function updates OEM capability to UMAC. Currently RTT |
| 3959 | * related capabilities are updated. More capabilities can be |
| 3960 | * added in future. |
| 3961 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3962 | * Return: QDF_STATUS |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 3963 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3964 | QDF_STATUS sme_oem_update_capability(tHalHandle hal, |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 3965 | struct sme_oem_capability *cap) |
| 3966 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3967 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 3968 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 3969 | uint8_t *bytes; |
| 3970 | |
| 3971 | bytes = pmac->rrm.rrmSmeContext.rrmConfig.rm_capability; |
| 3972 | |
| 3973 | if (cap->ftm_rr) |
| 3974 | bytes[4] |= RM_CAP_FTM_RANGE_REPORT; |
| 3975 | if (cap->lci_capability) |
| 3976 | bytes[4] |= RM_CAP_CIVIC_LOC_MEASUREMENT; |
| 3977 | |
| 3978 | return status; |
| 3979 | } |
| 3980 | |
| 3981 | /** |
| 3982 | * sme_oem_get_capability() - get oem capability |
| 3983 | * @hal: Handle returned by mac_open |
| 3984 | * @oem_cap: pointer to oem_capability |
| 3985 | * |
| 3986 | * This function is used to get the OEM capability from UMAC. |
| 3987 | * Currently RTT related capabilities are received. More |
| 3988 | * capabilities can be added in future. |
| 3989 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3990 | * Return: QDF_STATUS |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 3991 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3992 | QDF_STATUS sme_oem_get_capability(tHalHandle hal, |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 3993 | struct sme_oem_capability *cap) |
| 3994 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3995 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 3996 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 3997 | uint8_t *bytes; |
| 3998 | |
| 3999 | bytes = pmac->rrm.rrmSmeContext.rrmConfig.rm_capability; |
| 4000 | |
| 4001 | cap->ftm_rr = bytes[4] & RM_CAP_FTM_RANGE_REPORT; |
| 4002 | cap->lci_capability = bytes[4] & RM_CAP_CIVIC_LOC_MEASUREMENT; |
| 4003 | |
| 4004 | return status; |
| 4005 | } |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 4006 | #endif |
Krishna Kumaar Natarajan | 53ca290 | 2015-12-04 14:01:46 -0800 | [diff] [blame] | 4007 | |
| 4008 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4009 | * sme_roam_set_key() - To set encryption key. |
| 4010 | * @hal: hal global context |
| 4011 | * @session_id: session id |
| 4012 | * @set_key: pointer to a caller allocated object of tCsrSetContextInfo |
| 4013 | * @ptr_roam_id: Upon success return, this is the id caller can use to |
| 4014 | * identify the request in roamcallback |
| 4015 | * |
| 4016 | * This function should be called only when connected. This is an asynchronous |
| 4017 | * API. |
| 4018 | * |
| 4019 | * Return: Status of operation |
| 4020 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4021 | QDF_STATUS sme_roam_set_key(tHalHandle hal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4022 | tCsrRoamSetKey *set_key, uint32_t *ptr_roam_id) |
| 4023 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4024 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4025 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 4026 | uint32_t roam_id; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 4027 | struct csr_roam_session *session = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4028 | struct ps_global_info *ps_global_info = &mac_ctx->sme.ps_global_info; |
| 4029 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4030 | 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] | 4031 | session_id, 0)); |
| 4032 | if (set_key->keyLength > CSR_MAX_KEY_LEN) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4033 | sme_err("Invalid key length: %d", set_key->keyLength); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4034 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4035 | } |
| 4036 | /*Once Setkey is done, we can go in BMPS */ |
| 4037 | if (set_key->keyLength) |
| 4038 | ps_global_info->remain_in_power_active_till_dhcp = false; |
| 4039 | |
| 4040 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4041 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4042 | return status; |
| 4043 | |
| 4044 | roam_id = GET_NEXT_ROAM_ID(&mac_ctx->roam); |
| 4045 | if (ptr_roam_id) |
| 4046 | *ptr_roam_id = roam_id; |
| 4047 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4048 | sme_debug("keyLength: %d", set_key->keyLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4049 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4050 | sme_debug("Session_id: %d roam_id: %d", session_id, roam_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4051 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 4052 | if (!session) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4053 | sme_err("session %d not found", session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4054 | sme_release_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4055 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4056 | } |
| 4057 | if (CSR_IS_INFRA_AP(&session->connectedProfile) |
| 4058 | && set_key->keyDirection == eSIR_TX_DEFAULT) { |
| 4059 | if ((eCSR_ENCRYPT_TYPE_WEP40 == set_key->encType) |
| 4060 | || (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == |
| 4061 | set_key->encType)) { |
| 4062 | session->pCurRoamProfile->negotiatedUCEncryptionType = |
| 4063 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 4064 | } |
| 4065 | if ((eCSR_ENCRYPT_TYPE_WEP104 == set_key->encType) |
| 4066 | || (eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == |
| 4067 | set_key->encType)) { |
| 4068 | session->pCurRoamProfile->negotiatedUCEncryptionType = |
| 4069 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4070 | } |
| 4071 | } |
| 4072 | status = csr_roam_set_key(mac_ctx, session_id, set_key, roam_id); |
| 4073 | sme_release_global_lock(&mac_ctx->sme); |
| 4074 | return status; |
| 4075 | } |
| 4076 | |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 4077 | /** |
| 4078 | * sme_roam_set_default_key_index - To set default wep key idx |
| 4079 | * @hal: pointer to hal handler |
| 4080 | * @session_id: session id |
| 4081 | * @default_idx: default wep key index |
| 4082 | * |
| 4083 | * This function prepares a message and post to WMA to set wep default |
| 4084 | * key index |
| 4085 | * |
| 4086 | * Return: Success:QDF_STATUS_SUCCESS Failure: Error value |
| 4087 | */ |
| 4088 | QDF_STATUS sme_roam_set_default_key_index(tHalHandle hal, uint8_t session_id, |
| 4089 | uint8_t default_idx) |
| 4090 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4091 | struct scheduler_msg msg = {0}; |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 4092 | struct wep_update_default_key_idx *update_key; |
| 4093 | |
| 4094 | update_key = qdf_mem_malloc(sizeof(*update_key)); |
| 4095 | if (!update_key) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4096 | sme_err("Failed to allocate memory for update key"); |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 4097 | return QDF_STATUS_E_NOMEM; |
| 4098 | } |
| 4099 | |
| 4100 | update_key->session_id = session_id; |
| 4101 | update_key->default_idx = default_idx; |
| 4102 | |
| 4103 | msg.type = WMA_UPDATE_WEP_DEFAULT_KEY; |
| 4104 | msg.reserved = 0; |
| 4105 | msg.bodyptr = (void *)update_key; |
| 4106 | |
| 4107 | if (QDF_STATUS_SUCCESS != |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 4108 | scheduler_post_message(QDF_MODULE_ID_SME, |
| 4109 | QDF_MODULE_ID_WMA, |
| 4110 | QDF_MODULE_ID_WMA, &msg)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4111 | sme_err("Failed to post WMA_UPDATE_WEP_DEFAULT_KEY to WMA"); |
Masti, Narayanraddi | ab712a7 | 2016-08-04 11:59:11 +0530 | [diff] [blame] | 4112 | qdf_mem_free(update_key); |
| 4113 | return QDF_STATUS_E_FAILURE; |
| 4114 | } |
| 4115 | |
| 4116 | return QDF_STATUS_SUCCESS; |
| 4117 | } |
| 4118 | |
| 4119 | |
Jeff Johnson | 8bd2335 | 2017-09-26 11:39:24 -0700 | [diff] [blame] | 4120 | /** |
| 4121 | * sme_get_rssi() - API to retrieve current RSSI |
| 4122 | * @hHal: HAL handle for device |
| 4123 | * @callback: SME sends back the requested stats using the callback |
| 4124 | * @staId: The station ID for which the RSSI is requested for |
| 4125 | * @bssid: The bssid of the connected session |
| 4126 | * @lastRSSI: RSSI value at time of request. In case fw cannot provide |
| 4127 | * RSSI, do not hold up but return this value. |
| 4128 | * @pContext: user context to be passed back along with the callback |
| 4129 | * |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4130 | * A wrapper function that client calls to register a callback to get RSSI |
| 4131 | * |
Jeff Johnson | 8bd2335 | 2017-09-26 11:39:24 -0700 | [diff] [blame] | 4132 | * Return: QDF_STATUS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4133 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4134 | QDF_STATUS sme_get_rssi(tHalHandle hHal, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4135 | tCsrRssiCallback callback, uint8_t staId, |
| 4136 | struct qdf_mac_addr bssId, int8_t lastRSSI, |
Jeff Johnson | 8bd2335 | 2017-09-26 11:39:24 -0700 | [diff] [blame] | 4137 | void *pContext) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4138 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4139 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4140 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4141 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4142 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4143 | TRACE_CODE_SME_RX_HDD_GET_RSSI, NO_SESSION, 0)); |
| 4144 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4145 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4146 | status = csr_get_rssi(pMac, callback, |
| 4147 | staId, bssId, lastRSSI, |
Jeff Johnson | 8bd2335 | 2017-09-26 11:39:24 -0700 | [diff] [blame] | 4148 | pContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4149 | sme_release_global_lock(&pMac->sme); |
| 4150 | } |
| 4151 | return status; |
| 4152 | } |
| 4153 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4154 | /* |
| 4155 | * sme_get_snr() - |
| 4156 | * A wrapper function that client calls to register a callback to get SNR |
| 4157 | * |
| 4158 | * callback - SME sends back the requested stats using the callback |
| 4159 | * staId - The station ID for which the stats is requested for |
| 4160 | * pContext - user context to be passed back along with the callback |
| 4161 | * p_cds_context - cds context |
| 4162 | * \return QDF_STATUS |
| 4163 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4164 | QDF_STATUS sme_get_snr(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4165 | tCsrSnrCallback callback, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4166 | uint8_t staId, struct qdf_mac_addr bssId, void *pContext) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4167 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4168 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4169 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4170 | |
| 4171 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4172 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4173 | status = csr_get_snr(pMac, callback, staId, bssId, pContext); |
| 4174 | sme_release_global_lock(&pMac->sme); |
| 4175 | } |
| 4176 | return status; |
| 4177 | } |
| 4178 | |
Naveen Rawat | fa2a100 | 2018-05-17 16:06:37 -0700 | [diff] [blame] | 4179 | #ifndef QCA_SUPPORT_CP_STATS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4180 | /* |
| 4181 | * sme_get_statistics() - |
| 4182 | * A wrapper function that client calls to register a callback to get |
| 4183 | * different PHY level statistics from CSR. |
| 4184 | * |
| 4185 | * requesterId - different client requesting for statistics, |
| 4186 | * HDD, UMA/GAN etc |
| 4187 | * statsMask - The different category/categories of stats requester |
| 4188 | * is looking for |
| 4189 | * callback - SME sends back the requested stats using the callback |
| 4190 | * periodicity - If requester needs periodic update in millisec, 0 means |
| 4191 | * it's an one time request |
| 4192 | * cache - If requester is happy with cached stats |
| 4193 | * staId - The station ID for which the stats is requested for |
| 4194 | * pContext - user context to be passed back along with the callback |
| 4195 | * sessionId - sme session interface |
| 4196 | * Return QDF_STATUS |
| 4197 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4198 | QDF_STATUS sme_get_statistics(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4199 | eCsrStatsRequesterType requesterId, |
| 4200 | uint32_t statsMask, tCsrStatsCallback callback, |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 4201 | uint8_t staId, void *pContext, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4202 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4203 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4204 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4205 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4206 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4207 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4208 | status = csr_get_statistics(pMac, requesterId, statsMask, |
| 4209 | callback, staId, pContext, |
| 4210 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4211 | sme_release_global_lock(&pMac->sme); |
| 4212 | } |
| 4213 | |
| 4214 | return status; |
| 4215 | |
| 4216 | } |
Naveen Rawat | fa2a100 | 2018-05-17 16:06:37 -0700 | [diff] [blame] | 4217 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4218 | |
Jeff Johnson | ca7a716 | 2018-07-07 12:56:54 -0700 | [diff] [blame] | 4219 | QDF_STATUS sme_get_link_status(mac_handle_t mac_handle, |
| 4220 | csr_link_status_callback callback, |
| 4221 | void *context, uint8_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4222 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4223 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Jeff Johnson | ca7a716 | 2018-07-07 12:56:54 -0700 | [diff] [blame] | 4224 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
| 4225 | tAniGetLinkStatus *msg; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4226 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4227 | |
Jeff Johnson | ca7a716 | 2018-07-07 12:56:54 -0700 | [diff] [blame] | 4228 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4229 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | ca7a716 | 2018-07-07 12:56:54 -0700 | [diff] [blame] | 4230 | msg = qdf_mem_malloc(sizeof(*msg)); |
| 4231 | if (!msg) { |
| 4232 | sme_err("Malloc failure"); |
| 4233 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4234 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4235 | } |
| 4236 | |
Jeff Johnson | ca7a716 | 2018-07-07 12:56:54 -0700 | [diff] [blame] | 4237 | msg->msgType = WMA_LINK_STATUS_GET_REQ; |
| 4238 | msg->msgLen = sizeof(*msg); |
| 4239 | msg->sessionId = session_id; |
| 4240 | mac->sme.link_status_context = context; |
| 4241 | mac->sme.link_status_callback = callback; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4242 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4243 | message.type = WMA_LINK_STATUS_GET_REQ; |
Jeff Johnson | ca7a716 | 2018-07-07 12:56:54 -0700 | [diff] [blame] | 4244 | message.bodyptr = msg; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4245 | message.reserved = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4246 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 4247 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 4248 | QDF_MODULE_ID_WMA, |
| 4249 | QDF_MODULE_ID_WMA, &message); |
Jeff Johnson | ca7a716 | 2018-07-07 12:56:54 -0700 | [diff] [blame] | 4250 | if (QDF_IS_STATUS_ERROR(status)) { |
| 4251 | sme_err("post msg failed, %d", status); |
| 4252 | qdf_mem_free(msg); |
| 4253 | mac->sme.link_status_context = NULL; |
| 4254 | mac->sme.link_status_callback = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4255 | } |
| 4256 | |
Jeff Johnson | ca7a716 | 2018-07-07 12:56:54 -0700 | [diff] [blame] | 4257 | sme_release_global_lock(&mac->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4258 | } |
| 4259 | |
| 4260 | return status; |
| 4261 | } |
| 4262 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4263 | /* |
| 4264 | * sme_get_country_code() - |
| 4265 | * To return the current country code. If no country code is applied, |
| 4266 | * default country code is used to fill the buffer. |
| 4267 | * If 11d supported is turned off, an error is return and the last |
| 4268 | * applied/default country code is used. |
| 4269 | * This is a synchronous API. |
| 4270 | * |
| 4271 | * pBuf - pointer to a caller allocated buffer for returned country code. |
| 4272 | * pbLen For input, this parameter indicates how big is the buffer. |
| 4273 | * Upon return, this parameter has the number of bytes for |
| 4274 | * country. If pBuf doesn't have enough space, this function |
| 4275 | * returns fail status and this parameter contains the number |
| 4276 | * that is needed. |
| 4277 | * |
| 4278 | * Return QDF_STATUS SUCCESS. |
| 4279 | * |
| 4280 | * FAILURE or RESOURCES The API finished and failed. |
| 4281 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4282 | 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] | 4283 | { |
| 4284 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4285 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4286 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4287 | TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0)); |
| 4288 | |
| 4289 | return csr_get_country_code(pMac, pBuf, pbLen); |
| 4290 | } |
| 4291 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4292 | /* some support functions */ |
| 4293 | bool sme_is11d_supported(tHalHandle hHal) |
| 4294 | { |
| 4295 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4296 | |
Kiran Kumar Lokere | 3beeb95 | 2017-05-02 18:40:24 -0700 | [diff] [blame] | 4297 | return wlan_reg_11d_enabled_on_host(pMac->psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4298 | } |
| 4299 | |
| 4300 | bool sme_is11h_supported(tHalHandle hHal) |
| 4301 | { |
| 4302 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4303 | |
| 4304 | return csr_is11h_supported(pMac); |
| 4305 | } |
| 4306 | |
| 4307 | bool sme_is_wmm_supported(tHalHandle hHal) |
| 4308 | { |
| 4309 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4310 | |
| 4311 | return csr_is_wmm_supported(pMac); |
| 4312 | } |
| 4313 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4314 | /* |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4315 | * sme_generic_change_country_code() - |
| 4316 | * Change Country code from upperlayer during WLAN driver operation. |
| 4317 | * This is a synchronous API. |
| 4318 | * |
| 4319 | * hHal - The handle returned by mac_open. |
| 4320 | * pCountry New Country Code String |
| 4321 | * reg_domain regulatory domain |
| 4322 | * Return QDF_STATUS SUCCESS. |
| 4323 | * FAILURE or RESOURCES The API finished and failed. |
| 4324 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4325 | QDF_STATUS sme_generic_change_country_code(tHalHandle hHal, |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 4326 | uint8_t *pCountry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4327 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4328 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4329 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4330 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4331 | tAniGenericChangeCountryCodeReq *pMsg; |
| 4332 | |
| 4333 | if (NULL == pMac) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4334 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4335 | "%s: pMac is null", __func__); |
| 4336 | return status; |
| 4337 | } |
| 4338 | |
| 4339 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4340 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4341 | pMsg = qdf_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4342 | |
| 4343 | if (NULL == pMsg) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4344 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4345 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4346 | } |
| 4347 | |
| 4348 | pMsg->msgType = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE; |
| 4349 | pMsg->msgLen = |
| 4350 | (uint16_t) sizeof(tAniGenericChangeCountryCodeReq); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4351 | qdf_mem_copy(pMsg->countryCode, pCountry, 2); |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 4352 | pMsg->countryCode[2] = ' '; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4353 | |
| 4354 | msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE; |
| 4355 | msg.bodyptr = pMsg; |
| 4356 | msg.reserved = 0; |
| 4357 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4358 | if (QDF_STATUS_SUCCESS != |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 4359 | scheduler_post_message(QDF_MODULE_ID_SME, |
| 4360 | QDF_MODULE_ID_SME, |
| 4361 | QDF_MODULE_ID_SME, &msg)) { |
| 4362 | 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] | 4363 | qdf_mem_free(pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4364 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4365 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4366 | sme_release_global_lock(&pMac->sme); |
| 4367 | } |
| 4368 | |
| 4369 | return status; |
| 4370 | } |
| 4371 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4372 | /* |
| 4373 | * sme_dhcp_start_ind() - |
| 4374 | * API to signal the FW about the DHCP Start event. |
| 4375 | * |
| 4376 | * hHal - HAL handle for device. |
| 4377 | * device_mode - mode(AP,SAP etc) of the device. |
| 4378 | * macAddr - MAC address of the adapter. |
| 4379 | * sessionId - session ID. |
| 4380 | * Return QDF_STATUS SUCCESS. |
| 4381 | * FAILURE or RESOURCES The API finished and failed. |
| 4382 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4383 | QDF_STATUS sme_dhcp_start_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4384 | uint8_t device_mode, |
| 4385 | uint8_t *macAddr, uint8_t sessionId) |
| 4386 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4387 | QDF_STATUS status; |
| 4388 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4389 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4390 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4391 | tAniDHCPInd *pMsg; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 4392 | struct csr_roam_session *pSession; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4393 | |
| 4394 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4395 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4396 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 4397 | |
| 4398 | if (!pSession) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4399 | sme_err("Session: %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4400 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4401 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4402 | } |
Arif Hussain | 3316f40 | 2016-11-10 13:08:03 -0800 | [diff] [blame] | 4403 | pSession->dhcp_done = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4404 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4405 | pMsg = (tAniDHCPInd *) qdf_mem_malloc(sizeof(tAniDHCPInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4406 | if (NULL == pMsg) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4407 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4408 | "%s: Not able to allocate memory for dhcp start", |
| 4409 | __func__); |
| 4410 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4411 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4412 | } |
| 4413 | pMsg->msgType = WMA_DHCP_START_IND; |
| 4414 | pMsg->msgLen = (uint16_t) sizeof(tAniDHCPInd); |
| 4415 | pMsg->device_mode = device_mode; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4416 | qdf_mem_copy(pMsg->adapterMacAddr.bytes, macAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4417 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 4418 | qdf_copy_macaddr(&pMsg->peerMacAddr, |
Srinivas Girigowda | 296105a | 2015-09-24 16:31:16 -0700 | [diff] [blame] | 4419 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4420 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4421 | message.type = WMA_DHCP_START_IND; |
| 4422 | message.bodyptr = pMsg; |
| 4423 | message.reserved = 0; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 4424 | 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] | 4425 | sessionId, message.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 4426 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 4427 | QDF_MODULE_ID_WMA, |
| 4428 | QDF_MODULE_ID_WMA, |
| 4429 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4430 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4431 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4432 | "%s: Post DHCP Start MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4433 | qdf_mem_free(pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4434 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4435 | } |
| 4436 | sme_release_global_lock(&pMac->sme); |
| 4437 | } |
| 4438 | return status; |
| 4439 | } |
| 4440 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4441 | /* |
| 4442 | * sme_dhcp_stop_ind() - |
| 4443 | * API to signal the FW about the DHCP complete event. |
| 4444 | * |
| 4445 | * hHal - HAL handle for device. |
| 4446 | * device_mode - mode(AP, SAP etc) of the device. |
| 4447 | * macAddr - MAC address of the adapter. |
| 4448 | * sessionId - session ID. |
| 4449 | * Return QDF_STATUS SUCCESS. |
| 4450 | * FAILURE or RESOURCES The API finished and failed. |
| 4451 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4452 | QDF_STATUS sme_dhcp_stop_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4453 | uint8_t device_mode, |
| 4454 | uint8_t *macAddr, uint8_t sessionId) |
| 4455 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4456 | QDF_STATUS status; |
| 4457 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4458 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4459 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4460 | tAniDHCPInd *pMsg; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 4461 | struct csr_roam_session *pSession; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4462 | |
| 4463 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4464 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4465 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 4466 | |
| 4467 | if (!pSession) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4468 | sme_err("Session: %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4469 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4470 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4471 | } |
Arif Hussain | 3316f40 | 2016-11-10 13:08:03 -0800 | [diff] [blame] | 4472 | pSession->dhcp_done = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4473 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4474 | pMsg = (tAniDHCPInd *) qdf_mem_malloc(sizeof(tAniDHCPInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4475 | if (NULL == pMsg) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4476 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4477 | "%s: Not able to allocate memory for dhcp stop", |
| 4478 | __func__); |
| 4479 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4480 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4481 | } |
| 4482 | |
| 4483 | pMsg->msgType = WMA_DHCP_STOP_IND; |
| 4484 | pMsg->msgLen = (uint16_t) sizeof(tAniDHCPInd); |
| 4485 | pMsg->device_mode = device_mode; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4486 | qdf_mem_copy(pMsg->adapterMacAddr.bytes, macAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4487 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 4488 | qdf_copy_macaddr(&pMsg->peerMacAddr, |
Srinivas Girigowda | 296105a | 2015-09-24 16:31:16 -0700 | [diff] [blame] | 4489 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4490 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4491 | message.type = WMA_DHCP_STOP_IND; |
| 4492 | message.bodyptr = pMsg; |
| 4493 | message.reserved = 0; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 4494 | 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] | 4495 | sessionId, message.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 4496 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 4497 | QDF_MODULE_ID_WMA, |
| 4498 | QDF_MODULE_ID_WMA, |
| 4499 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4500 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4501 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4502 | "%s: Post DHCP Stop MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4503 | qdf_mem_free(pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4504 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4505 | } |
| 4506 | |
| 4507 | sme_release_global_lock(&pMac->sme); |
| 4508 | } |
| 4509 | return status; |
| 4510 | } |
| 4511 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4512 | /* |
| 4513 | * sme_TXFailMonitorStopInd() - |
| 4514 | * API to signal the FW to start monitoring TX failures |
| 4515 | * |
| 4516 | * Return QDF_STATUS SUCCESS. |
| 4517 | * FAILURE or RESOURCES The API finished and failed. |
| 4518 | */ |
| 4519 | QDF_STATUS sme_tx_fail_monitor_start_stop_ind(tHalHandle hHal, uint8_t |
| 4520 | tx_fail_count, |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4521 | void *txFailIndCallback) |
| 4522 | { |
| 4523 | QDF_STATUS status; |
| 4524 | QDF_STATUS qdf_status; |
| 4525 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4526 | struct scheduler_msg message = {0}; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4527 | tAniTXFailMonitorInd *pMsg; |
| 4528 | |
| 4529 | status = sme_acquire_global_lock(&pMac->sme); |
| 4530 | if (QDF_STATUS_SUCCESS == status) { |
| 4531 | pMsg = (tAniTXFailMonitorInd *) |
| 4532 | qdf_mem_malloc(sizeof(tAniTXFailMonitorInd)); |
| 4533 | if (NULL == pMsg) { |
| 4534 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 4535 | "%s: Failed to allocate memory", __func__); |
| 4536 | sme_release_global_lock(&pMac->sme); |
| 4537 | return QDF_STATUS_E_NOMEM; |
| 4538 | } |
| 4539 | |
| 4540 | pMsg->msgType = WMA_TX_FAIL_MONITOR_IND; |
| 4541 | pMsg->msgLen = (uint16_t) sizeof(tAniTXFailMonitorInd); |
| 4542 | |
| 4543 | /* tx_fail_count = 0 should disable the Monitoring in FW */ |
| 4544 | pMsg->tx_fail_count = tx_fail_count; |
| 4545 | pMsg->txFailIndCallback = txFailIndCallback; |
| 4546 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 4547 | message.type = WMA_TX_FAIL_MONITOR_IND; |
| 4548 | message.bodyptr = pMsg; |
| 4549 | message.reserved = 0; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4550 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 4551 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 4552 | QDF_MODULE_ID_WMA, |
| 4553 | QDF_MODULE_ID_WMA, |
| 4554 | &message); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 4555 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 4556 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 4557 | "%s: Post TX Fail monitor Start MSG fail", |
| 4558 | __func__); |
| 4559 | qdf_mem_free(pMsg); |
| 4560 | status = QDF_STATUS_E_FAILURE; |
| 4561 | } |
| 4562 | sme_release_global_lock(&pMac->sme); |
| 4563 | } |
| 4564 | return status; |
| 4565 | } |
| 4566 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4567 | /* |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4568 | * sme_neighbor_report_request() - |
| 4569 | * API to request neighbor report. |
| 4570 | * |
| 4571 | * hHal - The handle returned by mac_open. |
| 4572 | * pRrmNeighborReq - Pointer to a caller allocated object of type |
| 4573 | * tRrmNeighborReq. Caller owns the memory and is |
| 4574 | * responsible for freeing it. |
| 4575 | * Return QDF_STATUS |
| 4576 | * QDF_STATUS_E_FAILURE - failure |
| 4577 | * QDF_STATUS_SUCCESS success |
| 4578 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4579 | QDF_STATUS sme_neighbor_report_request(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4580 | tpRrmNeighborReq pRrmNeighborReq, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4581 | tpRrmNeighborRspCallbackInfo callbackInfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4582 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4583 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4584 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4585 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4586 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4587 | TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, |
| 4588 | 0)); |
| 4589 | |
Vignesh Viswanathan | 694e28e | 2018-01-18 20:53:57 +0530 | [diff] [blame] | 4590 | if (pRrmNeighborReq->neighbor_report_offload) { |
| 4591 | status = csr_invoke_neighbor_report_request(sessionId, |
| 4592 | pRrmNeighborReq, |
| 4593 | false); |
| 4594 | return status; |
| 4595 | } |
| 4596 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4597 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4598 | status = |
Jeff Johnson | ed3de52 | 2018-06-10 18:27:51 -0700 | [diff] [blame] | 4599 | sme_rrm_neighbor_report_request(pMac, sessionId, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4600 | pRrmNeighborReq, callbackInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4601 | sme_release_global_lock(&pMac->sme); |
| 4602 | } |
| 4603 | |
| 4604 | return status; |
| 4605 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4606 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4607 | /* |
| 4608 | * sme_get_wcnss_wlan_compiled_version() - |
| 4609 | * This API returns the version of the WCNSS WLAN API with |
| 4610 | * which the HOST driver was built |
| 4611 | * |
| 4612 | * hHal - The handle returned by mac_open. |
| 4613 | * pVersion - Points to the Version structure to be filled |
| 4614 | * Return QDF_STATUS |
| 4615 | * QDF_STATUS_E_INVAL - failure |
| 4616 | * QDF_STATUS_SUCCESS success |
| 4617 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4618 | QDF_STATUS sme_get_wcnss_wlan_compiled_version(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4619 | tSirVersionType *pVersion) |
| 4620 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4621 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4622 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4623 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4624 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4625 | if (pVersion != NULL) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4626 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4627 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4628 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4629 | |
| 4630 | sme_release_global_lock(&pMac->sme); |
| 4631 | } |
| 4632 | |
| 4633 | return status; |
| 4634 | } |
| 4635 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4636 | /* |
| 4637 | * sme_get_wcnss_wlan_reported_version() - |
| 4638 | * This API returns the version of the WCNSS WLAN API with |
| 4639 | * which the WCNSS driver reports it was built |
| 4640 | * hHal - The handle returned by mac_open. |
| 4641 | * pVersion - Points to the Version structure to be filled |
| 4642 | * Return QDF_STATUS |
| 4643 | * QDF_STATUS_E_INVAL - failure |
| 4644 | * QDF_STATUS_SUCCESS success |
| 4645 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4646 | QDF_STATUS sme_get_wcnss_wlan_reported_version(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4647 | tSirVersionType *pVersion) |
| 4648 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4649 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4650 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4651 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4652 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4653 | if (pVersion != NULL) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4654 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4655 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4656 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4657 | |
| 4658 | sme_release_global_lock(&pMac->sme); |
| 4659 | } |
| 4660 | |
| 4661 | return status; |
| 4662 | } |
| 4663 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4664 | /* |
| 4665 | * sme_get_wcnss_software_version() - |
| 4666 | * This API returns the version string of the WCNSS driver |
| 4667 | * |
| 4668 | * hHal - The handle returned by mac_open. |
| 4669 | * pVersion - Points to the Version string buffer to be filled |
| 4670 | * versionBufferSize - THe size of the Version string buffer |
| 4671 | * Return QDF_STATUS |
| 4672 | * QDF_STATUS_E_INVAL - failure |
| 4673 | * QDF_STATUS_SUCCESS success |
| 4674 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4675 | QDF_STATUS sme_get_wcnss_software_version(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4676 | uint8_t *pVersion, |
| 4677 | uint32_t versionBufferSize) |
| 4678 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4679 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4680 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4681 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4682 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4683 | if (pVersion != NULL) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4684 | status = |
Jeff Johnson | abb7404 | 2017-08-31 11:44:55 -0700 | [diff] [blame] | 4685 | wma_get_wcnss_software_version( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4686 | pVersion, |
| 4687 | versionBufferSize); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4688 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4689 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4690 | sme_release_global_lock(&pMac->sme); |
| 4691 | } |
| 4692 | |
| 4693 | return status; |
| 4694 | } |
| 4695 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4696 | /* |
| 4697 | * sme_get_wcnss_hardware_version() - |
| 4698 | * This API returns the version string of the WCNSS hardware |
| 4699 | * |
| 4700 | * hHal - The handle returned by mac_open. |
| 4701 | * pVersion - Points to the Version string buffer to be filled |
| 4702 | * versionBufferSize - THe size of the Version string buffer |
| 4703 | * Return QDF_STATUS |
| 4704 | * QDF_STATUS_E_INVAL - failure |
| 4705 | * QDF_STATUS_SUCCESS success |
| 4706 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4707 | QDF_STATUS sme_get_wcnss_hardware_version(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4708 | uint8_t *pVersion, |
| 4709 | uint32_t versionBufferSize) |
| 4710 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4711 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4712 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4713 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4714 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4715 | if (pVersion != NULL) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4716 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4717 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4718 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4719 | |
| 4720 | sme_release_global_lock(&pMac->sme); |
| 4721 | } |
| 4722 | |
| 4723 | return status; |
| 4724 | } |
| 4725 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4726 | #ifdef FEATURE_OEM_DATA_SUPPORT |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 4727 | /** |
| 4728 | * sme_oem_data_req() - send oem data request to WMA |
| 4729 | * @hal: HAL handle |
| 4730 | * @hdd_oem_req: OEM data request from HDD |
| 4731 | * |
| 4732 | * Return: QDF_STATUS |
| 4733 | */ |
Krishna Kumaar Natarajan | c1fa17d | 2016-08-03 14:19:20 -0700 | [diff] [blame] | 4734 | 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] | 4735 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4736 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | c1fa17d | 2016-08-03 14:19:20 -0700 | [diff] [blame] | 4737 | struct oem_data_req *oem_data_req; |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 4738 | void *wma_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4739 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4740 | SME_ENTER(); |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 4741 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 4742 | if (!wma_handle) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4743 | sme_err("wma_handle is NULL"); |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 4744 | return QDF_STATUS_E_FAILURE; |
| 4745 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4746 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 4747 | oem_data_req = qdf_mem_malloc(sizeof(*oem_data_req)); |
| 4748 | if (!oem_data_req) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4749 | sme_err("mem alloc failed"); |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 4750 | return QDF_STATUS_E_NOMEM; |
| 4751 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4752 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 4753 | oem_data_req->data_len = hdd_oem_req->data_len; |
| 4754 | oem_data_req->data = qdf_mem_malloc(oem_data_req->data_len); |
| 4755 | if (!oem_data_req->data) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4756 | sme_err("mem alloc failed"); |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 4757 | return QDF_STATUS_E_NOMEM; |
| 4758 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4759 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 4760 | qdf_mem_copy(oem_data_req->data, hdd_oem_req->data, |
| 4761 | oem_data_req->data_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4762 | |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 4763 | status = wma_start_oem_data_req(wma_handle, oem_data_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4764 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4765 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4766 | sme_err("Post oem data request msg fail"); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4767 | else |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4768 | sme_debug("OEM request(length: %d) sent to WMA", |
| 4769 | oem_data_req->data_len); |
Krishna Kumaar Natarajan | c5e06ac | 2016-06-30 16:49:19 -0700 | [diff] [blame] | 4770 | |
| 4771 | if (oem_data_req->data_len) |
| 4772 | qdf_mem_free(oem_data_req->data); |
| 4773 | qdf_mem_free(oem_data_req); |
| 4774 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 4775 | SME_EXIT(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4776 | return status; |
| 4777 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4778 | #endif /*FEATURE_OEM_DATA_SUPPORT */ |
| 4779 | |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 4780 | QDF_STATUS sme_open_session(tHalHandle hal, struct sme_session_params *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4781 | { |
Arif Hussain | ee67701 | 2017-01-26 17:50:13 -0800 | [diff] [blame] | 4782 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 4783 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Arif Hussain | ee67701 | 2017-01-26 17:50:13 -0800 | [diff] [blame] | 4784 | struct cdp_pdev *pdev; |
| 4785 | ol_txrx_peer_handle peer; |
| 4786 | uint8_t peer_id; |
Krishna Kumaar Natarajan | b9e1d71 | 2017-06-20 17:14:37 -0700 | [diff] [blame] | 4787 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4788 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 4789 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG, |
Rajeev Kumar | 7414c8c | 2017-04-06 15:42:52 -0700 | [diff] [blame] | 4790 | "%s: type=%d, session_id %d subType=%d addr:%pM", |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 4791 | __func__, params->type_of_persona, |
| 4792 | params->sme_session_id, params->subtype_of_persona, |
| 4793 | params->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4794 | |
Arif Hussain | ee67701 | 2017-01-26 17:50:13 -0800 | [diff] [blame] | 4795 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 4796 | |
| 4797 | if (NULL == pdev) { |
| 4798 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, |
| 4799 | "%s: Failed to get pdev handler", __func__); |
| 4800 | return status; |
| 4801 | } |
| 4802 | |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 4803 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 4804 | if (QDF_IS_STATUS_ERROR(status)) |
| 4805 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4806 | |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 4807 | peer = cdp_peer_find_by_addr(soc, pdev, params->self_mac_addr, |
| 4808 | &peer_id); |
Arif Hussain | ee67701 | 2017-01-26 17:50:13 -0800 | [diff] [blame] | 4809 | if (peer) { |
| 4810 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, |
| 4811 | "%s: Peer=%d exist with same MAC", |
| 4812 | __func__, peer_id); |
| 4813 | status = QDF_STATUS_E_INVAL; |
| 4814 | } else { |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 4815 | status = csr_roam_open_session(mac_ctx, params); |
Arif Hussain | ee67701 | 2017-01-26 17:50:13 -0800 | [diff] [blame] | 4816 | } |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 4817 | sme_release_global_lock(&mac_ctx->sme); |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 4818 | |
| 4819 | 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] | 4820 | params->sme_session_id, 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4821 | |
| 4822 | return status; |
| 4823 | } |
| 4824 | |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 4825 | QDF_STATUS sme_close_session(tHalHandle hal, uint8_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4826 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4827 | QDF_STATUS status; |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 4828 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4829 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4830 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 4831 | TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, session_id, 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4832 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4833 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Krunal Soni | 8d184fa | 2017-11-20 21:52:05 -0800 | [diff] [blame] | 4834 | status = csr_roam_close_session(pMac, session_id, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4835 | sme_release_global_lock(&pMac->sme); |
| 4836 | } |
| 4837 | |
| 4838 | return status; |
| 4839 | } |
| 4840 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4841 | /* |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4842 | * sme_change_mcc_beacon_interval() - |
| 4843 | * To update P2P-GO beaconInterval. This function should be called after |
| 4844 | * disassociating all the station is done |
| 4845 | * This is an asynchronous API. |
| 4846 | * |
| 4847 | * @sessionId: Session Identifier |
| 4848 | * Return QDF_STATUS SUCCESS |
| 4849 | * FAILURE or RESOURCES |
| 4850 | * The API finished and failed. |
| 4851 | */ |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 4852 | QDF_STATUS sme_change_mcc_beacon_interval(uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4853 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4854 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 4855 | tpAniSirGlobal mac_ctx = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4856 | |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 4857 | if (!mac_ctx) { |
| 4858 | sme_err("mac_ctx is NULL"); |
| 4859 | return status; |
| 4860 | } |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 4861 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4862 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Archana Ramachandran | 2eb7a61 | 2017-03-23 22:58:42 -0700 | [diff] [blame] | 4863 | status = csr_send_chng_mcc_beacon_interval(mac_ctx, |
| 4864 | sessionId); |
| 4865 | sme_release_global_lock(&mac_ctx->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4866 | } |
| 4867 | return status; |
| 4868 | } |
| 4869 | |
| 4870 | /** |
| 4871 | * sme_set_host_offload(): API to set the host offload feature. |
| 4872 | * @hHal: The handle returned by mac_open. |
| 4873 | * @sessionId: Session Identifier |
| 4874 | * @request: Pointer to the offload request. |
| 4875 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4876 | * Return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4877 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4878 | QDF_STATUS sme_set_host_offload(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4879 | tpSirHostOffloadReq request) |
| 4880 | { |
| 4881 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4882 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4883 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4884 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4885 | TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0)); |
| 4886 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4887 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4888 | #ifdef WLAN_NS_OFFLOAD |
| 4889 | if (SIR_IPV6_NS_OFFLOAD == request->offloadType) { |
| 4890 | status = sme_set_ps_ns_offload(hHal, request, |
| 4891 | sessionId); |
| 4892 | } else |
| 4893 | #endif /* WLAN_NS_OFFLOAD */ |
| 4894 | { |
| 4895 | status = sme_set_ps_host_offload(hHal, request, |
| 4896 | sessionId); |
| 4897 | } |
| 4898 | sme_release_global_lock(&pMac->sme); |
| 4899 | } |
| 4900 | |
| 4901 | return status; |
| 4902 | } |
| 4903 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4904 | /* |
| 4905 | * sme_set_keep_alive() - |
| 4906 | * API to set the Keep Alive feature. |
| 4907 | * |
| 4908 | * hHal - The handle returned by mac_open. |
| 4909 | * request - Pointer to the Keep Alive request. |
| 4910 | * Return QDF_STATUS |
| 4911 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4912 | QDF_STATUS sme_set_keep_alive(tHalHandle hHal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4913 | tpSirKeepAliveReq request) |
| 4914 | { |
| 4915 | tpSirKeepAliveReq request_buf; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4916 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4917 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 4918 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4919 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 4920 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4921 | FL("WMA_SET_KEEP_ALIVE message")); |
| 4922 | |
| 4923 | if (pSession == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4924 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4925 | FL("Session not Found")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4926 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4927 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4928 | request_buf = qdf_mem_malloc(sizeof(tSirKeepAliveReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4929 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4930 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4931 | "Not able to allocate memory for keep alive request"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4932 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4933 | } |
| 4934 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 4935 | qdf_copy_macaddr(&request->bssid, &pSession->connectedProfile.bssid); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4936 | qdf_mem_copy(request_buf, request, sizeof(tSirKeepAliveReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4937 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 4938 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4939 | "buff TP %d input TP %d ", request_buf->timePeriod, |
| 4940 | request->timePeriod); |
| 4941 | request_buf->sessionId = session_id; |
| 4942 | |
| 4943 | msg.type = WMA_SET_KEEP_ALIVE; |
| 4944 | msg.reserved = 0; |
| 4945 | msg.bodyptr = request_buf; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 4946 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 4947 | session_id, msg.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4948 | if (QDF_STATUS_SUCCESS != |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 4949 | scheduler_post_message(QDF_MODULE_ID_SME, |
| 4950 | QDF_MODULE_ID_WMA, |
| 4951 | QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4952 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4953 | "Not able to post WMA_SET_KEEP_ALIVE message to WMA"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4954 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4955 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4956 | } |
| 4957 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4958 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4959 | } |
| 4960 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 4961 | /* |
| 4962 | * sme_get_operation_channel() - |
| 4963 | * API to get current channel on which STA is parked his function gives |
| 4964 | * channel information only of infra station or IBSS station |
| 4965 | * |
| 4966 | * hHal, pointer to memory location and sessionId |
| 4967 | * Returns QDF_STATUS_SUCCESS |
| 4968 | * QDF_STATUS_E_FAILURE |
| 4969 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4970 | QDF_STATUS sme_get_operation_channel(tHalHandle hHal, uint32_t *pChannel, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4971 | uint8_t sessionId) |
| 4972 | { |
| 4973 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 4974 | struct csr_roam_session *pSession; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4975 | |
| 4976 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 4977 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 4978 | |
| 4979 | if ((pSession->connectedProfile.BSSType == |
| 4980 | eCSR_BSS_TYPE_INFRASTRUCTURE) |
| 4981 | || (pSession->connectedProfile.BSSType == |
| 4982 | eCSR_BSS_TYPE_IBSS) |
| 4983 | || (pSession->connectedProfile.BSSType == |
| 4984 | eCSR_BSS_TYPE_INFRA_AP) |
| 4985 | || (pSession->connectedProfile.BSSType == |
| 4986 | eCSR_BSS_TYPE_START_IBSS)) { |
| 4987 | *pChannel = pSession->connectedProfile.operationChannel; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4988 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4989 | } |
| 4990 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4991 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4992 | } /* sme_get_operation_channel ends here */ |
| 4993 | |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 4994 | /** |
| 4995 | * sme_register_mgmt_frame_ind_callback() - Register a callback for |
| 4996 | * management frame indication to PE. |
| 4997 | * |
| 4998 | * @hal: hal pointer |
| 4999 | * @callback: callback pointer to be registered |
| 5000 | * |
| 5001 | * This function is used to register a callback for management |
| 5002 | * frame indication to PE. |
| 5003 | * |
| 5004 | * Return: Success if msg is posted to PE else Failure. |
| 5005 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5006 | QDF_STATUS sme_register_mgmt_frame_ind_callback(tHalHandle hal, |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5007 | sir_mgmt_frame_ind_callback callback) |
| 5008 | { |
| 5009 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 5010 | struct sir_sme_mgmt_frame_cb_req *msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5011 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5012 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5013 | if (QDF_STATUS_SUCCESS == |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5014 | sme_acquire_global_lock(&mac_ctx->sme)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5015 | msg = qdf_mem_malloc(sizeof(*msg)); |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5016 | if (NULL == msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5017 | sme_err("Not able to allocate memory"); |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5018 | sme_release_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5019 | return QDF_STATUS_E_NOMEM; |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5020 | } |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5021 | msg->message_type = eWNI_SME_REGISTER_MGMT_FRAME_CB; |
| 5022 | msg->length = sizeof(*msg); |
| 5023 | |
| 5024 | msg->callback = callback; |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 5025 | status = umac_send_mb_message_to_mac(msg); |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5026 | sme_release_global_lock(&mac_ctx->sme); |
| 5027 | return status; |
| 5028 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5029 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 7996eb7 | 2015-12-30 17:24:02 +0530 | [diff] [blame] | 5030 | } |
| 5031 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5032 | /* |
| 5033 | * sme_RegisterMgtFrame() - |
Jeff Johnson | 698eacd | 2018-05-12 17:00:03 -0700 | [diff] [blame] | 5034 | * To register management frame of specified type and subtype. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5035 | * |
| 5036 | * frameType - type of the frame that needs to be passed to HDD. |
| 5037 | * matchData - data which needs to be matched before passing frame |
| 5038 | * to HDD. |
| 5039 | * matchDataLen - Length of matched data. |
| 5040 | * Return QDF_STATUS |
| 5041 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5042 | QDF_STATUS sme_register_mgmt_frame(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5043 | uint16_t frameType, uint8_t *matchData, |
| 5044 | uint16_t matchLen) |
| 5045 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5046 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5047 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5048 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5049 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5050 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5051 | tSirRegisterMgmtFrame *pMsg; |
| 5052 | uint16_t len; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 5053 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, |
| 5054 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5055 | |
| 5056 | if (!CSR_IS_SESSION_ANY(sessionId) && !pSession) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5057 | sme_err("Session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5058 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5059 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5060 | } |
| 5061 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5062 | if (!CSR_IS_SESSION_ANY(sessionId) && |
| 5063 | !pSession->sessionActive) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5064 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5065 | "%s Invalid Sessionid", __func__); |
| 5066 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5067 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5068 | } |
| 5069 | |
| 5070 | len = sizeof(tSirRegisterMgmtFrame) + matchLen; |
| 5071 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5072 | pMsg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5073 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5074 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5075 | else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5076 | pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ; |
| 5077 | pMsg->length = len; |
| 5078 | pMsg->sessionId = sessionId; |
| 5079 | pMsg->registerFrame = true; |
| 5080 | pMsg->frameType = frameType; |
| 5081 | pMsg->matchLen = matchLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5082 | qdf_mem_copy(pMsg->matchData, matchData, matchLen); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 5083 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5084 | } |
| 5085 | sme_release_global_lock(&pMac->sme); |
| 5086 | } |
| 5087 | return status; |
| 5088 | } |
| 5089 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5090 | /* |
| 5091 | * sme_DeregisterMgtFrame() - |
Jeff Johnson | 698eacd | 2018-05-12 17:00:03 -0700 | [diff] [blame] | 5092 | * To De-register management frame of specified type and subtype. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5093 | * |
| 5094 | * frameType - type of the frame that needs to be passed to HDD. |
| 5095 | * matchData - data which needs to be matched before passing frame |
| 5096 | * to HDD. |
| 5097 | * matchDataLen - Length of matched data. |
| 5098 | * Return QDF_STATUS |
| 5099 | */ |
| 5100 | QDF_STATUS sme_deregister_mgmt_frame(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5101 | uint16_t frameType, uint8_t *matchData, |
| 5102 | uint16_t matchLen) |
| 5103 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5104 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5105 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5106 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5107 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5108 | TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, |
| 5109 | 0)); |
| 5110 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5111 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5112 | tSirRegisterMgmtFrame *pMsg; |
| 5113 | uint16_t len; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 5114 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, |
| 5115 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5116 | |
| 5117 | if (!CSR_IS_SESSION_ANY(sessionId) && !pSession) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5118 | sme_err("Session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5119 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5120 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5121 | } |
| 5122 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5123 | if (!CSR_IS_SESSION_ANY(sessionId) && |
| 5124 | !pSession->sessionActive) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5125 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5126 | "%s Invalid Sessionid", __func__); |
| 5127 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5128 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5129 | } |
| 5130 | |
| 5131 | len = sizeof(tSirRegisterMgmtFrame) + matchLen; |
| 5132 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5133 | pMsg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5134 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5135 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5136 | else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5137 | pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ; |
| 5138 | pMsg->length = len; |
| 5139 | pMsg->registerFrame = false; |
| 5140 | pMsg->frameType = frameType; |
| 5141 | pMsg->matchLen = matchLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5142 | qdf_mem_copy(pMsg->matchData, matchData, matchLen); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 5143 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5144 | } |
| 5145 | sme_release_global_lock(&pMac->sme); |
| 5146 | } |
| 5147 | return status; |
| 5148 | } |
| 5149 | |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5150 | /** |
| 5151 | * sme_prepare_mgmt_tx() - Prepares mgmt frame |
| 5152 | * @hal: The handle returned by mac_open |
| 5153 | * @session_id: session id |
| 5154 | * @buf: pointer to frame |
| 5155 | * @len: frame length |
| 5156 | * |
| 5157 | * Return: QDF_STATUS |
| 5158 | */ |
| 5159 | static QDF_STATUS sme_prepare_mgmt_tx(tHalHandle hal, uint8_t session_id, |
| 5160 | const uint8_t *buf, uint32_t len) |
| 5161 | { |
| 5162 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 5163 | struct sir_mgmt_msg *msg; |
| 5164 | uint16_t msg_len; |
| 5165 | struct scheduler_msg sch_msg = {0}; |
| 5166 | |
| 5167 | sme_debug("prepares auth frame"); |
| 5168 | |
| 5169 | msg_len = sizeof(*msg) + len; |
| 5170 | msg = qdf_mem_malloc(msg_len); |
| 5171 | if (msg == NULL) { |
| 5172 | status = QDF_STATUS_E_NOMEM; |
| 5173 | } else { |
| 5174 | msg->type = eWNI_SME_SEND_MGMT_FRAME_TX; |
| 5175 | msg->msg_len = msg_len; |
| 5176 | msg->session_id = session_id; |
| 5177 | msg->data = (uint8_t *)msg + sizeof(*msg); |
| 5178 | qdf_mem_copy(msg->data, buf, len); |
| 5179 | |
| 5180 | sch_msg.type = eWNI_SME_SEND_MGMT_FRAME_TX; |
| 5181 | sch_msg.bodyptr = msg; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 5182 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 5183 | QDF_MODULE_ID_PE, |
| 5184 | QDF_MODULE_ID_PE, &sch_msg); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5185 | } |
| 5186 | return status; |
| 5187 | } |
| 5188 | |
| 5189 | QDF_STATUS sme_send_mgmt_tx(tHalHandle hal, uint8_t session_id, |
| 5190 | const uint8_t *buf, uint32_t len) |
| 5191 | { |
| 5192 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 5193 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 5194 | |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5195 | status = sme_acquire_global_lock(&mac->sme); |
| 5196 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 5197 | status = sme_prepare_mgmt_tx(hal, session_id, buf, len); |
| 5198 | sme_release_global_lock(&mac->sme); |
| 5199 | } |
| 5200 | |
| 5201 | return status; |
| 5202 | } |
| 5203 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5204 | #ifdef WLAN_FEATURE_EXTWOW_SUPPORT |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 5205 | /** |
| 5206 | * sme_configure_ext_wow() - configure Extr WoW |
| 5207 | * @hHal - The handle returned by mac_open. |
| 5208 | * @wlanExtParams - Depicts the wlan Ext params. |
| 5209 | * @callback - ext_wow callback to be registered. |
| 5210 | * @callback_context - ext_wow callback context |
| 5211 | * |
| 5212 | * SME will pass this request to lower mac to configure Extr WoW |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5213 | * Return: QDF_STATUS |
Krishna Kumaar Natarajan | d913190 | 2015-10-19 11:52:47 -0700 | [diff] [blame] | 5214 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5215 | QDF_STATUS sme_configure_ext_wow(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5216 | tpSirExtWoWParams wlanExtParams, |
| 5217 | csr_readyToExtWoWCallback callback, |
| 5218 | void *callback_context) |
| 5219 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5220 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 5221 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5222 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 5223 | struct scheduler_msg message = {0}; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5224 | tpSirExtWoWParams MsgPtr = qdf_mem_malloc(sizeof(*MsgPtr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5225 | |
| 5226 | if (!MsgPtr) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5227 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5228 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5229 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5230 | TRACE_CODE_SME_RX_HDD_CONFIG_EXTWOW, NO_SESSION, 0)); |
| 5231 | |
| 5232 | pMac->readyToExtWoWCallback = callback; |
| 5233 | pMac->readyToExtWoWContext = callback_context; |
| 5234 | |
| 5235 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5236 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5237 | |
| 5238 | /* serialize the req through MC thread */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5239 | qdf_mem_copy(MsgPtr, wlanExtParams, sizeof(*MsgPtr)); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 5240 | message.bodyptr = MsgPtr; |
| 5241 | message.type = WMA_WLAN_EXT_WOW; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 5242 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 5243 | QDF_MODULE_ID_WMA, |
| 5244 | QDF_MODULE_ID_WMA, |
| 5245 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5246 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5247 | pMac->readyToExtWoWCallback = NULL; |
| 5248 | pMac->readyToExtWoWContext = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5249 | qdf_mem_free(MsgPtr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5250 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5251 | } |
| 5252 | sme_release_global_lock(&pMac->sme); |
| 5253 | } else { |
| 5254 | pMac->readyToExtWoWCallback = NULL; |
| 5255 | pMac->readyToExtWoWContext = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5256 | qdf_mem_free(MsgPtr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5257 | } |
| 5258 | |
| 5259 | return status; |
| 5260 | } |
| 5261 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5262 | /* |
| 5263 | * sme_configure_app_type1_params() - |
| 5264 | * SME will pass this request to lower mac to configure Indoor WoW parameters. |
| 5265 | * |
| 5266 | * hHal - The handle returned by mac_open. |
| 5267 | * wlanAppType1Params- Depicts the wlan App Type 1(Indoor) params |
| 5268 | * Return QDF_STATUS |
| 5269 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5270 | QDF_STATUS sme_configure_app_type1_params(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5271 | tpSirAppType1Params wlanAppType1Params) |
| 5272 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5273 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 5274 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5275 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 5276 | struct scheduler_msg message = {0}; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5277 | tpSirAppType1Params MsgPtr = qdf_mem_malloc(sizeof(*MsgPtr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5278 | |
| 5279 | if (!MsgPtr) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5280 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5281 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5282 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5283 | TRACE_CODE_SME_RX_HDD_CONFIG_APP_TYPE1, NO_SESSION, |
| 5284 | 0)); |
| 5285 | |
| 5286 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5287 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5288 | /* serialize the req through MC thread */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5289 | qdf_mem_copy(MsgPtr, wlanAppType1Params, sizeof(*MsgPtr)); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 5290 | message.bodyptr = MsgPtr; |
| 5291 | message.type = WMA_WLAN_SET_APP_TYPE1_PARAMS; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 5292 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 5293 | QDF_MODULE_ID_WMA, |
| 5294 | QDF_MODULE_ID_WMA, |
| 5295 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5296 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5297 | qdf_mem_free(MsgPtr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5298 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5299 | } |
| 5300 | sme_release_global_lock(&pMac->sme); |
| 5301 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5302 | qdf_mem_free(MsgPtr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5303 | } |
| 5304 | |
| 5305 | return status; |
| 5306 | } |
| 5307 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5308 | /* |
| 5309 | * sme_configure_app_type2_params() - |
| 5310 | * SME will pass this request to lower mac to configure Indoor WoW parameters. |
| 5311 | * |
| 5312 | * hHal - The handle returned by mac_open. |
| 5313 | * wlanAppType2Params- Depicts the wlan App Type 2 (Outdoor) params |
| 5314 | * Return QDF_STATUS |
| 5315 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5316 | QDF_STATUS sme_configure_app_type2_params(tHalHandle hHal, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5317 | tpSirAppType2Params wlanAppType2Params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5318 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5319 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 5320 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5321 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 5322 | struct scheduler_msg message = {0}; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5323 | tpSirAppType2Params MsgPtr = qdf_mem_malloc(sizeof(*MsgPtr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5324 | |
| 5325 | if (!MsgPtr) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5326 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5327 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5328 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5329 | TRACE_CODE_SME_RX_HDD_CONFIG_APP_TYPE2, NO_SESSION, |
| 5330 | 0)); |
| 5331 | |
| 5332 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5333 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5334 | /* serialize the req through MC thread */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5335 | qdf_mem_copy(MsgPtr, wlanAppType2Params, sizeof(*MsgPtr)); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 5336 | message.bodyptr = MsgPtr; |
| 5337 | message.type = WMA_WLAN_SET_APP_TYPE2_PARAMS; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 5338 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 5339 | QDF_MODULE_ID_WMA, |
| 5340 | QDF_MODULE_ID_WMA, |
| 5341 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5342 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5343 | qdf_mem_free(MsgPtr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5344 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5345 | } |
| 5346 | sme_release_global_lock(&pMac->sme); |
| 5347 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5348 | qdf_mem_free(MsgPtr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5349 | } |
| 5350 | |
| 5351 | return status; |
| 5352 | } |
| 5353 | #endif |
| 5354 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5355 | /* |
| 5356 | * sme_get_infra_session_id |
| 5357 | * To get the session ID for infra session, if connected |
| 5358 | * This is a synchronous API. |
| 5359 | * |
| 5360 | * hHal - The handle returned by mac_open. |
| 5361 | * sessionid, -1 if infra session is not connected |
| 5362 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5363 | int8_t sme_get_infra_session_id(tHalHandle hHal) |
| 5364 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5365 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5366 | int8_t sessionid = -1; |
| 5367 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5368 | |
| 5369 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5370 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5371 | |
| 5372 | sessionid = csr_get_infra_session_id(pMac); |
| 5373 | |
| 5374 | sme_release_global_lock(&pMac->sme); |
| 5375 | } |
| 5376 | |
| 5377 | return sessionid; |
| 5378 | } |
| 5379 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5380 | /* |
| 5381 | * sme_get_infra_operation_channel() - |
| 5382 | * To get the operating channel for infra session, if connected |
| 5383 | * This is a synchronous API. |
| 5384 | * |
| 5385 | * hHal - The handle returned by mac_open. |
| 5386 | * sessionId - the sessionId returned by sme_open_session. |
| 5387 | * Return operating channel, 0 if infra session is not connected |
| 5388 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5389 | uint8_t sme_get_infra_operation_channel(tHalHandle hHal, uint8_t sessionId) |
| 5390 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5391 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5392 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5393 | uint8_t channel = 0; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5394 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5395 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5396 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5397 | |
| 5398 | channel = csr_get_infra_operation_channel(pMac, sessionId); |
| 5399 | |
| 5400 | sme_release_global_lock(&pMac->sme); |
| 5401 | } |
| 5402 | |
| 5403 | return channel; |
| 5404 | } |
| 5405 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5406 | /* This routine will return poerating channel on which other BSS is operating |
| 5407 | * to be used for concurrency mode. If other BSS is not up or not connected it |
| 5408 | * will return 0 |
| 5409 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5410 | uint8_t sme_get_concurrent_operation_channel(tHalHandle hHal) |
| 5411 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5412 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5413 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5414 | uint8_t channel = 0; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5415 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5416 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5417 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5418 | |
| 5419 | channel = csr_get_concurrent_operation_channel(pMac); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5420 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
| 5421 | "%s: Other Concurrent Channel: %d", __func__, channel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5422 | sme_release_global_lock(&pMac->sme); |
| 5423 | } |
| 5424 | |
| 5425 | return channel; |
| 5426 | } |
| 5427 | |
| 5428 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 5429 | uint16_t sme_check_concurrent_channel_overlap(tHalHandle hHal, uint16_t sap_ch, |
| 5430 | eCsrPhyMode sapPhyMode, |
| 5431 | uint8_t cc_switch_mode) |
| 5432 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5433 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5434 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5435 | uint16_t channel = 0; |
| 5436 | |
| 5437 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5438 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5439 | channel = |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5440 | csr_check_concurrent_channel_overlap(pMac, sap_ch, |
| 5441 | sapPhyMode, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5442 | cc_switch_mode); |
| 5443 | sme_release_global_lock(&pMac->sme); |
| 5444 | } |
| 5445 | |
| 5446 | return channel; |
| 5447 | } |
| 5448 | #endif |
| 5449 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 5450 | /** |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 5451 | * sme_set_tsfcb() - Set callback for TSF capture |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5452 | * @h_hal: Handler return by mac_open |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 5453 | * @cb_fn: Callback function pointer |
| 5454 | * @db_ctx: Callback data |
| 5455 | * |
| 5456 | * Return: QDF_STATUS |
| 5457 | */ |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5458 | QDF_STATUS sme_set_tsfcb(tHalHandle h_hal, |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 5459 | int (*cb_fn)(void *cb_ctx, struct stsf *ptsf), void *cb_ctx) |
| 5460 | { |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5461 | tpAniSirGlobal mac = PMAC_STRUCT(h_hal); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 5462 | QDF_STATUS status; |
| 5463 | |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5464 | status = sme_acquire_global_lock(&mac->sme); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 5465 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5466 | mac->sme.get_tsf_cb = cb_fn; |
| 5467 | mac->sme.get_tsf_cxt = cb_ctx; |
| 5468 | sme_release_global_lock(&mac->sme); |
Manikandan Mohan | dcc21ba | 2016-03-15 14:31:56 -0700 | [diff] [blame] | 5469 | } |
| 5470 | return status; |
| 5471 | } |
| 5472 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 5473 | /** |
| 5474 | * sme_reset_tsfcb() - Reset callback for TSF capture |
| 5475 | * @h_hal: Handler return by mac_open |
| 5476 | * |
| 5477 | * This function reset the tsf capture callback to SME |
| 5478 | * |
| 5479 | * Return: QDF_STATUS |
| 5480 | */ |
| 5481 | QDF_STATUS sme_reset_tsfcb(tHalHandle h_hal) |
| 5482 | { |
| 5483 | tpAniSirGlobal mac; |
| 5484 | QDF_STATUS status; |
| 5485 | |
| 5486 | if (!h_hal) { |
| 5487 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 5488 | FL("h_hal is not valid")); |
| 5489 | return QDF_STATUS_E_INVAL; |
| 5490 | } |
| 5491 | mac = PMAC_STRUCT(h_hal); |
| 5492 | |
| 5493 | status = sme_acquire_global_lock(&mac->sme); |
| 5494 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 5495 | mac->sme.get_tsf_cb = NULL; |
| 5496 | mac->sme.get_tsf_cxt = NULL; |
| 5497 | sme_release_global_lock(&mac->sme); |
| 5498 | } |
| 5499 | return status; |
| 5500 | } |
| 5501 | |
yuanl | 2746f07 | 2018-09-21 19:19:16 +0800 | [diff] [blame^] | 5502 | #if defined(WLAN_FEATURE_TSF) && !defined(WLAN_FEATURE_TSF_PLUS_NOIRQ) |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5503 | /* |
yuanl | 2746f07 | 2018-09-21 19:19:16 +0800 | [diff] [blame^] | 5504 | * sme_set_tsf_gpio() - set gpio pin that be toggled when capture tsf |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5505 | * @h_hal: Handler return by mac_open |
| 5506 | * @pinvalue: gpio pin id |
| 5507 | * |
| 5508 | * Return: QDF_STATUS |
| 5509 | */ |
| 5510 | QDF_STATUS sme_set_tsf_gpio(tHalHandle h_hal, uint32_t pinvalue) |
| 5511 | { |
| 5512 | QDF_STATUS status; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 5513 | struct scheduler_msg tsf_msg = {0}; |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5514 | tpAniSirGlobal mac = PMAC_STRUCT(h_hal); |
| 5515 | |
| 5516 | status = sme_acquire_global_lock(&mac->sme); |
| 5517 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 5518 | tsf_msg.type = WMA_TSF_GPIO_PIN; |
| 5519 | tsf_msg.reserved = 0; |
| 5520 | tsf_msg.bodyval = pinvalue; |
| 5521 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 5522 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 5523 | QDF_MODULE_ID_WMA, |
| 5524 | QDF_MODULE_ID_WMA, &tsf_msg); |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5525 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5526 | sme_err("Unable to post WMA_TSF_GPIO_PIN"); |
Manikandan Mohan | 976e756 | 2016-03-15 16:33:31 -0700 | [diff] [blame] | 5527 | status = QDF_STATUS_E_FAILURE; |
| 5528 | } |
| 5529 | sme_release_global_lock(&mac->sme); |
| 5530 | } |
| 5531 | return status; |
| 5532 | } |
| 5533 | #endif |
| 5534 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 5535 | QDF_STATUS sme_get_cfg_valid_channels(uint8_t *aValidChannels, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5536 | uint32_t *len) |
| 5537 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5538 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 5539 | tpAniSirGlobal mac_ctx = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5540 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 5541 | if (NULL == mac_ctx) { |
| 5542 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 5543 | FL("Invalid MAC context")); |
| 5544 | return QDF_STATUS_E_FAILURE; |
| 5545 | } |
| 5546 | |
| 5547 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5548 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 5549 | status = csr_get_cfg_valid_channels(mac_ctx, |
| 5550 | aValidChannels, len); |
| 5551 | sme_release_global_lock(&mac_ctx->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5552 | } |
| 5553 | |
| 5554 | return status; |
| 5555 | } |
| 5556 | |
Amar Singhal | f0a94ad | 2017-11-27 15:20:00 -0800 | [diff] [blame] | 5557 | static uint8_t *sme_reg_hint_to_str(const enum country_src src) |
| 5558 | { |
| 5559 | switch (src) { |
| 5560 | case SOURCE_CORE: |
| 5561 | return "WORLD MODE"; |
| 5562 | |
| 5563 | case SOURCE_DRIVER: |
| 5564 | return "BDF file"; |
| 5565 | |
| 5566 | case SOURCE_USERSPACE: |
| 5567 | return "user-space"; |
| 5568 | |
| 5569 | case SOURCE_11D: |
| 5570 | return "802.11D IEs in beacons"; |
| 5571 | |
| 5572 | default: |
| 5573 | return "unknown"; |
| 5574 | } |
| 5575 | } |
| 5576 | |
Amar Singhal | 6edf973 | 2016-11-20 21:43:40 -0800 | [diff] [blame] | 5577 | void sme_set_cc_src(tHalHandle hHal, enum country_src cc_src) |
| 5578 | { |
| 5579 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hHal); |
| 5580 | |
| 5581 | mac_ctx->reg_hint_src = cc_src; |
Amar Singhal | f0a94ad | 2017-11-27 15:20:00 -0800 | [diff] [blame] | 5582 | |
| 5583 | sme_debug("Country source is %s", |
| 5584 | sme_reg_hint_to_str(cc_src)); |
Amar Singhal | 6edf973 | 2016-11-20 21:43:40 -0800 | [diff] [blame] | 5585 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5586 | |
| 5587 | /** |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 5588 | * sme_handle_generic_change_country_code() - handles country ch req |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5589 | * @mac_ctx: mac global context |
| 5590 | * @msg: request msg packet |
| 5591 | * |
| 5592 | * If Supplicant country code is priority than 11d is disabled. |
| 5593 | * If 11D is enabled, we update the country code after every scan. |
| 5594 | * Hence when Supplicant country code is priority, we don't need 11D info. |
| 5595 | * Country code from Supplicant is set as current country code. |
| 5596 | * |
| 5597 | * Return: status of operation |
| 5598 | */ |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5599 | static QDF_STATUS |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 5600 | sme_handle_generic_change_country_code(tpAniSirGlobal mac_ctx, |
| 5601 | void *pMsgBuf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5602 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5603 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 5604 | v_REGDOMAIN_t reg_domain_id = 0; |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 5605 | bool user_ctry_priority = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5606 | mac_ctx->roam.configParam.fSupplicantCountryCodeHasPriority; |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 5607 | tAniGenericChangeCountryCodeReq *msg = pMsgBuf; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5608 | |
Amar Singhal | 6edf973 | 2016-11-20 21:43:40 -0800 | [diff] [blame] | 5609 | if (SOURCE_11D != mac_ctx->reg_hint_src) { |
| 5610 | if (SOURCE_DRIVER != mac_ctx->reg_hint_src) { |
| 5611 | if (user_ctry_priority) |
| 5612 | mac_ctx->roam.configParam.Is11dSupportEnabled = |
| 5613 | false; |
| 5614 | else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5615 | if (mac_ctx->roam.configParam. |
| 5616 | Is11dSupportEnabled && |
| 5617 | mac_ctx->scan.countryCode11d[0] != 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5618 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5619 | sme_debug("restore 11d"); |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 5620 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5621 | status = |
| 5622 | csr_get_regulatory_domain_for_country( |
Amar Singhal | 6edf973 | 2016-11-20 21:43:40 -0800 | [diff] [blame] | 5623 | mac_ctx, |
| 5624 | mac_ctx->scan.countryCode11d, |
| 5625 | ®_domain_id, |
| 5626 | SOURCE_11D); |
| 5627 | return QDF_STATUS_E_FAILURE; |
| 5628 | } |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 5629 | } |
| 5630 | } |
| 5631 | } else { |
| 5632 | /* if kernel gets invalid country code; it |
| 5633 | * resets the country code to world |
| 5634 | */ |
| 5635 | if (('0' != msg->countryCode[0]) || |
| 5636 | ('0' != msg->countryCode[1])) |
| 5637 | qdf_mem_copy(mac_ctx->scan.countryCode11d, |
| 5638 | msg->countryCode, |
| 5639 | WNI_CFG_COUNTRY_CODE_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5640 | } |
Amar Singhal | 7f1f3ec | 2015-10-13 17:14:08 -0700 | [diff] [blame] | 5641 | |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 5642 | qdf_mem_copy(mac_ctx->scan.countryCodeCurrent, |
| 5643 | msg->countryCode, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5644 | WNI_CFG_COUNTRY_CODE_LEN); |
Amar Singhal | 9d5b1fe | 2016-10-16 20:16:05 -0700 | [diff] [blame] | 5645 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5646 | /* get the channels based on new cc */ |
| 5647 | status = csr_get_channel_and_power_list(mac_ctx); |
| 5648 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5649 | if (status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5650 | sme_err("fail to get Channels"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5651 | return status; |
| 5652 | } |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 5653 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5654 | /* reset info based on new cc, and we are done */ |
| 5655 | csr_apply_channel_power_info_wrapper(mac_ctx); |
| 5656 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5657 | csr_scan_filter_results(mac_ctx); |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 5658 | |
| 5659 | /* scans after the country is set by User hints or |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5660 | * Country IE |
| 5661 | */ |
| 5662 | mac_ctx->scan.curScanType = eSIR_ACTIVE_SCAN; |
Amar Singhal | 9d5b1fe | 2016-10-16 20:16:05 -0700 | [diff] [blame] | 5663 | |
Amar Singhal | 6edf973 | 2016-11-20 21:43:40 -0800 | [diff] [blame] | 5664 | mac_ctx->reg_hint_src = SOURCE_UNKNOWN; |
| 5665 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5666 | sme_disconnect_connected_sessions(mac_ctx); |
Amar Singhal | b6d0dc4 | 2016-10-19 09:45:05 -0700 | [diff] [blame] | 5667 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5668 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5669 | } |
| 5670 | |
Jeff Johnson | 330c0bf | 2018-06-01 15:13:12 -0700 | [diff] [blame] | 5671 | QDF_STATUS sme_update_channel_list(tHalHandle hal) |
Mukul Sharma | ecf8e09 | 2017-12-19 22:36:31 +0530 | [diff] [blame] | 5672 | { |
Jeff Johnson | 330c0bf | 2018-06-01 15:13:12 -0700 | [diff] [blame] | 5673 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 5674 | QDF_STATUS status; |
Mukul Sharma | ecf8e09 | 2017-12-19 22:36:31 +0530 | [diff] [blame] | 5675 | |
| 5676 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 5677 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 5678 | /* Update umac channel (enable/disable) from cds channels */ |
| 5679 | status = csr_get_channel_and_power_list(mac_ctx); |
| 5680 | if (status != QDF_STATUS_SUCCESS) { |
| 5681 | sme_err("fail to get Channels"); |
| 5682 | sme_release_global_lock(&mac_ctx->sme); |
| 5683 | return status; |
| 5684 | } |
| 5685 | |
| 5686 | csr_apply_channel_power_info_wrapper(mac_ctx); |
| 5687 | csr_scan_filter_results(mac_ctx); |
| 5688 | sme_disconnect_connected_sessions(mac_ctx); |
| 5689 | sme_release_global_lock(&mac_ctx->sme); |
| 5690 | } |
| 5691 | |
| 5692 | return status; |
| 5693 | } |
| 5694 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5695 | static bool |
| 5696 | sme_search_in_base_ch_lst(tpAniSirGlobal mac_ctx, uint8_t curr_ch) |
| 5697 | { |
| 5698 | uint8_t i; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 5699 | struct csr_channel *ch_lst_info; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5700 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5701 | ch_lst_info = &mac_ctx->scan.base_channels; |
| 5702 | for (i = 0; i < ch_lst_info->numChannels; i++) { |
| 5703 | if (ch_lst_info->channelList[i] == curr_ch) |
| 5704 | return true; |
| 5705 | } |
| 5706 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5707 | return false; |
| 5708 | } |
| 5709 | /** |
| 5710 | * sme_disconnect_connected_sessions() - Disconnect STA and P2P client session |
| 5711 | * if channel is not supported |
| 5712 | * @mac_ctx: mac global context |
| 5713 | * |
| 5714 | * If new country code does not support the channel on which STA/P2P client |
| 5715 | * is connetced, it sends the disconnect to the AP/P2P GO |
| 5716 | * |
| 5717 | * Return: void |
| 5718 | */ |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5719 | static void sme_disconnect_connected_sessions(tpAniSirGlobal mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5720 | { |
| 5721 | uint8_t session_id, found = false; |
| 5722 | uint8_t curr_ch; |
| 5723 | |
| 5724 | for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) { |
| 5725 | if (!csr_is_session_client_and_connected(mac_ctx, session_id)) |
| 5726 | continue; |
| 5727 | found = false; |
| 5728 | /* Session is connected.Check the channel */ |
| 5729 | curr_ch = csr_get_infra_operation_channel(mac_ctx, |
| 5730 | session_id); |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5731 | sme_debug("Current Operating channel : %d, session :%d", |
| 5732 | curr_ch, session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5733 | found = sme_search_in_base_ch_lst(mac_ctx, curr_ch); |
| 5734 | if (!found) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 5735 | sme_debug("Disconnect Session: %d", session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5736 | csr_roam_disconnect(mac_ctx, session_id, |
| 5737 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 5738 | } |
| 5739 | } |
| 5740 | } |
| 5741 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5742 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5743 | QDF_STATUS sme_8023_multicast_list(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5744 | tpSirRcvFltMcAddrList pMulticastAddrs) |
| 5745 | { |
| 5746 | tpSirRcvFltMcAddrList request_buf; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 5747 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5748 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 5749 | struct csr_roam_session *pSession = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5750 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5751 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 5752 | "%s: ulMulticastAddrCnt: %d, multicastAddr[0]: %pK", __func__, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5753 | pMulticastAddrs->ulMulticastAddrCnt, |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 5754 | pMulticastAddrs->multicastAddr[0].bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5755 | |
Ravi Joshi | 4f447cb | 2016-07-19 13:42:01 -0700 | [diff] [blame] | 5756 | /* Find the connected Infra / P2P_client connected session */ |
Krunal Soni | fea0680 | 2017-04-13 14:44:48 -0700 | [diff] [blame] | 5757 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5758 | if (!CSR_IS_SESSION_VALID(pMac, sessionId) || |
| 5759 | (!csr_is_conn_state_infra(pMac, sessionId) && |
| 5760 | !csr_is_ndi_started(pMac, sessionId))) { |
Abhishek Singh | 5d8d733 | 2017-08-10 15:15:24 +0530 | [diff] [blame] | 5761 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | f2599dd | 2015-11-16 18:20:46 -0800 | [diff] [blame] | 5762 | "%s: Unable to find the session Id: %d", __func__, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5763 | sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5764 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5765 | } |
| 5766 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5767 | request_buf = qdf_mem_malloc(sizeof(tSirRcvFltMcAddrList)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5768 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5769 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5770 | "%s: Not able to allocate memory for 8023 Multicast List request", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5771 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5772 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5773 | } |
| 5774 | |
Ravi Joshi | 4f447cb | 2016-07-19 13:42:01 -0700 | [diff] [blame] | 5775 | if (!csr_is_conn_state_connected_infra(pMac, sessionId) && |
| 5776 | !csr_is_ndi_started(pMac, sessionId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5777 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Ravi Joshi | 4f447cb | 2016-07-19 13:42:01 -0700 | [diff] [blame] | 5778 | "%s: Request ignored, session %d is not connected or started", |
| 5779 | __func__, sessionId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5780 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5781 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5782 | } |
| 5783 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5784 | qdf_mem_copy(request_buf, pMulticastAddrs, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5785 | sizeof(tSirRcvFltMcAddrList)); |
| 5786 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 5787 | qdf_copy_macaddr(&request_buf->self_macaddr, &pSession->selfMacAddr); |
| 5788 | qdf_copy_macaddr(&request_buf->bssid, |
Srinivas Girigowda | 9853049 | 2015-11-20 17:39:24 -0800 | [diff] [blame] | 5789 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5790 | |
| 5791 | msg.type = WMA_8023_MULTICAST_LIST_REQ; |
| 5792 | msg.reserved = 0; |
| 5793 | msg.bodyptr = request_buf; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 5794 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 5795 | sessionId, msg.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 5796 | if (QDF_STATUS_SUCCESS != scheduler_post_message(QDF_MODULE_ID_SME, |
| 5797 | QDF_MODULE_ID_WMA, |
| 5798 | QDF_MODULE_ID_WMA, |
| 5799 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5800 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5801 | "%s: Not able to post WMA_8023_MULTICAST_LIST message to WMA", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5802 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5803 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5804 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5805 | } |
| 5806 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5807 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5808 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5809 | #endif /* WLAN_FEATURE_PACKET_FILTERING */ |
| 5810 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5811 | /* |
| 5812 | * sme_is_channel_valid() - |
| 5813 | * To check if the channel is valid for currently established domain |
| 5814 | * This is a synchronous API. |
| 5815 | * |
| 5816 | * hHal - The handle returned by mac_open. |
| 5817 | * channel - channel to verify |
| 5818 | * Return true/false, true if channel is valid |
| 5819 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5820 | bool sme_is_channel_valid(tHalHandle hHal, uint8_t channel) |
| 5821 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5822 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5823 | bool valid = false; |
| 5824 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5825 | |
| 5826 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5827 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5828 | |
| 5829 | valid = csr_roam_is_channel_valid(pMac, channel); |
| 5830 | |
| 5831 | sme_release_global_lock(&pMac->sme); |
| 5832 | } |
| 5833 | |
| 5834 | return valid; |
| 5835 | } |
| 5836 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5837 | /* |
| 5838 | * sme_set_freq_band() - |
| 5839 | * Used to set frequency band. |
| 5840 | * |
| 5841 | * hHal |
| 5842 | * sessionId - Session Identifier |
| 5843 | * band value to be configured |
| 5844 | * Return QDF_STATUS |
| 5845 | */ |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 5846 | QDF_STATUS sme_set_freq_band(tHalHandle hHal, uint8_t sessionId, |
| 5847 | enum band_info eBand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5848 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5849 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5850 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5851 | |
| 5852 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5853 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5854 | status = csr_set_band(hHal, sessionId, eBand); |
| 5855 | sme_release_global_lock(&pMac->sme); |
| 5856 | } |
| 5857 | return status; |
| 5858 | } |
| 5859 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5860 | /* |
| 5861 | * sme_get_freq_band() - |
| 5862 | * Used to get the current band settings. |
| 5863 | * |
| 5864 | * hHal |
| 5865 | * pBand pointer to hold band value |
| 5866 | * Return QDF_STATUS |
| 5867 | */ |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 5868 | QDF_STATUS sme_get_freq_band(tHalHandle hHal, enum band_info *pBand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5869 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5870 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5871 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5872 | |
| 5873 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5874 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5875 | *pBand = csr_get_current_band(hHal); |
| 5876 | sme_release_global_lock(&pMac->sme); |
| 5877 | } |
| 5878 | return status; |
| 5879 | } |
| 5880 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5881 | /* |
| 5882 | * sme_set_max_tx_power_per_band() - |
| 5883 | * Set the Maximum Transmit Power specific to band dynamically. |
| 5884 | * Note: this setting will not persist over reboots. |
| 5885 | * |
| 5886 | * band |
| 5887 | * power to set in dB |
| 5888 | * Return QDF_STATUS |
| 5889 | */ |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 5890 | 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] | 5891 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 5892 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5893 | tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL; |
| 5894 | |
| 5895 | pMaxTxPowerPerBandParams = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5896 | qdf_mem_malloc(sizeof(tMaxTxPowerPerBandParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5897 | if (NULL == pMaxTxPowerPerBandParams) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5898 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5899 | "%s:Not able to allocate memory for pMaxTxPowerPerBandParams", |
| 5900 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5901 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5902 | } |
| 5903 | |
| 5904 | pMaxTxPowerPerBandParams->power = dB; |
| 5905 | pMaxTxPowerPerBandParams->bandInfo = band; |
| 5906 | |
| 5907 | msg.type = WMA_SET_MAX_TX_POWER_PER_BAND_REQ; |
| 5908 | msg.reserved = 0; |
| 5909 | msg.bodyptr = pMaxTxPowerPerBandParams; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 5910 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 5911 | NO_SESSION, msg.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 5912 | if (QDF_STATUS_SUCCESS != scheduler_post_message(QDF_MODULE_ID_SME, |
| 5913 | QDF_MODULE_ID_WMA, |
| 5914 | QDF_MODULE_ID_WMA, |
| 5915 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5916 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5917 | "%s:Not able to post WMA_SET_MAX_TX_POWER_PER_BAND_REQ", |
| 5918 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5919 | qdf_mem_free(pMaxTxPowerPerBandParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5920 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5921 | } |
| 5922 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5923 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5924 | } |
| 5925 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5926 | /* |
| 5927 | * sme_set_max_tx_power() - |
| 5928 | * Set the Maximum Transmit Power dynamically. Note: this setting will |
| 5929 | * not persist over reboots. |
| 5930 | * |
| 5931 | * hHal |
| 5932 | * pBssid BSSID to set the power cap for |
| 5933 | * pBssid pSelfMacAddress self MAC Address |
| 5934 | * pBssid power to set in dB |
| 5935 | * Return QDF_STATUS |
| 5936 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5937 | QDF_STATUS sme_set_max_tx_power(tHalHandle hHal, struct qdf_mac_addr pBssid, |
| 5938 | struct qdf_mac_addr pSelfMacAddress, int8_t dB) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5939 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 5940 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5941 | tpMaxTxPowerParams pMaxTxParams = NULL; |
| 5942 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5943 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5944 | TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5945 | pMaxTxParams = qdf_mem_malloc(sizeof(tMaxTxPowerParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5946 | if (NULL == pMaxTxParams) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5947 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5948 | "%s: Not able to allocate memory for pMaxTxParams", |
| 5949 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5950 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5951 | } |
| 5952 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 5953 | qdf_copy_macaddr(&pMaxTxParams->bssId, &pBssid); |
| 5954 | qdf_copy_macaddr(&pMaxTxParams->selfStaMacAddr, &pSelfMacAddress); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5955 | pMaxTxParams->power = dB; |
| 5956 | |
| 5957 | msg.type = WMA_SET_MAX_TX_POWER_REQ; |
| 5958 | msg.reserved = 0; |
| 5959 | msg.bodyptr = pMaxTxParams; |
| 5960 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 5961 | if (QDF_STATUS_SUCCESS != scheduler_post_message(QDF_MODULE_ID_SME, |
| 5962 | QDF_MODULE_ID_WMA, |
| 5963 | QDF_MODULE_ID_WMA, |
| 5964 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5965 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5966 | "%s: Not able to post WMA_SET_MAX_TX_POWER_REQ message to WMA", |
| 5967 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5968 | qdf_mem_free(pMaxTxParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5969 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5970 | } |
| 5971 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5972 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5973 | } |
| 5974 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 5975 | /* |
| 5976 | * sme_set_custom_mac_addr() - |
| 5977 | * Set the customer Mac Address. |
| 5978 | * |
| 5979 | * customMacAddr customer MAC Address |
| 5980 | * Return QDF_STATUS |
| 5981 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5982 | QDF_STATUS sme_set_custom_mac_addr(tSirMacAddr customMacAddr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5983 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 5984 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5985 | tSirMacAddr *pBaseMacAddr; |
| 5986 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5987 | pBaseMacAddr = qdf_mem_malloc(sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5988 | if (NULL == pBaseMacAddr) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5989 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5990 | FL("Not able to allocate memory for pBaseMacAddr")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5991 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5992 | } |
| 5993 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5994 | qdf_mem_copy(*pBaseMacAddr, customMacAddr, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5995 | |
| 5996 | msg.type = SIR_HAL_SET_BASE_MACADDR_IND; |
| 5997 | msg.reserved = 0; |
| 5998 | msg.bodyptr = pBaseMacAddr; |
| 5999 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 6000 | if (QDF_STATUS_SUCCESS != scheduler_post_message(QDF_MODULE_ID_SME, |
| 6001 | QDF_MODULE_ID_WMA, |
| 6002 | QDF_MODULE_ID_WMA, |
| 6003 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6004 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6005 | "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] | 6006 | qdf_mem_free(pBaseMacAddr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6007 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6008 | } |
| 6009 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6010 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6011 | } |
| 6012 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6013 | /* |
| 6014 | * sme_set_tx_power() - |
| 6015 | * Set Transmit Power dynamically. |
| 6016 | * |
| 6017 | * hHal |
| 6018 | * sessionId Target Session ID |
| 6019 | * BSSID |
| 6020 | * dev_mode dev_mode such as station, P2PGO, SAP |
| 6021 | * dBm power to set |
| 6022 | * Return QDF_STATUS |
| 6023 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6024 | QDF_STATUS sme_set_tx_power(tHalHandle hHal, uint8_t sessionId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6025 | struct qdf_mac_addr pBSSId, |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 6026 | enum QDF_OPMODE dev_mode, int dBm) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6027 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 6028 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6029 | tpMaxTxPowerParams pTxParams = NULL; |
| 6030 | int8_t power = (int8_t) dBm; |
| 6031 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6032 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6033 | TRACE_CODE_SME_RX_HDD_SET_TXPOW, sessionId, 0)); |
| 6034 | |
| 6035 | /* make sure there is no overflow */ |
| 6036 | if ((int)power != dBm) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6037 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6038 | "%s: error, invalid power = %d", __func__, dBm); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6039 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6040 | } |
| 6041 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6042 | pTxParams = qdf_mem_malloc(sizeof(tMaxTxPowerParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6043 | if (NULL == pTxParams) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6044 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6045 | "%s: Not able to allocate memory for pTxParams", |
| 6046 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6047 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6048 | } |
| 6049 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 6050 | qdf_copy_macaddr(&pTxParams->bssId, &pBSSId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6051 | pTxParams->power = power; /* unit is dBm */ |
| 6052 | pTxParams->dev_mode = dev_mode; |
| 6053 | msg.type = WMA_SET_TX_POWER_REQ; |
| 6054 | msg.reserved = 0; |
| 6055 | msg.bodyptr = pTxParams; |
| 6056 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 6057 | if (QDF_STATUS_SUCCESS != scheduler_post_message(QDF_MODULE_ID_SME, |
| 6058 | QDF_MODULE_ID_WMA, |
| 6059 | QDF_MODULE_ID_WMA, |
| 6060 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6061 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6062 | "%s: failed to post WMA_SET_TX_POWER_REQ to WMA", |
| 6063 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6064 | qdf_mem_free(pTxParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6065 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6066 | } |
| 6067 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6068 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6069 | } |
| 6070 | |
Vignesh Viswanathan | 32761e4 | 2017-09-25 17:10:54 +0530 | [diff] [blame] | 6071 | QDF_STATUS sme_update_session_param(tHalHandle hal, uint8_t session_id, |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6072 | uint32_t param_type, uint32_t param_val) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6073 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6074 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6075 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6076 | uint16_t len; |
| 6077 | |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6078 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6079 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6080 | struct sir_update_session_param *msg; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 6081 | struct csr_roam_session *session = CSR_GET_SESSION(mac_ctx, |
| 6082 | session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6083 | |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6084 | if (!session) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6085 | sme_err("Session: %d not found", session_id); |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6086 | sme_release_global_lock(&mac_ctx->sme); |
| 6087 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6088 | } |
| 6089 | |
Selvaraj, Sridhar | 5b5a065 | 2017-05-04 11:23:07 +0530 | [diff] [blame] | 6090 | if (param_type == SIR_PARAM_IGNORE_ASSOC_DISALLOWED) |
| 6091 | mac_ctx->ignore_assoc_disallowed = param_val; |
| 6092 | |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6093 | if (!session->sessionActive) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6094 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6095 | |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6096 | len = sizeof(*msg); |
| 6097 | msg = qdf_mem_malloc(len); |
| 6098 | if (!msg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6099 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6100 | else { |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6101 | msg->message_type = eWNI_SME_SESSION_UPDATE_PARAM; |
| 6102 | msg->length = len; |
| 6103 | msg->session_id = session_id; |
| 6104 | msg->param_type = param_type; |
| 6105 | msg->param_val = param_val; |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 6106 | status = umac_send_mb_message_to_mac(msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6107 | } |
Selvaraj, Sridhar | 7231c5f | 2016-09-28 12:42:33 +0530 | [diff] [blame] | 6108 | sme_release_global_lock(&mac_ctx->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6109 | } |
| 6110 | return status; |
| 6111 | } |
| 6112 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6113 | /* |
| 6114 | * sme_set_tm_level() - |
| 6115 | * Set Thermal Mitigation Level to RIVA |
| 6116 | * |
| 6117 | * hHal - The handle returned by mac_open. |
| 6118 | * newTMLevel - new Thermal Mitigation Level |
| 6119 | * tmMode - Thermal Mitigation handle mode, default 0 |
| 6120 | * Return QDF_STATUS |
| 6121 | */ |
| 6122 | QDF_STATUS sme_set_tm_level(tHalHandle hHal, uint16_t newTMLevel, uint16_t |
| 6123 | tmMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6124 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6125 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 6126 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6127 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 6128 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6129 | tAniSetTmLevelReq *setTmLevelReq = NULL; |
| 6130 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6131 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6132 | TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0)); |
| 6133 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6134 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6135 | setTmLevelReq = |
| 6136 | (tAniSetTmLevelReq *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6137 | qdf_mem_malloc(sizeof(tAniSetTmLevelReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6138 | if (NULL == setTmLevelReq) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6139 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6140 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6141 | } |
| 6142 | |
| 6143 | setTmLevelReq->tmMode = tmMode; |
| 6144 | setTmLevelReq->newTmLevel = newTMLevel; |
| 6145 | |
| 6146 | /* serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 6147 | message.bodyptr = setTmLevelReq; |
| 6148 | message.type = WMA_SET_TM_LEVEL_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 6149 | 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] | 6150 | NO_SESSION, message.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 6151 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 6152 | QDF_MODULE_ID_WMA, |
| 6153 | QDF_MODULE_ID_WMA, |
| 6154 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6155 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6156 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6157 | "%s: Post Set TM Level MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6158 | qdf_mem_free(setTmLevelReq); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6159 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6160 | } |
| 6161 | sme_release_global_lock(&pMac->sme); |
| 6162 | } |
| 6163 | return status; |
| 6164 | } |
| 6165 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6166 | /* |
| 6167 | * sme_feature_caps_exchange() - SME interface to exchange capabilities between |
| 6168 | * Host and FW. |
| 6169 | * |
| 6170 | * hHal - HAL handle for device |
| 6171 | * Return NONE |
| 6172 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6173 | void sme_feature_caps_exchange(tHalHandle hHal) |
| 6174 | { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6175 | MTRACE(qdf_trace |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6176 | (QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_HDD_CAPS_EXCH, |
| 6177 | NO_SESSION, 0)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6178 | } |
| 6179 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6180 | /* |
| 6181 | * sme_disable_feature_capablity() - SME interface to disable Active mode |
| 6182 | * offload capablity in Host. |
| 6183 | * |
| 6184 | * hHal - HAL handle for device |
| 6185 | * Return NONE |
| 6186 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6187 | void sme_disable_feature_capablity(uint8_t feature_index) |
| 6188 | { |
| 6189 | } |
| 6190 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6191 | /* |
| 6192 | * sme_reset_power_values_for5_g |
| 6193 | * Reset the power values for 5G band with default power values. |
| 6194 | * |
| 6195 | * hHal - HAL handle for device |
| 6196 | * Return NONE |
| 6197 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6198 | void sme_reset_power_values_for5_g(tHalHandle hHal) |
| 6199 | { |
| 6200 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6201 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6202 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6203 | TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0)); |
| 6204 | csr_save_channel_power_for_band(pMac, true); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6205 | /* Store the channel+power info in the global place: Cfg */ |
| 6206 | csr_apply_power2_current(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6207 | } |
| 6208 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6209 | /* |
| 6210 | * sme_update_roam_prefer5_g_hz() - |
| 6211 | * Enable/disable Roam prefer 5G runtime option |
| 6212 | * This function is called through dynamic setConfig callback function |
| 6213 | * to configure the Roam prefer 5G runtime option |
| 6214 | * |
| 6215 | * hHal - HAL handle for device |
| 6216 | * nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option |
| 6217 | * Return Success or failure |
| 6218 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6219 | |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 6220 | QDF_STATUS sme_update_roam_prefer5_g_hz(tHalHandle hHal, |
| 6221 | bool nRoamPrefer5GHz) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6222 | { |
| 6223 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6224 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6225 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6226 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6227 | TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0)); |
| 6228 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6229 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 6230 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6231 | "%s: gRoamPrefer5GHz is changed from %d to %d", |
| 6232 | __func__, pMac->roam.configParam.nRoamPrefer5GHz, |
| 6233 | nRoamPrefer5GHz); |
| 6234 | pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz; |
| 6235 | sme_release_global_lock(&pMac->sme); |
| 6236 | } |
| 6237 | |
| 6238 | return status; |
| 6239 | } |
| 6240 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6241 | /* |
| 6242 | * sme_set_roam_intra_band() - |
| 6243 | * enable/disable Intra band roaming |
| 6244 | * This function is called through dynamic setConfig callback function |
| 6245 | * to configure the intra band roaming |
| 6246 | * hHal - HAL handle for device |
| 6247 | * nRoamIntraBand Enable/Disable Intra band roaming |
| 6248 | * Return Success or failure |
| 6249 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6250 | QDF_STATUS sme_set_roam_intra_band(tHalHandle hHal, const bool nRoamIntraBand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6251 | { |
| 6252 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6253 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6254 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6255 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6256 | TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0)); |
| 6257 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6258 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 6259 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6260 | "%s: gRoamIntraBand is changed from %d to %d", |
| 6261 | __func__, pMac->roam.configParam.nRoamIntraBand, |
| 6262 | nRoamIntraBand); |
| 6263 | pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand; |
| 6264 | sme_release_global_lock(&pMac->sme); |
| 6265 | } |
| 6266 | |
| 6267 | return status; |
| 6268 | } |
| 6269 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6270 | /* |
| 6271 | * sme_update_roam_scan_n_probes() - |
| 6272 | * Function to update roam scan N probes |
| 6273 | * This function is called through dynamic setConfig callback function |
| 6274 | * to update roam scan N probes |
| 6275 | * hHal - HAL handle for device |
| 6276 | * sessionId - Session Identifier |
| 6277 | * nProbes number of probe requests to be sent out |
| 6278 | * Return Success or failure |
| 6279 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6280 | 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] | 6281 | const uint8_t nProbes) |
| 6282 | { |
| 6283 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6284 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6285 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6286 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6287 | TRACE_CODE_SME_RX_HDD_UPDATE_ROAM_SCAN_N_PROBES, |
| 6288 | NO_SESSION, 0)); |
| 6289 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6290 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 6291 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6292 | "%s: gRoamScanNProbes is changed from %d to %d", |
| 6293 | __func__, pMac->roam.configParam.nProbes, nProbes); |
| 6294 | pMac->roam.configParam.nProbes = nProbes; |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 6295 | |
| 6296 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 6297 | csr_roam_offload_scan(pMac, sessionId, |
| 6298 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 6299 | REASON_NPROBES_CHANGED); |
| 6300 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6301 | sme_release_global_lock(&pMac->sme); |
| 6302 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6303 | return status; |
| 6304 | } |
| 6305 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6306 | /* |
| 6307 | * sme_update_roam_scan_home_away_time() - |
| 6308 | * Function to update roam scan Home away time |
| 6309 | * This function is called through dynamic setConfig callback function |
| 6310 | * to update roam scan home away time |
| 6311 | * |
| 6312 | * hHal - HAL handle for device |
| 6313 | * sessionId - Session Identifier |
| 6314 | * nRoamScanAwayTime Scan home away time |
| 6315 | * bSendOffloadCmd If true then send offload command to firmware |
| 6316 | * If false then command is not sent to firmware |
| 6317 | * Return Success or failure |
| 6318 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6319 | QDF_STATUS sme_update_roam_scan_home_away_time(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6320 | uint8_t sessionId, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6321 | const uint16_t nRoamScanHomeAwayTime, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6322 | const bool bSendOffloadCmd) |
| 6323 | { |
| 6324 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6325 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6326 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6327 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6328 | TRACE_CODE_SME_RX_HDD_UPDATE_ROAM_SCAN_HOME_AWAY_TIME, |
| 6329 | NO_SESSION, 0)); |
| 6330 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6331 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 6332 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6333 | "%s: gRoamScanHomeAwayTime is changed from %d to %d", |
| 6334 | __func__, |
| 6335 | pMac->roam.configParam.nRoamScanHomeAwayTime, |
| 6336 | nRoamScanHomeAwayTime); |
| 6337 | pMac->roam.configParam.nRoamScanHomeAwayTime = |
| 6338 | nRoamScanHomeAwayTime; |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 6339 | |
| 6340 | if (pMac->roam.configParam.isRoamOffloadScanEnabled && |
| 6341 | bSendOffloadCmd) { |
| 6342 | csr_roam_offload_scan(pMac, sessionId, |
| 6343 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 6344 | REASON_HOME_AWAY_TIME_CHANGED); |
| 6345 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6346 | sme_release_global_lock(&pMac->sme); |
| 6347 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6348 | return status; |
| 6349 | } |
| 6350 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6351 | /** |
| 6352 | * sme_ext_change_channel()- function to post send ECSA |
| 6353 | * action frame to csr. |
| 6354 | * @hHal: Hal context |
| 6355 | * @channel: new channel to switch |
| 6356 | * @session_id: senssion it should be sent on. |
| 6357 | * |
| 6358 | * This function is called to post ECSA frame to csr. |
| 6359 | * |
| 6360 | * Return: success if msg is sent else return failure |
| 6361 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6362 | QDF_STATUS sme_ext_change_channel(tHalHandle h_hal, uint32_t channel, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6363 | uint8_t session_id) |
| 6364 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6365 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6366 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(h_hal); |
| 6367 | uint8_t channel_state; |
| 6368 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6369 | sme_err("Set Channel: %d", channel); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6370 | channel_state = |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 6371 | wlan_reg_get_channel_state(mac_ctx->pdev, channel); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6372 | |
| 6373 | if (CHANNEL_STATE_DISABLE == channel_state) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6374 | sme_err("Invalid channel: %d", channel); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6375 | return QDF_STATUS_E_INVAL; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6376 | } |
| 6377 | |
| 6378 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 6379 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6380 | if (QDF_STATUS_SUCCESS == status) { |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 6381 | /* update the channel list to the firmware */ |
| 6382 | status = csr_send_ext_change_channel(mac_ctx, |
| 6383 | channel, session_id); |
| 6384 | sme_release_global_lock(&mac_ctx->sme); |
| 6385 | } |
| 6386 | |
| 6387 | return status; |
| 6388 | } |
| 6389 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6390 | /* |
| 6391 | * sme_get_roam_intra_band() - |
| 6392 | * get Intra band roaming |
| 6393 | * |
| 6394 | * hHal - HAL handle for device |
| 6395 | * Return Success or failure |
| 6396 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6397 | bool sme_get_roam_intra_band(tHalHandle hHal) |
| 6398 | { |
| 6399 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6400 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6401 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6402 | TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0)); |
| 6403 | return pMac->roam.configParam.nRoamIntraBand; |
| 6404 | } |
| 6405 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6406 | /* |
| 6407 | * sme_get_roam_scan_n_probes() - |
| 6408 | * get N Probes |
| 6409 | * |
| 6410 | * hHal - HAL handle for device |
| 6411 | * Return Success or failure |
| 6412 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6413 | uint8_t sme_get_roam_scan_n_probes(tHalHandle hHal) |
| 6414 | { |
| 6415 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6416 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6417 | return pMac->roam.configParam.nProbes; |
| 6418 | } |
| 6419 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6420 | /* |
| 6421 | * sme_get_roam_scan_home_away_time() - |
| 6422 | * get Roam scan home away time |
| 6423 | * |
| 6424 | * hHal - HAL handle for device |
| 6425 | * Return Success or failure |
| 6426 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6427 | uint16_t sme_get_roam_scan_home_away_time(tHalHandle hHal) |
| 6428 | { |
| 6429 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6430 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6431 | return pMac->roam.configParam.nRoamScanHomeAwayTime; |
| 6432 | } |
| 6433 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6434 | /* |
| 6435 | * sme_update_roam_rssi_diff() - |
| 6436 | * Update RoamRssiDiff |
| 6437 | * This function is called through dynamic setConfig callback function |
| 6438 | * to configure RoamRssiDiff |
| 6439 | * Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125] |
| 6440 | * |
| 6441 | * hHal - HAL handle for device |
| 6442 | * sessionId - Session Identifier |
| 6443 | * RoamRssiDiff - minimum rssi difference between potential |
| 6444 | * candidate and current AP. |
| 6445 | * Return Success or failure |
| 6446 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6447 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6448 | QDF_STATUS sme_update_roam_rssi_diff(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6449 | uint8_t RoamRssiDiff) |
| 6450 | { |
| 6451 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6452 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6453 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 6454 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 6455 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 6456 | FL("Invalid sme session id: %d"), sessionId); |
| 6457 | return QDF_STATUS_E_INVAL; |
| 6458 | } |
| 6459 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6460 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6461 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6462 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6463 | "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %s", |
| 6464 | RoamRssiDiff, |
| 6465 | pMac->roam.configParam.RoamRssiDiff, |
| 6466 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 6467 | neighborRoamInfo |
| 6468 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6469 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6470 | pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff; |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 6471 | |
| 6472 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 6473 | csr_roam_offload_scan(pMac, sessionId, |
| 6474 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 6475 | REASON_RSSI_DIFF_CHANGED); |
| 6476 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6477 | sme_release_global_lock(&pMac->sme); |
| 6478 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6479 | return status; |
| 6480 | } |
| 6481 | |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 6482 | #ifdef WLAN_FEATURE_FILS_SK |
| 6483 | QDF_STATUS sme_update_fils_config(tHalHandle hal, uint8_t session_id, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 6484 | struct csr_roam_profile *src_profile) |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 6485 | { |
| 6486 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 6487 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 6488 | tpCsrNeighborRoamControlInfo neighbor_roam_info = |
| 6489 | &mac->roam.neighborRoamInfo[session_id]; |
| 6490 | |
| 6491 | if (session_id >= CSR_ROAM_SESSION_MAX) { |
| 6492 | sme_err("Invalid sme session id: %d", session_id); |
| 6493 | return QDF_STATUS_E_INVAL; |
| 6494 | } |
| 6495 | |
| 6496 | if (!src_profile) { |
| 6497 | sme_err("src roam profile NULL"); |
| 6498 | return QDF_STATUS_E_INVAL; |
| 6499 | } |
| 6500 | |
| 6501 | if (!mac->roam.configParam.isFastRoamIniFeatureEnabled || |
| 6502 | (neighbor_roam_info->neighborRoamState != |
| 6503 | eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)) { |
| 6504 | sme_info("Fast roam is disabled or not connected(%d)", |
| 6505 | neighbor_roam_info->neighborRoamState); |
| 6506 | return QDF_STATUS_E_PERM; |
| 6507 | } |
| 6508 | |
| 6509 | csr_update_fils_config(mac, session_id, src_profile); |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 6510 | if (csr_roamIsRoamOffloadEnabled(mac)) { |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 6511 | status = sme_acquire_global_lock(&mac->sme); |
| 6512 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 6513 | sme_debug("Updating fils config to fw"); |
| 6514 | csr_roam_offload_scan(mac, session_id, |
| 6515 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 6516 | REASON_FILS_PARAMS_CHANGED); |
| 6517 | sme_release_global_lock(&mac->sme); |
| 6518 | } else { |
| 6519 | sme_err("Failed to acquire SME lock"); |
| 6520 | } |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 6521 | } else { |
| 6522 | sme_info("LFR3 not enabled"); |
| 6523 | return QDF_STATUS_E_INVAL; |
| 6524 | } |
| 6525 | |
| 6526 | return status; |
| 6527 | } |
| 6528 | |
| 6529 | void sme_send_hlp_ie_info(tHalHandle hal, uint8_t session_id, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 6530 | struct csr_roam_profile *profile, uint32_t if_addr) |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 6531 | { |
| 6532 | int i; |
| 6533 | struct scheduler_msg msg; |
| 6534 | QDF_STATUS status; |
| 6535 | struct hlp_params *params; |
| 6536 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 6537 | struct csr_roam_session *session = CSR_GET_SESSION(mac, session_id); |
| 6538 | tpCsrNeighborRoamControlInfo neighbor_roam_info = |
| 6539 | &mac->roam.neighborRoamInfo[session_id]; |
| 6540 | |
| 6541 | if (!session) { |
| 6542 | sme_err("session NULL"); |
| 6543 | return; |
| 6544 | } |
| 6545 | |
| 6546 | if (!mac->roam.configParam.isFastRoamIniFeatureEnabled || |
| 6547 | (neighbor_roam_info->neighborRoamState != |
| 6548 | eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)) { |
| 6549 | sme_debug("Fast roam is disabled or not connected(%d)", |
| 6550 | neighbor_roam_info->neighborRoamState); |
| 6551 | return; |
| 6552 | } |
| 6553 | |
| 6554 | params = qdf_mem_malloc(sizeof(*params)); |
| 6555 | if (!params) { |
| 6556 | sme_err("Mem alloc for HLP IE fails"); |
| 6557 | return; |
| 6558 | } |
| 6559 | if ((profile->hlp_ie_len + |
| 6560 | SIR_IPV4_ADDR_LEN) > FILS_MAX_HLP_DATA_LEN) { |
| 6561 | sme_err("HLP IE len exceeds %d", |
| 6562 | profile->hlp_ie_len); |
| 6563 | qdf_mem_free(params); |
| 6564 | return; |
| 6565 | } |
| 6566 | |
| 6567 | params->vdev_id = session_id; |
| 6568 | params->hlp_ie_len = profile->hlp_ie_len + SIR_IPV4_ADDR_LEN; |
| 6569 | |
| 6570 | for (i = 0; i < SIR_IPV4_ADDR_LEN; i++) |
| 6571 | params->hlp_ie[i] = (if_addr >> (i * 8)) & 0xFF; |
| 6572 | |
| 6573 | qdf_mem_copy(params->hlp_ie + SIR_IPV4_ADDR_LEN, |
| 6574 | profile->hlp_ie, profile->hlp_ie_len); |
| 6575 | |
| 6576 | msg.type = SIR_HAL_HLP_IE_INFO; |
| 6577 | msg.reserved = 0; |
| 6578 | msg.bodyptr = params; |
| 6579 | status = sme_acquire_global_lock(&mac->sme); |
| 6580 | if (status != QDF_STATUS_SUCCESS) { |
| 6581 | sme_err("sme lock acquire fails"); |
| 6582 | qdf_mem_free(params); |
| 6583 | return; |
| 6584 | } |
| 6585 | |
| 6586 | if (!QDF_IS_STATUS_SUCCESS |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 6587 | (scheduler_post_message(QDF_MODULE_ID_SME, |
| 6588 | QDF_MODULE_ID_WMA, |
| 6589 | QDF_MODULE_ID_WMA, &msg))) { |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 6590 | sme_err("Not able to post WMA_HLP_IE_INFO message to HAL"); |
| 6591 | sme_release_global_lock(&mac->sme); |
| 6592 | qdf_mem_free(params); |
| 6593 | return; |
| 6594 | } |
| 6595 | |
| 6596 | sme_release_global_lock(&mac->sme); |
| 6597 | } |
| 6598 | |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 6599 | 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] | 6600 | { |
| 6601 | struct fils_join_rsp_params *roam_fils_params; |
| 6602 | |
| 6603 | if (!roam_info) { |
| 6604 | sme_err("FILS Roam Info NULL"); |
| 6605 | return; |
| 6606 | } |
| 6607 | |
| 6608 | roam_fils_params = roam_info->fils_join_rsp; |
| 6609 | if (!roam_fils_params) { |
| 6610 | sme_err("FILS Roam Param NULL"); |
| 6611 | return; |
| 6612 | } |
| 6613 | |
| 6614 | if (roam_fils_params->fils_pmk) |
| 6615 | qdf_mem_free(roam_fils_params->fils_pmk); |
| 6616 | |
| 6617 | qdf_mem_free(roam_fils_params); |
| 6618 | |
| 6619 | roam_info->fils_join_rsp = NULL; |
| 6620 | } |
| 6621 | |
| 6622 | #else |
| 6623 | inline void sme_send_hlp_ie_info(tHalHandle hal, uint8_t session_id, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 6624 | struct csr_roam_profile *profile, uint32_t if_addr) |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 6625 | {} |
| 6626 | #endif |
| 6627 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6628 | /* |
| 6629 | * sme_update_fast_transition_enabled() - enable/disable Fast Transition |
| 6630 | * support at runtime |
| 6631 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 6632 | * isFastTransitionEnabled. |
| 6633 | * This is a synchronous call |
| 6634 | * |
| 6635 | * hHal - The handle returned by mac_open. |
| 6636 | * Return QDF_STATUS_SUCCESS - SME update isFastTransitionEnabled config |
| 6637 | * successfully. |
| 6638 | * Other status means SME is failed to update isFastTransitionEnabled. |
| 6639 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6640 | QDF_STATUS sme_update_fast_transition_enabled(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6641 | bool isFastTransitionEnabled) |
| 6642 | { |
| 6643 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6644 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6645 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6646 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6647 | TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, |
| 6648 | 0)); |
| 6649 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6650 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 6651 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6652 | "%s: FastTransitionEnabled is changed from %d to %d", |
| 6653 | __func__, |
| 6654 | pMac->roam.configParam.isFastTransitionEnabled, |
| 6655 | isFastTransitionEnabled); |
| 6656 | pMac->roam.configParam.isFastTransitionEnabled = |
| 6657 | isFastTransitionEnabled; |
| 6658 | sme_release_global_lock(&pMac->sme); |
| 6659 | } |
| 6660 | |
| 6661 | return status; |
| 6662 | } |
| 6663 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6664 | /* |
| 6665 | * sme_update_wes_mode() - |
| 6666 | * Update WES Mode |
| 6667 | * This function is called through dynamic setConfig callback function |
| 6668 | * to configure isWESModeEnabled |
| 6669 | * |
| 6670 | * hHal - HAL handle for device |
| 6671 | * isWESModeEnabled - WES mode |
| 6672 | * sessionId - Session Identifier |
| 6673 | * Return QDF_STATUS_SUCCESS - SME update isWESModeEnabled config successfully. |
| 6674 | * Other status means SME is failed to update isWESModeEnabled. |
| 6675 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6676 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6677 | QDF_STATUS sme_update_wes_mode(tHalHandle hHal, bool isWESModeEnabled, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6678 | uint8_t sessionId) |
| 6679 | { |
| 6680 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6681 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6682 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 6683 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 6684 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 6685 | FL("Invalid sme session id: %d"), sessionId); |
| 6686 | return QDF_STATUS_E_INVAL; |
| 6687 | } |
| 6688 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6689 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6690 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6691 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6692 | "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %s", |
| 6693 | isWESModeEnabled, |
| 6694 | pMac->roam.configParam.isWESModeEnabled, |
| 6695 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 6696 | neighborRoamInfo |
| 6697 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6698 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6699 | pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled; |
| 6700 | sme_release_global_lock(&pMac->sme); |
| 6701 | } |
| 6702 | |
| 6703 | return status; |
| 6704 | } |
| 6705 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6706 | /* |
| 6707 | * sme_set_roam_scan_control() - |
| 6708 | * Set roam scan control |
| 6709 | * This function is called to set roam scan control |
| 6710 | * if roam scan control is set to 0, roaming scan cache is cleared |
| 6711 | * any value other than 0 is treated as invalid value |
| 6712 | * hHal - HAL handle for device |
| 6713 | * sessionId - Session Identifier |
| 6714 | * Return QDF_STATUS_SUCCESS - SME update config successfully. |
| 6715 | * Other status means SME failure to update |
| 6716 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6717 | QDF_STATUS sme_set_roam_scan_control(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6718 | bool roamScanControl) |
| 6719 | { |
| 6720 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6721 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6722 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6723 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6724 | TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0)); |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 6725 | |
| 6726 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 6727 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 6728 | FL("Invalid sme session id: %d"), sessionId); |
| 6729 | return QDF_STATUS_E_INVAL; |
| 6730 | } |
| 6731 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6732 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6733 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6734 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6735 | "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %s", |
| 6736 | roamScanControl, |
| 6737 | pMac->roam.configParam.nRoamScanControl, |
| 6738 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 6739 | neighborRoamInfo |
| 6740 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6741 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6742 | pMac->roam.configParam.nRoamScanControl = roamScanControl; |
| 6743 | if (0 == roamScanControl) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6744 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6745 | "LFR runtime successfully cleared roam scan cache"); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6746 | csr_flush_cfg_bg_scan_roam_channel_list(pMac, |
| 6747 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6748 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 6749 | csr_roam_offload_scan(pMac, sessionId, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6750 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 6751 | REASON_FLUSH_CHANNEL_LIST); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6752 | } |
| 6753 | } |
| 6754 | sme_release_global_lock(&pMac->sme); |
| 6755 | } |
| 6756 | return status; |
| 6757 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6758 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6759 | /* |
| 6760 | * sme_update_is_fast_roam_ini_feature_enabled() - enable/disable LFR |
| 6761 | * support at runtime |
| 6762 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 6763 | * isFastRoamIniFeatureEnabled. |
| 6764 | * This is a synchronous call |
| 6765 | * |
| 6766 | * hHal - The handle returned by mac_open. |
| 6767 | * sessionId - Session Identifier |
| 6768 | * Return QDF_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config |
| 6769 | * successfully. |
| 6770 | * Other status means SME is failed to update isFastRoamIniFeatureEnabled. |
| 6771 | */ |
| 6772 | QDF_STATUS sme_update_is_fast_roam_ini_feature_enabled(tHalHandle hHal, |
| 6773 | uint8_t sessionId, const bool isFastRoamIniFeatureEnabled) |
| 6774 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6775 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6776 | |
| 6777 | if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == |
| 6778 | isFastRoamIniFeatureEnabled) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6779 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6780 | "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", |
| 6781 | __func__, |
| 6782 | pMac->roam.configParam.isFastRoamIniFeatureEnabled, |
| 6783 | isFastRoamIniFeatureEnabled); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6784 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6785 | } |
| 6786 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6787 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6788 | "%s: FastRoamEnabled is changed from %d to %d", __func__, |
| 6789 | pMac->roam.configParam.isFastRoamIniFeatureEnabled, |
| 6790 | isFastRoamIniFeatureEnabled); |
| 6791 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = |
| 6792 | isFastRoamIniFeatureEnabled; |
| 6793 | csr_neighbor_roam_update_fast_roaming_enabled(pMac, sessionId, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6794 | isFastRoamIniFeatureEnabled); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6795 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6796 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6797 | } |
| 6798 | |
Mukul Sharma | 69c44cd | 2016-09-12 18:33:57 +0530 | [diff] [blame] | 6799 | /** |
| 6800 | * sme_config_fast_roaming() - enable/disable LFR support at runtime |
| 6801 | * @hal - The handle returned by macOpen. |
| 6802 | * @session_id - Session Identifier |
| 6803 | * @is_fast_roam_enabled - flag to enable/disable roaming |
| 6804 | * |
| 6805 | * When Supplicant issues enabled/disable fast roaming on the basis |
| 6806 | * of the Bssid modification in network block (e.g. AutoJoin mode N/W block) |
| 6807 | * |
| 6808 | * Return: QDF_STATUS |
| 6809 | */ |
| 6810 | |
| 6811 | QDF_STATUS sme_config_fast_roaming(tHalHandle hal, uint8_t session_id, |
| 6812 | const bool is_fast_roam_enabled) |
| 6813 | { |
| 6814 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 6815 | struct csr_roam_session *session = CSR_GET_SESSION(mac_ctx, session_id); |
Mukul Sharma | 69c44cd | 2016-09-12 18:33:57 +0530 | [diff] [blame] | 6816 | QDF_STATUS status; |
| 6817 | |
Varun Reddy Yeturu | e5a35d1 | 2017-10-20 11:26:57 -0700 | [diff] [blame] | 6818 | /* |
| 6819 | * supplicant_disabled_roaming flag is set to true in |
| 6820 | * wlan_hdd_cfg80211_connect_start when supplicant initiate connect |
| 6821 | * request with BSSID. This flag is reset when supplicant sends |
| 6822 | * vendor command to enable roaming after association. |
Arif Hussain | a48a9c0 | 2017-01-31 14:37:45 -0800 | [diff] [blame] | 6823 | * |
| 6824 | * This request from wpa_supplicant will be skipped in this function |
Varun Reddy Yeturu | e5a35d1 | 2017-10-20 11:26:57 -0700 | [diff] [blame] | 6825 | * if roaming is disabled using driver command or INI and |
| 6826 | * supplicant_disabled_roaming flag remains set. So make sure to set |
| 6827 | * supplicant_disabled_roaming flag as per wpa_supplicant even if roam |
| 6828 | * request from wpa_supplicant ignored. |
Arif Hussain | a48a9c0 | 2017-01-31 14:37:45 -0800 | [diff] [blame] | 6829 | */ |
| 6830 | if (session && session->pCurRoamProfile) |
Varun Reddy Yeturu | e5a35d1 | 2017-10-20 11:26:57 -0700 | [diff] [blame] | 6831 | session->pCurRoamProfile->supplicant_disabled_roaming = |
| 6832 | !is_fast_roam_enabled; |
Arif Hussain | a48a9c0 | 2017-01-31 14:37:45 -0800 | [diff] [blame] | 6833 | |
Mukul Sharma | 69c44cd | 2016-09-12 18:33:57 +0530 | [diff] [blame] | 6834 | if (!mac_ctx->roam.configParam.isFastRoamIniFeatureEnabled) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6835 | sme_debug("Fast roam is disabled through ini"); |
Mukul Sharma | 69c44cd | 2016-09-12 18:33:57 +0530 | [diff] [blame] | 6836 | if (!is_fast_roam_enabled) |
| 6837 | return QDF_STATUS_SUCCESS; |
| 6838 | return QDF_STATUS_E_FAILURE; |
| 6839 | } |
Sreelakshmi Konamki | bda5bbf | 2016-09-12 18:38:10 +0530 | [diff] [blame] | 6840 | |
Mukul Sharma | 69c44cd | 2016-09-12 18:33:57 +0530 | [diff] [blame] | 6841 | status = csr_neighbor_roam_update_fast_roaming_enabled(mac_ctx, |
| 6842 | session_id, is_fast_roam_enabled); |
| 6843 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 6844 | sme_err("update fast roaming failed. status: %d", status); |
Mukul Sharma | 69c44cd | 2016-09-12 18:33:57 +0530 | [diff] [blame] | 6845 | return QDF_STATUS_E_FAILURE; |
| 6846 | } |
| 6847 | |
| 6848 | return QDF_STATUS_SUCCESS; |
| 6849 | } |
| 6850 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6851 | /* |
| 6852 | * sme_update_is_mawc_ini_feature_enabled() - |
| 6853 | * Enable/disable LFR MAWC support at runtime |
| 6854 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 6855 | * isMAWCIniFeatureEnabled. |
| 6856 | * This is a synchronous call |
| 6857 | * |
| 6858 | * hHal - The handle returned by mac_open. |
| 6859 | * Return QDF_STATUS_SUCCESS - SME update MAWCEnabled config successfully. |
| 6860 | * Other status means SME is failed to update MAWCEnabled. |
| 6861 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6862 | QDF_STATUS sme_update_is_mawc_ini_feature_enabled(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6863 | const bool MAWCEnabled) |
| 6864 | { |
| 6865 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6866 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6867 | |
| 6868 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6869 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 6870 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6871 | "%s: MAWCEnabled is changed from %d to %d", __func__, |
Varun Reddy Yeturu | 061d4d6 | 2017-07-20 09:39:32 -0700 | [diff] [blame] | 6872 | pMac->roam.configParam.csr_mawc_config.mawc_enabled, |
| 6873 | MAWCEnabled); |
| 6874 | pMac->roam.configParam.csr_mawc_config.mawc_enabled = |
| 6875 | MAWCEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6876 | sme_release_global_lock(&pMac->sme); |
| 6877 | } |
| 6878 | |
| 6879 | return status; |
| 6880 | |
| 6881 | } |
| 6882 | |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 6883 | /** |
| 6884 | * sme_stop_roaming() - Stop roaming for a given sessionId |
| 6885 | * This is a synchronous call |
| 6886 | * |
| 6887 | * @hHal - The handle returned by mac_open |
| 6888 | * @sessionId - Session Identifier |
| 6889 | * |
| 6890 | * Return QDF_STATUS_SUCCESS on success |
| 6891 | * Other status on failure |
| 6892 | */ |
| 6893 | 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] | 6894 | { |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 6895 | struct scheduler_msg wma_msg = {0}; |
Jeff Johnson | c09caa4 | 2018-06-07 22:58:55 -0700 | [diff] [blame] | 6896 | QDF_STATUS status; |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 6897 | tSirRoamOffloadScanReq *req; |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 6898 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 6899 | tpCsrNeighborRoamControlInfo roam_info; |
Varun Reddy Yeturu | e5a35d1 | 2017-10-20 11:26:57 -0700 | [diff] [blame] | 6900 | struct csr_roam_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6901 | |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 6902 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 6903 | sme_err("incorrect session/vdev ID"); |
| 6904 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6905 | } |
Varun Reddy Yeturu | e5a35d1 | 2017-10-20 11:26:57 -0700 | [diff] [blame] | 6906 | |
| 6907 | session = CSR_GET_SESSION(mac_ctx, session_id); |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 6908 | |
Padma, Santhosh Kumar | 86747ec | 2018-05-29 18:28:29 +0530 | [diff] [blame] | 6909 | /* |
| 6910 | * set the driver_disabled_roaming flag to true even if roaming |
| 6911 | * is not enabled on this session so that roam start requests for |
| 6912 | * this session can be blocked until driver enables roaming |
| 6913 | */ |
Vignesh Viswanathan | 3d47803 | 2018-08-02 20:18:53 +0530 | [diff] [blame] | 6914 | if (reason == ecsr_driver_disabled && session->pCurRoamProfile && |
| 6915 | session->pCurRoamProfile->csrPersona == QDF_STA_MODE) { |
Padma, Santhosh Kumar | 86747ec | 2018-05-29 18:28:29 +0530 | [diff] [blame] | 6916 | session->pCurRoamProfile->driver_disabled_roaming = true; |
| 6917 | sme_debug("driver_disabled_roaming set for session %d", |
| 6918 | session_id); |
| 6919 | } |
| 6920 | |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 6921 | roam_info = &mac_ctx->roam.neighborRoamInfo[session_id]; |
| 6922 | if (!roam_info->b_roam_scan_offload_started) { |
| 6923 | sme_debug("Roaming already disabled for session %d", session_id); |
Varun Reddy Yeturu | e5a35d1 | 2017-10-20 11:26:57 -0700 | [diff] [blame] | 6924 | return QDF_STATUS_SUCCESS; |
| 6925 | } |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 6926 | req = qdf_mem_malloc(sizeof(*req)); |
| 6927 | if (!req) { |
| 6928 | sme_err("failed to allocated memory"); |
| 6929 | return QDF_STATUS_E_NOMEM; |
| 6930 | } |
| 6931 | |
| 6932 | req->Command = ROAM_SCAN_OFFLOAD_STOP; |
Padma, Santhosh Kumar | 86747ec | 2018-05-29 18:28:29 +0530 | [diff] [blame] | 6933 | if ((reason == eCsrForcedDisassoc) || reason == ecsr_driver_disabled) |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 6934 | req->reason = REASON_ROAM_STOP_ALL; |
| 6935 | else |
Varun Reddy Yeturu | bc1bea0 | 2018-02-01 18:12:34 -0800 | [diff] [blame] | 6936 | req->reason = REASON_SME_ISSUED; |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 6937 | req->sessionId = session_id; |
| 6938 | if (csr_neighbor_middle_of_roaming(mac_ctx, session_id)) |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 6939 | req->middle_of_roaming = 1; |
| 6940 | else |
| 6941 | csr_roam_reset_roam_params(mac_ctx); |
| 6942 | |
| 6943 | wma_msg.type = WMA_ROAM_SCAN_OFFLOAD_REQ; |
| 6944 | wma_msg.bodyptr = req; |
| 6945 | |
| 6946 | status = wma_post_ctrl_msg(mac_ctx, &wma_msg); |
Jeff Johnson | c09caa4 | 2018-06-07 22:58:55 -0700 | [diff] [blame] | 6947 | if (QDF_STATUS_SUCCESS != status) { |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 6948 | sme_err("WMA_ROAM_SCAN_OFFLOAD_REQ failed, session_id: %d", |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 6949 | session_id); |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 6950 | qdf_mem_free(req); |
| 6951 | return QDF_STATUS_E_FAULT; |
| 6952 | } |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 6953 | roam_info->b_roam_scan_offload_started = false; |
| 6954 | roam_info->last_sent_cmd = ROAM_SCAN_OFFLOAD_STOP; |
Naveen Rawat | 5c35ae4 | 2017-04-18 15:35:07 -0700 | [diff] [blame] | 6955 | |
| 6956 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6957 | } |
| 6958 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6959 | /* |
| 6960 | * sme_start_roaming() - Start roaming for a given sessionId |
| 6961 | * This is a synchronous call |
| 6962 | * |
| 6963 | * hHal - The handle returned by mac_open |
| 6964 | * sessionId - Session Identifier |
| 6965 | * Return QDF_STATUS_SUCCESS on success |
| 6966 | * Other status on failure |
| 6967 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6968 | 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] | 6969 | { |
| 6970 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6971 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6972 | |
| 6973 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6974 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6975 | csr_roam_offload_scan(pMac, sessionId, ROAM_SCAN_OFFLOAD_START, |
| 6976 | reason); |
| 6977 | sme_release_global_lock(&pMac->sme); |
| 6978 | } |
| 6979 | |
| 6980 | return status; |
| 6981 | } |
| 6982 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6983 | /* |
| 6984 | * sme_update_enable_fast_roam_in_concurrency() - enable/disable LFR if |
| 6985 | * Concurrent session exists |
| 6986 | * This is a synchronuous call |
| 6987 | * |
| 6988 | * hHal - The handle returned by mac_open. |
| 6989 | * Return QDF_STATUS_SUCCESS |
| 6990 | * Other status means SME is failed |
| 6991 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6992 | QDF_STATUS sme_update_enable_fast_roam_in_concurrency(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6993 | bool |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 6994 | bFastRoamInConIniFeatureEnabled) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6995 | { |
| 6996 | |
| 6997 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6998 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6999 | |
| 7000 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7001 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7002 | pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = |
| 7003 | bFastRoamInConIniFeatureEnabled; |
| 7004 | if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 7005 | pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = |
| 7006 | 0; |
| 7007 | } |
| 7008 | sme_release_global_lock(&pMac->sme); |
| 7009 | } |
| 7010 | |
| 7011 | return status; |
| 7012 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7013 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7014 | /* |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7015 | * sme_set_roam_opportunistic_scan_threshold_diff() - |
| 7016 | * Update Opportunistic Scan threshold diff |
| 7017 | * This function is called through dynamic setConfig callback function |
| 7018 | * to configure nOpportunisticThresholdDiff |
| 7019 | * |
| 7020 | * hHal - HAL handle for device |
| 7021 | * sessionId - Session Identifier |
| 7022 | * nOpportunisticThresholdDiff - Opportunistic Scan threshold diff |
| 7023 | * Return QDF_STATUS_SUCCESS - SME update nOpportunisticThresholdDiff config |
| 7024 | * successfully. |
| 7025 | * else SME is failed to update nOpportunisticThresholdDiff. |
| 7026 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7027 | QDF_STATUS sme_set_roam_opportunistic_scan_threshold_diff(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7028 | uint8_t sessionId, |
| 7029 | const uint8_t |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7030 | nOpportunisticThresholdDiff) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7031 | { |
| 7032 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7033 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7034 | |
| 7035 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7036 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 7037 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 7038 | nOpportunisticThresholdDiff, |
| 7039 | REASON_OPPORTUNISTIC_THRESH_DIFF_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7040 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7041 | pMac->roam.configParam.neighborRoamConfig. |
| 7042 | nOpportunisticThresholdDiff = |
| 7043 | nOpportunisticThresholdDiff; |
| 7044 | } |
| 7045 | sme_release_global_lock(&pMac->sme); |
| 7046 | } |
| 7047 | return status; |
| 7048 | } |
| 7049 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7050 | /* |
| 7051 | * sme_get_roam_opportunistic_scan_threshold_diff() |
| 7052 | * gets Opportunistic Scan threshold diff |
| 7053 | * This is a synchronous call |
| 7054 | * |
| 7055 | * hHal - The handle returned by mac_open |
| 7056 | * Return uint8_t - nOpportunisticThresholdDiff |
| 7057 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7058 | uint8_t sme_get_roam_opportunistic_scan_threshold_diff(tHalHandle hHal) |
| 7059 | { |
| 7060 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7061 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7062 | return pMac->roam.configParam.neighborRoamConfig. |
| 7063 | nOpportunisticThresholdDiff; |
| 7064 | } |
| 7065 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7066 | /* |
| 7067 | * sme_set_roam_rescan_rssi_diff() - Update roam rescan rssi diff |
| 7068 | * This function is called through dynamic setConfig callback function |
| 7069 | * to configure nRoamRescanRssiDiff |
| 7070 | * |
| 7071 | * hHal - HAL handle for device |
| 7072 | * sessionId - Session Identifier |
| 7073 | * nRoamRescanRssiDiff - roam rescan rssi diff |
| 7074 | * Return QDF_STATUS_SUCCESS - SME update nRoamRescanRssiDiff config |
| 7075 | * successfully. |
| 7076 | * else SME is failed to update nRoamRescanRssiDiff. |
| 7077 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7078 | QDF_STATUS sme_set_roam_rescan_rssi_diff(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7079 | uint8_t sessionId, |
| 7080 | const uint8_t nRoamRescanRssiDiff) |
| 7081 | { |
| 7082 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7083 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7084 | |
| 7085 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7086 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 7087 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 7088 | nRoamRescanRssiDiff, |
| 7089 | REASON_ROAM_RESCAN_RSSI_DIFF_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7090 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7091 | pMac->roam.configParam.neighborRoamConfig. |
| 7092 | nRoamRescanRssiDiff = nRoamRescanRssiDiff; |
| 7093 | } |
| 7094 | sme_release_global_lock(&pMac->sme); |
| 7095 | } |
| 7096 | return status; |
| 7097 | } |
| 7098 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7099 | /* |
| 7100 | * sme_get_roam_rescan_rssi_diff() |
| 7101 | * gets roam rescan rssi diff |
| 7102 | * This is a synchronous call |
| 7103 | * |
| 7104 | * hHal - The handle returned by mac_open |
| 7105 | * Return int8_t - nRoamRescanRssiDiff |
| 7106 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7107 | uint8_t sme_get_roam_rescan_rssi_diff(tHalHandle hHal) |
| 7108 | { |
| 7109 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7110 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7111 | return pMac->roam.configParam.neighborRoamConfig.nRoamRescanRssiDiff; |
| 7112 | } |
| 7113 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7114 | /* |
| 7115 | * sme_set_roam_bmiss_first_bcnt() - |
| 7116 | * Update Roam count for first beacon miss |
| 7117 | * This function is called through dynamic setConfig callback function |
| 7118 | * to configure nRoamBmissFirstBcnt |
| 7119 | * hHal - HAL handle for device |
| 7120 | * sessionId - Session Identifier |
| 7121 | * nRoamBmissFirstBcnt - Roam first bmiss count |
| 7122 | * Return QDF_STATUS_SUCCESS - SME update nRoamBmissFirstBcnt |
| 7123 | * successfully. |
| 7124 | * else SME is failed to update nRoamBmissFirstBcnt |
| 7125 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7126 | QDF_STATUS sme_set_roam_bmiss_first_bcnt(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7127 | uint8_t sessionId, |
| 7128 | const uint8_t nRoamBmissFirstBcnt) |
| 7129 | { |
| 7130 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7131 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7132 | |
| 7133 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7134 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 7135 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 7136 | nRoamBmissFirstBcnt, |
| 7137 | REASON_ROAM_BMISS_FIRST_BCNT_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7138 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7139 | pMac->roam.configParam.neighborRoamConfig. |
| 7140 | nRoamBmissFirstBcnt = nRoamBmissFirstBcnt; |
| 7141 | } |
| 7142 | sme_release_global_lock(&pMac->sme); |
| 7143 | } |
| 7144 | return status; |
| 7145 | } |
| 7146 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7147 | /* |
| 7148 | * sme_get_roam_bmiss_first_bcnt() - |
| 7149 | * get neighbor roam beacon miss first count |
| 7150 | * |
| 7151 | * hHal - The handle returned by mac_open. |
| 7152 | * Return uint8_t - neighbor roam beacon miss first count |
| 7153 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7154 | uint8_t sme_get_roam_bmiss_first_bcnt(tHalHandle hHal) |
| 7155 | { |
| 7156 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7157 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7158 | return pMac->roam.configParam.neighborRoamConfig.nRoamBmissFirstBcnt; |
| 7159 | } |
| 7160 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7161 | /* |
| 7162 | * sme_set_roam_bmiss_final_bcnt() - |
| 7163 | * Update Roam count for final beacon miss |
| 7164 | * This function is called through dynamic setConfig callback function |
| 7165 | * to configure nRoamBmissFinalBcnt |
| 7166 | * hHal - HAL handle for device |
| 7167 | * sessionId - Session Identifier |
| 7168 | * nRoamBmissFinalBcnt - Roam final bmiss count |
| 7169 | * Return QDF_STATUS_SUCCESS - SME update nRoamBmissFinalBcnt |
| 7170 | * successfully. |
| 7171 | * else SME is failed to update nRoamBmissFinalBcnt |
| 7172 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7173 | QDF_STATUS sme_set_roam_bmiss_final_bcnt(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7174 | uint8_t sessionId, |
| 7175 | const uint8_t nRoamBmissFinalBcnt) |
| 7176 | { |
| 7177 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7178 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7179 | |
| 7180 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7181 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 7182 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 7183 | nRoamBmissFinalBcnt, |
| 7184 | REASON_ROAM_BMISS_FINAL_BCNT_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7185 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7186 | pMac->roam.configParam.neighborRoamConfig. |
| 7187 | nRoamBmissFinalBcnt = nRoamBmissFinalBcnt; |
| 7188 | } |
| 7189 | sme_release_global_lock(&pMac->sme); |
| 7190 | } |
| 7191 | return status; |
| 7192 | } |
| 7193 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7194 | /* |
| 7195 | * sme_get_roam_bmiss_final_bcnt() - |
| 7196 | * gets Roam count for final beacon miss |
| 7197 | * This is a synchronous call |
| 7198 | * |
| 7199 | * hHal - The handle returned by mac_open |
| 7200 | * Return uint8_t - nRoamBmissFinalBcnt |
| 7201 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7202 | uint8_t sme_get_roam_bmiss_final_bcnt(tHalHandle hHal) |
| 7203 | { |
| 7204 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7205 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7206 | return pMac->roam.configParam.neighborRoamConfig.nRoamBmissFinalBcnt; |
| 7207 | } |
| 7208 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7209 | /* |
| 7210 | * sme_set_roam_beacon_rssi_weight() - |
| 7211 | * Update Roam beacon rssi weight |
| 7212 | * This function is called through dynamic setConfig callback function |
| 7213 | * to configure nRoamBeaconRssiWeight |
| 7214 | * |
| 7215 | * hHal - HAL handle for device |
| 7216 | * sessionId - Session Identifier |
| 7217 | * nRoamBeaconRssiWeight - Roam beacon rssi weight |
| 7218 | * Return QDF_STATUS_SUCCESS - SME update nRoamBeaconRssiWeight config |
| 7219 | * successfully. |
| 7220 | * else SME is failed to update nRoamBeaconRssiWeight |
| 7221 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7222 | QDF_STATUS sme_set_roam_beacon_rssi_weight(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7223 | uint8_t sessionId, |
| 7224 | const uint8_t nRoamBeaconRssiWeight) |
| 7225 | { |
| 7226 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7227 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7228 | |
| 7229 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7230 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 7231 | status = csr_neighbor_roam_update_config(pMac, sessionId, |
| 7232 | nRoamBeaconRssiWeight, |
| 7233 | REASON_ROAM_BEACON_RSSI_WEIGHT_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7234 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7235 | pMac->roam.configParam.neighborRoamConfig. |
| 7236 | nRoamBeaconRssiWeight = nRoamBeaconRssiWeight; |
| 7237 | } |
| 7238 | sme_release_global_lock(&pMac->sme); |
| 7239 | } |
| 7240 | return status; |
| 7241 | } |
| 7242 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7243 | /* |
| 7244 | * sme_get_roam_beacon_rssi_weight() - |
| 7245 | * gets Roam beacon rssi weight |
| 7246 | * This is a synchronous call |
| 7247 | * |
| 7248 | * hHal - The handle returned by mac_open |
| 7249 | * Return uint8_t - nRoamBeaconRssiWeight |
| 7250 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7251 | uint8_t sme_get_roam_beacon_rssi_weight(tHalHandle hHal) |
| 7252 | { |
| 7253 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7254 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7255 | return pMac->roam.configParam.neighborRoamConfig.nRoamBeaconRssiWeight; |
| 7256 | } |
| 7257 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7258 | /* |
| 7259 | * sme_set_neighbor_lookup_rssi_threshold() - update neighbor lookup |
| 7260 | * rssi threshold |
| 7261 | * This is a synchronous call |
| 7262 | * |
| 7263 | * hHal - The handle returned by mac_open. |
| 7264 | * sessionId - Session Identifier |
| 7265 | * Return QDF_STATUS_SUCCESS - SME update config successful. |
| 7266 | * Other status means SME is failed to update |
| 7267 | */ |
| 7268 | QDF_STATUS sme_set_neighbor_lookup_rssi_threshold(tHalHandle hHal, |
| 7269 | uint8_t sessionId, uint8_t neighborLookupRssiThreshold) |
| 7270 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7271 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7272 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7273 | |
| 7274 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7275 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Varun Reddy Yeturu | ff4feb0 | 2016-04-20 12:26:11 -0700 | [diff] [blame] | 7276 | status = csr_neighbor_roam_update_config(pMac, |
| 7277 | sessionId, neighborLookupRssiThreshold, |
| 7278 | REASON_LOOKUP_THRESH_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7279 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7280 | pMac->roam.configParam.neighborRoamConfig. |
| 7281 | nNeighborLookupRssiThreshold = |
| 7282 | neighborLookupRssiThreshold; |
| 7283 | } |
| 7284 | sme_release_global_lock(&pMac->sme); |
| 7285 | } |
| 7286 | return status; |
| 7287 | } |
| 7288 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7289 | /* |
| 7290 | * sme_set_delay_before_vdev_stop() - update delay before VDEV_STOP |
| 7291 | * This is a synchronous call |
| 7292 | * |
| 7293 | * hal - The handle returned by macOpen. |
| 7294 | * session_id - Session Identifier |
| 7295 | * delay_before_vdev_stop - value to be set |
| 7296 | * Return QDF_STATUS_SUCCESS - SME update config successful. |
| 7297 | * Other status means SME is failed to update |
| 7298 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7299 | QDF_STATUS sme_set_delay_before_vdev_stop(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7300 | uint8_t session_id, |
| 7301 | uint8_t delay_before_vdev_stop) |
| 7302 | { |
| 7303 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7304 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7305 | |
| 7306 | if (session_id >= CSR_ROAM_SESSION_MAX) { |
| 7307 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7308 | FL("Invalid sme session id: %d"), session_id); |
| 7309 | return QDF_STATUS_E_INVAL; |
| 7310 | } |
| 7311 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7312 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7313 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7314 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 7315 | "LFR param delay_before_vdev_stop changed from %d to %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7316 | pMac->roam.configParam.neighborRoamConfig. |
| 7317 | delay_before_vdev_stop, |
| 7318 | delay_before_vdev_stop); |
| 7319 | pMac->roam.neighborRoamInfo[session_id].cfgParams. |
| 7320 | delay_before_vdev_stop = delay_before_vdev_stop; |
| 7321 | pMac->roam.configParam.neighborRoamConfig. |
| 7322 | delay_before_vdev_stop = delay_before_vdev_stop; |
| 7323 | sme_release_global_lock(&pMac->sme); |
| 7324 | } |
| 7325 | return status; |
| 7326 | } |
| 7327 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7328 | /* |
| 7329 | * sme_get_neighbor_lookup_rssi_threshold() - get neighbor lookup |
| 7330 | * rssi threshold |
| 7331 | * This is a synchronous call |
| 7332 | * |
| 7333 | * hHal - The handle returned by mac_open. |
| 7334 | * Return QDF_STATUS_SUCCESS - SME update config successful. |
| 7335 | * Other status means SME is failed to update |
| 7336 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7337 | uint8_t sme_get_neighbor_lookup_rssi_threshold(tHalHandle hHal) |
| 7338 | { |
| 7339 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7340 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7341 | return pMac->roam.configParam.neighborRoamConfig. |
| 7342 | nNeighborLookupRssiThreshold; |
| 7343 | } |
| 7344 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7345 | /* |
| 7346 | * sme_set_neighbor_scan_refresh_period() - set neighbor scan results |
| 7347 | * refresh period |
| 7348 | * This is a synchronous call |
| 7349 | * |
| 7350 | * hHal - The handle returned by mac_open. |
| 7351 | * sessionId - Session Identifier |
| 7352 | * Return QDF_STATUS_SUCCESS - SME update config successful. |
| 7353 | * Other status means SME is failed to update |
| 7354 | */ |
| 7355 | QDF_STATUS sme_set_neighbor_scan_refresh_period(tHalHandle hHal, |
| 7356 | uint8_t sessionId, uint16_t neighborScanResultsRefreshPeriod) |
| 7357 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7358 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7359 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 7360 | struct csr_neighbor_roamconfig *pNeighborRoamConfig = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7361 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 7362 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7363 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7364 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7365 | FL("Invalid sme session id: %d"), sessionId); |
| 7366 | return QDF_STATUS_E_INVAL; |
| 7367 | } |
| 7368 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7369 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7370 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7371 | pNeighborRoamConfig = |
| 7372 | &pMac->roam.configParam.neighborRoamConfig; |
| 7373 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7374 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7375 | "LFR runtime successfully set roam scan refresh period to %d- old value is %d - roam state is %s", |
| 7376 | neighborScanResultsRefreshPeriod, |
| 7377 | pMac->roam.configParam.neighborRoamConfig. |
| 7378 | nNeighborResultsRefreshPeriod, |
| 7379 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 7380 | neighborRoamInfo |
| 7381 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7382 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7383 | pNeighborRoamConfig->nNeighborResultsRefreshPeriod = |
| 7384 | neighborScanResultsRefreshPeriod; |
| 7385 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod = |
| 7386 | neighborScanResultsRefreshPeriod; |
| 7387 | |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 7388 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 7389 | csr_roam_offload_scan(pMac, sessionId, |
| 7390 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 7391 | REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED); |
| 7392 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7393 | sme_release_global_lock(&pMac->sme); |
| 7394 | } |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 7395 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7396 | return status; |
| 7397 | } |
| 7398 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7399 | /* |
| 7400 | * sme_update_roam_scan_offload_enabled() - enable/disable roam scan |
| 7401 | * offload feaure |
| 7402 | * It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7403 | * gRoamScanOffloadEnabled. |
| 7404 | * This is a synchronous call |
| 7405 | * |
| 7406 | * hHal - The handle returned by mac_open. |
| 7407 | * Return QDF_STATUS_SUCCESS - SME update config successfully. |
| 7408 | * Other status means SME is failed to update. |
| 7409 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7410 | QDF_STATUS sme_update_roam_scan_offload_enabled(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7411 | bool nRoamScanOffloadEnabled) |
| 7412 | { |
| 7413 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7414 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7415 | |
| 7416 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7417 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7418 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7419 | "gRoamScanOffloadEnabled is changed from %d to %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7420 | pMac->roam.configParam.isRoamOffloadScanEnabled, |
| 7421 | nRoamScanOffloadEnabled); |
| 7422 | pMac->roam.configParam.isRoamOffloadScanEnabled = |
| 7423 | nRoamScanOffloadEnabled; |
| 7424 | sme_release_global_lock(&pMac->sme); |
| 7425 | } |
| 7426 | |
| 7427 | return status; |
| 7428 | } |
| 7429 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7430 | /* |
| 7431 | * sme_get_neighbor_scan_refresh_period() - get neighbor scan results |
| 7432 | * refresh period |
| 7433 | * This is a synchronous call |
| 7434 | * |
| 7435 | * \param hHal - The handle returned by mac_open. |
| 7436 | * \return uint16_t - Neighbor scan results refresh period value |
| 7437 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7438 | uint16_t sme_get_neighbor_scan_refresh_period(tHalHandle hHal) |
| 7439 | { |
| 7440 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7441 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7442 | return pMac->roam.configParam.neighborRoamConfig. |
| 7443 | nNeighborResultsRefreshPeriod; |
| 7444 | } |
| 7445 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7446 | /* |
| 7447 | * sme_get_empty_scan_refresh_period() - get empty scan refresh period |
| 7448 | * This is a synchronuous call |
| 7449 | * |
| 7450 | * hHal - The handle returned by mac_open. |
| 7451 | * Return QDF_STATUS_SUCCESS - SME update config successful. |
| 7452 | * Other status means SME is failed to update |
| 7453 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7454 | uint16_t sme_get_empty_scan_refresh_period(tHalHandle hHal) |
| 7455 | { |
| 7456 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7457 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7458 | return pMac->roam.configParam.neighborRoamConfig. |
| 7459 | nEmptyScanRefreshPeriod; |
| 7460 | } |
| 7461 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7462 | /* |
| 7463 | * sme_update_empty_scan_refresh_period |
| 7464 | * Update nEmptyScanRefreshPeriod |
| 7465 | * This function is called through dynamic setConfig callback function |
| 7466 | * to configure nEmptyScanRefreshPeriod |
| 7467 | * Usage: adb shell iwpriv wlan0 setConfig |
| 7468 | * nEmptyScanRefreshPeriod=[0 .. 60] |
| 7469 | * |
| 7470 | * hHal - HAL handle for device |
| 7471 | * sessionId - Session Identifier |
| 7472 | * nEmptyScanRefreshPeriod - scan period following empty scan results. |
| 7473 | * Return Success or failure |
| 7474 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7475 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7476 | QDF_STATUS sme_update_empty_scan_refresh_period(tHalHandle hHal, uint8_t |
| 7477 | sessionId, uint16_t |
| 7478 | nEmptyScanRefreshPeriod) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7479 | { |
| 7480 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7481 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 7482 | struct csr_neighbor_roamconfig *pNeighborRoamConfig = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7483 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 7484 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7485 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7486 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7487 | FL("Invalid sme session id: %d"), sessionId); |
| 7488 | return QDF_STATUS_E_INVAL; |
| 7489 | } |
| 7490 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7491 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7492 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7493 | pNeighborRoamConfig = |
| 7494 | &pMac->roam.configParam.neighborRoamConfig; |
| 7495 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7496 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7497 | "LFR runtime successfully set roam scan period to %d -old value is %d - roam state is %s", |
| 7498 | nEmptyScanRefreshPeriod, |
| 7499 | pMac->roam.configParam.neighborRoamConfig. |
| 7500 | nEmptyScanRefreshPeriod, |
| 7501 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 7502 | neighborRoamInfo |
| 7503 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7504 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7505 | pNeighborRoamConfig->nEmptyScanRefreshPeriod = |
| 7506 | nEmptyScanRefreshPeriod; |
| 7507 | pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod = |
| 7508 | nEmptyScanRefreshPeriod; |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 7509 | |
| 7510 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 7511 | csr_roam_offload_scan(pMac, sessionId, |
| 7512 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 7513 | REASON_EMPTY_SCAN_REF_PERIOD_CHANGED); |
| 7514 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7515 | sme_release_global_lock(&pMac->sme); |
| 7516 | } |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 7517 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7518 | return status; |
| 7519 | } |
| 7520 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7521 | /* |
| 7522 | * sme_set_neighbor_scan_min_chan_time() - |
| 7523 | * Update nNeighborScanMinChanTime |
| 7524 | * This function is called through dynamic setConfig callback function |
| 7525 | * to configure gNeighborScanChannelMinTime |
| 7526 | * Usage: adb shell iwpriv wlan0 setConfig |
| 7527 | * gNeighborScanChannelMinTime=[0 .. 60] |
| 7528 | * |
| 7529 | * hHal - HAL handle for device |
| 7530 | * nNeighborScanMinChanTime - Channel minimum dwell time |
| 7531 | * sessionId - Session Identifier |
| 7532 | * Return Success or failure |
| 7533 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7534 | QDF_STATUS sme_set_neighbor_scan_min_chan_time(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7535 | const uint16_t |
| 7536 | nNeighborScanMinChanTime, |
| 7537 | uint8_t sessionId) |
| 7538 | { |
| 7539 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7540 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7541 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7542 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7543 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7544 | FL("Invalid sme session id: %d"), sessionId); |
| 7545 | return QDF_STATUS_E_INVAL; |
| 7546 | } |
| 7547 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7550 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7551 | "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %s", |
| 7552 | nNeighborScanMinChanTime, |
| 7553 | pMac->roam.configParam.neighborRoamConfig. |
| 7554 | nNeighborScanMinChanTime, |
| 7555 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 7556 | neighborRoamInfo |
| 7557 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7558 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7559 | |
| 7560 | pMac->roam.configParam.neighborRoamConfig. |
| 7561 | nNeighborScanMinChanTime = nNeighborScanMinChanTime; |
| 7562 | pMac->roam.neighborRoamInfo[sessionId].cfgParams. |
| 7563 | minChannelScanTime = nNeighborScanMinChanTime; |
| 7564 | sme_release_global_lock(&pMac->sme); |
| 7565 | } |
| 7566 | |
| 7567 | return status; |
| 7568 | } |
| 7569 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7570 | /* |
| 7571 | * sme_set_neighbor_scan_max_chan_time() - |
| 7572 | * Update nNeighborScanMaxChanTime |
| 7573 | * This function is called through dynamic setConfig callback function |
| 7574 | * to configure gNeighborScanChannelMaxTime |
| 7575 | * Usage: adb shell iwpriv wlan0 setConfig |
| 7576 | * gNeighborScanChannelMaxTime=[0 .. 60] |
| 7577 | * |
| 7578 | * hHal - HAL handle for device |
| 7579 | * sessionId - Session Identifier |
| 7580 | * nNeighborScanMinChanTime - Channel maximum dwell time |
| 7581 | * Return Success or failure |
| 7582 | */ |
| 7583 | QDF_STATUS sme_set_neighbor_scan_max_chan_time(tHalHandle hHal, uint8_t |
| 7584 | sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7585 | const uint16_t |
| 7586 | nNeighborScanMaxChanTime) |
| 7587 | { |
| 7588 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7589 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 7590 | struct csr_neighbor_roamconfig *pNeighborRoamConfig = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7591 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 7592 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7593 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7594 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7595 | FL("Invalid sme session id: %d"), sessionId); |
| 7596 | return QDF_STATUS_E_INVAL; |
| 7597 | } |
| 7598 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7599 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7600 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7601 | pNeighborRoamConfig = |
| 7602 | &pMac->roam.configParam.neighborRoamConfig; |
| 7603 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7604 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7605 | "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %s", |
| 7606 | nNeighborScanMaxChanTime, |
| 7607 | pMac->roam.configParam.neighborRoamConfig. |
| 7608 | nNeighborScanMaxChanTime, |
| 7609 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 7610 | neighborRoamInfo |
| 7611 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7612 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7613 | pNeighborRoamConfig->nNeighborScanMaxChanTime = |
| 7614 | nNeighborScanMaxChanTime; |
| 7615 | pNeighborRoamInfo->cfgParams.maxChannelScanTime = |
| 7616 | nNeighborScanMaxChanTime; |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 7617 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 7618 | csr_roam_offload_scan(pMac, sessionId, |
| 7619 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 7620 | REASON_SCAN_CH_TIME_CHANGED); |
| 7621 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7622 | sme_release_global_lock(&pMac->sme); |
| 7623 | } |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 7624 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7625 | |
| 7626 | return status; |
| 7627 | } |
| 7628 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7629 | /* |
| 7630 | * sme_get_neighbor_scan_min_chan_time() - |
| 7631 | * get neighbor scan min channel time |
| 7632 | * |
| 7633 | * hHal - The handle returned by mac_open. |
| 7634 | * sessionId - Session Identifier |
| 7635 | * Return uint16_t - channel min time value |
| 7636 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7637 | uint16_t sme_get_neighbor_scan_min_chan_time(tHalHandle hHal, uint8_t sessionId) |
| 7638 | { |
| 7639 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7640 | |
| 7641 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7642 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7643 | FL("Invalid sme session id: %d"), sessionId); |
| 7644 | return 0; |
| 7645 | } |
| 7646 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7647 | return pMac->roam.neighborRoamInfo[sessionId].cfgParams. |
| 7648 | minChannelScanTime; |
| 7649 | } |
| 7650 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7651 | /* |
| 7652 | * sme_get_neighbor_roam_state() - |
| 7653 | * get neighbor roam state |
| 7654 | * |
| 7655 | * hHal - The handle returned by mac_open. |
| 7656 | * sessionId - Session Identifier |
| 7657 | * Return uint32_t - neighbor roam state |
| 7658 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7659 | uint32_t sme_get_neighbor_roam_state(tHalHandle hHal, uint8_t sessionId) |
| 7660 | { |
| 7661 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7662 | |
| 7663 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7664 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7665 | FL("Invalid sme session id: %d"), sessionId); |
| 7666 | return 0; |
| 7667 | } |
| 7668 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7669 | return pMac->roam.neighborRoamInfo[sessionId].neighborRoamState; |
| 7670 | } |
| 7671 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7672 | /* |
| 7673 | * sme_get_current_roam_state() - |
| 7674 | * get current roam state |
| 7675 | * |
| 7676 | * hHal - The handle returned by mac_open. |
| 7677 | * sessionId - Session Identifier |
| 7678 | * Return uint32_t - current roam state |
| 7679 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7680 | uint32_t sme_get_current_roam_state(tHalHandle hHal, uint8_t sessionId) |
| 7681 | { |
| 7682 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7683 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7684 | return pMac->roam.curState[sessionId]; |
| 7685 | } |
| 7686 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7687 | /* |
| 7688 | * sme_get_current_roam_sub_state() - |
| 7689 | * \brief get neighbor roam sub state |
| 7690 | * |
| 7691 | * hHal - The handle returned by mac_open. |
| 7692 | * sessionId - Session Identifier |
| 7693 | * Return uint32_t - current roam sub state |
| 7694 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7695 | uint32_t sme_get_current_roam_sub_state(tHalHandle hHal, uint8_t sessionId) |
| 7696 | { |
| 7697 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7698 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7699 | return pMac->roam.curSubState[sessionId]; |
| 7700 | } |
| 7701 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7702 | /* |
| 7703 | * sme_get_lim_sme_state() - |
| 7704 | * get Lim Sme state |
| 7705 | * |
| 7706 | * hHal - The handle returned by mac_open. |
| 7707 | * Return uint32_t - Lim Sme state |
| 7708 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7709 | uint32_t sme_get_lim_sme_state(tHalHandle hHal) |
| 7710 | { |
| 7711 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7712 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7713 | return pMac->lim.gLimSmeState; |
| 7714 | } |
| 7715 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7716 | /* |
| 7717 | * sme_get_lim_mlm_state() - |
| 7718 | * get Lim Mlm state |
| 7719 | * |
| 7720 | * hHal - The handle returned by mac_open. |
| 7721 | * Return uint32_t - Lim Mlm state |
| 7722 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7723 | uint32_t sme_get_lim_mlm_state(tHalHandle hHal) |
| 7724 | { |
| 7725 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7726 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7727 | return pMac->lim.gLimMlmState; |
| 7728 | } |
| 7729 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7730 | /* |
| 7731 | * sme_is_lim_session_valid() - |
| 7732 | * is Lim session valid |
| 7733 | * |
| 7734 | * hHal - The handle returned by mac_open. |
| 7735 | * sessionId - Session Identifier |
| 7736 | * Return bool - true or false |
| 7737 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7738 | bool sme_is_lim_session_valid(tHalHandle hHal, uint8_t sessionId) |
| 7739 | { |
| 7740 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Hanumantha Reddy Pothula | 589fd70 | 2015-11-17 15:25:16 +0530 | [diff] [blame] | 7741 | |
| 7742 | if (sessionId > pMac->lim.maxBssId) |
| 7743 | return false; |
| 7744 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7745 | return pMac->lim.gpSession[sessionId].valid; |
| 7746 | } |
| 7747 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7748 | /* |
| 7749 | * sme_get_lim_sme_session_state() - |
| 7750 | * get Lim Sme session state |
| 7751 | * |
| 7752 | * hHal - The handle returned by mac_open. |
| 7753 | * sessionId - Session Identifier |
| 7754 | * Return uint32_t - Lim Sme session state |
| 7755 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7756 | uint32_t sme_get_lim_sme_session_state(tHalHandle hHal, uint8_t sessionId) |
| 7757 | { |
| 7758 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7759 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7760 | return pMac->lim.gpSession[sessionId].limSmeState; |
| 7761 | } |
| 7762 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7763 | /* |
| 7764 | * sme_get_lim_mlm_session_state() - |
| 7765 | * \brief get Lim Mlm session state |
| 7766 | * |
| 7767 | * hHal - The handle returned by mac_open. |
| 7768 | * sessionId - Session Identifier |
| 7769 | * Return uint32_t - Lim Mlm session state |
| 7770 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7771 | uint32_t sme_get_lim_mlm_session_state(tHalHandle hHal, uint8_t sessionId) |
| 7772 | { |
| 7773 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7774 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7775 | return pMac->lim.gpSession[sessionId].limMlmState; |
| 7776 | } |
| 7777 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7778 | /* |
| 7779 | * sme_get_neighbor_scan_max_chan_time() - |
| 7780 | * get neighbor scan max channel time |
| 7781 | * |
| 7782 | * hHal - The handle returned by mac_open. |
| 7783 | * sessionId - Session Identifier |
| 7784 | * Return uint16_t - channel max time value |
| 7785 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7786 | uint16_t sme_get_neighbor_scan_max_chan_time(tHalHandle hHal, uint8_t sessionId) |
| 7787 | { |
| 7788 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7789 | |
| 7790 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7791 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7792 | FL("Invalid sme session id: %d"), sessionId); |
| 7793 | return 0; |
| 7794 | } |
| 7795 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7796 | return pMac->roam.neighborRoamInfo[sessionId].cfgParams. |
| 7797 | maxChannelScanTime; |
| 7798 | } |
| 7799 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7800 | /* |
| 7801 | * sme_set_neighbor_scan_period() - |
| 7802 | * Update nNeighborScanPeriod |
| 7803 | * This function is called through dynamic setConfig callback function |
| 7804 | * to configure nNeighborScanPeriod |
| 7805 | * Usage: adb shell iwpriv wlan0 setConfig |
| 7806 | * nNeighborScanPeriod=[0 .. 1000] |
| 7807 | * |
| 7808 | * hHal - HAL handle for device |
| 7809 | * sessionId - Session Identifier |
| 7810 | * nNeighborScanPeriod - neighbor scan period |
| 7811 | * Return Success or failure |
| 7812 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7813 | QDF_STATUS sme_set_neighbor_scan_period(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7814 | const uint16_t nNeighborScanPeriod) |
| 7815 | { |
| 7816 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7817 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 7818 | struct csr_neighbor_roamconfig *pNeighborRoamConfig = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7819 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 7820 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7821 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7822 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7823 | FL("Invalid sme session id: %d"), sessionId); |
| 7824 | return QDF_STATUS_E_INVAL; |
| 7825 | } |
| 7826 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7827 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7828 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7829 | pNeighborRoamConfig = |
| 7830 | &pMac->roam.configParam.neighborRoamConfig; |
| 7831 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7832 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7833 | "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] | 7834 | nNeighborScanPeriod, |
| 7835 | pMac->roam.configParam.neighborRoamConfig. |
| 7836 | nNeighborScanTimerPeriod, |
| 7837 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 7838 | neighborRoamInfo |
| 7839 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7840 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7841 | pNeighborRoamConfig->nNeighborScanTimerPeriod = |
| 7842 | nNeighborScanPeriod; |
| 7843 | pNeighborRoamInfo->cfgParams.neighborScanPeriod = |
| 7844 | nNeighborScanPeriod; |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 7845 | |
| 7846 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 7847 | csr_roam_offload_scan(pMac, sessionId, |
| 7848 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 7849 | REASON_SCAN_HOME_TIME_CHANGED); |
| 7850 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7851 | sme_release_global_lock(&pMac->sme); |
| 7852 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7853 | |
| 7854 | return status; |
| 7855 | } |
| 7856 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7857 | /* |
| 7858 | * sme_get_neighbor_scan_period() - |
| 7859 | * get neighbor scan period |
| 7860 | * |
| 7861 | * hHal - The handle returned by mac_open. |
| 7862 | * sessionId - Session Identifier |
| 7863 | * Return uint16_t - neighbor scan period |
| 7864 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7865 | uint16_t sme_get_neighbor_scan_period(tHalHandle hHal, uint8_t sessionId) |
| 7866 | { |
| 7867 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7868 | |
| 7869 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7870 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7871 | FL("Invalid sme session id: %d"), sessionId); |
| 7872 | return 0; |
| 7873 | } |
| 7874 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7875 | return pMac->roam.neighborRoamInfo[sessionId].cfgParams. |
| 7876 | neighborScanPeriod; |
| 7877 | } |
| 7878 | |
Sridhar Selvaraj | 1b2330c | 2017-07-21 15:16:42 +0530 | [diff] [blame] | 7879 | /** |
| 7880 | * sme_set_neighbor_scan_min_period() - Update neighbor_scan_min_period |
| 7881 | * This function is called through dynamic setConfig callback function |
| 7882 | * to configure neighbor_scan_min_period |
| 7883 | * |
| 7884 | * @hal - HAL handle for device |
| 7885 | * @session_id - Session Identifier |
| 7886 | * @neighbor_scan_min_period - neighbor scan min period |
| 7887 | * |
| 7888 | * Return - QDF_STATUS |
| 7889 | */ |
| 7890 | QDF_STATUS sme_set_neighbor_scan_min_period(tHalHandle hal, |
| 7891 | uint8_t session_id, |
| 7892 | const uint16_t |
| 7893 | neighbor_scan_min_period) |
| 7894 | { |
| 7895 | tpAniSirGlobal pmac = PMAC_STRUCT(hal); |
| 7896 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 7897 | struct csr_neighbor_roamconfig *p_neighbor_roam_config = NULL; |
Sridhar Selvaraj | 1b2330c | 2017-07-21 15:16:42 +0530 | [diff] [blame] | 7898 | tpCsrNeighborRoamControlInfo p_neighbor_roam_info = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7899 | |
Sridhar Selvaraj | 1b2330c | 2017-07-21 15:16:42 +0530 | [diff] [blame] | 7900 | if (session_id >= CSR_ROAM_SESSION_MAX) { |
| 7901 | sme_err("Invalid sme session id: %d", session_id); |
| 7902 | return QDF_STATUS_E_INVAL; |
| 7903 | } |
| 7904 | |
| 7905 | status = sme_acquire_global_lock(&pmac->sme); |
| 7906 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 7907 | p_neighbor_roam_config = |
| 7908 | &pmac->roam.configParam.neighborRoamConfig; |
| 7909 | p_neighbor_roam_info = &pmac-> |
| 7910 | roam.neighborRoamInfo[session_id]; |
| 7911 | sme_debug("LFR:set neighbor scan min period, old:%d, " |
| 7912 | "new: %d, state: %s", |
| 7913 | pmac->roam.configParam.neighborRoamConfig. |
| 7914 | neighbor_scan_min_timer_period, |
| 7915 | neighbor_scan_min_period, |
| 7916 | mac_trace_get_neighbour_roam_state(pmac->roam. |
| 7917 | neighborRoamInfo[session_id]. |
| 7918 | neighborRoamState)); |
| 7919 | p_neighbor_roam_config->neighbor_scan_min_timer_period = |
| 7920 | neighbor_scan_min_period; |
| 7921 | p_neighbor_roam_info->cfgParams.neighbor_scan_min_period = |
| 7922 | neighbor_scan_min_period; |
| 7923 | sme_release_global_lock(&pmac->sme); |
| 7924 | } |
| 7925 | |
| 7926 | return status; |
| 7927 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7928 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7929 | /* |
| 7930 | * sme_get_roam_rssi_diff() - get Roam rssi diff |
| 7931 | * This is a synchronous call |
| 7932 | * |
| 7933 | * hHal - The handle returned by mac_open. |
| 7934 | * Return uint16_t - Rssi diff value |
| 7935 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7936 | uint8_t sme_get_roam_rssi_diff(tHalHandle hHal) |
| 7937 | { |
| 7938 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 7939 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7940 | return pMac->roam.configParam.RoamRssiDiff; |
| 7941 | } |
| 7942 | |
| 7943 | /** |
| 7944 | * sme_change_roam_scan_channel_list() - to change scan channel list |
| 7945 | * @hHal: pointer HAL handle returned by mac_open |
| 7946 | * @sessionId: sme session id |
| 7947 | * @pChannelList: Output channel list |
| 7948 | * @numChannels: Output number of channels |
| 7949 | * |
| 7950 | * This routine is called to Change roam scan channel list. |
| 7951 | * This is a synchronous call |
| 7952 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7953 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7954 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7955 | 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] | 7956 | uint8_t *pChannelList, |
| 7957 | uint8_t numChannels) |
| 7958 | { |
| 7959 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7960 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7961 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7962 | uint8_t oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN * 2] = { 0 }; |
| 7963 | uint8_t newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN * 2] = { 0 }; |
| 7964 | uint8_t i = 0, j = 0; |
| 7965 | tCsrChannelInfo *chan_info; |
| 7966 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7967 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 7968 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 7969 | FL("Invalid sme session id: %d"), sessionId); |
| 7970 | return QDF_STATUS_E_INVAL; |
| 7971 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7972 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 7973 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7974 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7975 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 7976 | sme_err("Failed to acquire SME lock"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7977 | return status; |
| 7978 | } |
| 7979 | chan_info = &pNeighborRoamInfo->cfgParams.channelInfo; |
| 7980 | |
| 7981 | if (NULL != chan_info->ChannelList) { |
| 7982 | for (i = 0; i < chan_info->numOfChannels; i++) { |
| 7983 | if (j < sizeof(oldChannelList)) |
| 7984 | j += snprintf(oldChannelList + j, |
| 7985 | sizeof(oldChannelList) - |
| 7986 | j, "%d", |
| 7987 | chan_info->ChannelList[i]); |
| 7988 | else |
| 7989 | break; |
| 7990 | } |
| 7991 | } |
| 7992 | csr_flush_cfg_bg_scan_roam_channel_list(pMac, sessionId); |
| 7993 | csr_create_bg_scan_roam_channel_list(pMac, sessionId, pChannelList, |
| 7994 | numChannels); |
| 7995 | sme_set_roam_scan_control(hHal, sessionId, 1); |
| 7996 | if (NULL != chan_info->ChannelList) { |
| 7997 | j = 0; |
| 7998 | for (i = 0; i < chan_info->numOfChannels; i++) { |
| 7999 | if (j < sizeof(newChannelList)) |
| 8000 | j += snprintf(newChannelList + j, |
| 8001 | sizeof(newChannelList) - |
| 8002 | j, " %d", |
| 8003 | chan_info->ChannelList[i]); |
| 8004 | else |
| 8005 | break; |
| 8006 | } |
| 8007 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8008 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8009 | "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] | 8010 | newChannelList, oldChannelList, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8011 | pMac->roam.neighborRoamInfo[sessionId].neighborRoamState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8012 | |
| 8013 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 8014 | csr_roam_offload_scan(pMac, sessionId, |
| 8015 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 8016 | REASON_CHANNEL_LIST_CHANGED); |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 8017 | |
| 8018 | sme_release_global_lock(&pMac->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8019 | return status; |
| 8020 | } |
| 8021 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8022 | /** |
| 8023 | * sme_get_roam_scan_channel_list() - To get roam scan channel list |
| 8024 | * @hHal: HAL pointer |
| 8025 | * @pChannelList: Output channel list |
| 8026 | * @pNumChannels: Output number of channels |
| 8027 | * @sessionId: Session Identifier |
| 8028 | * |
| 8029 | * To get roam scan channel list This is a synchronous call |
| 8030 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8031 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8032 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8033 | QDF_STATUS sme_get_roam_scan_channel_list(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8034 | uint8_t *pChannelList, uint8_t *pNumChannels, |
| 8035 | uint8_t sessionId) |
| 8036 | { |
| 8037 | int i = 0; |
| 8038 | uint8_t *pOutPtr = pChannelList; |
| 8039 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8040 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8041 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8042 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 8043 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 8044 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8045 | FL("Invalid sme session id: %d"), sessionId); |
| 8046 | return QDF_STATUS_E_INVAL; |
| 8047 | } |
| 8048 | |
| 8049 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8050 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8051 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8052 | return status; |
| 8053 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8054 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_WARN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8055 | FL("Roam Scan channel list is NOT yet initialized")); |
| 8056 | *pNumChannels = 0; |
| 8057 | sme_release_global_lock(&pMac->sme); |
| 8058 | return status; |
| 8059 | } |
| 8060 | |
| 8061 | *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8062 | for (i = 0; i < (*pNumChannels); i++) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8063 | pOutPtr[i] = |
| 8064 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8065 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8066 | pOutPtr[i] = '\0'; |
| 8067 | sme_release_global_lock(&pMac->sme); |
| 8068 | return status; |
| 8069 | } |
| 8070 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8071 | /* |
| 8072 | * sme_get_is_ese_feature_enabled() - get ESE feature enabled or not |
| 8073 | * This is a synchronuous call |
| 8074 | * |
| 8075 | * hHal - The handle returned by mac_open. |
| 8076 | * Return true (1) - if the ESE feature is enabled |
| 8077 | * false (0) - if feature is disabled (compile or runtime) |
| 8078 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8079 | bool sme_get_is_ese_feature_enabled(tHalHandle hHal) |
| 8080 | { |
| 8081 | #ifdef FEATURE_WLAN_ESE |
| 8082 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8083 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8084 | return csr_roam_is_ese_ini_feature_enabled(pMac); |
| 8085 | #else |
| 8086 | return false; |
| 8087 | #endif |
| 8088 | } |
| 8089 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8090 | /* |
| 8091 | * sme_get_wes_mode() - get WES Mode |
| 8092 | * This is a synchronous call |
| 8093 | * |
| 8094 | * hHal - The handle returned by mac_open |
| 8095 | * Return uint8_t - WES Mode Enabled(1)/Disabled(0) |
| 8096 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8097 | bool sme_get_wes_mode(tHalHandle hHal) |
| 8098 | { |
| 8099 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8100 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8101 | return pMac->roam.configParam.isWESModeEnabled; |
| 8102 | } |
| 8103 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8104 | /* |
| 8105 | * sme_get_roam_scan_control() - get scan control |
| 8106 | * This is a synchronous call |
| 8107 | * |
| 8108 | * hHal - The handle returned by mac_open. |
| 8109 | * Return bool - Enabled(1)/Disabled(0) |
| 8110 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8111 | bool sme_get_roam_scan_control(tHalHandle hHal) |
| 8112 | { |
| 8113 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8114 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8115 | return pMac->roam.configParam.nRoamScanControl; |
| 8116 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8117 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8118 | /* |
| 8119 | * sme_get_is_lfr_feature_enabled() - get LFR feature enabled or not |
| 8120 | * This is a synchronuous call |
| 8121 | * hHal - The handle returned by mac_open. |
| 8122 | * Return true (1) - if the feature is enabled |
| 8123 | * false (0) - if feature is disabled (compile or runtime) |
| 8124 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8125 | bool sme_get_is_lfr_feature_enabled(tHalHandle hHal) |
| 8126 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8127 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8128 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8129 | return pMac->roam.configParam.isFastRoamIniFeatureEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8130 | } |
| 8131 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8132 | /* |
| 8133 | * sme_get_is_ft_feature_enabled() - get FT feature enabled or not |
| 8134 | * This is a synchronuous call |
| 8135 | * |
| 8136 | * hHal - The handle returned by mac_open. |
| 8137 | * Return true (1) - if the feature is enabled |
| 8138 | * false (0) - if feature is disabled (compile or runtime) |
| 8139 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8140 | bool sme_get_is_ft_feature_enabled(tHalHandle hHal) |
| 8141 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8142 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8143 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8144 | return pMac->roam.configParam.isFastTransitionEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8145 | } |
| 8146 | |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 8147 | /** |
| 8148 | * sme_is_feature_supported_by_fw() - check if feature is supported by FW |
| 8149 | * @feature: enum value of requested feature. |
| 8150 | * |
| 8151 | * Retrun: 1 if supported; 0 otherwise |
| 8152 | */ |
| 8153 | bool sme_is_feature_supported_by_fw(enum cap_bitmap feature) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8154 | { |
Krishna Kumaar Natarajan | d0bbb3c | 2017-03-13 17:04:58 -0700 | [diff] [blame] | 8155 | return IS_FEATURE_SUPPORTED_BY_FW(feature); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8156 | } |
| 8157 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8158 | QDF_STATUS sme_get_link_speed(tHalHandle hHal, tSirLinkSpeedInfo *lsReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8159 | void *plsContext, |
| 8160 | void (*pCallbackfn)(tSirLinkSpeedInfo *indParam, |
| 8161 | void *pContext)) |
| 8162 | { |
| 8163 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8164 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8165 | tpAniSirGlobal pMac; |
Mukul Sharma | c3886aa | 2017-05-04 17:53:22 +0530 | [diff] [blame] | 8166 | void *wma_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8167 | |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8168 | if (!hHal || !pCallbackfn || !lsReq) { |
| 8169 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8170 | FL("Invalid parameter")); |
| 8171 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8172 | } |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8173 | |
Mukul Sharma | c3886aa | 2017-05-04 17:53:22 +0530 | [diff] [blame] | 8174 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 8175 | if (!wma_handle) { |
| 8176 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8177 | "wma handle is NULL"); |
| 8178 | return QDF_STATUS_E_FAILURE; |
| 8179 | } |
| 8180 | |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8181 | pMac = PMAC_STRUCT(hHal); |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8182 | status = sme_acquire_global_lock(&pMac->sme); |
| 8183 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 8184 | sme_err("Failed to acquire global lock"); |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8185 | return QDF_STATUS_E_FAILURE; |
| 8186 | } |
| 8187 | |
| 8188 | pMac->sme.pLinkSpeedCbContext = plsContext; |
| 8189 | pMac->sme.pLinkSpeedIndCb = pCallbackfn; |
gaurank kathpalia | ca8f461 | 2018-06-13 14:21:53 +0530 | [diff] [blame] | 8190 | status = wma_get_link_speed(wma_handle, lsReq); |
Jeff Johnson | a5317a6 | 2017-01-26 08:51:25 -0800 | [diff] [blame] | 8191 | sme_release_global_lock(&pMac->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8192 | return status; |
| 8193 | } |
| 8194 | |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 8195 | QDF_STATUS sme_get_peer_stats(tpAniSirGlobal mac, |
| 8196 | struct sir_peer_info_req req) |
| 8197 | { |
| 8198 | QDF_STATUS qdf_status; |
| 8199 | struct scheduler_msg message = {0}; |
| 8200 | |
| 8201 | qdf_status = sme_acquire_global_lock(&mac->sme); |
| 8202 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 8203 | sme_debug("Failed to get Lock"); |
| 8204 | return qdf_status; |
| 8205 | } |
| 8206 | /* serialize the req through MC thread */ |
| 8207 | message.bodyptr = qdf_mem_malloc(sizeof(req)); |
| 8208 | if (NULL == message.bodyptr) { |
| 8209 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8210 | "%s: Memory allocation failed.", __func__); |
| 8211 | sme_release_global_lock(&mac->sme); |
| 8212 | return QDF_STATUS_E_NOMEM; |
| 8213 | } |
| 8214 | qdf_mem_copy(message.bodyptr, &req, sizeof(req)); |
| 8215 | message.type = WMA_GET_PEER_INFO; |
| 8216 | message.reserved = 0; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8217 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8218 | QDF_MODULE_ID_WMA, |
| 8219 | QDF_MODULE_ID_WMA, &message); |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 8220 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 8221 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8222 | "%s: Post get peer info msg fail", __func__); |
| 8223 | qdf_mem_free(message.bodyptr); |
| 8224 | qdf_status = QDF_STATUS_E_FAILURE; |
| 8225 | } |
| 8226 | sme_release_global_lock(&mac->sme); |
| 8227 | return qdf_status; |
| 8228 | } |
| 8229 | |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 8230 | QDF_STATUS sme_get_peer_info(tHalHandle hal, struct sir_peer_info_req req, |
| 8231 | void *context, |
| 8232 | void (*callbackfn)(struct sir_peer_info_resp *param, |
| 8233 | void *pcontext)) |
| 8234 | { |
| 8235 | |
| 8236 | QDF_STATUS status; |
| 8237 | QDF_STATUS qdf_status; |
| 8238 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 658e849 | 2017-12-13 11:35:41 -0800 | [diff] [blame] | 8239 | struct scheduler_msg message = {0}; |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 8240 | |
| 8241 | status = sme_acquire_global_lock(&mac->sme); |
| 8242 | if (QDF_STATUS_SUCCESS == status) { |
| 8243 | if (NULL == callbackfn) { |
| 8244 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8245 | "%s: Indication Call back is NULL", |
| 8246 | __func__); |
| 8247 | sme_release_global_lock(&mac->sme); |
| 8248 | return QDF_STATUS_E_FAILURE; |
| 8249 | } |
| 8250 | |
| 8251 | mac->sme.pget_peer_info_ind_cb = callbackfn; |
| 8252 | mac->sme.pget_peer_info_cb_context = context; |
| 8253 | |
| 8254 | /* serialize the req through MC thread */ |
| 8255 | message.bodyptr = qdf_mem_malloc(sizeof(req)); |
| 8256 | if (NULL == message.bodyptr) { |
| 8257 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8258 | "%s: Memory allocation failed.", __func__); |
| 8259 | sme_release_global_lock(&mac->sme); |
| 8260 | return QDF_STATUS_E_NOMEM; |
| 8261 | } |
| 8262 | qdf_mem_copy(message.bodyptr, &req, sizeof(req)); |
| 8263 | message.type = WMA_GET_PEER_INFO; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 8264 | message.reserved = 0; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8265 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8266 | QDF_MODULE_ID_WMA, |
| 8267 | QDF_MODULE_ID_WMA, |
| 8268 | &message); |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 8269 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 8270 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8271 | "%s: Post get peer info msg fail", __func__); |
| 8272 | qdf_mem_free(message.bodyptr); |
| 8273 | status = QDF_STATUS_E_FAILURE; |
| 8274 | } |
| 8275 | sme_release_global_lock(&mac->sme); |
| 8276 | } |
| 8277 | return status; |
| 8278 | } |
| 8279 | |
| 8280 | QDF_STATUS sme_get_peer_info_ext(tHalHandle hal, |
| 8281 | struct sir_peer_info_ext_req *req, |
| 8282 | void *context, |
| 8283 | void (*callbackfn)(struct sir_peer_info_ext_resp *param, |
| 8284 | void *pcontext)) |
| 8285 | { |
| 8286 | QDF_STATUS status; |
| 8287 | QDF_STATUS qdf_status; |
| 8288 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 658e849 | 2017-12-13 11:35:41 -0800 | [diff] [blame] | 8289 | struct scheduler_msg message = {0}; |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 8290 | |
| 8291 | status = sme_acquire_global_lock(&mac->sme); |
| 8292 | if (QDF_STATUS_SUCCESS == status) { |
| 8293 | if (NULL == callbackfn) { |
| 8294 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8295 | "%s: Indication Call back is NULL", |
| 8296 | __func__); |
| 8297 | sme_release_global_lock(&mac->sme); |
| 8298 | return QDF_STATUS_E_FAILURE; |
| 8299 | } |
| 8300 | |
| 8301 | mac->sme.pget_peer_info_ext_ind_cb = callbackfn; |
| 8302 | mac->sme.pget_peer_info_ext_cb_context = context; |
| 8303 | |
| 8304 | /* serialize the req through MC thread */ |
| 8305 | message.bodyptr = |
| 8306 | qdf_mem_malloc(sizeof(struct sir_peer_info_ext_req)); |
| 8307 | if (NULL == message.bodyptr) { |
| 8308 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8309 | "%s: Memory allocation failed.", __func__); |
| 8310 | sme_release_global_lock(&mac->sme); |
| 8311 | return QDF_STATUS_E_NOMEM; |
| 8312 | } |
| 8313 | qdf_mem_copy(message.bodyptr, |
| 8314 | req, |
| 8315 | sizeof(struct sir_peer_info_ext_req)); |
| 8316 | message.type = WMA_GET_PEER_INFO_EXT; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8317 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8318 | QDF_MODULE_ID_WMA, |
| 8319 | QDF_MODULE_ID_WMA, |
| 8320 | &message); |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 8321 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 8322 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8323 | "%s: Post get rssi msg fail", __func__); |
| 8324 | qdf_mem_free(message.bodyptr); |
| 8325 | status = QDF_STATUS_E_FAILURE; |
| 8326 | } |
| 8327 | sme_release_global_lock(&mac->sme); |
| 8328 | } |
| 8329 | return status; |
| 8330 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8331 | |
| 8332 | /* |
| 8333 | * SME API to enable/disable WLAN driver initiated SSR |
| 8334 | */ |
| 8335 | void sme_update_enable_ssr(tHalHandle hHal, bool enableSSR) |
| 8336 | { |
| 8337 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8338 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8339 | |
| 8340 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8341 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 8342 | sme_debug("SSR level is changed %d", enableSSR); |
Jeff Johnson | 698eacd | 2018-05-12 17:00:03 -0700 | [diff] [blame] | 8343 | /* not serializing this message, as this is only going |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8344 | * to set a variable in WMA/WDI |
| 8345 | */ |
| 8346 | WMA_SetEnableSSR(enableSSR); |
| 8347 | sme_release_global_lock(&pMac->sme); |
| 8348 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8349 | } |
| 8350 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8351 | /*convert the ini value to the ENUM used in csr and MAC for CB state*/ |
| 8352 | ePhyChanBondState sme_get_cb_phy_state_from_cb_ini_value(uint32_t cb_ini_value) |
| 8353 | { |
| 8354 | return csr_convert_cb_ini_value_to_phy_cb_state(cb_ini_value); |
| 8355 | } |
| 8356 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8357 | /* |
| 8358 | * sme_set_curr_device_mode() - Sets the current operating device mode. |
| 8359 | * |
| 8360 | * hHal - The handle returned by mac_open. |
| 8361 | * currDeviceMode - Current operating device mode. |
| 8362 | */ |
Peng Xu | f5d60c8 | 2015-10-02 17:17:03 -0700 | [diff] [blame] | 8363 | void sme_set_curr_device_mode(tHalHandle hHal, |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 8364 | enum QDF_OPMODE currDeviceMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8365 | { |
| 8366 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8367 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8368 | pMac->sme.currDeviceMode = currDeviceMode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8369 | } |
| 8370 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8371 | /* |
| 8372 | * sme_handoff_request() - a wrapper function to Request a handoff from CSR. |
| 8373 | * This is a synchronous call |
| 8374 | * |
| 8375 | * hHal - The handle returned by mac_open |
| 8376 | * sessionId - Session Identifier |
| 8377 | * pHandoffInfo - info provided by HDD with the handoff request (namely: |
| 8378 | * BSSID, channel etc.) |
| 8379 | * Return QDF_STATUS_SUCCESS - SME passed the request to CSR successfully. |
| 8380 | * Other status means SME is failed to send the request. |
| 8381 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8382 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8383 | QDF_STATUS sme_handoff_request(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8384 | uint8_t sessionId, |
| 8385 | tCsrHandoffRequest *pHandoffInfo) |
| 8386 | { |
| 8387 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8388 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8389 | |
| 8390 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8391 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 8392 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8393 | "%s: invoked", __func__); |
| 8394 | status = csr_handoff_request(pMac, sessionId, pHandoffInfo); |
| 8395 | sme_release_global_lock(&pMac->sme); |
| 8396 | } |
| 8397 | |
| 8398 | return status; |
| 8399 | } |
| 8400 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8401 | /* |
| 8402 | * SME API to check if there is any infra station or |
| 8403 | * P2P client is connected |
| 8404 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8405 | QDF_STATUS sme_is_sta_p2p_client_connected(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8406 | { |
| 8407 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8408 | |
| 8409 | if (csr_is_infra_connected(pMac)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8410 | return QDF_STATUS_SUCCESS; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8411 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8412 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8413 | } |
| 8414 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8415 | /** |
| 8416 | * sme_add_periodic_tx_ptrn() - Add Periodic TX Pattern |
| 8417 | * @hal: global hal handle |
| 8418 | * @addPeriodicTxPtrnParams: request message |
| 8419 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8420 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8421 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8422 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8423 | sme_add_periodic_tx_ptrn(tHalHandle hal, |
| 8424 | struct sSirAddPeriodicTxPtrn *addPeriodicTxPtrnParams) |
| 8425 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8426 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8427 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 8428 | struct sSirAddPeriodicTxPtrn *req_msg; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 8429 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8430 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8431 | SME_ENTER(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8432 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8433 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8434 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8435 | sme_err("memory allocation failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8436 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8437 | } |
| 8438 | |
| 8439 | *req_msg = *addPeriodicTxPtrnParams; |
| 8440 | |
| 8441 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8442 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8443 | sme_err("sme_acquire_global_lock failed!(status=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8444 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8445 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8446 | return status; |
| 8447 | } |
| 8448 | |
| 8449 | /* Serialize the req through MC thread */ |
| 8450 | msg.bodyptr = req_msg; |
| 8451 | msg.type = WMA_ADD_PERIODIC_TX_PTRN_IND; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 8452 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 8453 | NO_SESSION, msg.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8454 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8455 | QDF_MODULE_ID_WMA, |
| 8456 | QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8457 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8458 | sme_err("scheduler_post_msg failed!(err=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8459 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8460 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8461 | } |
| 8462 | sme_release_global_lock(&mac->sme); |
| 8463 | return status; |
| 8464 | } |
| 8465 | |
| 8466 | /** |
| 8467 | * sme_del_periodic_tx_ptrn() - Delete Periodic TX Pattern |
| 8468 | * @hal: global hal handle |
| 8469 | * @delPeriodicTxPtrnParams: request message |
| 8470 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8471 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8472 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8473 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8474 | sme_del_periodic_tx_ptrn(tHalHandle hal, |
| 8475 | struct sSirDelPeriodicTxPtrn *delPeriodicTxPtrnParams) |
| 8476 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8477 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8478 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 8479 | struct sSirDelPeriodicTxPtrn *req_msg; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 8480 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8481 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8482 | SME_ENTER(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8483 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8484 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8485 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8486 | sme_err("memory allocation failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8487 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8488 | } |
| 8489 | |
| 8490 | *req_msg = *delPeriodicTxPtrnParams; |
| 8491 | |
| 8492 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8493 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8494 | sme_err("sme_acquire_global_lock failed!(status=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8495 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8496 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8497 | return status; |
| 8498 | } |
| 8499 | |
| 8500 | /* Serialize the req through MC thread */ |
| 8501 | msg.bodyptr = req_msg; |
| 8502 | msg.type = WMA_DEL_PERIODIC_TX_PTRN_IND; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 8503 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 8504 | NO_SESSION, msg.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8505 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8506 | QDF_MODULE_ID_WMA, |
| 8507 | QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8508 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8509 | sme_err("scheduler_post_msg failed!(err=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8510 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8511 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8512 | } |
| 8513 | sme_release_global_lock(&mac->sme); |
| 8514 | return status; |
| 8515 | } |
| 8516 | |
Rachit Kankane | ee1735c | 2018-08-02 13:19:34 +0530 | [diff] [blame] | 8517 | #ifdef FEATURE_WLAN_RMC |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8518 | /* |
| 8519 | * sme_enable_rmc() - enables RMC |
| 8520 | * @hHal : Pointer to global HAL handle |
| 8521 | * @sessionId : Session ID |
| 8522 | * |
| 8523 | * Return: QDF_STATUS |
| 8524 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8525 | QDF_STATUS sme_enable_rmc(tHalHandle hHal, uint32_t sessionId) |
| 8526 | { |
| 8527 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 8528 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 8529 | struct scheduler_msg message = {0}; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8530 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 8531 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8532 | SME_ENTER(); |
| 8533 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8534 | status = sme_acquire_global_lock(&pMac->sme); |
| 8535 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 8536 | message.bodyptr = NULL; |
| 8537 | message.type = WMA_RMC_ENABLE_IND; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8538 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8539 | QDF_MODULE_ID_WMA, |
| 8540 | QDF_MODULE_ID_WMA, |
| 8541 | &message); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8542 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 8543 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8544 | "%s: failed to post message to WMA", |
| 8545 | __func__); |
| 8546 | status = QDF_STATUS_E_FAILURE; |
| 8547 | } |
| 8548 | sme_release_global_lock(&pMac->sme); |
| 8549 | } |
| 8550 | return status; |
| 8551 | } |
| 8552 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8553 | /* |
| 8554 | * sme_disable_rmc() - disables RMC |
| 8555 | * @hHal : Pointer to global HAL handle |
| 8556 | * @sessionId : Session ID |
| 8557 | * |
| 8558 | * Return: QDF_STATUS |
| 8559 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8560 | QDF_STATUS sme_disable_rmc(tHalHandle hHal, uint32_t sessionId) |
| 8561 | { |
| 8562 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 8563 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 8564 | struct scheduler_msg message = {0}; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8565 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 8566 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8567 | SME_ENTER(); |
| 8568 | |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8569 | status = sme_acquire_global_lock(&pMac->sme); |
| 8570 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 8571 | message.bodyptr = NULL; |
| 8572 | message.type = WMA_RMC_DISABLE_IND; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8573 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8574 | QDF_MODULE_ID_WMA, |
| 8575 | QDF_MODULE_ID_WMA, |
| 8576 | &message); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8577 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 8578 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8579 | "%s: failed to post message to WMA", |
| 8580 | __func__); |
| 8581 | status = QDF_STATUS_E_FAILURE; |
| 8582 | } |
| 8583 | sme_release_global_lock(&pMac->sme); |
| 8584 | } |
| 8585 | return status; |
| 8586 | } |
| 8587 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8588 | /* |
| 8589 | * sme_send_rmc_action_period() - sends RMC action period param to target |
| 8590 | * @hHal : Pointer to global HAL handle |
| 8591 | * @sessionId : Session ID |
| 8592 | * |
| 8593 | * Return: QDF_STATUS |
| 8594 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8595 | QDF_STATUS sme_send_rmc_action_period(tHalHandle hHal, uint32_t sessionId) |
| 8596 | { |
| 8597 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 8598 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 8599 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 8600 | struct scheduler_msg message = {0}; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8601 | |
| 8602 | status = sme_acquire_global_lock(&pMac->sme); |
| 8603 | if (QDF_STATUS_SUCCESS == status) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 8604 | message.bodyptr = NULL; |
| 8605 | message.type = WMA_RMC_ACTION_PERIOD_IND; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8606 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8607 | QDF_MODULE_ID_WMA, |
| 8608 | QDF_MODULE_ID_WMA, |
| 8609 | &message); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8610 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 8611 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8612 | "%s: failed to post message to WMA", |
| 8613 | __func__); |
| 8614 | status = QDF_STATUS_E_FAILURE; |
| 8615 | } |
| 8616 | sme_release_global_lock(&pMac->sme); |
| 8617 | } |
| 8618 | |
| 8619 | return status; |
| 8620 | } |
Rachit Kankane | ee1735c | 2018-08-02 13:19:34 +0530 | [diff] [blame] | 8621 | #endif /* FEATURE_WLAN_RMC */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8622 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8623 | /* |
| 8624 | * sme_request_ibss_peer_info() - request ibss peer info |
| 8625 | * @hHal : Pointer to global HAL handle |
| 8626 | * @pUserData : Pointer to user data |
| 8627 | * @peerInfoCbk : Peer info callback |
| 8628 | * @allPeerInfoReqd : All peer info required or not |
| 8629 | * @staIdx : sta index |
| 8630 | * |
| 8631 | * Return: QDF_STATUS |
| 8632 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8633 | QDF_STATUS sme_request_ibss_peer_info(tHalHandle hHal, void *pUserData, |
| 8634 | pIbssPeerInfoCb peerInfoCbk, |
| 8635 | bool allPeerInfoReqd, uint8_t staIdx) |
| 8636 | { |
| 8637 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 8638 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
| 8639 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 8640 | struct scheduler_msg message = {0}; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8641 | tSirIbssGetPeerInfoReqParams *pIbssInfoReqParams; |
| 8642 | |
| 8643 | status = sme_acquire_global_lock(&pMac->sme); |
| 8644 | if (QDF_STATUS_SUCCESS == status) { |
| 8645 | pMac->sme.peerInfoParams.peerInfoCbk = peerInfoCbk; |
| 8646 | pMac->sme.peerInfoParams.pUserData = pUserData; |
| 8647 | |
| 8648 | pIbssInfoReqParams = (tSirIbssGetPeerInfoReqParams *) |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8649 | qdf_mem_malloc(sizeof(tSirIbssGetPeerInfoReqParams)); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8650 | if (NULL == pIbssInfoReqParams) { |
| 8651 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8652 | "%s: Not able to allocate memory for dhcp start", |
| 8653 | __func__); |
| 8654 | sme_release_global_lock(&pMac->sme); |
| 8655 | return QDF_STATUS_E_NOMEM; |
| 8656 | } |
| 8657 | pIbssInfoReqParams->allPeerInfoReqd = allPeerInfoReqd; |
| 8658 | pIbssInfoReqParams->staIdx = staIdx; |
| 8659 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 8660 | message.type = WMA_GET_IBSS_PEER_INFO_REQ; |
| 8661 | message.bodyptr = pIbssInfoReqParams; |
| 8662 | message.reserved = 0; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8663 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8664 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8665 | QDF_MODULE_ID_WMA, |
| 8666 | QDF_MODULE_ID_WMA, |
| 8667 | &message); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8668 | if (QDF_STATUS_SUCCESS != qdf_status) { |
| 8669 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8670 | "%s: Post WMA_GET_IBSS_PEER_INFO_REQ MSG failed", |
| 8671 | __func__); |
| 8672 | qdf_mem_free(pIbssInfoReqParams); |
| 8673 | qdf_status = QDF_STATUS_E_FAILURE; |
| 8674 | } |
| 8675 | sme_release_global_lock(&pMac->sme); |
| 8676 | } |
| 8677 | |
| 8678 | return qdf_status; |
| 8679 | } |
| 8680 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8681 | /* |
| 8682 | * sme_send_cesium_enable_ind() - |
| 8683 | * Used to send proprietary cesium enable indication to fw |
| 8684 | * |
| 8685 | * hHal |
| 8686 | * sessionId |
| 8687 | * Return QDF_STATUS |
| 8688 | */ |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8689 | QDF_STATUS sme_send_cesium_enable_ind(tHalHandle hHal, uint32_t sessionId) |
| 8690 | { |
| 8691 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 8692 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 8693 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 8694 | struct scheduler_msg message = {0}; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8695 | |
| 8696 | status = sme_acquire_global_lock(&pMac->sme); |
| 8697 | if (QDF_STATUS_SUCCESS == status) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 8698 | message.bodyptr = NULL; |
| 8699 | message.type = WMA_IBSS_CESIUM_ENABLE_IND; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8700 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8701 | QDF_MODULE_ID_WMA, |
| 8702 | QDF_MODULE_ID_WMA, |
| 8703 | &message); |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 8704 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 8705 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8706 | "%s: failed to post message to WMA", |
| 8707 | __func__); |
| 8708 | status = QDF_STATUS_E_FAILURE; |
| 8709 | } |
| 8710 | sme_release_global_lock(&pMac->sme); |
| 8711 | } |
| 8712 | |
| 8713 | return status; |
| 8714 | } |
| 8715 | |
Paul Zhang | 99fe884 | 2017-12-08 14:43:46 +0800 | [diff] [blame] | 8716 | QDF_STATUS sme_set_wlm_latency_level(tHalHandle hal, uint16_t session_id, |
| 8717 | uint16_t latency_level) |
| 8718 | { |
| 8719 | QDF_STATUS status; |
| 8720 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 8721 | struct wlm_latency_level_param params; |
| 8722 | void *wma = cds_get_context(QDF_MODULE_ID_WMA); |
| 8723 | |
Bala Venkatesh | 7cf5b66 | 2018-05-10 15:18:53 +0530 | [diff] [blame] | 8724 | if (!wma) |
| 8725 | return QDF_STATUS_E_FAILURE; |
| 8726 | |
Paul Zhang | 99fe884 | 2017-12-08 14:43:46 +0800 | [diff] [blame] | 8727 | if (!mac_ctx->roam.configParam.wlm_latency_enable) { |
| 8728 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8729 | "%s: WLM latency level setting is disabled", |
| 8730 | __func__); |
| 8731 | return QDF_STATUS_E_FAILURE; |
| 8732 | } |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 8733 | if (!wma) { |
| 8734 | sme_err("wma is NULL"); |
| 8735 | return QDF_STATUS_E_FAILURE; |
| 8736 | } |
Paul Zhang | 99fe884 | 2017-12-08 14:43:46 +0800 | [diff] [blame] | 8737 | |
| 8738 | params.wlm_latency_level = latency_level; |
| 8739 | params.wlm_latency_flags = |
| 8740 | mac_ctx->roam.configParam.wlm_latency_flags[latency_level]; |
| 8741 | params.vdev_id = session_id; |
| 8742 | |
| 8743 | status = wma_set_wlm_latency_level(wma, ¶ms); |
| 8744 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 8745 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 8746 | "%s: failed to set latency level", |
| 8747 | __func__); |
| 8748 | |
| 8749 | return status; |
| 8750 | } |
| 8751 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8752 | void sme_get_command_q_status(tHalHandle hHal) |
| 8753 | { |
| 8754 | tSmeCmd *pTempCmd = NULL; |
| 8755 | tListElem *pEntry; |
Pragaspathi Thilagaraj | b11dbe4 | 2018-07-23 16:42:17 +0530 | [diff] [blame] | 8756 | tpAniSirGlobal pMac; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8757 | |
Pragaspathi Thilagaraj | b11dbe4 | 2018-07-23 16:42:17 +0530 | [diff] [blame] | 8758 | if (NULL != hHal) { |
| 8759 | pMac = PMAC_STRUCT(hHal); |
| 8760 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8761 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Pragaspathi Thilagaraj | b11dbe4 | 2018-07-23 16:42:17 +0530 | [diff] [blame] | 8762 | "%s: Invalid hHal pointer", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8763 | return; |
| 8764 | } |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 8765 | pEntry = csr_nonscan_active_ll_peek_head(pMac, LL_ACCESS_LOCK); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8766 | if (pEntry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8767 | pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8768 | |
Kabilan Kannan | 33fcd68 | 2018-03-08 14:29:46 -0800 | [diff] [blame] | 8769 | sme_err("WLAN_BUG_RCA: Currently smeCmdActiveList has command (0x%X)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8770 | (pTempCmd) ? pTempCmd->command : eSmeNoCommand); |
| 8771 | if (pTempCmd) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 8772 | if (eSmeCsrCommandMask & pTempCmd->command) |
| 8773 | /* CSR command is stuck. See what the reason code is |
| 8774 | * for that command |
| 8775 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8776 | dump_csr_command_info(pMac, pTempCmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8777 | } /* if(pTempCmd) */ |
| 8778 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 8779 | sme_err("Currently smeCmdPendingList has %d commands", |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 8780 | csr_nonscan_pending_ll_count(pMac)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8781 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8782 | } |
Kiran Kumar Lokere | 1aa9c9a | 2016-10-05 18:50:59 -0700 | [diff] [blame] | 8783 | |
Agrawal Ashish | b141b09 | 2016-09-02 19:59:26 +0530 | [diff] [blame] | 8784 | #ifdef WLAN_FEATURE_DSRC |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8785 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8786 | * copy_sir_ocb_config() - Performs deep copy of an OCB configuration |
| 8787 | * @src: the source configuration |
| 8788 | * |
| 8789 | * Return: pointer to the copied OCB configuration |
| 8790 | */ |
| 8791 | static struct sir_ocb_config *sme_copy_sir_ocb_config( |
| 8792 | struct sir_ocb_config *src) |
| 8793 | { |
| 8794 | struct sir_ocb_config *dst; |
| 8795 | uint32_t length; |
| 8796 | void *cursor; |
| 8797 | |
| 8798 | length = sizeof(*src) + |
| 8799 | src->channel_count * sizeof(*src->channels) + |
| 8800 | src->schedule_size * sizeof(*src->schedule) + |
| 8801 | src->dcc_ndl_chan_list_len + |
| 8802 | src->dcc_ndl_active_state_list_len; |
| 8803 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8804 | dst = qdf_mem_malloc(length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8805 | if (!dst) |
| 8806 | return NULL; |
| 8807 | |
| 8808 | *dst = *src; |
| 8809 | |
| 8810 | cursor = dst; |
| 8811 | cursor += sizeof(*dst); |
| 8812 | dst->channels = cursor; |
| 8813 | cursor += src->channel_count * sizeof(*src->channels); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8814 | qdf_mem_copy(dst->channels, src->channels, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8815 | src->channel_count * sizeof(*src->channels)); |
| 8816 | dst->schedule = cursor; |
| 8817 | cursor += src->schedule_size * sizeof(*src->schedule); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8818 | qdf_mem_copy(dst->schedule, src->schedule, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8819 | src->schedule_size * sizeof(*src->schedule)); |
| 8820 | dst->dcc_ndl_chan_list = cursor; |
| 8821 | cursor += src->dcc_ndl_chan_list_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8822 | 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] | 8823 | src->dcc_ndl_chan_list_len); |
| 8824 | dst->dcc_ndl_active_state_list = cursor; |
| 8825 | cursor += src->dcc_ndl_active_state_list_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8826 | qdf_mem_copy(dst->dcc_ndl_active_state_list, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8827 | src->dcc_ndl_active_state_list, |
| 8828 | src->dcc_ndl_active_state_list_len); |
| 8829 | return dst; |
| 8830 | } |
| 8831 | |
| 8832 | /** |
| 8833 | * sme_ocb_set_config() - Set the OCB configuration |
| 8834 | * @hHal: reference to the HAL |
| 8835 | * @context: the context of the call |
| 8836 | * @callback: the callback to hdd |
| 8837 | * @config: the OCB configuration |
| 8838 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8839 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8840 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8841 | QDF_STATUS sme_ocb_set_config(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8842 | ocb_callback callback, |
| 8843 | struct sir_ocb_config *config) |
| 8844 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8845 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8846 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 8847 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8848 | struct sir_ocb_config *msg_body; |
| 8849 | |
| 8850 | /* Lock the SME structure */ |
| 8851 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8852 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8853 | return status; |
| 8854 | |
| 8855 | /* |
| 8856 | * Check if there is a pending request and return an error if one |
| 8857 | * exists |
| 8858 | */ |
| 8859 | if (pMac->sme.ocb_set_config_callback) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8860 | status = QDF_STATUS_E_BUSY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8861 | goto end; |
| 8862 | } |
| 8863 | |
| 8864 | msg_body = sme_copy_sir_ocb_config(config); |
| 8865 | |
| 8866 | if (!msg_body) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8867 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8868 | goto end; |
| 8869 | } |
| 8870 | |
| 8871 | msg.type = WMA_OCB_SET_CONFIG_CMD; |
| 8872 | msg.bodyptr = msg_body; |
| 8873 | |
| 8874 | /* Set the request callback and context */ |
| 8875 | pMac->sme.ocb_set_config_callback = callback; |
| 8876 | pMac->sme.ocb_set_config_context = context; |
| 8877 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8878 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8879 | QDF_MODULE_ID_WMA, |
| 8880 | QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8881 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8882 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8883 | FL("Error posting message to WDA: %d"), status); |
| 8884 | pMac->sme.ocb_set_config_callback = callback; |
| 8885 | pMac->sme.ocb_set_config_context = context; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8886 | qdf_mem_free(msg_body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8887 | goto end; |
| 8888 | } |
| 8889 | |
| 8890 | end: |
| 8891 | sme_release_global_lock(&pMac->sme); |
| 8892 | |
| 8893 | return status; |
| 8894 | } |
| 8895 | |
| 8896 | /** |
| 8897 | * sme_ocb_set_utc_time() - Set the OCB UTC time |
| 8898 | * @hHal: reference to the HAL |
| 8899 | * @utc: the UTC time struct |
| 8900 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8901 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8902 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8903 | 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] | 8904 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8905 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8906 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 8907 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8908 | struct sir_ocb_utc *sme_utc; |
| 8909 | |
| 8910 | /* Lock the SME structure */ |
| 8911 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8912 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8913 | return status; |
| 8914 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8915 | sme_utc = qdf_mem_malloc(sizeof(*sme_utc)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8916 | if (!sme_utc) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8917 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8918 | FL("Malloc failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8919 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8920 | goto end; |
| 8921 | } |
| 8922 | *sme_utc = *utc; |
| 8923 | |
| 8924 | msg.type = WMA_OCB_SET_UTC_TIME_CMD; |
| 8925 | msg.reserved = 0; |
| 8926 | msg.bodyptr = sme_utc; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8927 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8928 | QDF_MODULE_ID_WMA, |
| 8929 | QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8930 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8931 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8932 | FL("Not able to post message to WDA")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8933 | qdf_mem_free(utc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8934 | goto end; |
| 8935 | } |
| 8936 | |
| 8937 | end: |
| 8938 | sme_release_global_lock(&pMac->sme); |
| 8939 | |
| 8940 | return status; |
| 8941 | } |
| 8942 | |
| 8943 | /** |
| 8944 | * sme_ocb_start_timing_advert() - Start sending timing advert frames |
| 8945 | * @hHal: reference to the HAL |
| 8946 | * @timing_advert: the timing advertisement struct |
| 8947 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8948 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8949 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8950 | QDF_STATUS sme_ocb_start_timing_advert(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8951 | struct sir_ocb_timing_advert *timing_advert) |
| 8952 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8953 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8954 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 8955 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8956 | void *buf; |
| 8957 | struct sir_ocb_timing_advert *sme_timing_advert; |
| 8958 | |
| 8959 | /* Lock the SME structure */ |
| 8960 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8961 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8962 | return status; |
| 8963 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8964 | buf = qdf_mem_malloc(sizeof(*sme_timing_advert) + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8965 | timing_advert->template_length); |
| 8966 | if (!buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8967 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8968 | FL("Not able to allocate memory for start TA")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8969 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8970 | goto end; |
| 8971 | } |
| 8972 | |
| 8973 | sme_timing_advert = (struct sir_ocb_timing_advert *)buf; |
| 8974 | *sme_timing_advert = *timing_advert; |
| 8975 | sme_timing_advert->template_value = buf + sizeof(*sme_timing_advert); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8976 | qdf_mem_copy(sme_timing_advert->template_value, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8977 | timing_advert->template_value, timing_advert->template_length); |
| 8978 | |
| 8979 | msg.type = WMA_OCB_START_TIMING_ADVERT_CMD; |
| 8980 | msg.reserved = 0; |
| 8981 | msg.bodyptr = buf; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 8982 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 8983 | QDF_MODULE_ID_WMA, |
| 8984 | QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8985 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8986 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8987 | FL("Not able to post msg to WDA")); |
| 8988 | goto end; |
| 8989 | } |
| 8990 | |
| 8991 | end: |
| 8992 | sme_release_global_lock(&pMac->sme); |
| 8993 | |
| 8994 | return status; |
| 8995 | } |
| 8996 | |
| 8997 | /** |
| 8998 | * sme_ocb_stop_timing_advert() - Stop sending timing advert frames on a channel |
| 8999 | * @hHal: reference to the HAL |
| 9000 | * @timing_advert: the timing advertisement struct |
| 9001 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9002 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9003 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9004 | QDF_STATUS sme_ocb_stop_timing_advert(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9005 | struct sir_ocb_timing_advert *timing_advert) |
| 9006 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9007 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9008 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9009 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9010 | struct sir_ocb_timing_advert *sme_timing_advert; |
| 9011 | |
| 9012 | /* Lock the SME structure */ |
| 9013 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9014 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9015 | return status; |
| 9016 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9017 | sme_timing_advert = qdf_mem_malloc(sizeof(*timing_advert)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9018 | if (!sme_timing_advert) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9019 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9020 | FL("Not able to allocate memory for stop TA")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9021 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9022 | goto end; |
| 9023 | } |
| 9024 | *sme_timing_advert = *timing_advert; |
| 9025 | |
| 9026 | msg.type = WMA_OCB_STOP_TIMING_ADVERT_CMD; |
| 9027 | msg.reserved = 0; |
| 9028 | msg.bodyptr = sme_timing_advert; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 9029 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 9030 | QDF_MODULE_ID_WMA, |
| 9031 | QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9032 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9033 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9034 | FL("Not able to post msg to WDA")); |
| 9035 | goto end; |
| 9036 | } |
| 9037 | |
| 9038 | end: |
| 9039 | sme_release_global_lock(&pMac->sme); |
| 9040 | |
| 9041 | return status; |
| 9042 | } |
| 9043 | |
| 9044 | /** |
Naveen Rawat | b4d3762 | 2015-11-13 16:15:25 -0800 | [diff] [blame] | 9045 | * sme_ocb_gen_timing_advert_frame() - generate TA frame and populate the buffer |
| 9046 | * @hal_handle: reference to the HAL |
| 9047 | * @self_addr: the self MAC address |
| 9048 | * @buf: the buffer that will contain the frame |
| 9049 | * @timestamp_offset: return for the offset of the timestamp field |
| 9050 | * @time_value_offset: return for the time_value field in the TA IE |
| 9051 | * |
| 9052 | * Return: the length of the buffer. |
| 9053 | */ |
| 9054 | int sme_ocb_gen_timing_advert_frame(tHalHandle hal_handle, |
| 9055 | tSirMacAddr self_addr, uint8_t **buf, |
| 9056 | uint32_t *timestamp_offset, |
| 9057 | uint32_t *time_value_offset) |
| 9058 | { |
| 9059 | int template_length; |
| 9060 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
| 9061 | |
| 9062 | template_length = sch_gen_timing_advert_frame(mac_ctx, self_addr, buf, |
| 9063 | timestamp_offset, |
| 9064 | time_value_offset); |
| 9065 | return template_length; |
| 9066 | } |
| 9067 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9068 | * sme_ocb_get_tsf_timer() - Get the TSF timer value |
| 9069 | * @hHal: reference to the HAL |
| 9070 | * @context: the context of the call |
| 9071 | * @callback: the callback to hdd |
| 9072 | * @request: the TSF timer request |
| 9073 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9074 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9075 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9076 | QDF_STATUS sme_ocb_get_tsf_timer(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9077 | ocb_callback callback, |
| 9078 | struct sir_ocb_get_tsf_timer *request) |
| 9079 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9080 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9081 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9082 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9083 | struct sir_ocb_get_tsf_timer *msg_body; |
| 9084 | |
| 9085 | /* Lock the SME structure */ |
| 9086 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9087 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9088 | return status; |
| 9089 | |
| 9090 | /* Allocate memory for the WMI request, and copy the parameter */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9091 | msg_body = qdf_mem_malloc(sizeof(*msg_body)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9092 | if (!msg_body) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9093 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9094 | goto end; |
| 9095 | } |
| 9096 | *msg_body = *request; |
| 9097 | |
| 9098 | msg.type = WMA_OCB_GET_TSF_TIMER_CMD; |
| 9099 | msg.bodyptr = msg_body; |
| 9100 | |
| 9101 | /* Set the request callback and the context */ |
| 9102 | pMac->sme.ocb_get_tsf_timer_callback = callback; |
| 9103 | pMac->sme.ocb_get_tsf_timer_context = context; |
| 9104 | |
| 9105 | /* Post the message to WDA */ |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 9106 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 9107 | QDF_MODULE_ID_WMA, |
| 9108 | QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9109 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9110 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9111 | FL("Error posting message to WDA: %d"), status); |
| 9112 | pMac->sme.ocb_get_tsf_timer_callback = NULL; |
| 9113 | pMac->sme.ocb_get_tsf_timer_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9114 | qdf_mem_free(msg_body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9115 | goto end; |
| 9116 | } |
| 9117 | |
| 9118 | end: |
| 9119 | sme_release_global_lock(&pMac->sme); |
| 9120 | |
| 9121 | return status; |
| 9122 | } |
| 9123 | |
| 9124 | /** |
| 9125 | * sme_dcc_get_stats() - Get the DCC stats |
| 9126 | * @hHal: reference to the HAL |
| 9127 | * @context: the context of the call |
| 9128 | * @callback: the callback to hdd |
| 9129 | * @request: the get DCC stats request |
| 9130 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9131 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9132 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9133 | QDF_STATUS sme_dcc_get_stats(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9134 | ocb_callback callback, |
| 9135 | struct sir_dcc_get_stats *request) |
| 9136 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9137 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9138 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9139 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9140 | struct sir_dcc_get_stats *msg_body; |
| 9141 | |
| 9142 | /* Lock the SME structure */ |
| 9143 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9144 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9145 | return status; |
| 9146 | |
| 9147 | /* Allocate memory for the WMI request, and copy the parameter */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9148 | msg_body = qdf_mem_malloc(sizeof(*msg_body) + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9149 | request->request_array_len); |
| 9150 | if (!msg_body) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9151 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9152 | goto end; |
| 9153 | } |
| 9154 | *msg_body = *request; |
| 9155 | msg_body->request_array = (void *)msg_body + sizeof(*msg_body); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9156 | qdf_mem_copy(msg_body->request_array, request->request_array, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9157 | request->request_array_len); |
| 9158 | |
| 9159 | msg.type = WMA_DCC_GET_STATS_CMD; |
| 9160 | msg.bodyptr = msg_body; |
| 9161 | |
| 9162 | /* Set the request callback and context */ |
| 9163 | pMac->sme.dcc_get_stats_callback = callback; |
| 9164 | pMac->sme.dcc_get_stats_context = context; |
| 9165 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 9166 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 9167 | QDF_MODULE_ID_WMA, |
| 9168 | QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9169 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9170 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9171 | FL("Error posting message to WDA: %d"), status); |
| 9172 | pMac->sme.dcc_get_stats_callback = callback; |
| 9173 | pMac->sme.dcc_get_stats_context = context; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9174 | qdf_mem_free(msg_body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9175 | goto end; |
| 9176 | } |
| 9177 | |
| 9178 | end: |
| 9179 | sme_release_global_lock(&pMac->sme); |
| 9180 | |
| 9181 | return status; |
| 9182 | } |
| 9183 | |
| 9184 | /** |
| 9185 | * sme_dcc_clear_stats() - Clear the DCC stats |
| 9186 | * @hHal: reference to the HAL |
| 9187 | * @vdev_id: vdev id for OCB interface |
| 9188 | * @dcc_stats_bitmap: the entries in the stats to clear |
| 9189 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9190 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9191 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9192 | QDF_STATUS sme_dcc_clear_stats(tHalHandle hHal, uint32_t vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9193 | uint32_t dcc_stats_bitmap) |
| 9194 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9195 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9196 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9197 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9198 | struct sir_dcc_clear_stats *request; |
| 9199 | |
| 9200 | /* Lock the SME structure */ |
| 9201 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9202 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9203 | return status; |
| 9204 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9205 | request = qdf_mem_malloc(sizeof(struct sir_dcc_clear_stats)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9206 | if (!request) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9207 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9208 | FL("Not able to allocate memory")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9209 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9210 | goto end; |
| 9211 | } |
| 9212 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9213 | request->vdev_id = vdev_id; |
| 9214 | request->dcc_stats_bitmap = dcc_stats_bitmap; |
| 9215 | |
| 9216 | msg.type = WMA_DCC_CLEAR_STATS_CMD; |
| 9217 | msg.bodyptr = request; |
| 9218 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 9219 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 9220 | QDF_MODULE_ID_WMA, |
| 9221 | QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9222 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9223 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9224 | FL("Not able to post msg to WDA")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9225 | qdf_mem_free(request); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9226 | goto end; |
| 9227 | } |
| 9228 | |
| 9229 | end: |
| 9230 | sme_release_global_lock(&pMac->sme); |
| 9231 | |
| 9232 | return status; |
| 9233 | } |
| 9234 | |
| 9235 | /** |
| 9236 | * sme_dcc_update_ndl() - Update the DCC settings |
| 9237 | * @hHal: reference to the HAL |
| 9238 | * @context: the context of the call |
| 9239 | * @callback: the callback to hdd |
| 9240 | * @request: the update DCC request |
| 9241 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9242 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9243 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9244 | QDF_STATUS sme_dcc_update_ndl(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9245 | ocb_callback callback, |
| 9246 | struct sir_dcc_update_ndl *request) |
| 9247 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9248 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9249 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 9250 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9251 | struct sir_dcc_update_ndl *msg_body; |
| 9252 | |
| 9253 | /* Lock the SME structure */ |
| 9254 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9255 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9256 | return status; |
| 9257 | |
| 9258 | /* Allocate memory for the WMI request, and copy the parameter */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9259 | msg_body = qdf_mem_malloc(sizeof(*msg_body) + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9260 | request->dcc_ndl_chan_list_len + |
| 9261 | request->dcc_ndl_active_state_list_len); |
| 9262 | if (!msg_body) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9263 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9264 | FL("Failed to allocate memory")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9265 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9266 | goto end; |
| 9267 | } |
| 9268 | |
| 9269 | *msg_body = *request; |
| 9270 | |
| 9271 | msg_body->dcc_ndl_chan_list = (void *)msg_body + sizeof(*msg_body); |
| 9272 | msg_body->dcc_ndl_active_state_list = msg_body->dcc_ndl_chan_list + |
| 9273 | request->dcc_ndl_chan_list_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9274 | 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] | 9275 | request->dcc_ndl_active_state_list_len); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9276 | qdf_mem_copy(msg_body->dcc_ndl_active_state_list, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9277 | request->dcc_ndl_active_state_list, |
| 9278 | request->dcc_ndl_active_state_list_len); |
| 9279 | |
| 9280 | msg.type = WMA_DCC_UPDATE_NDL_CMD; |
| 9281 | msg.bodyptr = msg_body; |
| 9282 | |
| 9283 | /* Set the request callback and the context */ |
| 9284 | pMac->sme.dcc_update_ndl_callback = callback; |
| 9285 | pMac->sme.dcc_update_ndl_context = context; |
| 9286 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 9287 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 9288 | QDF_MODULE_ID_WMA, |
| 9289 | QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9290 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9291 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9292 | FL("Error posting message to WDA: %d"), status); |
| 9293 | pMac->sme.dcc_update_ndl_callback = NULL; |
| 9294 | pMac->sme.dcc_update_ndl_context = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9295 | qdf_mem_free(msg_body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9296 | goto end; |
| 9297 | } |
| 9298 | |
| 9299 | end: |
| 9300 | sme_release_global_lock(&pMac->sme); |
| 9301 | |
| 9302 | return status; |
| 9303 | } |
| 9304 | |
| 9305 | /** |
| 9306 | * sme_register_for_dcc_stats_event() - Register for the periodic DCC stats |
| 9307 | * event |
| 9308 | * @hHal: reference to the HAL |
| 9309 | * @context: the context of the call |
| 9310 | * @callback: the callback to hdd |
| 9311 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9312 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9313 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9314 | QDF_STATUS sme_register_for_dcc_stats_event(tHalHandle hHal, void *context, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9315 | ocb_callback callback) |
| 9316 | { |
| 9317 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9318 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9319 | |
| 9320 | status = sme_acquire_global_lock(&pMac->sme); |
| 9321 | pMac->sme.dcc_stats_event_callback = callback; |
| 9322 | pMac->sme.dcc_stats_event_context = context; |
| 9323 | sme_release_global_lock(&pMac->sme); |
| 9324 | |
| 9325 | return 0; |
| 9326 | } |
| 9327 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 9328 | /** |
| 9329 | * sme_deregister_for_dcc_stats_event() - De-Register for the periodic DCC stats |
| 9330 | * event |
| 9331 | * @h_hal: Hal Handle |
| 9332 | * |
| 9333 | * This function de-registers the DCC perioc stats callback |
| 9334 | * |
| 9335 | * Return: QDF_STATUS Enumeration |
| 9336 | */ |
| 9337 | QDF_STATUS sme_deregister_for_dcc_stats_event(tHalHandle h_hal) |
| 9338 | { |
| 9339 | tpAniSirGlobal mac; |
| 9340 | QDF_STATUS status; |
| 9341 | |
| 9342 | if (!h_hal) { |
| 9343 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9344 | FL("h_hal is not valid")); |
| 9345 | return QDF_STATUS_E_INVAL; |
| 9346 | } |
| 9347 | mac = PMAC_STRUCT(h_hal); |
| 9348 | |
| 9349 | status = sme_acquire_global_lock(&mac->sme); |
| 9350 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 9351 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9352 | FL("Failed to acquire global lock")); |
| 9353 | return status; |
| 9354 | } |
| 9355 | mac->sme.dcc_stats_event_callback = NULL; |
| 9356 | mac->sme.dcc_stats_event_context = NULL; |
| 9357 | sme_release_global_lock(&mac->sme); |
| 9358 | |
| 9359 | return status; |
| 9360 | } |
Kiran Kumar Lokere | 1a43bcf | 2018-05-15 15:51:58 -0700 | [diff] [blame] | 9361 | #else |
| 9362 | void sme_set_etsi13_srd_ch_in_master_mode(tHalHandle hal, |
| 9363 | bool etsi13_srd_chan_support) |
| 9364 | { |
| 9365 | tpAniSirGlobal mac; |
| 9366 | |
| 9367 | mac = PMAC_STRUCT(hal); |
| 9368 | mac->sap.enable_etsi13_srd_chan_support = etsi13_srd_chan_support; |
| 9369 | sme_debug("srd_ch_support %d", mac->sap.enable_etsi13_srd_chan_support); |
| 9370 | } |
Agrawal Ashish | b141b09 | 2016-09-02 19:59:26 +0530 | [diff] [blame] | 9371 | #endif |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 9372 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9373 | void sme_get_recovery_stats(tHalHandle hHal) |
| 9374 | { |
| 9375 | uint8_t i; |
| 9376 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9377 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9378 | "Self Recovery Stats"); |
| 9379 | for (i = 0; i < MAX_ACTIVE_CMD_STATS; i++) { |
| 9380 | if (eSmeNoCommand != |
| 9381 | g_self_recovery_stats.activeCmdStats[i].command) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9382 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9383 | "timestamp %llu: command 0x%0X: reason %d: session %d", |
| 9384 | g_self_recovery_stats.activeCmdStats[i]. |
| 9385 | timestamp, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9386 | g_self_recovery_stats.activeCmdStats[i].command, |
| 9387 | g_self_recovery_stats.activeCmdStats[i].reason, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9388 | g_self_recovery_stats.activeCmdStats[i]. |
| 9389 | sessionId); |
| 9390 | } |
| 9391 | } |
| 9392 | } |
| 9393 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9394 | QDF_STATUS sme_notify_modem_power_state(tHalHandle hHal, uint32_t value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9395 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 9396 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9397 | tpSirModemPowerStateInd request_buf; |
| 9398 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9399 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9400 | if (NULL == pMac) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9401 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9402 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9403 | request_buf = qdf_mem_malloc(sizeof(tSirModemPowerStateInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9404 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9405 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9406 | "%s: Not able to allocate memory for MODEM POWER STATE IND", |
| 9407 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9408 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9409 | } |
| 9410 | |
| 9411 | request_buf->param = value; |
| 9412 | |
| 9413 | msg.type = WMA_MODEM_POWER_STATE_IND; |
| 9414 | msg.reserved = 0; |
| 9415 | msg.bodyptr = request_buf; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9416 | if (!QDF_IS_STATUS_SUCCESS |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 9417 | (scheduler_post_message(QDF_MODULE_ID_SME, |
| 9418 | QDF_MODULE_ID_WMA, |
| 9419 | QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9420 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9421 | "%s: Not able to post WMA_MODEM_POWER_STATE_IND message to WMA", |
| 9422 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9423 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9424 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9425 | } |
| 9426 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9427 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9428 | } |
| 9429 | |
| 9430 | #ifdef QCA_HT_2040_COEX |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9431 | QDF_STATUS sme_notify_ht2040_mode(tHalHandle hHal, uint16_t staId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 9432 | struct qdf_mac_addr macAddrSTA, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9433 | uint8_t sessionId, |
| 9434 | uint8_t channel_type) |
| 9435 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 9436 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9437 | tUpdateVHTOpMode *pHtOpMode = NULL; |
| 9438 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9439 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9440 | if (NULL == pMac) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9441 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9442 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9443 | pHtOpMode = qdf_mem_malloc(sizeof(tUpdateVHTOpMode)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9444 | if (NULL == pHtOpMode) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9445 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9446 | "%s: Not able to allocate memory for setting OP mode", |
| 9447 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9448 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9449 | } |
| 9450 | |
| 9451 | switch (channel_type) { |
| 9452 | case eHT_CHAN_HT20: |
| 9453 | pHtOpMode->opMode = eHT_CHANNEL_WIDTH_20MHZ; |
| 9454 | break; |
| 9455 | |
| 9456 | case eHT_CHAN_HT40MINUS: |
| 9457 | case eHT_CHAN_HT40PLUS: |
| 9458 | pHtOpMode->opMode = eHT_CHANNEL_WIDTH_40MHZ; |
| 9459 | break; |
| 9460 | |
| 9461 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9462 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9463 | "%s: Invalid OP mode", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9464 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9465 | } |
| 9466 | |
| 9467 | pHtOpMode->staId = staId, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9468 | qdf_mem_copy(pHtOpMode->peer_mac, macAddrSTA.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9469 | sizeof(tSirMacAddr)); |
| 9470 | pHtOpMode->smesessionId = sessionId; |
| 9471 | |
| 9472 | msg.type = WMA_UPDATE_OP_MODE; |
| 9473 | msg.reserved = 0; |
| 9474 | msg.bodyptr = pHtOpMode; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9475 | if (!QDF_IS_STATUS_SUCCESS |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 9476 | (scheduler_post_message(QDF_MODULE_ID_SME, |
| 9477 | QDF_MODULE_ID_WMA, |
| 9478 | QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9479 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9480 | "%s: Not able to post WMA_UPDATE_OP_MODE message to WMA", |
| 9481 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9482 | qdf_mem_free(pHtOpMode); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9483 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9484 | } |
| 9485 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 9486 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 698eacd | 2018-05-12 17:00:03 -0700 | [diff] [blame] | 9487 | "%s: Notified FW about OP mode: %d for staId=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9488 | __func__, pHtOpMode->opMode, staId); |
| 9489 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9490 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9491 | } |
| 9492 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9493 | /* |
| 9494 | * sme_set_ht2040_mode() - |
| 9495 | * To update HT Operation beacon IE. |
| 9496 | * |
| 9497 | * Return QDF_STATUS SUCCESS |
| 9498 | * FAILURE or RESOURCES |
| 9499 | * The API finished and failed. |
| 9500 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9501 | QDF_STATUS sme_set_ht2040_mode(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9502 | uint8_t channel_type, bool obssEnabled) |
| 9503 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9504 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9505 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 9506 | ePhyChanBondState cbMode; |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 9507 | struct csr_roam_session *session = CSR_GET_SESSION(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9508 | |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 9509 | if (!CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 9510 | sme_err("Session not valid for session id %d", sessionId); |
| 9511 | return QDF_STATUS_E_INVAL; |
| 9512 | } |
| 9513 | session = CSR_GET_SESSION(pMac, sessionId); |
| 9514 | sme_debug("Update HT operation beacon IE, channel_type=%d cur cbmode %d", |
| 9515 | channel_type, session->bssParams.cbMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9516 | |
| 9517 | switch (channel_type) { |
| 9518 | case eHT_CHAN_HT20: |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 9519 | if (!session->bssParams.cbMode) |
| 9520 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9521 | cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
| 9522 | break; |
| 9523 | case eHT_CHAN_HT40MINUS: |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 9524 | if (session->bssParams.cbMode) |
| 9525 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9526 | cbMode = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 9527 | break; |
| 9528 | case eHT_CHAN_HT40PLUS: |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 9529 | if (session->bssParams.cbMode) |
| 9530 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9531 | cbMode = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 9532 | break; |
| 9533 | default: |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 9534 | sme_err("Error!!! Invalid HT20/40 mode !"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9535 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9536 | } |
Abhishek Singh | 9d5f458 | 2017-10-11 17:59:48 +0530 | [diff] [blame] | 9537 | session->bssParams.cbMode = cbMode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9538 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9539 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9540 | status = csr_set_ht2040_mode(pMac, sessionId, |
| 9541 | cbMode, obssEnabled); |
| 9542 | sme_release_global_lock(&pMac->sme); |
| 9543 | } |
| 9544 | return status; |
| 9545 | } |
| 9546 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9547 | #endif |
| 9548 | |
| 9549 | /* |
| 9550 | * SME API to enable/disable idle mode powersave |
| 9551 | * This should be called only if powersave offload |
| 9552 | * is enabled |
| 9553 | */ |
Arunk Khandavalli | 847969d | 2017-09-25 15:15:36 +0530 | [diff] [blame] | 9554 | QDF_STATUS sme_set_idle_powersave_config(bool value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9555 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 9556 | void *wmaContext = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9557 | |
| 9558 | if (NULL == wmaContext) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9559 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9560 | "%s: wmaContext is NULL", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9561 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9562 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9563 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9564 | " Idle Ps Set Value %d", value); |
| 9565 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9566 | if (QDF_STATUS_SUCCESS != wma_set_idle_ps_config(wmaContext, value)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9567 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9568 | " Failed to Set Idle Ps Value %d", value); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9569 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9570 | } |
Arunk Khandavalli | 847969d | 2017-09-25 15:15:36 +0530 | [diff] [blame] | 9571 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9572 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9573 | } |
| 9574 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9575 | int16_t sme_get_ht_config(tHalHandle hHal, uint8_t session_id, |
| 9576 | uint16_t ht_capab) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9577 | { |
| 9578 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 9579 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9580 | |
| 9581 | if (NULL == pSession) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9582 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9583 | "%s: pSession is NULL", __func__); |
| 9584 | return -EIO; |
| 9585 | } |
| 9586 | switch (ht_capab) { |
| 9587 | case WNI_CFG_HT_CAP_INFO_ADVANCE_CODING: |
| 9588 | return pSession->htConfig.ht_rx_ldpc; |
| 9589 | case WNI_CFG_HT_CAP_INFO_TX_STBC: |
| 9590 | return pSession->htConfig.ht_tx_stbc; |
| 9591 | case WNI_CFG_HT_CAP_INFO_RX_STBC: |
| 9592 | return pSession->htConfig.ht_rx_stbc; |
| 9593 | case WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ: |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 9594 | return pSession->htConfig.ht_sgi20; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9595 | case WNI_CFG_HT_CAP_INFO_SHORT_GI_40MHZ: |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 9596 | return pSession->htConfig.ht_sgi40; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9597 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9598 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9599 | "invalid ht capability"); |
| 9600 | return -EIO; |
| 9601 | } |
| 9602 | } |
| 9603 | |
| 9604 | int sme_update_ht_config(tHalHandle hHal, uint8_t sessionId, uint16_t htCapab, |
| 9605 | int value) |
| 9606 | { |
| 9607 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 9608 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9609 | |
| 9610 | if (NULL == pSession) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9611 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9612 | "%s: pSession is NULL", __func__); |
| 9613 | return -EIO; |
| 9614 | } |
| 9615 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9616 | if (QDF_STATUS_SUCCESS != wma_set_htconfig(sessionId, htCapab, value)) { |
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 | "Failed to set ht capability in target"); |
| 9619 | return -EIO; |
| 9620 | } |
| 9621 | |
| 9622 | switch (htCapab) { |
| 9623 | case WNI_CFG_HT_CAP_INFO_ADVANCE_CODING: |
| 9624 | pSession->htConfig.ht_rx_ldpc = value; |
Kiran Kumar Lokere | e43a458 | 2018-05-08 19:54:03 -0700 | [diff] [blame] | 9625 | pMac->roam.configParam.rx_ldpc_enable = value; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9626 | break; |
| 9627 | case WNI_CFG_HT_CAP_INFO_TX_STBC: |
| 9628 | pSession->htConfig.ht_tx_stbc = value; |
| 9629 | break; |
| 9630 | case WNI_CFG_HT_CAP_INFO_RX_STBC: |
| 9631 | pSession->htConfig.ht_rx_stbc = value; |
| 9632 | break; |
| 9633 | case WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ: |
Krishna Kumaar Natarajan | a5c5aad | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 9634 | value = value ? 1 : 0; /* HT SGI can be only 1 or 0 */ |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 9635 | pSession->htConfig.ht_sgi20 = value; |
| 9636 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9637 | case WNI_CFG_HT_CAP_INFO_SHORT_GI_40MHZ: |
Krishna Kumaar Natarajan | a5c5aad | 2016-12-05 14:12:13 -0800 | [diff] [blame] | 9638 | value = value ? 1 : 0; /* HT SGI can be only 1 or 0 */ |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 9639 | pSession->htConfig.ht_sgi40 = value; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9640 | break; |
| 9641 | } |
| 9642 | |
Naveen Rawat | 8029a40 | 2017-06-01 10:54:19 -0700 | [diff] [blame] | 9643 | csr_roam_update_config(pMac, sessionId, htCapab, value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9644 | return 0; |
| 9645 | } |
| 9646 | |
Kiran Kumar Lokere | 08195ef | 2018-01-17 19:25:15 -0800 | [diff] [blame] | 9647 | int sme_set_addba_accept(tHalHandle hal, uint8_t session_id, int value) |
| 9648 | { |
| 9649 | struct sme_addba_accept *addba_accept; |
| 9650 | struct scheduler_msg msg = {0}; |
| 9651 | QDF_STATUS status; |
| 9652 | |
| 9653 | addba_accept = qdf_mem_malloc(sizeof(*addba_accept)); |
| 9654 | if (!addba_accept) { |
| 9655 | sme_err("mem alloc failed for addba_accept"); |
| 9656 | return -EIO; |
| 9657 | } |
| 9658 | addba_accept->session_id = session_id; |
| 9659 | addba_accept->addba_accept = value; |
| 9660 | qdf_mem_zero(&msg, sizeof(msg)); |
| 9661 | msg.type = eWNI_SME_SET_ADDBA_ACCEPT; |
| 9662 | msg.reserved = 0; |
| 9663 | msg.bodyptr = addba_accept; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 9664 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 9665 | QDF_MODULE_ID_PE, |
| 9666 | QDF_MODULE_ID_PE, &msg); |
Kiran Kumar Lokere | 08195ef | 2018-01-17 19:25:15 -0800 | [diff] [blame] | 9667 | if (status != QDF_STATUS_SUCCESS) { |
| 9668 | sme_err("Not able to post addba reject"); |
| 9669 | qdf_mem_free(addba_accept); |
| 9670 | return -EIO; |
| 9671 | } |
| 9672 | return 0; |
| 9673 | } |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 9674 | |
| 9675 | int sme_set_ba_buff_size(tHalHandle hal, uint8_t session_id, |
| 9676 | uint16_t buff_size) |
| 9677 | { |
| 9678 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 9679 | if (!buff_size) { |
| 9680 | sme_err("invalid buff size %d", buff_size); |
| 9681 | return -EINVAL; |
| 9682 | } |
| 9683 | mac_ctx->usr_cfg_ba_buff_size = buff_size; |
| 9684 | sme_debug("addba buff size is set to %d", |
| 9685 | mac_ctx->usr_cfg_ba_buff_size); |
| 9686 | |
| 9687 | return 0; |
| 9688 | } |
| 9689 | |
| 9690 | #define DEFAULT_BA_BUFF_SIZE 64 |
| 9691 | int sme_send_addba_req(tHalHandle hal, uint8_t session_id, uint8_t tid, |
| 9692 | uint16_t buff_size) |
| 9693 | { |
| 9694 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 9695 | uint16_t ba_buff = 0; |
| 9696 | QDF_STATUS status; |
| 9697 | struct scheduler_msg msg = {0}; |
| 9698 | struct send_add_ba_req *send_ba_req; |
| 9699 | struct csr_roam_session *csr_session = NULL; |
| 9700 | |
| 9701 | if (!csr_is_conn_state_connected_infra(mac_ctx, session_id)) { |
| 9702 | sme_err("STA not infra/connected state session_id: %d", |
| 9703 | session_id); |
| 9704 | return -EINVAL; |
| 9705 | } |
| 9706 | csr_session = CSR_GET_SESSION(mac_ctx, session_id); |
| 9707 | if (!csr_session) { |
| 9708 | sme_err("CSR session is NULL"); |
| 9709 | return -EINVAL; |
| 9710 | } |
| 9711 | send_ba_req = qdf_mem_malloc(sizeof(*send_ba_req)); |
| 9712 | if (!send_ba_req) { |
| 9713 | sme_err("mem alloc failed"); |
| 9714 | return -EIO; |
| 9715 | } |
| 9716 | qdf_mem_copy(send_ba_req->mac_addr, |
| 9717 | csr_session->connectedProfile.bssid.bytes, |
| 9718 | QDF_MAC_ADDR_SIZE); |
| 9719 | ba_buff = buff_size; |
| 9720 | if (!buff_size) { |
| 9721 | if (mac_ctx->usr_cfg_ba_buff_size) |
| 9722 | ba_buff = mac_ctx->usr_cfg_ba_buff_size; |
| 9723 | else |
| 9724 | ba_buff = DEFAULT_BA_BUFF_SIZE; |
| 9725 | } |
| 9726 | send_ba_req->param.vdev_id = session_id; |
| 9727 | send_ba_req->param.tidno = tid; |
| 9728 | send_ba_req->param.buffersize = ba_buff; |
| 9729 | msg.type = WMA_SEND_ADDBA_REQ; |
| 9730 | msg.bodyptr = send_ba_req; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 9731 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 9732 | QDF_MODULE_ID_WMA, |
| 9733 | QDF_MODULE_ID_WMA, &msg); |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 9734 | if (QDF_STATUS_SUCCESS != status) { |
| 9735 | sme_err("Failed to post WMA_SEND_ADDBA_REQ"); |
| 9736 | qdf_mem_free(send_ba_req); |
| 9737 | return -EIO; |
| 9738 | } |
| 9739 | sme_debug("ADDBA_REQ sent to FW: tid %d buff_size %d", tid, ba_buff); |
| 9740 | |
| 9741 | return 0; |
| 9742 | } |
| 9743 | |
Kiran Kumar Lokere | 3324f63 | 2018-03-01 21:43:21 -0800 | [diff] [blame] | 9744 | int sme_set_no_ack_policy(tHalHandle hal, uint8_t session_id, |
| 9745 | uint8_t val, uint8_t ac) |
| 9746 | { |
| 9747 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 9748 | uint8_t i, set_val; |
Arif Hussain | eb8ba36 | 2018-03-07 19:15:13 -0800 | [diff] [blame] | 9749 | struct scheduler_msg msg = {0}; |
| 9750 | QDF_STATUS status; |
Kiran Kumar Lokere | 3324f63 | 2018-03-01 21:43:21 -0800 | [diff] [blame] | 9751 | |
| 9752 | if (ac > MAX_NUM_AC) { |
| 9753 | sme_err("invalid ac val %d", ac); |
| 9754 | return -EINVAL; |
| 9755 | } |
| 9756 | if (val) |
| 9757 | set_val = 1; |
| 9758 | else |
| 9759 | set_val = 0; |
| 9760 | if (ac == MAX_NUM_AC) { |
| 9761 | for (i = 0; i < ac; i++) |
| 9762 | mac_ctx->no_ack_policy_cfg[i] = set_val; |
| 9763 | } else { |
| 9764 | mac_ctx->no_ack_policy_cfg[ac] = set_val; |
| 9765 | } |
| 9766 | sme_debug("no ack is set to %d for ac %d", set_val, ac); |
Arif Hussain | eb8ba36 | 2018-03-07 19:15:13 -0800 | [diff] [blame] | 9767 | qdf_mem_zero(&msg, sizeof(msg)); |
| 9768 | msg.type = eWNI_SME_UPDATE_EDCA_PROFILE; |
| 9769 | msg.reserved = 0; |
| 9770 | msg.bodyval = session_id; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 9771 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 9772 | QDF_MODULE_ID_PE, |
| 9773 | QDF_MODULE_ID_PE, &msg); |
Arif Hussain | eb8ba36 | 2018-03-07 19:15:13 -0800 | [diff] [blame] | 9774 | if (status != QDF_STATUS_SUCCESS) { |
| 9775 | sme_err("Not able to post update edca profile"); |
| 9776 | return -EIO; |
| 9777 | } |
Kiran Kumar Lokere | 3324f63 | 2018-03-01 21:43:21 -0800 | [diff] [blame] | 9778 | |
| 9779 | return 0; |
| 9780 | } |
| 9781 | |
Kiran Kumar Lokere | a006a30 | 2018-03-07 20:58:13 -0800 | [diff] [blame] | 9782 | int sme_set_auto_rate_he_ltf(tHalHandle hal, uint8_t session_id, |
| 9783 | uint8_t cfg_val) |
| 9784 | { |
| 9785 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 9786 | uint32_t set_val; |
| 9787 | uint32_t bit_mask = 0; |
| 9788 | int status; |
| 9789 | |
| 9790 | if (cfg_val > QCA_WLAN_HE_LTF_4X) { |
| 9791 | sme_err("invalid HE LTF cfg %d", cfg_val); |
| 9792 | return -EINVAL; |
| 9793 | } |
| 9794 | |
| 9795 | /*set the corresponding HE LTF cfg BIT*/ |
| 9796 | if (cfg_val == QCA_WLAN_HE_LTF_AUTO) |
| 9797 | bit_mask = HE_LTF_ALL; |
| 9798 | else |
| 9799 | bit_mask = (1 << (cfg_val - 1)); |
| 9800 | |
| 9801 | set_val = mac_ctx->he_sgi_ltf_cfg_bit_mask; |
| 9802 | |
| 9803 | SET_AUTO_RATE_HE_LTF_VAL(set_val, bit_mask); |
| 9804 | |
| 9805 | mac_ctx->he_sgi_ltf_cfg_bit_mask = set_val; |
| 9806 | status = wma_cli_set_command(session_id, |
| 9807 | WMI_VDEV_PARAM_AUTORATE_MISC_CFG, |
| 9808 | set_val, VDEV_CMD); |
| 9809 | if (status) { |
| 9810 | sme_err("failed to set he_ltf_sgi"); |
| 9811 | return status; |
| 9812 | } |
| 9813 | |
| 9814 | sme_debug("HE SGI_LTF is set to 0x%08X", |
| 9815 | mac_ctx->he_sgi_ltf_cfg_bit_mask); |
| 9816 | |
| 9817 | return 0; |
| 9818 | } |
| 9819 | |
| 9820 | int sme_set_auto_rate_he_sgi(tHalHandle hal, uint8_t session_id, |
| 9821 | uint8_t cfg_val) |
| 9822 | { |
| 9823 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 9824 | uint32_t set_val; |
| 9825 | uint32_t sgi_bit_mask = 0; |
| 9826 | int status; |
| 9827 | |
| 9828 | if ((cfg_val > AUTO_RATE_GI_3200NS) || |
| 9829 | (cfg_val < AUTO_RATE_GI_400NS)) { |
| 9830 | sme_err("invalid auto rate GI cfg %d", cfg_val); |
| 9831 | return -EINVAL; |
| 9832 | } |
| 9833 | |
| 9834 | sgi_bit_mask = (1 << cfg_val); |
| 9835 | |
| 9836 | set_val = mac_ctx->he_sgi_ltf_cfg_bit_mask; |
| 9837 | SET_AUTO_RATE_SGI_VAL(set_val, sgi_bit_mask); |
| 9838 | |
| 9839 | mac_ctx->he_sgi_ltf_cfg_bit_mask = set_val; |
| 9840 | status = wma_cli_set_command(session_id, |
| 9841 | WMI_VDEV_PARAM_AUTORATE_MISC_CFG, |
| 9842 | set_val, VDEV_CMD); |
| 9843 | if (status) { |
| 9844 | sme_err("failed to set he_ltf_sgi"); |
| 9845 | return status; |
| 9846 | } |
| 9847 | |
| 9848 | sme_debug("auto rate HE SGI_LTF is set to 0x%08X", |
| 9849 | mac_ctx->he_sgi_ltf_cfg_bit_mask); |
| 9850 | |
| 9851 | return 0; |
| 9852 | } |
| 9853 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9854 | #define HT20_SHORT_GI_MCS7_RATE 722 |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 9855 | /* |
| 9856 | * sme_send_rate_update_ind() - |
| 9857 | * API to Update rate |
| 9858 | * |
| 9859 | * hHal - The handle returned by mac_open |
| 9860 | * rateUpdateParams - Pointer to rate update params |
| 9861 | * Return QDF_STATUS |
| 9862 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9863 | QDF_STATUS sme_send_rate_update_ind(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9864 | tSirRateUpdateInd *rateUpdateParams) |
| 9865 | { |
| 9866 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9867 | QDF_STATUS status; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 9868 | struct scheduler_msg msg = {0}; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9869 | tSirRateUpdateInd *rate_upd = qdf_mem_malloc(sizeof(tSirRateUpdateInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9870 | |
| 9871 | if (rate_upd == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9872 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9873 | "Rate update struct alloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9874 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9875 | } |
| 9876 | *rate_upd = *rateUpdateParams; |
| 9877 | |
| 9878 | if (rate_upd->mcastDataRate24GHz == HT20_SHORT_GI_MCS7_RATE) |
| 9879 | rate_upd->mcastDataRate24GHzTxFlag = |
Naveen Rawat | ea1564b | 2018-05-17 15:56:11 -0700 | [diff] [blame] | 9880 | TX_RATE_HT20 | TX_RATE_SGI; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9881 | else if (rate_upd->reliableMcastDataRate == |
| 9882 | HT20_SHORT_GI_MCS7_RATE) |
| 9883 | rate_upd->reliableMcastDataRateTxFlag = |
Naveen Rawat | ea1564b | 2018-05-17 15:56:11 -0700 | [diff] [blame] | 9884 | TX_RATE_HT20 | TX_RATE_SGI; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9885 | |
| 9886 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9887 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9888 | msg.type = WMA_RATE_UPDATE_IND; |
| 9889 | msg.bodyptr = rate_upd; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 9890 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 9891 | NO_SESSION, msg.type)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9892 | if (!QDF_IS_STATUS_SUCCESS |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 9893 | (scheduler_post_message(QDF_MODULE_ID_SME, |
| 9894 | QDF_MODULE_ID_WMA, |
| 9895 | QDF_MODULE_ID_WMA, |
| 9896 | &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9897 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Rachit Kankane | ee1735c | 2018-08-02 13:19:34 +0530 | [diff] [blame] | 9898 | "%s: Not able to post WMA_RATE_UPDATE_IND to WMA!", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9899 | __func__); |
| 9900 | |
| 9901 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9902 | qdf_mem_free(rate_upd); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9903 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9904 | } |
| 9905 | |
| 9906 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9907 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9908 | } |
| 9909 | |
| 9910 | return status; |
| 9911 | } |
| 9912 | |
| 9913 | /** |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 9914 | * sme_update_access_policy_vendor_ie() - update vendor ie and access policy. |
| 9915 | * @hal: Pointer to the mac context |
| 9916 | * @session_id: sme session id |
| 9917 | * @vendor_ie: vendor ie |
| 9918 | * @access_policy: vendor ie access policy |
| 9919 | * |
| 9920 | * This function updates the vendor ie and access policy to lim. |
| 9921 | * |
| 9922 | * Return: success or failure. |
| 9923 | */ |
| 9924 | QDF_STATUS sme_update_access_policy_vendor_ie(tHalHandle hal, |
| 9925 | uint8_t session_id, uint8_t *vendor_ie, int access_policy) |
| 9926 | { |
| 9927 | struct sme_update_access_policy_vendor_ie *msg; |
| 9928 | uint16_t msg_len; |
| 9929 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 9930 | |
| 9931 | msg_len = sizeof(*msg); |
| 9932 | |
| 9933 | msg = qdf_mem_malloc(msg_len); |
| 9934 | if (!msg) { |
Srinivas Girigowda | 09625b0 | 2018-09-10 15:28:09 -0700 | [diff] [blame] | 9935 | return QDF_STATUS_E_NOMEM; |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 9936 | } |
| 9937 | |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 9938 | msg->msg_type = (uint16_t)eWNI_SME_UPDATE_ACCESS_POLICY_VENDOR_IE; |
| 9939 | msg->length = (uint16_t)msg_len; |
| 9940 | |
| 9941 | qdf_mem_copy(&msg->ie[0], vendor_ie, sizeof(msg->ie)); |
| 9942 | |
| 9943 | msg->sme_session_id = session_id; |
| 9944 | msg->access_policy = access_policy; |
| 9945 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 9946 | sme_debug("sme_session_id: %hu, access_policy: %d", session_id, |
| 9947 | access_policy); |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 9948 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 9949 | status = umac_send_mb_message_to_mac(msg); |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 9950 | |
| 9951 | return status; |
| 9952 | } |
| 9953 | |
| 9954 | /** |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 9955 | * sme_update_short_retry_limit_threshold() - update short frame retry limit TH |
| 9956 | * @hal: Handle returned by mac_open |
| 9957 | * @session_id: Session ID on which short frame retry limit needs to be |
| 9958 | * updated to FW |
| 9959 | * @short_limit_count_th: Retry count TH to retry short frame. |
| 9960 | * |
| 9961 | * This function is used to configure count to retry short frame. |
| 9962 | * |
| 9963 | * Return: QDF_STATUS |
| 9964 | */ |
| 9965 | QDF_STATUS sme_update_short_retry_limit_threshold(tHalHandle hal_handle, |
| 9966 | struct sme_short_retry_limit *short_retry_limit_th) |
| 9967 | { |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 9968 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 9969 | struct sme_short_retry_limit *srl; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 9970 | struct scheduler_msg msg = {0}; |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 9971 | |
| 9972 | srl = qdf_mem_malloc(sizeof(*srl)); |
| 9973 | if (NULL == srl) { |
| 9974 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9975 | "%s: fail to alloc short retry limit", __func__); |
| 9976 | return QDF_STATUS_E_FAILURE; |
| 9977 | } |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 9978 | sme_debug("session_id %d short retry limit count: %d", |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 9979 | short_retry_limit_th->session_id, |
| 9980 | short_retry_limit_th->short_retry_limit); |
| 9981 | |
| 9982 | srl->session_id = short_retry_limit_th->session_id; |
| 9983 | srl->short_retry_limit = short_retry_limit_th->short_retry_limit; |
| 9984 | |
| 9985 | qdf_mem_zero(&msg, sizeof(msg)); |
| 9986 | msg.type = SIR_HAL_SHORT_RETRY_LIMIT_CNT; |
| 9987 | msg.reserved = 0; |
| 9988 | msg.bodyptr = srl; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 9989 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 9990 | QDF_MODULE_ID_WMA, |
| 9991 | QDF_MODULE_ID_WMA, &msg); |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 9992 | if (status != QDF_STATUS_SUCCESS) { |
| 9993 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 9994 | FL("Not able to post short retry limit count to WDA")); |
| 9995 | qdf_mem_free(srl); |
| 9996 | return QDF_STATUS_E_FAILURE; |
| 9997 | } |
| 9998 | |
| 9999 | return status; |
| 10000 | } |
| 10001 | |
| 10002 | /** |
| 10003 | * sme_update_long_retry_limit_threshold() - update long retry limit TH |
| 10004 | * @hal: Handle returned by mac_open |
| 10005 | * @session_id: Session ID on which long frames retry TH needs to be updated |
| 10006 | * to FW |
| 10007 | * @long_limit_count_th: Retry count to retry long frame. |
| 10008 | * |
| 10009 | * This function is used to configure TH to retry long frame. |
| 10010 | * |
| 10011 | * Return: QDF_STATUS |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10012 | */ |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10013 | QDF_STATUS sme_update_long_retry_limit_threshold(tHalHandle hal_handle, |
| 10014 | struct sme_long_retry_limit *long_retry_limit_th) |
| 10015 | { |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10016 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10017 | struct sme_long_retry_limit *lrl; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10018 | struct scheduler_msg msg = {0}; |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10019 | |
| 10020 | lrl = qdf_mem_malloc(sizeof(*lrl)); |
| 10021 | if (NULL == lrl) { |
| 10022 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10023 | "%s: fail to alloc long retry limit", __func__); |
| 10024 | return QDF_STATUS_E_FAILURE; |
| 10025 | } |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 10026 | sme_debug("session_id %d long retry limit count: %d", |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10027 | long_retry_limit_th->session_id, |
| 10028 | long_retry_limit_th->long_retry_limit); |
| 10029 | |
| 10030 | lrl->session_id = long_retry_limit_th->session_id; |
| 10031 | lrl->long_retry_limit = long_retry_limit_th->long_retry_limit; |
| 10032 | |
| 10033 | qdf_mem_zero(&msg, sizeof(msg)); |
| 10034 | msg.type = SIR_HAL_LONG_RETRY_LIMIT_CNT; |
| 10035 | msg.reserved = 0; |
| 10036 | msg.bodyptr = lrl; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 10037 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 10038 | QDF_MODULE_ID_WMA, |
| 10039 | QDF_MODULE_ID_WMA, &msg); |
Agrawal Ashish | da3e950 | 2016-09-21 17:43:51 +0530 | [diff] [blame] | 10040 | |
| 10041 | if (status != QDF_STATUS_SUCCESS) { |
| 10042 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10043 | FL("Not able to post long retry limit count to WDA")); |
| 10044 | qdf_mem_free(lrl); |
| 10045 | return QDF_STATUS_E_FAILURE; |
| 10046 | } |
| 10047 | |
| 10048 | return status; |
| 10049 | } |
| 10050 | |
| 10051 | /** |
Agrawal, Ashish | 4e5fa1c | 2016-09-21 19:03:43 +0530 | [diff] [blame] | 10052 | * sme_update_sta_inactivity_timeout(): Update sta_inactivity_timeout to FW |
| 10053 | * @hal: Handle returned by mac_open |
| 10054 | * @session_id: Session ID on which sta_inactivity_timeout needs |
| 10055 | * to be updated to FW |
| 10056 | * @sta_inactivity_timeout: sta inactivity timeout. |
| 10057 | * |
| 10058 | * If a station does not send anything in sta_inactivity_timeout seconds, an |
| 10059 | * empty data frame is sent to it in order to verify whether it is |
| 10060 | * still in range. If this frame is not ACKed, the station will be |
| 10061 | * disassociated and then deauthenticated. |
| 10062 | * |
| 10063 | * Return: QDF_STATUS_SUCCESS or non-zero on failure. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10064 | */ |
Agrawal, Ashish | 4e5fa1c | 2016-09-21 19:03:43 +0530 | [diff] [blame] | 10065 | QDF_STATUS sme_update_sta_inactivity_timeout(tHalHandle hal_handle, |
| 10066 | struct sme_sta_inactivity_timeout *sta_inactivity_timer) |
| 10067 | { |
| 10068 | struct sme_sta_inactivity_timeout *inactivity_time; |
| 10069 | void *wma_handle; |
| 10070 | |
| 10071 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 10072 | inactivity_time = qdf_mem_malloc(sizeof(*inactivity_time)); |
| 10073 | if (NULL == inactivity_time) { |
| 10074 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10075 | "%s: fail to alloc inactivity_time", __func__); |
| 10076 | return QDF_STATUS_E_FAILURE; |
| 10077 | } |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 10078 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Agrawal, Ashish | 4e5fa1c | 2016-09-21 19:03:43 +0530 | [diff] [blame] | 10079 | FL("sta_inactivity_timeout: %d"), |
| 10080 | sta_inactivity_timer->sta_inactivity_timeout); |
| 10081 | inactivity_time->session_id = sta_inactivity_timer->session_id; |
| 10082 | inactivity_time->sta_inactivity_timeout = |
| 10083 | sta_inactivity_timer->sta_inactivity_timeout; |
| 10084 | |
| 10085 | wma_update_sta_inactivity_timeout(wma_handle, |
| 10086 | inactivity_time); |
| 10087 | return QDF_STATUS_SUCCESS; |
| 10088 | } |
| 10089 | |
| 10090 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10091 | * sme_get_reg_info() - To get registration info |
| 10092 | * @hHal: HAL context |
| 10093 | * @chanId: channel id |
| 10094 | * @regInfo1: first reg info to fill |
| 10095 | * @regInfo2: second reg info to fill |
| 10096 | * |
| 10097 | * This routine will give you reg info |
| 10098 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10099 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10100 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10101 | QDF_STATUS sme_get_reg_info(tHalHandle hHal, uint8_t chanId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10102 | uint32_t *regInfo1, uint32_t *regInfo2) |
| 10103 | { |
| 10104 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10105 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10106 | uint8_t i; |
| 10107 | bool found = false; |
| 10108 | |
| 10109 | status = sme_acquire_global_lock(&pMac->sme); |
| 10110 | *regInfo1 = 0; |
| 10111 | *regInfo2 = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10112 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10113 | return status; |
| 10114 | |
| 10115 | for (i = 0; i < WNI_CFG_VALID_CHANNEL_LIST_LEN; i++) { |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 10116 | if (pMac->scan.defaultPowerTable[i].chan_num == chanId) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10117 | SME_SET_CHANNEL_REG_POWER(*regInfo1, |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 10118 | pMac->scan.defaultPowerTable[i].tx_power); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10119 | |
| 10120 | SME_SET_CHANNEL_MAX_TX_POWER(*regInfo2, |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 10121 | pMac->scan.defaultPowerTable[i].tx_power); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10122 | found = true; |
| 10123 | break; |
| 10124 | } |
| 10125 | } |
| 10126 | if (!found) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10127 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10128 | |
| 10129 | sme_release_global_lock(&pMac->sme); |
| 10130 | return status; |
| 10131 | } |
| 10132 | |
| 10133 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10134 | /* |
| 10135 | * sme_auto_shutdown_cb() - |
| 10136 | * Used to plug in callback function for receiving auto shutdown evt |
| 10137 | * |
| 10138 | * hHal |
| 10139 | * pCallbackfn : callback function pointer should be plugged in |
| 10140 | * Return QDF_STATUS |
| 10141 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10142 | QDF_STATUS sme_set_auto_shutdown_cb(tHalHandle hHal, void (*pCallbackfn)(void) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10143 | ) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10144 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10145 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10146 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10147 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10148 | "%s: Plug in Auto shutdown event callback", __func__); |
| 10149 | |
| 10150 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10151 | if (QDF_STATUS_SUCCESS == status) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10152 | if (NULL != pCallbackfn) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10153 | pMac->sme.pAutoShutdownNotificationCb = pCallbackfn; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10154 | sme_release_global_lock(&pMac->sme); |
| 10155 | } |
| 10156 | |
| 10157 | return status; |
| 10158 | } |
| 10159 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10160 | /* |
| 10161 | * sme_set_auto_shutdown_timer() - |
| 10162 | * API to set auto shutdown timer value in FW. |
| 10163 | * |
| 10164 | * hHal - The handle returned by mac_open |
| 10165 | * timer_val - The auto shutdown timer value to be set |
| 10166 | * Return Configuration message posting status, SUCCESS or Fail |
| 10167 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10168 | 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] | 10169 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10170 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10171 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10172 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10173 | tSirAutoShutdownCmdParams *auto_sh_cmd; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10174 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10175 | |
| 10176 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10177 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10178 | auto_sh_cmd = (tSirAutoShutdownCmdParams *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10179 | qdf_mem_malloc(sizeof(tSirAutoShutdownCmdParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10180 | if (auto_sh_cmd == NULL) { |
Dustin Brown | a286862 | 2018-03-20 11:38:14 -0700 | [diff] [blame] | 10181 | sme_err("Request Buffer Alloc Fail"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10182 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10183 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10184 | } |
| 10185 | |
| 10186 | auto_sh_cmd->timer_val = timer_val; |
| 10187 | |
| 10188 | /* serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10189 | message.bodyptr = auto_sh_cmd; |
| 10190 | message.type = WMA_SET_AUTO_SHUTDOWN_TIMER_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 10191 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 10192 | QDF_MODULE_ID_WMA, |
| 10193 | QDF_MODULE_ID_WMA, |
| 10194 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10195 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10196 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10197 | "%s: Post Auto shutdown MSG fail", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10198 | qdf_mem_free(auto_sh_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10199 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10200 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10201 | } |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 10202 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10203 | "%s: Posted Auto shutdown MSG", __func__); |
| 10204 | sme_release_global_lock(&pMac->sme); |
| 10205 | } |
| 10206 | |
| 10207 | return status; |
| 10208 | } |
| 10209 | #endif |
| 10210 | |
Nirav Shah | eb017be | 2018-02-15 11:20:58 +0530 | [diff] [blame] | 10211 | #ifdef FEATURE_WLAN_CH_AVOID |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10212 | /* |
| 10213 | * sme_ch_avoid_update_req() - |
| 10214 | * API to request channel avoidance update from FW. |
| 10215 | * |
| 10216 | * hHal - The handle returned by mac_open |
Jeff Johnson | c5927de | 2018-05-11 09:12:53 -0700 | [diff] [blame] | 10217 | * update_type - The update_type parameter of this request call |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10218 | * Return Configuration message posting status, SUCCESS or Fail |
| 10219 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10220 | QDF_STATUS sme_ch_avoid_update_req(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10221 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10222 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10223 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10224 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10225 | tSirChAvoidUpdateReq *cauReq; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10226 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10227 | |
| 10228 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10229 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10230 | cauReq = (tSirChAvoidUpdateReq *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10231 | qdf_mem_malloc(sizeof(tSirChAvoidUpdateReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10232 | if (NULL == cauReq) { |
Dustin Brown | a286862 | 2018-03-20 11:38:14 -0700 | [diff] [blame] | 10233 | sme_err("Request Buffer Alloc Fail"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10234 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10235 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10236 | } |
| 10237 | |
| 10238 | cauReq->reserved_param = 0; |
| 10239 | |
| 10240 | /* serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10241 | message.bodyptr = cauReq; |
| 10242 | message.type = WMA_CH_AVOID_UPDATE_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 10243 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 10244 | QDF_MODULE_ID_WMA, |
| 10245 | QDF_MODULE_ID_WMA, |
| 10246 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10247 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10248 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10249 | "%s: Post Ch Avoid Update MSG fail", |
| 10250 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10251 | qdf_mem_free(cauReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10252 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10253 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10254 | } |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 10255 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10256 | "%s: Posted Ch Avoid Update MSG", __func__); |
| 10257 | sme_release_global_lock(&pMac->sme); |
| 10258 | } |
| 10259 | |
| 10260 | return status; |
| 10261 | } |
Nirav Shah | eb017be | 2018-02-15 11:20:58 +0530 | [diff] [blame] | 10262 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10263 | |
| 10264 | /** |
| 10265 | * sme_set_miracast() - Function to set miracast value to UMAC |
| 10266 | * @hal: Handle returned by macOpen |
| 10267 | * @filter_type: 0-Disabled, 1-Source, 2-sink |
| 10268 | * |
| 10269 | * This function passes down the value of miracast set by |
| 10270 | * framework to UMAC |
| 10271 | * |
| 10272 | * Return: Configuration message posting status, SUCCESS or Fail |
| 10273 | * |
| 10274 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10275 | QDF_STATUS sme_set_miracast(tHalHandle hal, uint8_t filter_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10276 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10277 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10278 | uint32_t *val; |
| 10279 | tpAniSirGlobal mac_ptr = PMAC_STRUCT(hal); |
| 10280 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10281 | val = qdf_mem_malloc(sizeof(*val)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10282 | if (NULL == val || NULL == mac_ptr) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10283 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10284 | "%s: Invalid pointer", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10285 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10286 | } |
| 10287 | |
| 10288 | *val = filter_type; |
| 10289 | |
| 10290 | msg.type = SIR_HAL_SET_MIRACAST; |
| 10291 | msg.reserved = 0; |
| 10292 | msg.bodyptr = val; |
| 10293 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10294 | if (!QDF_IS_STATUS_SUCCESS( |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 10295 | scheduler_post_message(QDF_MODULE_ID_SME, |
| 10296 | QDF_MODULE_ID_WMA, |
| 10297 | QDF_MODULE_ID_WMA, |
| 10298 | &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10299 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10300 | "%s: Not able to post WDA_SET_MAS_ENABLE_DISABLE to WMA!", |
| 10301 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10302 | qdf_mem_free(val); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10303 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10304 | } |
| 10305 | |
| 10306 | mac_ptr->sme.miracast_value = filter_type; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10307 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10308 | } |
| 10309 | |
| 10310 | /** |
| 10311 | * sme_set_mas() - Function to set MAS value to UMAC |
| 10312 | * @val: 1-Enable, 0-Disable |
| 10313 | * |
| 10314 | * This function passes down the value of MAS to the UMAC. A |
| 10315 | * value of 1 will enable MAS and a value of 0 will disable MAS |
| 10316 | * |
| 10317 | * Return: Configuration message posting status, SUCCESS or Fail |
| 10318 | * |
| 10319 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10320 | QDF_STATUS sme_set_mas(uint32_t val) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10321 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10322 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10323 | uint32_t *ptr_val; |
| 10324 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10325 | ptr_val = qdf_mem_malloc(sizeof(*ptr_val)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10326 | if (NULL == ptr_val) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10327 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10328 | "%s: could not allocate ptr_val", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10329 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10330 | } |
| 10331 | |
| 10332 | *ptr_val = val; |
| 10333 | |
| 10334 | msg.type = SIR_HAL_SET_MAS; |
| 10335 | msg.reserved = 0; |
| 10336 | msg.bodyptr = ptr_val; |
| 10337 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10338 | if (!QDF_IS_STATUS_SUCCESS( |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 10339 | scheduler_post_message(QDF_MODULE_ID_SME, |
| 10340 | QDF_MODULE_ID_WMA, |
| 10341 | QDF_MODULE_ID_WMA, |
| 10342 | &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10343 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10344 | "%s: Not able to post WDA_SET_MAS_ENABLE_DISABLE to WMA!", |
| 10345 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10346 | qdf_mem_free(ptr_val); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10347 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10348 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10349 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10350 | } |
| 10351 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 10352 | /** |
| 10353 | * sme_roam_channel_change_req() - Channel change to new target channel |
| 10354 | * @hHal: handle returned by mac_open |
| 10355 | * @bssid: mac address of BSS |
| 10356 | * @ch_params: target channel information |
| 10357 | * @profile: CSR profile |
| 10358 | * |
| 10359 | * API to Indicate Channel change to new target channel |
| 10360 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10361 | * Return: QDF_STATUS |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 10362 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10363 | QDF_STATUS sme_roam_channel_change_req(tHalHandle hHal, |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 10364 | struct qdf_mac_addr bssid, |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 10365 | struct ch_params *ch_params, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 10366 | struct csr_roam_profile *profile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10367 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10368 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10369 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10370 | |
| 10371 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10372 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10373 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 10374 | status = csr_roam_channel_change_req(pMac, bssid, ch_params, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10375 | profile); |
| 10376 | sme_release_global_lock(&pMac->sme); |
| 10377 | } |
| 10378 | return status; |
| 10379 | } |
| 10380 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10381 | /* |
| 10382 | * sme_process_channel_change_resp() - |
| 10383 | * API to Indicate Channel change response message to SAP. |
| 10384 | * |
| 10385 | * Return QDF_STATUS |
| 10386 | */ |
| 10387 | static QDF_STATUS sme_process_channel_change_resp(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10388 | uint16_t msg_type, void *pMsgBuf) |
| 10389 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10390 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 10391 | struct csr_roam_info proam_info = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10392 | eCsrRoamResult roamResult; |
| 10393 | tpSwitchChannelParams pChnlParams = (tpSwitchChannelParams) pMsgBuf; |
| 10394 | uint32_t SessionId = pChnlParams->peSessionId; |
| 10395 | |
| 10396 | proam_info.channelChangeRespEvent = |
| 10397 | (tSirChanChangeResponse *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10398 | qdf_mem_malloc(sizeof(tSirChanChangeResponse)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10399 | if (NULL == proam_info.channelChangeRespEvent) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10400 | status = QDF_STATUS_E_NOMEM; |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 10401 | sme_err("Channel Change Event Allocation Failed: %d\n", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10402 | return status; |
| 10403 | } |
| 10404 | if (msg_type == eWNI_SME_CHANNEL_CHANGE_RSP) { |
| 10405 | proam_info.channelChangeRespEvent->sessionId = SessionId; |
| 10406 | proam_info.channelChangeRespEvent->newChannelNumber = |
| 10407 | pChnlParams->channelNumber; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10408 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10409 | if (pChnlParams->status == QDF_STATUS_SUCCESS) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 10410 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10411 | "sapdfs: Received success eWNI_SME_CHANNEL_CHANGE_RSP for sessionId[%d]", |
| 10412 | SessionId); |
| 10413 | proam_info.channelChangeRespEvent->channelChangeStatus = |
| 10414 | 1; |
| 10415 | roamResult = eCSR_ROAM_RESULT_CHANNEL_CHANGE_SUCCESS; |
| 10416 | } else { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 10417 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10418 | "sapdfs: Received failure eWNI_SME_CHANNEL_CHANGE_RSP for sessionId[%d]", |
| 10419 | SessionId); |
| 10420 | proam_info.channelChangeRespEvent->channelChangeStatus = |
| 10421 | 0; |
| 10422 | roamResult = eCSR_ROAM_RESULT_CHANNEL_CHANGE_FAILURE; |
| 10423 | } |
| 10424 | |
| 10425 | csr_roam_call_callback(pMac, SessionId, &proam_info, 0, |
| 10426 | eCSR_ROAM_SET_CHANNEL_RSP, roamResult); |
| 10427 | |
| 10428 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10429 | status = QDF_STATUS_E_FAILURE; |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 10430 | sme_err("Invalid Channel Change Resp Message: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10431 | status); |
| 10432 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10433 | qdf_mem_free(proam_info.channelChangeRespEvent); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10434 | |
| 10435 | return status; |
| 10436 | } |
| 10437 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10438 | /* |
| 10439 | * sme_roam_start_beacon_req() - |
| 10440 | * API to Indicate LIM to start Beacon Tx after SAP CAC Wait is completed. |
| 10441 | * |
| 10442 | * hHal - The handle returned by mac_open |
| 10443 | * sessionId - session ID |
| 10444 | * dfsCacWaitStatus - CAC WAIT status flag |
| 10445 | * Return QDF_STATUS |
| 10446 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10447 | 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] | 10448 | uint8_t dfsCacWaitStatus) |
| 10449 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10450 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10451 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10452 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10453 | status = sme_acquire_global_lock(&pMac->sme); |
| 10454 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10455 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10456 | status = csr_roam_start_beacon_req(pMac, bssid, |
| 10457 | dfsCacWaitStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10458 | sme_release_global_lock(&pMac->sme); |
| 10459 | } |
| 10460 | return status; |
| 10461 | } |
| 10462 | |
Abhishek Singh | 20a8e44 | 2018-09-12 15:50:44 +0530 | [diff] [blame] | 10463 | #ifdef CONFIG_VDEV_SM |
| 10464 | QDF_STATUS sme_csa_restart(tpAniSirGlobal mac_ctx, uint8_t session_id) |
| 10465 | { |
| 10466 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 10467 | |
| 10468 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 10469 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 10470 | status = csr_csa_restart(mac_ctx, session_id); |
| 10471 | sme_release_global_lock(&mac_ctx->sme); |
| 10472 | } |
| 10473 | |
| 10474 | return status; |
| 10475 | } |
| 10476 | #endif |
| 10477 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 10478 | /** |
| 10479 | * sme_roam_csa_ie_request() - request CSA IE transmission from PE |
| 10480 | * @hHal: handle returned by mac_open |
| 10481 | * @bssid: SAP bssid |
| 10482 | * @targetChannel: target channel information |
| 10483 | * @csaIeReqd: CSA IE Request |
| 10484 | * @ch_params: channel information |
| 10485 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10486 | * Return: QDF_STATUS |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 10487 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10488 | 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] | 10489 | uint8_t targetChannel, uint8_t csaIeReqd, |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 10490 | struct ch_params *ch_params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10491 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10492 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10493 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10494 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10495 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10496 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 10497 | status = csr_roam_send_chan_sw_ie_request(pMac, bssid, |
| 10498 | targetChannel, csaIeReqd, ch_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10499 | sme_release_global_lock(&pMac->sme); |
| 10500 | } |
| 10501 | return status; |
| 10502 | } |
| 10503 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10504 | /* |
| 10505 | * sme_init_thermal_info() - |
| 10506 | * SME API to initialize the thermal mitigation parameters |
| 10507 | * |
| 10508 | * hHal |
| 10509 | * thermalParam : thermal mitigation parameters |
| 10510 | * Return QDF_STATUS |
| 10511 | */ |
| 10512 | QDF_STATUS sme_init_thermal_info(tHalHandle hHal, tSmeThermalParams |
| 10513 | thermalParam) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10514 | { |
| 10515 | t_thermal_mgmt *pWmaParam; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10516 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10517 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 10518 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10519 | pWmaParam = (t_thermal_mgmt *) qdf_mem_malloc(sizeof(t_thermal_mgmt)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10520 | if (NULL == pWmaParam) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10521 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10522 | "%s: could not allocate tThermalMgmt", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10523 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10524 | } |
| 10525 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10526 | pWmaParam->thermalMgmtEnabled = thermalParam.smeThermalMgmtEnabled; |
| 10527 | pWmaParam->throttlePeriod = thermalParam.smeThrottlePeriod; |
Poddar, Siddarth | 8390502 | 2016-04-16 17:56:08 -0700 | [diff] [blame] | 10528 | |
| 10529 | pWmaParam->throttle_duty_cycle_tbl[0] = |
| 10530 | thermalParam.sme_throttle_duty_cycle_tbl[0]; |
| 10531 | pWmaParam->throttle_duty_cycle_tbl[1] = |
| 10532 | thermalParam.sme_throttle_duty_cycle_tbl[1]; |
| 10533 | pWmaParam->throttle_duty_cycle_tbl[2] = |
| 10534 | thermalParam.sme_throttle_duty_cycle_tbl[2]; |
| 10535 | pWmaParam->throttle_duty_cycle_tbl[3] = |
| 10536 | thermalParam.sme_throttle_duty_cycle_tbl[3]; |
| 10537 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10538 | pWmaParam->thermalLevels[0].minTempThreshold = |
| 10539 | thermalParam.smeThermalLevels[0].smeMinTempThreshold; |
| 10540 | pWmaParam->thermalLevels[0].maxTempThreshold = |
| 10541 | thermalParam.smeThermalLevels[0].smeMaxTempThreshold; |
| 10542 | pWmaParam->thermalLevels[1].minTempThreshold = |
| 10543 | thermalParam.smeThermalLevels[1].smeMinTempThreshold; |
| 10544 | pWmaParam->thermalLevels[1].maxTempThreshold = |
| 10545 | thermalParam.smeThermalLevels[1].smeMaxTempThreshold; |
| 10546 | pWmaParam->thermalLevels[2].minTempThreshold = |
| 10547 | thermalParam.smeThermalLevels[2].smeMinTempThreshold; |
| 10548 | pWmaParam->thermalLevels[2].maxTempThreshold = |
| 10549 | thermalParam.smeThermalLevels[2].smeMaxTempThreshold; |
| 10550 | pWmaParam->thermalLevels[3].minTempThreshold = |
| 10551 | thermalParam.smeThermalLevels[3].smeMinTempThreshold; |
| 10552 | pWmaParam->thermalLevels[3].maxTempThreshold = |
| 10553 | thermalParam.smeThermalLevels[3].smeMaxTempThreshold; |
| 10554 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10555 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10556 | msg.type = WMA_INIT_THERMAL_INFO_CMD; |
| 10557 | msg.bodyptr = pWmaParam; |
| 10558 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10559 | if (!QDF_IS_STATUS_SUCCESS |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 10560 | (scheduler_post_message(QDF_MODULE_ID_SME, |
| 10561 | QDF_MODULE_ID_WMA, |
| 10562 | QDF_MODULE_ID_WMA, |
| 10563 | &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10564 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10565 | "%s: Not able to post WMA_SET_THERMAL_INFO_CMD to WMA!", |
| 10566 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10567 | qdf_mem_free(pWmaParam); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10568 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10569 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10570 | } |
| 10571 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10572 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10573 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10574 | qdf_mem_free(pWmaParam); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10575 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10576 | } |
| 10577 | |
| 10578 | /** |
| 10579 | * sme_add_set_thermal_level_callback() - Plug in set thermal level callback |
| 10580 | * @hal: Handle returned by macOpen |
| 10581 | * @callback: sme_set_thermal_level_callback |
| 10582 | * |
| 10583 | * Plug in set thermal level callback |
| 10584 | * |
| 10585 | * Return: none |
| 10586 | */ |
| 10587 | void sme_add_set_thermal_level_callback(tHalHandle hal, |
| 10588 | sme_set_thermal_level_callback callback) |
| 10589 | { |
| 10590 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
| 10591 | |
| 10592 | pMac->sme.set_thermal_level_cb = callback; |
| 10593 | } |
| 10594 | |
| 10595 | /** |
| 10596 | * sme_set_thermal_level() - SME API to set the thermal mitigation level |
| 10597 | * @hal: Handler to HAL |
| 10598 | * @level: Thermal mitigation level |
| 10599 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10600 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10601 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10602 | QDF_STATUS sme_set_thermal_level(tHalHandle hal, uint8_t level) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10603 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10604 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10605 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10606 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10607 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10608 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10609 | qdf_mem_set(&msg, sizeof(msg), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10610 | msg.type = WMA_SET_THERMAL_LEVEL; |
| 10611 | msg.bodyval = level; |
| 10612 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 10613 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 10614 | QDF_MODULE_ID_WMA, |
| 10615 | QDF_MODULE_ID_WMA, &msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10616 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10617 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10618 | "%s: Not able to post WMA_SET_THERMAL_LEVEL to WMA!", |
| 10619 | __func__); |
| 10620 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10621 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10622 | } |
| 10623 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10624 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10625 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10626 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10627 | } |
| 10628 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10629 | /* |
| 10630 | * sme_txpower_limit() - |
| 10631 | * SME API to set txpower limits |
| 10632 | * |
| 10633 | * hHal |
| 10634 | * psmetx : power limits for 2g/5g |
| 10635 | * Return QDF_STATUS |
| 10636 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10637 | QDF_STATUS sme_txpower_limit(tHalHandle hHal, tSirTxPowerLimit *psmetx) |
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 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 10640 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10641 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10642 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 10643 | tSirTxPowerLimit *tx_power_limit; |
| 10644 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10645 | tx_power_limit = qdf_mem_malloc(sizeof(*tx_power_limit)); |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 10646 | if (!tx_power_limit) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10647 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 10648 | "%s: Memory allocation for TxPowerLimit failed!", |
| 10649 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10650 | return QDF_STATUS_E_FAILURE; |
Prashanth Bhatta | 75fa9a1 | 2016-01-11 18:30:08 -0800 | [diff] [blame] | 10651 | } |
| 10652 | |
| 10653 | *tx_power_limit = *psmetx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10654 | |
| 10655 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10656 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10657 | message.type = WMA_TX_POWER_LIMIT; |
| 10658 | message.reserved = 0; |
| 10659 | message.bodyptr = tx_power_limit; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10660 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 10661 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 10662 | QDF_MODULE_ID_WMA, |
| 10663 | QDF_MODULE_ID_WMA, |
| 10664 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10665 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10666 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10667 | "%s: not able to post WMA_TX_POWER_LIMIT", |
| 10668 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10669 | status = QDF_STATUS_E_FAILURE; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10670 | qdf_mem_free(tx_power_limit); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10671 | } |
| 10672 | sme_release_global_lock(&pMac->sme); |
| 10673 | } |
| 10674 | return status; |
| 10675 | } |
| 10676 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10677 | QDF_STATUS sme_update_connect_debug(tHalHandle hHal, uint32_t set_value) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10678 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10679 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10680 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10681 | |
Dundi Raviteja | f99ce09 | 2018-09-27 17:51:59 +0530 | [diff] [blame] | 10682 | pMac->mlme_cfg->gen.debug_packet_log = set_value; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10683 | return status; |
| 10684 | } |
| 10685 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10686 | /* |
| 10687 | * sme_ap_disable_intra_bss_fwd() - |
| 10688 | * SME will send message to WMA to set Intra BSS in txrx |
| 10689 | * |
| 10690 | * hHal - The handle returned by mac_open |
| 10691 | * sessionId - session id ( vdev id) |
| 10692 | * disablefwd - bool value that indicate disable intrabss fwd disable |
| 10693 | * Return QDF_STATUS |
| 10694 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10695 | 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] | 10696 | bool disablefwd) |
| 10697 | { |
| 10698 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10699 | int status = QDF_STATUS_SUCCESS; |
| 10700 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10701 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10702 | tpDisableIntraBssFwd pSapDisableIntraFwd = NULL; |
| 10703 | |
| 10704 | /* Prepare the request to send to SME. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10705 | pSapDisableIntraFwd = qdf_mem_malloc(sizeof(tDisableIntraBssFwd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10706 | if (NULL == pSapDisableIntraFwd) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 10707 | sme_err("Memory Allocation Failure!!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10708 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10709 | } |
| 10710 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10711 | pSapDisableIntraFwd->sessionId = sessionId; |
| 10712 | pSapDisableIntraFwd->disableintrabssfwd = disablefwd; |
| 10713 | |
| 10714 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10715 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10716 | /* serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 10717 | message.bodyptr = pSapDisableIntraFwd; |
| 10718 | message.type = WMA_SET_SAP_INTRABSS_DIS; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 10719 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 10720 | QDF_MODULE_ID_WMA, |
| 10721 | QDF_MODULE_ID_WMA, |
| 10722 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10723 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 10724 | status = QDF_STATUS_E_FAILURE; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10725 | qdf_mem_free(pSapDisableIntraFwd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10726 | } |
| 10727 | sme_release_global_lock(&pMac->sme); |
| 10728 | } |
| 10729 | return status; |
| 10730 | } |
| 10731 | |
| 10732 | #ifdef WLAN_FEATURE_STATS_EXT |
| 10733 | |
Jeff Johnson | 4584365 | 2018-07-04 12:47:34 -0700 | [diff] [blame] | 10734 | void sme_stats_ext_register_callback(mac_handle_t mac_handle, |
| 10735 | stats_ext_cb callback) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10736 | { |
Jeff Johnson | 4584365 | 2018-07-04 12:47:34 -0700 | [diff] [blame] | 10737 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10738 | |
Jeff Johnson | 4584365 | 2018-07-04 12:47:34 -0700 | [diff] [blame] | 10739 | if (!mac) { |
| 10740 | sme_err("Invalid mac context"); |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 10741 | return; |
| 10742 | } |
| 10743 | |
Jeff Johnson | 4584365 | 2018-07-04 12:47:34 -0700 | [diff] [blame] | 10744 | mac->sme.stats_ext_cb = callback; |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 10745 | } |
| 10746 | |
Jeff Johnson | 4584365 | 2018-07-04 12:47:34 -0700 | [diff] [blame] | 10747 | void sme_stats_ext_deregister_callback(mac_handle_t mac_handle) |
| 10748 | { |
| 10749 | sme_stats_ext_register_callback(mac_handle, NULL); |
| 10750 | } |
| 10751 | |
| 10752 | void sme_stats_ext2_register_callback(mac_handle_t mac_handle, |
| 10753 | stats_ext2_cb callback) |
| 10754 | { |
| 10755 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
| 10756 | |
| 10757 | if (!mac) { |
| 10758 | sme_err("Invalid mac context"); |
| 10759 | return; |
| 10760 | } |
| 10761 | |
| 10762 | mac->sme.stats_ext2_cb = callback; |
| 10763 | } |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 10764 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10765 | /* |
| 10766 | * sme_stats_ext_request() - |
| 10767 | * Function called when HDD receives STATS EXT vendor command from userspace |
| 10768 | * |
| 10769 | * sessionID - vdevID for the stats ext request |
| 10770 | * input - Stats Ext Request structure ptr |
| 10771 | * Return QDF_STATUS |
| 10772 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10773 | QDF_STATUS sme_stats_ext_request(uint8_t session_id, tpStatsExtRequestReq input) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10774 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 10775 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10776 | tpStatsExtRequest data; |
| 10777 | size_t data_len; |
| 10778 | |
| 10779 | data_len = sizeof(tStatsExtRequest) + input->request_data_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10780 | data = qdf_mem_malloc(data_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10781 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10782 | if (data == NULL) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10783 | return QDF_STATUS_E_NOMEM; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10784 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10785 | data->vdev_id = session_id; |
| 10786 | data->request_data_len = input->request_data_len; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10787 | if (input->request_data_len) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10788 | qdf_mem_copy(data->request_data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10789 | input->request_data, input->request_data_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10790 | |
| 10791 | msg.type = WMA_STATS_EXT_REQUEST; |
| 10792 | msg.reserved = 0; |
| 10793 | msg.bodyptr = data; |
| 10794 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 10795 | if (QDF_STATUS_SUCCESS != scheduler_post_message(QDF_MODULE_ID_SME, |
| 10796 | QDF_MODULE_ID_WMA, |
| 10797 | QDF_MODULE_ID_WMA, |
| 10798 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10799 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10800 | "%s: Not able to post WMA_STATS_EXT_REQUEST message to WMA", |
| 10801 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10802 | qdf_mem_free(data); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10803 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10804 | } |
| 10805 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10806 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10807 | } |
| 10808 | |
Jeff Johnson | fdecd51 | 2018-06-10 09:18:32 -0700 | [diff] [blame] | 10809 | /** |
| 10810 | * sme_stats_ext_event() - eWNI_SME_STATS_EXT_EVENT processor |
| 10811 | * @mac: Global MAC context |
| 10812 | * @msg: "stats ext" message |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10813 | |
Jeff Johnson | fdecd51 | 2018-06-10 09:18:32 -0700 | [diff] [blame] | 10814 | * This callback function called when SME received eWNI_SME_STATS_EXT_EVENT |
| 10815 | * response from WMA |
| 10816 | * |
| 10817 | * Return: QDF_STATUS |
| 10818 | */ |
| 10819 | static QDF_STATUS sme_stats_ext_event(tpAniSirGlobal mac, |
Jeff Johnson | 4584365 | 2018-07-04 12:47:34 -0700 | [diff] [blame] | 10820 | struct stats_ext_event *msg) |
Jeff Johnson | fdecd51 | 2018-06-10 09:18:32 -0700 | [diff] [blame] | 10821 | { |
| 10822 | if (!msg) { |
| 10823 | sme_err("Null msg"); |
| 10824 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10825 | } |
| 10826 | |
Jeff Johnson | 4584365 | 2018-07-04 12:47:34 -0700 | [diff] [blame] | 10827 | if (mac->sme.stats_ext_cb) |
| 10828 | mac->sme.stats_ext_cb(mac->hdd_handle, msg); |
Jeff Johnson | fdecd51 | 2018-06-10 09:18:32 -0700 | [diff] [blame] | 10829 | |
| 10830 | return QDF_STATUS_SUCCESS; |
| 10831 | } |
| 10832 | |
| 10833 | #else |
| 10834 | |
| 10835 | static QDF_STATUS sme_stats_ext_event(tpAniSirGlobal mac, |
Jeff Johnson | 4584365 | 2018-07-04 12:47:34 -0700 | [diff] [blame] | 10836 | struct stats_ext_event *msg) |
Jeff Johnson | fdecd51 | 2018-06-10 09:18:32 -0700 | [diff] [blame] | 10837 | { |
| 10838 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10839 | } |
| 10840 | |
| 10841 | #endif |
| 10842 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10843 | /* |
| 10844 | * sme_update_dfs_scan_mode() - |
| 10845 | * Update DFS roam scan mode |
| 10846 | * This function is called through dynamic setConfig callback function |
| 10847 | * to configure allowDFSChannelRoam. |
| 10848 | * hHal - HAL handle for device |
| 10849 | * sessionId - Session Identifier |
| 10850 | * allowDFSChannelRoam - DFS roaming scan mode 0 (disable), |
| 10851 | * 1 (passive), 2 (active) |
| 10852 | * Return QDF_STATUS_SUCCESS - SME update DFS roaming scan config |
| 10853 | * successfully. |
| 10854 | * Other status means SME failed to update DFS roaming scan config. |
| 10855 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10856 | QDF_STATUS sme_update_dfs_scan_mode(tHalHandle hHal, uint8_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10857 | uint8_t allowDFSChannelRoam) |
| 10858 | { |
| 10859 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10860 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10861 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 10862 | if (sessionId >= CSR_ROAM_SESSION_MAX) { |
| 10863 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 10864 | FL("Invalid sme session id: %d"), sessionId); |
| 10865 | return QDF_STATUS_E_INVAL; |
| 10866 | } |
| 10867 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10868 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10869 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10870 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10871 | "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] | 10872 | allowDFSChannelRoam, |
| 10873 | pMac->roam.configParam.allowDFSChannelRoam, |
| 10874 | mac_trace_get_neighbour_roam_state(pMac->roam. |
| 10875 | neighborRoamInfo |
| 10876 | [sessionId]. |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10877 | neighborRoamState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10878 | pMac->roam.configParam.allowDFSChannelRoam = |
| 10879 | allowDFSChannelRoam; |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 10880 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 10881 | csr_roam_offload_scan(pMac, sessionId, |
| 10882 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 10883 | REASON_ROAM_DFS_SCAN_MODE_CHANGED); |
| 10884 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10885 | sme_release_global_lock(&pMac->sme); |
| 10886 | } |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 10887 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10888 | |
| 10889 | return status; |
| 10890 | } |
| 10891 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10892 | /* |
| 10893 | * sme_get_dfs_scan_mode() - get DFS roam scan mode |
| 10894 | * This is a synchronous call |
| 10895 | * |
| 10896 | * hHal - The handle returned by mac_open. |
| 10897 | * Return DFS roaming scan mode 0 (disable), 1 (passive), 2 (active) |
| 10898 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10899 | uint8_t sme_get_dfs_scan_mode(tHalHandle hHal) |
| 10900 | { |
| 10901 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10902 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10903 | return pMac->roam.configParam.allowDFSChannelRoam; |
| 10904 | } |
| 10905 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10906 | /* |
| 10907 | * sme_modify_add_ie() - |
| 10908 | * This function sends msg to updates the additional IE buffers in PE |
| 10909 | * |
| 10910 | * hHal - global structure |
| 10911 | * pModifyIE - pointer to tModifyIE structure |
| 10912 | * updateType - type of buffer |
| 10913 | * Return Success or failure |
| 10914 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10915 | QDF_STATUS sme_modify_add_ie(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10916 | tSirModifyIE *pModifyIE, eUpdateIEsType updateType) |
| 10917 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10918 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10919 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10920 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10921 | status = sme_acquire_global_lock(&pMac->sme); |
| 10922 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10923 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10924 | status = csr_roam_modify_add_ies(pMac, pModifyIE, updateType); |
| 10925 | sme_release_global_lock(&pMac->sme); |
| 10926 | } |
| 10927 | return status; |
| 10928 | } |
| 10929 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10930 | /* |
| 10931 | * sme_update_add_ie() - |
| 10932 | * This function sends msg to updates the additional IE buffers in PE |
| 10933 | * |
| 10934 | * hHal - global structure |
| 10935 | * pUpdateIE - pointer to structure tUpdateIE |
| 10936 | * updateType - type of buffer |
| 10937 | * Return Success or failure |
| 10938 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10939 | QDF_STATUS sme_update_add_ie(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10940 | tSirUpdateIE *pUpdateIE, eUpdateIEsType updateType) |
| 10941 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10942 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10943 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 10944 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10945 | status = sme_acquire_global_lock(&pMac->sme); |
| 10946 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10947 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10948 | status = csr_roam_update_add_ies(pMac, pUpdateIE, updateType); |
| 10949 | sme_release_global_lock(&pMac->sme); |
| 10950 | } |
| 10951 | return status; |
| 10952 | } |
| 10953 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10954 | /** |
| 10955 | * sme_update_dsc_pto_up_mapping() |
| 10956 | * @hHal: HAL context |
| 10957 | * @dscpmapping: pointer to DSCP mapping structure |
| 10958 | * @sessionId: SME session id |
| 10959 | * |
| 10960 | * This routine is called to update dscp mapping |
| 10961 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10962 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10963 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10964 | QDF_STATUS sme_update_dsc_pto_up_mapping(tHalHandle hHal, |
Abhishek Singh | 12be60f | 2017-08-11 13:52:42 +0530 | [diff] [blame] | 10965 | enum sme_qos_wmmuptype *dscpmapping, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10966 | uint8_t sessionId) |
| 10967 | { |
| 10968 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10969 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10970 | uint8_t i, j, peSessionId; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 10971 | struct csr_roam_session *pCsrSession = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10972 | tpPESession pSession = NULL; |
| 10973 | |
| 10974 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10975 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10976 | return status; |
| 10977 | pCsrSession = CSR_GET_SESSION(pMac, sessionId); |
| 10978 | if (pCsrSession == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10979 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10980 | FL("Session lookup fails for CSR session")); |
| 10981 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10982 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10983 | } |
| 10984 | if (!CSR_IS_SESSION_VALID(pMac, sessionId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10985 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10986 | FL("Invalid session Id %u"), sessionId); |
| 10987 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10988 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10989 | } |
| 10990 | |
| 10991 | pSession = pe_find_session_by_bssid(pMac, |
| 10992 | pCsrSession->connectedProfile.bssid.bytes, |
| 10993 | &peSessionId); |
| 10994 | |
| 10995 | if (pSession == NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10996 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10997 | FL(" Session lookup fails for BSSID")); |
| 10998 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10999 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11000 | } |
| 11001 | |
| 11002 | if (!pSession->QosMapSet.present) { |
Srinivas Girigowda | 2b5d47c | 2017-03-29 00:28:46 -0700 | [diff] [blame] | 11003 | sme_debug("QOS Mapping IE not present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11004 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11005 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11006 | } |
| 11007 | for (i = 0; i < SME_QOS_WMM_UP_MAX; i++) { |
| 11008 | for (j = pSession->QosMapSet.dscp_range[i][0]; |
| 11009 | j <= pSession->QosMapSet.dscp_range[i][1]; |
| 11010 | j++) { |
| 11011 | if ((pSession->QosMapSet.dscp_range[i][0] == 255) |
| 11012 | && (pSession->QosMapSet.dscp_range[i][1] == |
| 11013 | 255)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11014 | QDF_TRACE(QDF_MODULE_ID_SME, |
Kiran Kumar Lokere | 1d411bb | 2017-11-29 15:24:05 -0800 | [diff] [blame] | 11015 | QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11016 | FL("User Priority %d isn't used"), i); |
| 11017 | break; |
| 11018 | } else { |
| 11019 | dscpmapping[j] = i; |
| 11020 | } |
| 11021 | } |
| 11022 | } |
| 11023 | for (i = 0; i < pSession->QosMapSet.num_dscp_exceptions; i++) |
| 11024 | if (pSession->QosMapSet.dscp_exceptions[i][0] != 255) |
| 11025 | dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0]] = |
| 11026 | pSession->QosMapSet.dscp_exceptions[i][1]; |
| 11027 | |
| 11028 | sme_release_global_lock(&pMac->sme); |
| 11029 | return status; |
| 11030 | } |
| 11031 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11032 | /* |
| 11033 | * sme_abort_roam_scan() - |
| 11034 | * API to abort current roam scan cycle by roam scan offload module. |
| 11035 | * |
| 11036 | * hHal - The handle returned by mac_open. |
| 11037 | * sessionId - Session Identifier |
| 11038 | * Return QDF_STATUS |
| 11039 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11040 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11041 | QDF_STATUS sme_abort_roam_scan(tHalHandle hHal, uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11042 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11043 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11044 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 11045 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11046 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) { |
| 11047 | /* acquire the lock for the sme object */ |
| 11048 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11049 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11050 | csr_roam_offload_scan(pMac, sessionId, |
| 11051 | ROAM_SCAN_OFFLOAD_ABORT_SCAN, |
| 11052 | REASON_ROAM_ABORT_ROAM_SCAN); |
| 11053 | /* release the lock for the sme object */ |
| 11054 | sme_release_global_lock(&pMac->sme); |
| 11055 | } |
| 11056 | } |
| 11057 | |
| 11058 | return status; |
| 11059 | } |
| 11060 | |
| 11061 | #ifdef FEATURE_WLAN_EXTSCAN |
| 11062 | /** |
| 11063 | * sme_get_valid_channels_by_band() - to fetch valid channels filtered by band |
| 11064 | * @hHal: HAL context |
| 11065 | * @wifiBand: RF band information |
| 11066 | * @aValidChannels: output array to store channel info |
| 11067 | * @pNumChannels: output number of channels |
| 11068 | * |
| 11069 | * SME API to fetch all valid channels filtered by band |
| 11070 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11071 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11072 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11073 | QDF_STATUS sme_get_valid_channels_by_band(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11074 | uint8_t wifiBand, |
| 11075 | uint32_t *aValidChannels, |
| 11076 | uint8_t *pNumChannels) |
| 11077 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11078 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11079 | uint8_t chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11080 | uint8_t numChannels = 0; |
| 11081 | uint8_t i = 0; |
| 11082 | uint32_t totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 11083 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hHal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11084 | |
| 11085 | if (!aValidChannels || !pNumChannels) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11086 | sme_err("Output channel list/NumChannels is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11087 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11088 | } |
| 11089 | |
Sreelakshmi Konamki | 0d17c6a | 2017-06-08 12:58:54 +0530 | [diff] [blame] | 11090 | if (wifiBand >= WIFI_BAND_MAX) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11091 | sme_err("Invalid wifiBand: %d", wifiBand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11092 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11093 | } |
| 11094 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 11095 | status = sme_get_cfg_valid_channels(&chanList[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11096 | &totValidChannels); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11097 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11098 | sme_err("Fail to get valid channel list (err=%d)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11099 | return status; |
| 11100 | } |
| 11101 | |
| 11102 | switch (wifiBand) { |
| 11103 | case WIFI_BAND_UNSPECIFIED: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11104 | sme_debug("Unspec Band, return all %d valid channels", |
| 11105 | totValidChannels); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11106 | numChannels = totValidChannels; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11107 | for (i = 0; i < totValidChannels; i++) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11108 | aValidChannels[i] = cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11109 | break; |
| 11110 | |
| 11111 | case WIFI_BAND_BG: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11112 | sme_debug("WIFI_BAND_BG (2.4 GHz)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11113 | for (i = 0; i < totValidChannels; i++) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11114 | if (WLAN_REG_IS_24GHZ_CH(chanList[i])) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11115 | aValidChannels[numChannels++] = |
| 11116 | cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11117 | } |
| 11118 | break; |
| 11119 | |
| 11120 | case WIFI_BAND_A: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11121 | sme_debug("WIFI_BAND_A (5 GHz without DFS)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11122 | for (i = 0; i < totValidChannels; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 11123 | if (WLAN_REG_IS_5GHZ_CH(chanList[i]) && |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11124 | !wlan_reg_is_dfs_ch(mac_ctx->pdev, chanList[i])) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11125 | aValidChannels[numChannels++] = |
| 11126 | cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11127 | } |
| 11128 | break; |
| 11129 | |
| 11130 | case WIFI_BAND_ABG: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11131 | sme_debug("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11132 | for (i = 0; i < totValidChannels; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 11133 | if ((WLAN_REG_IS_24GHZ_CH(chanList[i]) || |
| 11134 | WLAN_REG_IS_5GHZ_CH(chanList[i])) && |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11135 | !wlan_reg_is_dfs_ch(mac_ctx->pdev, chanList[i])) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11136 | aValidChannels[numChannels++] = |
| 11137 | cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11138 | } |
| 11139 | break; |
| 11140 | |
| 11141 | case WIFI_BAND_A_DFS_ONLY: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11142 | sme_debug("WIFI_BAND_A_DFS (5 GHz DFS only)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11143 | for (i = 0; i < totValidChannels; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 11144 | if (WLAN_REG_IS_5GHZ_CH(chanList[i]) && |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11145 | wlan_reg_is_dfs_ch(mac_ctx->pdev, chanList[i])) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11146 | aValidChannels[numChannels++] = |
| 11147 | cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11148 | } |
| 11149 | break; |
| 11150 | |
| 11151 | case WIFI_BAND_A_WITH_DFS: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11152 | sme_debug("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11153 | for (i = 0; i < totValidChannels; i++) { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11154 | if (WLAN_REG_IS_5GHZ_CH(chanList[i])) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11155 | aValidChannels[numChannels++] = |
| 11156 | cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11157 | } |
| 11158 | break; |
| 11159 | |
| 11160 | case WIFI_BAND_ABG_WITH_DFS: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11161 | 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] | 11162 | for (i = 0; i < totValidChannels; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 11163 | if (WLAN_REG_IS_24GHZ_CH(chanList[i]) || |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11164 | WLAN_REG_IS_5GHZ_CH(chanList[i])) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11165 | aValidChannels[numChannels++] = |
| 11166 | cds_chan_to_freq(chanList[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11167 | } |
| 11168 | break; |
| 11169 | |
| 11170 | default: |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11171 | sme_err("Unknown wifiBand: %d", wifiBand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11172 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11173 | } |
| 11174 | *pNumChannels = numChannels; |
| 11175 | |
| 11176 | return status; |
| 11177 | } |
| 11178 | |
Jeff Johnson | fed9a73 | 2018-07-18 12:18:03 -0700 | [diff] [blame] | 11179 | QDF_STATUS |
| 11180 | sme_ext_scan_get_capabilities(mac_handle_t mac_handle, |
| 11181 | struct extscan_capabilities_params *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11182 | { |
Jeff Johnson | fed9a73 | 2018-07-18 12:18:03 -0700 | [diff] [blame] | 11183 | QDF_STATUS status; |
| 11184 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11185 | struct scheduler_msg message = {0}; |
Jeff Johnson | fed9a73 | 2018-07-18 12:18:03 -0700 | [diff] [blame] | 11186 | struct extscan_capabilities_params *bodyptr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11187 | |
Jeff Johnson | fed9a73 | 2018-07-18 12:18:03 -0700 | [diff] [blame] | 11188 | /* per contract must make a copy of the params when messaging */ |
| 11189 | bodyptr = qdf_mem_malloc(sizeof(*bodyptr)); |
| 11190 | if (!bodyptr) |
| 11191 | return QDF_STATUS_E_NOMEM; |
| 11192 | *bodyptr = *params; |
| 11193 | |
| 11194 | status = sme_acquire_global_lock(&mac->sme); |
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 | /* Serialize the req through MC thread */ |
Jeff Johnson | fed9a73 | 2018-07-18 12:18:03 -0700 | [diff] [blame] | 11197 | message.bodyptr = bodyptr; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11198 | message.type = WMA_EXTSCAN_GET_CAPABILITIES_REQ; |
Jeff Johnson | fed9a73 | 2018-07-18 12:18:03 -0700 | [diff] [blame] | 11199 | qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 11200 | NO_SESSION, message.type); |
| 11201 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11202 | QDF_MODULE_ID_WMA, |
| 11203 | QDF_MODULE_ID_WMA, |
| 11204 | &message); |
| 11205 | sme_release_global_lock(&mac->sme); |
| 11206 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11207 | |
Jeff Johnson | fed9a73 | 2018-07-18 12:18:03 -0700 | [diff] [blame] | 11208 | if (QDF_IS_STATUS_ERROR(status)) { |
| 11209 | sme_err("failure: %d", status); |
| 11210 | qdf_mem_free(bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11211 | } |
| 11212 | return status; |
| 11213 | } |
| 11214 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11215 | /* |
| 11216 | * sme_ext_scan_start() - |
| 11217 | * SME API to issue extscan start |
| 11218 | * |
| 11219 | * hHal |
| 11220 | * pStartCmd: extscan start structure |
| 11221 | * Return QDF_STATUS |
| 11222 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11223 | QDF_STATUS sme_ext_scan_start(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11224 | tSirWifiScanCmdReqParams *pStartCmd) |
| 11225 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11226 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11227 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11228 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11229 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11230 | |
| 11231 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11232 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11233 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11234 | message.bodyptr = pStartCmd; |
| 11235 | message.type = WMA_EXTSCAN_START_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11236 | 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] | 11237 | NO_SESSION, message.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11238 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11239 | QDF_MODULE_ID_WMA, |
| 11240 | QDF_MODULE_ID_WMA, |
| 11241 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11242 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 11243 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11244 | |
| 11245 | sme_release_global_lock(&pMac->sme); |
| 11246 | } |
| 11247 | return status; |
| 11248 | } |
| 11249 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11250 | /* |
| 11251 | * sme_ext_scan_stop() - |
| 11252 | * SME API to issue extscan stop |
| 11253 | * |
| 11254 | * hHal |
| 11255 | * pStopReq: extscan stop structure |
| 11256 | * Return QDF_STATUS |
| 11257 | */ |
| 11258 | QDF_STATUS sme_ext_scan_stop(tHalHandle hHal, tSirExtScanStopReqParams |
| 11259 | *pStopReq) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11260 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11261 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11262 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11263 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11264 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11265 | |
| 11266 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11267 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11268 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11269 | message.bodyptr = pStopReq; |
| 11270 | message.type = WMA_EXTSCAN_STOP_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11271 | 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] | 11272 | NO_SESSION, message.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11273 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11274 | QDF_MODULE_ID_WMA, |
| 11275 | QDF_MODULE_ID_WMA, |
| 11276 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11277 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 11278 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11279 | sme_release_global_lock(&pMac->sme); |
| 11280 | } |
| 11281 | return status; |
| 11282 | } |
| 11283 | |
Jeff Johnson | 1148cb0 | 2018-07-13 23:14:32 -0700 | [diff] [blame] | 11284 | QDF_STATUS |
| 11285 | sme_set_bss_hotlist(mac_handle_t mac_handle, |
| 11286 | struct extscan_bssid_hotlist_set_params *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11287 | { |
Jeff Johnson | 1148cb0 | 2018-07-13 23:14:32 -0700 | [diff] [blame] | 11288 | QDF_STATUS status; |
| 11289 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11290 | struct scheduler_msg message = {0}; |
Jeff Johnson | 1148cb0 | 2018-07-13 23:14:32 -0700 | [diff] [blame] | 11291 | struct extscan_bssid_hotlist_set_params *bodyptr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11292 | |
Jeff Johnson | 1148cb0 | 2018-07-13 23:14:32 -0700 | [diff] [blame] | 11293 | /* per contract must make a copy of the params when messaging */ |
| 11294 | bodyptr = qdf_mem_malloc(sizeof(*bodyptr)); |
| 11295 | if (!bodyptr) { |
| 11296 | sme_err("buffer allocation failure"); |
| 11297 | return QDF_STATUS_E_NOMEM; |
| 11298 | } |
| 11299 | *bodyptr = *params; |
| 11300 | |
| 11301 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11302 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11303 | /* Serialize the req through MC thread */ |
Jeff Johnson | 1148cb0 | 2018-07-13 23:14:32 -0700 | [diff] [blame] | 11304 | message.bodyptr = bodyptr; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11305 | message.type = WMA_EXTSCAN_SET_BSSID_HOTLIST_REQ; |
Jeff Johnson | 1148cb0 | 2018-07-13 23:14:32 -0700 | [diff] [blame] | 11306 | qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 11307 | NO_SESSION, message.type); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11308 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11309 | QDF_MODULE_ID_WMA, |
| 11310 | QDF_MODULE_ID_WMA, &message); |
Jeff Johnson | 1148cb0 | 2018-07-13 23:14:32 -0700 | [diff] [blame] | 11311 | sme_release_global_lock(&mac->sme); |
| 11312 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11313 | |
Jeff Johnson | 1148cb0 | 2018-07-13 23:14:32 -0700 | [diff] [blame] | 11314 | if (QDF_IS_STATUS_ERROR(status)) { |
| 11315 | sme_err("failure: %d", status); |
| 11316 | qdf_mem_free(bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11317 | } |
| 11318 | return status; |
| 11319 | } |
| 11320 | |
Jeff Johnson | 9743eb7 | 2018-07-14 10:30:04 -0700 | [diff] [blame] | 11321 | QDF_STATUS |
| 11322 | sme_reset_bss_hotlist(mac_handle_t mac_handle, |
| 11323 | struct extscan_bssid_hotlist_reset_params *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11324 | { |
Jeff Johnson | 9743eb7 | 2018-07-14 10:30:04 -0700 | [diff] [blame] | 11325 | QDF_STATUS status; |
| 11326 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11327 | struct scheduler_msg message = {0}; |
Jeff Johnson | 9743eb7 | 2018-07-14 10:30:04 -0700 | [diff] [blame] | 11328 | struct extscan_bssid_hotlist_reset_params *bodyptr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11329 | |
Jeff Johnson | 9743eb7 | 2018-07-14 10:30:04 -0700 | [diff] [blame] | 11330 | /* per contract must make a copy of the params when messaging */ |
| 11331 | bodyptr = qdf_mem_malloc(sizeof(*bodyptr)); |
| 11332 | if (!bodyptr) { |
| 11333 | sme_err("buffer allocation failure"); |
| 11334 | return QDF_STATUS_E_NOMEM; |
| 11335 | } |
| 11336 | *bodyptr = *params; |
| 11337 | |
| 11338 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11339 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11340 | /* Serialize the req through MC thread */ |
Jeff Johnson | 9743eb7 | 2018-07-14 10:30:04 -0700 | [diff] [blame] | 11341 | message.bodyptr = bodyptr; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11342 | message.type = WMA_EXTSCAN_RESET_BSSID_HOTLIST_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11343 | 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] | 11344 | NO_SESSION, message.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11345 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11346 | QDF_MODULE_ID_WMA, |
| 11347 | QDF_MODULE_ID_WMA, &message); |
Jeff Johnson | 9743eb7 | 2018-07-14 10:30:04 -0700 | [diff] [blame] | 11348 | sme_release_global_lock(&mac->sme); |
| 11349 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11350 | |
Jeff Johnson | 9743eb7 | 2018-07-14 10:30:04 -0700 | [diff] [blame] | 11351 | if (QDF_IS_STATUS_ERROR(status)) { |
| 11352 | sme_err("failure: %d", status); |
| 11353 | qdf_mem_free(bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11354 | } |
| 11355 | return status; |
| 11356 | } |
| 11357 | |
Jeff Johnson | b43ed03 | 2018-07-16 06:59:21 -0700 | [diff] [blame] | 11358 | QDF_STATUS |
| 11359 | sme_set_significant_change(mac_handle_t mac_handle, |
| 11360 | struct extscan_set_sig_changereq_params *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11361 | { |
Jeff Johnson | b43ed03 | 2018-07-16 06:59:21 -0700 | [diff] [blame] | 11362 | QDF_STATUS status; |
| 11363 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11364 | struct scheduler_msg message = {0}; |
Jeff Johnson | b43ed03 | 2018-07-16 06:59:21 -0700 | [diff] [blame] | 11365 | struct extscan_set_sig_changereq_params *bodyptr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11366 | |
Jeff Johnson | b43ed03 | 2018-07-16 06:59:21 -0700 | [diff] [blame] | 11367 | /* per contract must make a copy of the params when messaging */ |
| 11368 | bodyptr = qdf_mem_malloc(sizeof(*bodyptr)); |
| 11369 | if (!bodyptr) { |
| 11370 | sme_err("buffer allocation failure"); |
| 11371 | return QDF_STATUS_E_NOMEM; |
| 11372 | } |
| 11373 | *bodyptr = *params; |
| 11374 | |
| 11375 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11376 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11377 | /* Serialize the req through MC thread */ |
Jeff Johnson | b43ed03 | 2018-07-16 06:59:21 -0700 | [diff] [blame] | 11378 | message.bodyptr = bodyptr; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11379 | message.type = WMA_EXTSCAN_SET_SIGNF_CHANGE_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11380 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11381 | QDF_MODULE_ID_WMA, |
| 11382 | QDF_MODULE_ID_WMA, |
| 11383 | &message); |
Jeff Johnson | b43ed03 | 2018-07-16 06:59:21 -0700 | [diff] [blame] | 11384 | sme_release_global_lock(&mac->sme); |
| 11385 | } |
Jeff Johnson | b43ed03 | 2018-07-16 06:59:21 -0700 | [diff] [blame] | 11386 | if (QDF_IS_STATUS_ERROR(status)) { |
| 11387 | sme_err("failure: %d", status); |
| 11388 | qdf_mem_free(bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11389 | } |
| 11390 | return status; |
| 11391 | } |
| 11392 | |
Jeff Johnson | 0c8dbc3 | 2018-07-16 22:10:48 -0700 | [diff] [blame] | 11393 | QDF_STATUS |
| 11394 | sme_reset_significant_change(mac_handle_t mac_handle, |
| 11395 | struct extscan_capabilities_reset_params *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11396 | { |
Jeff Johnson | 0c8dbc3 | 2018-07-16 22:10:48 -0700 | [diff] [blame] | 11397 | QDF_STATUS status; |
| 11398 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11399 | struct scheduler_msg message = {0}; |
Jeff Johnson | 0c8dbc3 | 2018-07-16 22:10:48 -0700 | [diff] [blame] | 11400 | struct extscan_capabilities_reset_params *bodyptr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11401 | |
Jeff Johnson | 0c8dbc3 | 2018-07-16 22:10:48 -0700 | [diff] [blame] | 11402 | /* per contract must make a copy of the params when messaging */ |
| 11403 | bodyptr = qdf_mem_malloc(sizeof(*bodyptr)); |
| 11404 | if (!bodyptr) { |
| 11405 | sme_err("buffer allocation failure"); |
| 11406 | return QDF_STATUS_E_NOMEM; |
| 11407 | } |
| 11408 | *bodyptr = *params; |
| 11409 | |
| 11410 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11411 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11412 | /* Serialize the req through MC thread */ |
Jeff Johnson | 0c8dbc3 | 2018-07-16 22:10:48 -0700 | [diff] [blame] | 11413 | message.bodyptr = bodyptr; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11414 | message.type = WMA_EXTSCAN_RESET_SIGNF_CHANGE_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11415 | 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] | 11416 | NO_SESSION, message.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11417 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11418 | QDF_MODULE_ID_WMA, |
| 11419 | QDF_MODULE_ID_WMA, |
| 11420 | &message); |
Jeff Johnson | 0c8dbc3 | 2018-07-16 22:10:48 -0700 | [diff] [blame] | 11421 | sme_release_global_lock(&mac->sme); |
| 11422 | } |
Jeff Johnson | 0c8dbc3 | 2018-07-16 22:10:48 -0700 | [diff] [blame] | 11423 | if (QDF_IS_STATUS_ERROR(status)) { |
| 11424 | sme_err("failure: %d", status); |
| 11425 | qdf_mem_free(bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11426 | } |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11427 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11428 | return status; |
| 11429 | } |
| 11430 | |
Jeff Johnson | 2ba6009 | 2018-07-17 08:19:37 -0700 | [diff] [blame] | 11431 | QDF_STATUS |
| 11432 | sme_get_cached_results(mac_handle_t mac_handle, |
| 11433 | struct extscan_cached_result_params *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11434 | { |
Jeff Johnson | 2ba6009 | 2018-07-17 08:19:37 -0700 | [diff] [blame] | 11435 | QDF_STATUS status; |
| 11436 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11437 | struct scheduler_msg message = {0}; |
Jeff Johnson | 2ba6009 | 2018-07-17 08:19:37 -0700 | [diff] [blame] | 11438 | struct extscan_cached_result_params *bodyptr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11439 | |
Jeff Johnson | 2ba6009 | 2018-07-17 08:19:37 -0700 | [diff] [blame] | 11440 | /* per contract must make a copy of the params when messaging */ |
| 11441 | bodyptr = qdf_mem_malloc(sizeof(*bodyptr)); |
| 11442 | if (!bodyptr) |
| 11443 | return QDF_STATUS_E_NOMEM; |
| 11444 | *bodyptr = *params; |
| 11445 | |
| 11446 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11447 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11448 | /* Serialize the req through MC thread */ |
Jeff Johnson | 2ba6009 | 2018-07-17 08:19:37 -0700 | [diff] [blame] | 11449 | message.bodyptr = bodyptr; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11450 | message.type = WMA_EXTSCAN_GET_CACHED_RESULTS_REQ; |
Jeff Johnson | 2ba6009 | 2018-07-17 08:19:37 -0700 | [diff] [blame] | 11451 | qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 11452 | NO_SESSION, message.type); |
| 11453 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11454 | QDF_MODULE_ID_WMA, |
| 11455 | QDF_MODULE_ID_WMA, |
| 11456 | &message); |
| 11457 | sme_release_global_lock(&mac->sme); |
| 11458 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11459 | |
Jeff Johnson | 2ba6009 | 2018-07-17 08:19:37 -0700 | [diff] [blame] | 11460 | if (QDF_IS_STATUS_ERROR(status)) { |
| 11461 | sme_err("failure: %d", status); |
| 11462 | qdf_mem_free(bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11463 | } |
| 11464 | return status; |
| 11465 | } |
| 11466 | |
| 11467 | /** |
| 11468 | * sme_set_epno_list() - set epno network list |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 11469 | * @hal: global hal handle |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11470 | * @input: request message |
| 11471 | * |
| 11472 | * This function constructs the cds message and fill in message type, |
| 11473 | * bodyptr with %input and posts it to WDA queue. |
| 11474 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 11475 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11476 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11477 | QDF_STATUS sme_set_epno_list(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11478 | struct wifi_epno_params *input) |
| 11479 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11480 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11481 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11482 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11483 | struct wifi_epno_params *req_msg; |
| 11484 | int len, i; |
| 11485 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11486 | SME_ENTER(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11487 | len = sizeof(*req_msg) + |
| 11488 | (input->num_networks * sizeof(struct wifi_epno_network)); |
Mukul Sharma | e8c919f | 2016-10-02 20:35:15 +0530 | [diff] [blame] | 11489 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11490 | req_msg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11491 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11492 | sme_err("qdf_mem_malloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11493 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11494 | } |
| 11495 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11496 | req_msg->num_networks = input->num_networks; |
| 11497 | req_msg->request_id = input->request_id; |
| 11498 | req_msg->session_id = input->session_id; |
Mukul Sharma | e8c919f | 2016-10-02 20:35:15 +0530 | [diff] [blame] | 11499 | |
| 11500 | /* Fill only when num_networks are non zero */ |
| 11501 | if (req_msg->num_networks) { |
| 11502 | req_msg->min_5ghz_rssi = input->min_5ghz_rssi; |
| 11503 | req_msg->min_24ghz_rssi = input->min_24ghz_rssi; |
| 11504 | req_msg->initial_score_max = input->initial_score_max; |
| 11505 | req_msg->same_network_bonus = input->same_network_bonus; |
| 11506 | req_msg->secure_bonus = input->secure_bonus; |
| 11507 | req_msg->band_5ghz_bonus = input->band_5ghz_bonus; |
| 11508 | req_msg->current_connection_bonus = |
| 11509 | input->current_connection_bonus; |
| 11510 | |
| 11511 | for (i = 0; i < req_msg->num_networks; i++) { |
| 11512 | req_msg->networks[i].flags = input->networks[i].flags; |
| 11513 | req_msg->networks[i].auth_bit_field = |
| 11514 | input->networks[i].auth_bit_field; |
| 11515 | req_msg->networks[i].ssid.length = |
| 11516 | input->networks[i].ssid.length; |
| 11517 | qdf_mem_copy(req_msg->networks[i].ssid.ssId, |
| 11518 | input->networks[i].ssid.ssId, |
| 11519 | req_msg->networks[i].ssid.length); |
| 11520 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11521 | } |
| 11522 | |
| 11523 | status = sme_acquire_global_lock(&mac->sme); |
Vignesh Viswanathan | cbb5b95 | 2017-08-02 14:32:49 +0530 | [diff] [blame] | 11524 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11525 | sme_err("sme_acquire_global_lock failed!(status=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11526 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11527 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11528 | return status; |
| 11529 | } |
| 11530 | |
| 11531 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11532 | message.bodyptr = req_msg; |
| 11533 | message.type = WMA_SET_EPNO_LIST_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11534 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11535 | QDF_MODULE_ID_WMA, |
| 11536 | QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11537 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11538 | sme_err("scheduler_post_msg failed!(err=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11539 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11540 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11541 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11542 | } |
| 11543 | sme_release_global_lock(&mac->sme); |
| 11544 | return status; |
| 11545 | } |
| 11546 | |
| 11547 | /** |
| 11548 | * sme_set_passpoint_list() - set passpoint network list |
| 11549 | * @hal: global hal handle |
| 11550 | * @input: request message |
| 11551 | * |
| 11552 | * This function constructs the cds message and fill in message type, |
| 11553 | * bodyptr with @input and posts it to WDA queue. |
| 11554 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 11555 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11556 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11557 | QDF_STATUS sme_set_passpoint_list(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11558 | struct wifi_passpoint_req *input) |
| 11559 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11560 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11561 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11562 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11563 | struct wifi_passpoint_req *req_msg; |
| 11564 | int len, i; |
| 11565 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11566 | SME_ENTER(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11567 | len = sizeof(*req_msg) + |
| 11568 | (input->num_networks * sizeof(struct wifi_passpoint_network)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11569 | req_msg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11570 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11571 | sme_err("qdf_mem_malloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11572 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11573 | } |
| 11574 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11575 | req_msg->num_networks = input->num_networks; |
| 11576 | req_msg->request_id = input->request_id; |
| 11577 | req_msg->session_id = input->session_id; |
| 11578 | for (i = 0; i < req_msg->num_networks; i++) { |
| 11579 | req_msg->networks[i].id = |
| 11580 | input->networks[i].id; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11581 | qdf_mem_copy(req_msg->networks[i].realm, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11582 | input->networks[i].realm, |
| 11583 | strlen(input->networks[i].realm) + 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11584 | qdf_mem_copy(req_msg->networks[i].plmn, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11585 | input->networks[i].plmn, |
| 11586 | SIR_PASSPOINT_PLMN_LEN); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11587 | qdf_mem_copy(req_msg->networks[i].roaming_consortium_ids, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11588 | input->networks[i].roaming_consortium_ids, |
| 11589 | sizeof(req_msg->networks[i].roaming_consortium_ids)); |
| 11590 | } |
| 11591 | |
| 11592 | status = sme_acquire_global_lock(&mac->sme); |
Vignesh Viswanathan | cbb5b95 | 2017-08-02 14:32:49 +0530 | [diff] [blame] | 11593 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11594 | sme_err("sme_acquire_global_lock failed!(status=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11595 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11596 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11597 | return status; |
| 11598 | } |
| 11599 | |
| 11600 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11601 | message.bodyptr = req_msg; |
| 11602 | message.type = WMA_SET_PASSPOINT_LIST_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11603 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11604 | QDF_MODULE_ID_WMA, |
| 11605 | QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11606 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11607 | sme_err("scheduler_post_msg failed!(err=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11608 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11609 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11610 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11611 | } |
| 11612 | sme_release_global_lock(&mac->sme); |
| 11613 | return status; |
| 11614 | } |
| 11615 | |
| 11616 | /** |
| 11617 | * sme_reset_passpoint_list() - reset passpoint network list |
| 11618 | * @hHal: global hal handle |
| 11619 | * @input: request message |
| 11620 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 11621 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11622 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11623 | QDF_STATUS sme_reset_passpoint_list(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11624 | struct wifi_passpoint_req *input) |
| 11625 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11626 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11627 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11628 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11629 | struct wifi_passpoint_req *req_msg; |
| 11630 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11631 | SME_ENTER(); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11632 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11633 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11634 | sme_err("qdf_mem_malloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11635 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11636 | } |
| 11637 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11638 | req_msg->request_id = input->request_id; |
| 11639 | req_msg->session_id = input->session_id; |
| 11640 | |
| 11641 | status = sme_acquire_global_lock(&mac->sme); |
Vignesh Viswanathan | cbb5b95 | 2017-08-02 14:32:49 +0530 | [diff] [blame] | 11642 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11643 | sme_err("sme_acquire_global_lock failed!(status=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11644 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11645 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11646 | return status; |
| 11647 | } |
| 11648 | |
| 11649 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11650 | message.bodyptr = req_msg; |
| 11651 | message.type = WMA_RESET_PASSPOINT_LIST_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11652 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11653 | QDF_MODULE_ID_WMA, |
| 11654 | QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11655 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 11656 | sme_err("scheduler_post_msg failed!(err=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11657 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11658 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11659 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11660 | } |
| 11661 | sme_release_global_lock(&mac->sme); |
| 11662 | return status; |
| 11663 | } |
| 11664 | |
Jeff Johnson | 17b1239 | 2018-07-03 22:21:15 -0700 | [diff] [blame] | 11665 | QDF_STATUS sme_ext_scan_register_callback(mac_handle_t mac_handle, |
| 11666 | ext_scan_ind_cb ext_scan_ind_cb) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11667 | { |
Jeff Johnson | 17b1239 | 2018-07-03 22:21:15 -0700 | [diff] [blame] | 11668 | QDF_STATUS status; |
| 11669 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11670 | |
Jeff Johnson | 17b1239 | 2018-07-03 22:21:15 -0700 | [diff] [blame] | 11671 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11672 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 17b1239 | 2018-07-03 22:21:15 -0700 | [diff] [blame] | 11673 | mac->sme.ext_scan_ind_cb = ext_scan_ind_cb; |
| 11674 | sme_release_global_lock(&mac->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11675 | } |
| 11676 | return status; |
| 11677 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11678 | #endif /* FEATURE_WLAN_EXTSCAN */ |
| 11679 | |
Wen Gong | 7952fbd | 2018-04-18 11:27:23 +0800 | [diff] [blame] | 11680 | /** |
| 11681 | * sme_send_wisa_params(): Pass WISA mode to WMA |
| 11682 | * @hal: HAL context |
| 11683 | * @wisa_params: pointer to WISA params struct |
| 11684 | * @sessionId: SME session id |
| 11685 | * |
| 11686 | * Pass WISA params to WMA |
| 11687 | * |
| 11688 | * Return: QDF_STATUS |
| 11689 | */ |
| 11690 | QDF_STATUS sme_set_wisa_params(tHalHandle hal, |
| 11691 | struct sir_wisa_params *wisa_params) |
| 11692 | { |
| 11693 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11694 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 11695 | struct scheduler_msg message = {0}; |
| 11696 | struct sir_wisa_params *cds_msg_wisa_params; |
| 11697 | |
| 11698 | cds_msg_wisa_params = qdf_mem_malloc(sizeof(struct sir_wisa_params)); |
| 11699 | if (!cds_msg_wisa_params) |
| 11700 | return QDF_STATUS_E_NOMEM; |
| 11701 | |
| 11702 | *cds_msg_wisa_params = *wisa_params; |
| 11703 | status = sme_acquire_global_lock(&mac->sme); |
| 11704 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 11705 | message.bodyptr = cds_msg_wisa_params; |
| 11706 | message.type = WMA_SET_WISA_PARAMS; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11707 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11708 | QDF_MODULE_ID_WMA, |
| 11709 | QDF_MODULE_ID_WMA, &message); |
Wen Gong | 7952fbd | 2018-04-18 11:27:23 +0800 | [diff] [blame] | 11710 | sme_release_global_lock(&mac->sme); |
| 11711 | } |
| 11712 | return status; |
| 11713 | } |
| 11714 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11715 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 11716 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11717 | /* |
| 11718 | * sme_ll_stats_clear_req() - |
| 11719 | * SME API to clear Link Layer Statistics |
| 11720 | * |
| 11721 | * hHal |
| 11722 | * pclearStatsReq: Link Layer clear stats request params structure |
| 11723 | * Return QDF_STATUS |
| 11724 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11725 | QDF_STATUS sme_ll_stats_clear_req(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11726 | tSirLLStatsClearReq *pclearStatsReq) |
| 11727 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11728 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11729 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11730 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11731 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11732 | tSirLLStatsClearReq *clear_stats_req; |
| 11733 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 11734 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11735 | "staId = %u", pclearStatsReq->staId); |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 11736 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11737 | "statsClearReqMask = 0x%X", |
| 11738 | pclearStatsReq->statsClearReqMask); |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 11739 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11740 | "stopReq = %u", pclearStatsReq->stopReq); |
Deepak Dhamdhere | 6adc08e | 2017-07-27 09:33:22 -0700 | [diff] [blame] | 11741 | if (!sme_is_session_id_valid(hHal, pclearStatsReq->staId)) { |
| 11742 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11743 | "%s: invalid staId %d", |
| 11744 | __func__, pclearStatsReq->staId); |
| 11745 | return QDF_STATUS_E_INVAL; |
| 11746 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11747 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11748 | clear_stats_req = qdf_mem_malloc(sizeof(*clear_stats_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11749 | |
| 11750 | if (!clear_stats_req) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11751 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11752 | "%s: Not able to allocate memory for WMA_LL_STATS_CLEAR_REQ", |
| 11753 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11754 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11755 | } |
| 11756 | |
| 11757 | *clear_stats_req = *pclearStatsReq; |
| 11758 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11759 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11760 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11761 | message.bodyptr = clear_stats_req; |
| 11762 | message.type = WMA_LINK_LAYER_STATS_CLEAR_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11763 | 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] | 11764 | NO_SESSION, message.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11765 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11766 | QDF_MODULE_ID_WMA, |
| 11767 | QDF_MODULE_ID_WMA, |
| 11768 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11769 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11770 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11771 | "%s: not able to post WMA_LL_STATS_CLEAR_REQ", |
| 11772 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11773 | qdf_mem_free(clear_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11774 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11775 | } |
| 11776 | sme_release_global_lock(&pMac->sme); |
| 11777 | } else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11778 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11779 | "%s: sme_acquire_global_lock error", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11780 | qdf_mem_free(clear_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11781 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11782 | } |
| 11783 | |
| 11784 | return status; |
| 11785 | } |
| 11786 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11787 | /* |
| 11788 | * sme_ll_stats_set_req() - |
| 11789 | * SME API to set the Link Layer Statistics |
| 11790 | * |
| 11791 | * hHal |
| 11792 | * psetStatsReq: Link Layer set stats request params structure |
| 11793 | * Return QDF_STATUS |
| 11794 | */ |
| 11795 | QDF_STATUS sme_ll_stats_set_req(tHalHandle hHal, tSirLLStatsSetReq |
| 11796 | *psetStatsReq) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11797 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11798 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 11799 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11800 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11801 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11802 | tSirLLStatsSetReq *set_stats_req; |
| 11803 | |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 11804 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11805 | "%s: MPDU Size = %u", __func__, |
| 11806 | psetStatsReq->mpduSizeThreshold); |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 11807 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11808 | " Aggressive Stats Collections = %u", |
| 11809 | psetStatsReq->aggressiveStatisticsGathering); |
| 11810 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11811 | set_stats_req = qdf_mem_malloc(sizeof(*set_stats_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11812 | |
| 11813 | if (!set_stats_req) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11814 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11815 | "%s: Not able to allocate memory for WMA_LL_STATS_SET_REQ", |
| 11816 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11817 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11818 | } |
| 11819 | |
| 11820 | *set_stats_req = *psetStatsReq; |
| 11821 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11822 | if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11823 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11824 | message.bodyptr = set_stats_req; |
| 11825 | message.type = WMA_LINK_LAYER_STATS_SET_REQ; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 11826 | 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] | 11827 | NO_SESSION, message.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11828 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11829 | QDF_MODULE_ID_WMA, |
| 11830 | QDF_MODULE_ID_WMA, |
| 11831 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11832 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11833 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11834 | "%s: not able to post WMA_LL_STATS_SET_REQ", |
| 11835 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11836 | qdf_mem_free(set_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11837 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11838 | } |
| 11839 | sme_release_global_lock(&pMac->sme); |
| 11840 | } else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11841 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11842 | "%s: sme_acquire_global_lock error", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11843 | qdf_mem_free(set_stats_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11844 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11845 | } |
| 11846 | |
| 11847 | return status; |
| 11848 | } |
| 11849 | |
Dundi Raviteja | e232cf1 | 2018-05-16 18:34:34 +0530 | [diff] [blame] | 11850 | QDF_STATUS sme_ll_stats_get_req(mac_handle_t mac_handle, |
| 11851 | tSirLLStatsGetReq *get_stats_req, |
| 11852 | void *context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11853 | { |
Dundi Raviteja | e232cf1 | 2018-05-16 18:34:34 +0530 | [diff] [blame] | 11854 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 11855 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 11856 | struct scheduler_msg message = {0}; |
Dundi Raviteja | e232cf1 | 2018-05-16 18:34:34 +0530 | [diff] [blame] | 11857 | tSirLLStatsGetReq *ll_stats_get_req; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11858 | |
Dundi Raviteja | e232cf1 | 2018-05-16 18:34:34 +0530 | [diff] [blame] | 11859 | ll_stats_get_req = qdf_mem_malloc(sizeof(*ll_stats_get_req)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11860 | |
Dundi Raviteja | e232cf1 | 2018-05-16 18:34:34 +0530 | [diff] [blame] | 11861 | if (!ll_stats_get_req) { |
| 11862 | sme_err("Unable to allocate memory for WMA_LL_STATS_GET_REQ"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11863 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11864 | } |
| 11865 | |
Dundi Raviteja | e232cf1 | 2018-05-16 18:34:34 +0530 | [diff] [blame] | 11866 | *ll_stats_get_req = *get_stats_req; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11867 | |
Dundi Raviteja | e232cf1 | 2018-05-16 18:34:34 +0530 | [diff] [blame] | 11868 | mac->sme.ll_stats_context = context; |
| 11869 | if (sme_acquire_global_lock(&mac->sme) == QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11870 | /* Serialize the req through MC thread */ |
Dundi Raviteja | e232cf1 | 2018-05-16 18:34:34 +0530 | [diff] [blame] | 11871 | message.bodyptr = ll_stats_get_req; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 11872 | message.type = WMA_LINK_LAYER_STATS_GET_REQ; |
Dundi Raviteja | e232cf1 | 2018-05-16 18:34:34 +0530 | [diff] [blame] | 11873 | qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 11874 | NO_SESSION, message.type); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 11875 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 11876 | QDF_MODULE_ID_WMA, |
| 11877 | QDF_MODULE_ID_WMA, &message); |
Dundi Raviteja | e232cf1 | 2018-05-16 18:34:34 +0530 | [diff] [blame] | 11878 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 11879 | sme_err("Not able to post WMA_LL_STATS_GET_REQ"); |
| 11880 | qdf_mem_free(ll_stats_get_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11881 | } |
Dundi Raviteja | e232cf1 | 2018-05-16 18:34:34 +0530 | [diff] [blame] | 11882 | sme_release_global_lock(&mac->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11883 | } else { |
Dundi Raviteja | e232cf1 | 2018-05-16 18:34:34 +0530 | [diff] [blame] | 11884 | sme_err("sme_acquire_global_lock error"); |
| 11885 | qdf_mem_free(ll_stats_get_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11886 | } |
| 11887 | |
| 11888 | return status; |
| 11889 | } |
| 11890 | |
Jeff Johnson | 959f369 | 2018-07-03 17:30:40 -0700 | [diff] [blame] | 11891 | QDF_STATUS sme_set_link_layer_stats_ind_cb(mac_handle_t mac_handle, |
| 11892 | link_layer_stats_cb callback) |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11893 | { |
Jeff Johnson | 959f369 | 2018-07-03 17:30:40 -0700 | [diff] [blame] | 11894 | QDF_STATUS status; |
| 11895 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11896 | |
Jeff Johnson | 959f369 | 2018-07-03 17:30:40 -0700 | [diff] [blame] | 11897 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11898 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 959f369 | 2018-07-03 17:30:40 -0700 | [diff] [blame] | 11899 | mac->sme.link_layer_stats_cb = callback; |
| 11900 | sme_release_global_lock(&mac->sme); |
| 11901 | } else { |
| 11902 | sme_err("sme_acquire_global_lock error"); |
| 11903 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11904 | |
| 11905 | return status; |
| 11906 | } |
| 11907 | |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 11908 | /** |
Zhang Qian | a6e9c10 | 2016-12-22 16:47:24 +0800 | [diff] [blame] | 11909 | * sme_set_link_layer_ext_cb() - Register callback for link layer statistics |
| 11910 | * @hal: Mac global handle |
| 11911 | * @ll_stats_ext_cb: HDD callback which needs to be invoked after getting |
| 11912 | * status notification from FW |
| 11913 | * |
| 11914 | * Return: eHalStatus |
| 11915 | */ |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11916 | QDF_STATUS sme_set_link_layer_ext_cb(tHalHandle hal, void (*ll_stats_ext_cb) |
Jeff Johnson | 2d29212 | 2018-06-02 21:02:02 -0700 | [diff] [blame] | 11917 | (hdd_handle_t callback_ctx, tSirLLStatsResults |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11918 | *rsp)) |
Zhang Qian | a6e9c10 | 2016-12-22 16:47:24 +0800 | [diff] [blame] | 11919 | { |
| 11920 | QDF_STATUS status; |
| 11921 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 11922 | |
| 11923 | status = sme_acquire_global_lock(&mac->sme); |
| 11924 | if (status == QDF_STATUS_SUCCESS) { |
| 11925 | mac->sme.link_layer_stats_ext_cb = ll_stats_ext_cb; |
| 11926 | sme_release_global_lock(&mac->sme); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11927 | } else |
Zhang Qian | a6e9c10 | 2016-12-22 16:47:24 +0800 | [diff] [blame] | 11928 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11929 | "%s: sme_qcquire_global_lock error", __func__); |
Zhang Qian | a6e9c10 | 2016-12-22 16:47:24 +0800 | [diff] [blame] | 11930 | return status; |
| 11931 | } |
| 11932 | |
| 11933 | /** |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 11934 | * sme_reset_link_layer_stats_ind_cb() - SME API to reset link layer stats |
| 11935 | * indication |
| 11936 | * @h_hal: Hal Handle |
| 11937 | * |
| 11938 | * This function reset's the link layer stats indication |
| 11939 | * |
| 11940 | * Return: QDF_STATUS Enumeration |
| 11941 | */ |
| 11942 | |
| 11943 | QDF_STATUS sme_reset_link_layer_stats_ind_cb(tHalHandle h_hal) |
| 11944 | { |
| 11945 | QDF_STATUS status; |
| 11946 | tpAniSirGlobal pmac; |
| 11947 | |
| 11948 | if (!h_hal) { |
| 11949 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11950 | FL("hHal is not valid")); |
| 11951 | return QDF_STATUS_E_INVAL; |
| 11952 | } |
| 11953 | pmac = PMAC_STRUCT(h_hal); |
| 11954 | |
| 11955 | status = sme_acquire_global_lock(&pmac->sme); |
| 11956 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 959f369 | 2018-07-03 17:30:40 -0700 | [diff] [blame] | 11957 | pmac->sme.link_layer_stats_cb = NULL; |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 11958 | sme_release_global_lock(&pmac->sme); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 11959 | } else |
| 11960 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11961 | "%s: sme_acquire_global_lock error", __func__); |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 11962 | |
| 11963 | return status; |
| 11964 | } |
| 11965 | |
Zhang Qian | 73c348a | 2017-03-13 16:15:55 +0800 | [diff] [blame] | 11966 | /** |
| 11967 | * sme_ll_stats_set_thresh - set threshold for mac counters |
| 11968 | * @hal, hal layer handle |
| 11969 | * @threshold, threshold for mac counters |
| 11970 | * |
| 11971 | * Return: QDF_STATUS Enumeration |
| 11972 | */ |
| 11973 | QDF_STATUS sme_ll_stats_set_thresh(tHalHandle hal, |
| 11974 | struct sir_ll_ext_stats_threshold *threshold) |
| 11975 | { |
| 11976 | QDF_STATUS status; |
| 11977 | tpAniSirGlobal mac; |
Rajeev Kumar | 658e849 | 2017-12-13 11:35:41 -0800 | [diff] [blame] | 11978 | struct scheduler_msg message = {0}; |
Zhang Qian | 73c348a | 2017-03-13 16:15:55 +0800 | [diff] [blame] | 11979 | struct sir_ll_ext_stats_threshold *thresh; |
| 11980 | |
| 11981 | if (!threshold) { |
| 11982 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11983 | FL("threshold is not valid")); |
| 11984 | return QDF_STATUS_E_INVAL; |
| 11985 | } |
| 11986 | |
| 11987 | if (!hal) { |
| 11988 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11989 | FL("hal is not valid")); |
| 11990 | return QDF_STATUS_E_INVAL; |
| 11991 | } |
| 11992 | mac = PMAC_STRUCT(hal); |
| 11993 | |
| 11994 | thresh = qdf_mem_malloc(sizeof(*thresh)); |
| 11995 | if (!thresh) { |
| 11996 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 11997 | "%s: Fail to alloc mem", __func__); |
| 11998 | return QDF_STATUS_E_NOMEM; |
| 11999 | } |
| 12000 | *thresh = *threshold; |
| 12001 | |
| 12002 | status = sme_acquire_global_lock(&mac->sme); |
| 12003 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 12004 | /* Serialize the req through MC thread */ |
| 12005 | message.bodyptr = thresh; |
| 12006 | message.type = WDA_LINK_LAYER_STATS_SET_THRESHOLD; |
| 12007 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 12008 | NO_SESSION, message.type)); |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 12009 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 12010 | QDF_MODULE_ID_WMA, |
| 12011 | QDF_MODULE_ID_WMA, &message); |
Zhang Qian | 73c348a | 2017-03-13 16:15:55 +0800 | [diff] [blame] | 12012 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 12013 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12014 | "%s: not able to post WDA_LL_STATS_GET_REQ", |
| 12015 | __func__); |
| 12016 | qdf_mem_free(thresh); |
| 12017 | } |
| 12018 | sme_release_global_lock(&mac->sme); |
| 12019 | } else { |
| 12020 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 12021 | FL("sme_acquire_global_lock error")); |
| 12022 | qdf_mem_free(thresh); |
| 12023 | } |
| 12024 | return status; |
| 12025 | } |
Arun Khandavalli | 4b55da7 | 2016-07-19 19:55:01 +0530 | [diff] [blame] | 12026 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12027 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 12028 | |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 12029 | #ifdef WLAN_POWER_DEBUGFS |
| 12030 | /** |
| 12031 | * sme_power_debug_stats_req() - SME API to collect Power debug stats |
| 12032 | * @callback_fn: Pointer to the callback function for Power stats event |
| 12033 | * @power_stats_context: Pointer to context |
| 12034 | * |
| 12035 | * Return: QDF_STATUS |
| 12036 | */ |
| 12037 | QDF_STATUS sme_power_debug_stats_req(tHalHandle hal, void (*callback_fn) |
| 12038 | (struct power_stats_response *response, |
| 12039 | void *context), void *power_stats_context) |
| 12040 | { |
| 12041 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12042 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12043 | struct scheduler_msg msg = {0}; |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 12044 | |
| 12045 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 12046 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 12047 | if (!callback_fn) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12048 | sme_err("Indication callback did not registered"); |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 12049 | sme_release_global_lock(&mac_ctx->sme); |
| 12050 | return QDF_STATUS_E_FAILURE; |
| 12051 | } |
| 12052 | |
| 12053 | mac_ctx->sme.power_debug_stats_context = power_stats_context; |
| 12054 | mac_ctx->sme.power_stats_resp_callback = callback_fn; |
| 12055 | msg.bodyptr = NULL; |
| 12056 | msg.type = WMA_POWER_DEBUG_STATS_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 12057 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 12058 | QDF_MODULE_ID_WMA, |
| 12059 | QDF_MODULE_ID_WMA, &msg); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12060 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12061 | sme_err("not able to post WDA_POWER_DEBUG_STATS_REQ"); |
Sridhar Selvaraj | dc400d2 | 2016-10-18 17:18:03 +0530 | [diff] [blame] | 12062 | sme_release_global_lock(&mac_ctx->sme); |
| 12063 | } |
| 12064 | return status; |
| 12065 | } |
| 12066 | #endif |
| 12067 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12068 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12069 | /** |
| 12070 | * sme_update_roam_key_mgmt_offload_enabled() - enable/disable key mgmt offload |
| 12071 | * This is a synchronous call |
| 12072 | * @hal_ctx: The handle returned by mac_open. |
| 12073 | * @session_id: Session Identifier |
| 12074 | * @key_mgmt_offload_enabled: key mgmt enable/disable flag |
Deepak Dhamdhere | 828f189 | 2017-02-09 11:51:19 -0800 | [diff] [blame] | 12075 | * @pmkid_modes: PMKID modes of PMKSA caching and OKC |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12076 | * Return: QDF_STATUS_SUCCESS - SME updated config successfully. |
| 12077 | * Other status means SME is failed to update. |
| 12078 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12079 | |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12080 | QDF_STATUS sme_update_roam_key_mgmt_offload_enabled(tHalHandle hal_ctx, |
Deepak Dhamdhere | 828f189 | 2017-02-09 11:51:19 -0800 | [diff] [blame] | 12081 | uint8_t session_id, |
| 12082 | bool key_mgmt_offload_enabled, |
| 12083 | struct pmkid_mode_bits *pmkid_modes) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12084 | { |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12085 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12086 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12087 | |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12088 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12089 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12090 | if (CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 12091 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12092 | "%s: LFR3: key_mgmt_offload_enabled changed to %d", |
| 12093 | __func__, key_mgmt_offload_enabled); |
| 12094 | status = csr_roam_set_key_mgmt_offload(mac_ctx, |
| 12095 | session_id, |
| 12096 | key_mgmt_offload_enabled, |
Deepak Dhamdhere | 828f189 | 2017-02-09 11:51:19 -0800 | [diff] [blame] | 12097 | pmkid_modes); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12098 | } else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12099 | status = QDF_STATUS_E_INVAL; |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 12100 | sme_release_global_lock(&mac_ctx->sme); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12101 | } |
| 12102 | |
| 12103 | return status; |
| 12104 | } |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 12105 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12106 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12107 | /* |
| 12108 | * sme_get_temperature() - |
| 12109 | * SME API to get the pdev temperature |
| 12110 | * |
| 12111 | * hHal |
| 12112 | * temperature context |
| 12113 | * pCallbackfn: callback fn with response (temperature) |
| 12114 | * Return QDF_STATUS |
| 12115 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12116 | QDF_STATUS sme_get_temperature(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12117 | void *tempContext, |
| 12118 | void (*pCallbackfn)(int temperature, |
| 12119 | void *pContext)) |
| 12120 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12121 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12122 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12123 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12124 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12125 | |
| 12126 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12127 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12128 | if ((NULL == pCallbackfn) && |
| 12129 | (NULL == pMac->sme.pGetTemperatureCb)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12130 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12131 | "Indication Call back did not registered"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12132 | sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12133 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12134 | } else if (NULL != pCallbackfn) { |
| 12135 | pMac->sme.pTemperatureCbContext = tempContext; |
| 12136 | pMac->sme.pGetTemperatureCb = pCallbackfn; |
| 12137 | } |
| 12138 | /* serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12139 | message.bodyptr = NULL; |
| 12140 | message.type = WMA_GET_TEMPERATURE_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 12141 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 12142 | QDF_MODULE_ID_WMA, |
| 12143 | QDF_MODULE_ID_WMA, |
| 12144 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12145 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12146 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12147 | FL("Post Get Temperature msg fail")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12148 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12149 | } |
| 12150 | sme_release_global_lock(&pMac->sme); |
| 12151 | } |
| 12152 | return status; |
| 12153 | } |
| 12154 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12155 | /* |
| 12156 | * sme_set_scanning_mac_oui() - |
| 12157 | * SME API to set scanning mac oui |
| 12158 | * |
| 12159 | * hHal |
| 12160 | * pScanMacOui: Scanning Mac Oui (input 3 bytes) |
| 12161 | * Return QDF_STATUS |
| 12162 | */ |
| 12163 | QDF_STATUS sme_set_scanning_mac_oui(tHalHandle hHal, tSirScanMacOui |
| 12164 | *pScanMacOui) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12165 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12166 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12167 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12168 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12169 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12170 | |
| 12171 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12172 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12173 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12174 | message.bodyptr = pScanMacOui; |
| 12175 | message.type = WMA_SET_SCAN_MAC_OUI_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 12176 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 12177 | QDF_MODULE_ID_WMA, |
| 12178 | QDF_MODULE_ID_WMA, |
| 12179 | &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12180 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12181 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12182 | FL("Msg post Set Scan Mac OUI failed")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12183 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12184 | } |
| 12185 | sme_release_global_lock(&pMac->sme); |
| 12186 | } |
| 12187 | return status; |
| 12188 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12189 | |
| 12190 | #ifdef DHCP_SERVER_OFFLOAD |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12191 | /* |
| 12192 | * sme_set_dhcp_srv_offload() - |
| 12193 | * SME API to set DHCP server offload info |
| 12194 | * |
| 12195 | * hHal |
| 12196 | * pDhcpSrvInfo : DHCP server offload info struct |
| 12197 | * Return QDF_STATUS |
| 12198 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12199 | QDF_STATUS sme_set_dhcp_srv_offload(tHalHandle hHal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12200 | tSirDhcpSrvOffloadInfo *pDhcpSrvInfo) |
| 12201 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12202 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12203 | tSirDhcpSrvOffloadInfo *pSmeDhcpSrvInfo; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12204 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12205 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 12206 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12207 | pSmeDhcpSrvInfo = qdf_mem_malloc(sizeof(*pSmeDhcpSrvInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12208 | |
| 12209 | if (!pSmeDhcpSrvInfo) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12210 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12211 | "%s: Not able to allocate memory for WMA_SET_DHCP_SERVER_OFFLOAD_CMD", |
| 12212 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12213 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12214 | } |
| 12215 | |
| 12216 | *pSmeDhcpSrvInfo = *pDhcpSrvInfo; |
| 12217 | |
| 12218 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12219 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12220 | /* serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12221 | message.type = WMA_SET_DHCP_SERVER_OFFLOAD_CMD; |
| 12222 | message.bodyptr = pSmeDhcpSrvInfo; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12223 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12224 | if (!QDF_IS_STATUS_SUCCESS |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 12225 | (scheduler_post_message(QDF_MODULE_ID_SME, |
| 12226 | QDF_MODULE_ID_WMA, |
| 12227 | QDF_MODULE_ID_WMA, |
| 12228 | &message))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12229 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 12230 | "%s:WMA_SET_DHCP_SERVER_OFFLOAD_CMD failed", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12231 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12232 | qdf_mem_free(pSmeDhcpSrvInfo); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12233 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12234 | } |
| 12235 | sme_release_global_lock(&pMac->sme); |
| 12236 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12237 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12238 | "%s: sme_acquire_global_lock error!", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12239 | qdf_mem_free(pSmeDhcpSrvInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12240 | } |
| 12241 | |
| 12242 | return status; |
| 12243 | } |
| 12244 | #endif /* DHCP_SERVER_OFFLOAD */ |
| 12245 | |
Krunal Soni | aadaa27 | 2017-10-04 16:42:55 -0700 | [diff] [blame] | 12246 | QDF_STATUS sme_send_unit_test_cmd(uint32_t vdev_id, uint32_t module_id, |
| 12247 | uint32_t arg_count, uint32_t *arg) |
| 12248 | { |
| 12249 | return wma_form_unit_test_cmd_and_send(vdev_id, module_id, |
| 12250 | arg_count, arg); |
| 12251 | } |
| 12252 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12253 | #ifdef WLAN_FEATURE_GPIO_LED_FLASHING |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12254 | /* |
| 12255 | * sme_set_led_flashing() - |
| 12256 | * API to set the Led flashing parameters. |
| 12257 | * |
| 12258 | * hHal - The handle returned by mac_open. |
| 12259 | * x0, x1 - led flashing parameters |
| 12260 | * Return QDF_STATUS |
| 12261 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12262 | QDF_STATUS sme_set_led_flashing(tHalHandle hHal, uint8_t type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12263 | uint32_t x0, uint32_t x1) |
| 12264 | { |
Jeff Johnson | 5a6b660 | 2017-10-04 14:44:30 -0700 | [diff] [blame] | 12265 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12266 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12267 | struct scheduler_msg message = {0}; |
Jeff Johnson | 5a6b660 | 2017-10-04 14:44:30 -0700 | [diff] [blame] | 12268 | struct flashing_req_params *ledflashing; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12269 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12270 | ledflashing = qdf_mem_malloc(sizeof(*ledflashing)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12271 | if (!ledflashing) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12272 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 12273 | "Not able to allocate memory for WMA_LED_TIMING_REQ"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12274 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12275 | } |
| 12276 | |
Jeff Johnson | 5a6b660 | 2017-10-04 14:44:30 -0700 | [diff] [blame] | 12277 | ledflashing->req_id = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12278 | ledflashing->pattern_id = type; |
| 12279 | ledflashing->led_x0 = x0; |
| 12280 | ledflashing->led_x1 = x1; |
| 12281 | |
| 12282 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12283 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12284 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12285 | message.bodyptr = ledflashing; |
| 12286 | message.type = WMA_LED_FLASHING_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 12287 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 12288 | QDF_MODULE_ID_WMA, |
| 12289 | QDF_MODULE_ID_WMA, &message); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12290 | sme_release_global_lock(&pMac->sme); |
| 12291 | } |
Jeff Johnson | 5a6b660 | 2017-10-04 14:44:30 -0700 | [diff] [blame] | 12292 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 12293 | qdf_mem_free(ledflashing); |
| 12294 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12295 | return status; |
| 12296 | } |
| 12297 | #endif |
| 12298 | |
| 12299 | /** |
| 12300 | * sme_handle_dfS_chan_scan() - handle DFS channel configuration |
| 12301 | * @h_hal: corestack handler |
| 12302 | * @dfs_flag: flag indicating dfs channel enable/disable |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12303 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12304 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12305 | 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] | 12306 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12307 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12308 | tpAniSirGlobal mac = PMAC_STRUCT(h_hal); |
| 12309 | |
| 12310 | status = sme_acquire_global_lock(&mac->sme); |
| 12311 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12312 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12313 | |
| 12314 | mac->scan.fEnableDFSChnlScan = dfs_flag; |
| 12315 | |
| 12316 | /* update the channel list to the firmware */ |
| 12317 | status = csr_update_channel_list(mac); |
| 12318 | |
| 12319 | sme_release_global_lock(&mac->sme); |
| 12320 | } |
| 12321 | |
| 12322 | return status; |
| 12323 | } |
| 12324 | |
Min Liu | 5eaf724 | 2018-03-13 17:32:15 +0800 | [diff] [blame] | 12325 | /** |
| 12326 | * sme_enable_dfS_chan_scan() - set DFS channel scan enable/disable |
| 12327 | * @h_hal: corestack handler |
| 12328 | * @dfs_flag: flag indicating dfs channel enable/disable |
| 12329 | * Return: QDF_STATUS |
| 12330 | */ |
| 12331 | QDF_STATUS sme_enable_dfs_chan_scan(tHalHandle h_hal, uint8_t dfs_flag) |
| 12332 | { |
| 12333 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 12334 | tpAniSirGlobal mac; |
| 12335 | |
| 12336 | if (!h_hal) { |
| 12337 | sme_err("hal is NULL"); |
| 12338 | return QDF_STATUS_E_INVAL; |
| 12339 | } |
| 12340 | |
| 12341 | mac = PMAC_STRUCT(h_hal); |
Min Liu | 5eaf724 | 2018-03-13 17:32:15 +0800 | [diff] [blame] | 12342 | |
| 12343 | mac->scan.fEnableDFSChnlScan = dfs_flag; |
| 12344 | |
| 12345 | return status; |
| 12346 | } |
| 12347 | |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 12348 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 12349 | /** |
| 12350 | * sme_validate_sap_channel_switch() - validate target channel switch w.r.t |
| 12351 | * concurreny rules set to avoid channel interference. |
| 12352 | * @hal - Hal context |
| 12353 | * @sap_ch - channel to switch |
| 12354 | * @sap_phy_mode - phy mode of SAP |
| 12355 | * @cc_switch_mode - concurreny switch mode |
| 12356 | * @session_id - sme session id. |
| 12357 | * |
| 12358 | * Return: true if there is no channel interference else return false |
| 12359 | */ |
| 12360 | bool sme_validate_sap_channel_switch(tHalHandle hal, |
| 12361 | uint16_t sap_ch, eCsrPhyMode sap_phy_mode, uint8_t cc_switch_mode, |
| 12362 | uint8_t session_id) |
| 12363 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12364 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 12365 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 12366 | struct csr_roam_session *session = CSR_GET_SESSION(mac, session_id); |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 12367 | uint16_t intf_channel = 0; |
| 12368 | |
| 12369 | if (!session) |
| 12370 | return false; |
| 12371 | |
| 12372 | session->ch_switch_in_progress = true; |
| 12373 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12374 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 12375 | intf_channel = csr_check_concurrent_channel_overlap(mac, sap_ch, |
| 12376 | sap_phy_mode, |
| 12377 | cc_switch_mode); |
| 12378 | sme_release_global_lock(&mac->sme); |
| 12379 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12380 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 12381 | FL("sme_acquire_global_lock error!")); |
| 12382 | session->ch_switch_in_progress = false; |
| 12383 | return false; |
| 12384 | } |
| 12385 | |
| 12386 | session->ch_switch_in_progress = false; |
| 12387 | return (intf_channel == 0) ? true : false; |
| 12388 | } |
| 12389 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12390 | |
| 12391 | /** |
| 12392 | * sme_configure_stats_avg_factor() - function to config avg. stats factor |
| 12393 | * @hal: hal |
| 12394 | * @session_id: session ID |
| 12395 | * @stats_avg_factor: average stats factor |
| 12396 | * |
| 12397 | * This function configures the stats avg factor in firmware |
| 12398 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12399 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12400 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12401 | 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] | 12402 | uint16_t stats_avg_factor) |
| 12403 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12404 | struct scheduler_msg msg = {0}; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12405 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12406 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 12407 | struct sir_stats_avg_factor *stats_factor; |
| 12408 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12409 | stats_factor = qdf_mem_malloc(sizeof(*stats_factor)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12410 | |
| 12411 | if (!stats_factor) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12412 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12413 | "%s: Not able to allocate memory for SIR_HAL_CONFIG_STATS_FACTOR", |
| 12414 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12415 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12416 | } |
| 12417 | |
| 12418 | status = sme_acquire_global_lock(&mac->sme); |
| 12419 | |
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 | |
| 12422 | stats_factor->vdev_id = session_id; |
| 12423 | stats_factor->stats_avg_factor = stats_avg_factor; |
| 12424 | |
| 12425 | /* serialize the req through MC thread */ |
| 12426 | msg.type = SIR_HAL_CONFIG_STATS_FACTOR; |
| 12427 | msg.bodyptr = stats_factor; |
| 12428 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12429 | if (!QDF_IS_STATUS_SUCCESS( |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 12430 | scheduler_post_message(QDF_MODULE_ID_SME, |
| 12431 | QDF_MODULE_ID_WMA, |
| 12432 | QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12433 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12434 | "%s: Not able to post SIR_HAL_CONFIG_STATS_FACTOR to WMA!", |
| 12435 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12436 | qdf_mem_free(stats_factor); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12437 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12438 | } |
| 12439 | sme_release_global_lock(&mac->sme); |
| 12440 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12441 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12442 | "%s: sme_acquire_global_lock error!", |
| 12443 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12444 | qdf_mem_free(stats_factor); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12445 | } |
| 12446 | |
| 12447 | return status; |
| 12448 | } |
| 12449 | |
| 12450 | /** |
| 12451 | * sme_configure_guard_time() - function to configure guard time |
| 12452 | * @hal: hal |
| 12453 | * @session_id: session id |
| 12454 | * @guard_time: guard time |
| 12455 | * |
| 12456 | * This function configures the guard time in firmware |
| 12457 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12458 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12459 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12460 | QDF_STATUS sme_configure_guard_time(tHalHandle hal, uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12461 | uint32_t guard_time) |
| 12462 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12463 | struct scheduler_msg msg = {0}; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12464 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12465 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 12466 | struct sir_guard_time_request *g_time; |
| 12467 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12468 | g_time = qdf_mem_malloc(sizeof(*g_time)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12469 | |
| 12470 | if (!g_time) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12471 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12472 | "%s: Not able to allocate memory for SIR_HAL_CONFIG_GUARD_TIME", |
| 12473 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12474 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12475 | } |
| 12476 | |
| 12477 | status = sme_acquire_global_lock(&mac->sme); |
| 12478 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12479 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12480 | |
| 12481 | g_time->vdev_id = session_id; |
| 12482 | g_time->guard_time = guard_time; |
| 12483 | |
| 12484 | /* serialize the req through MC thread */ |
| 12485 | msg.type = SIR_HAL_CONFIG_GUARD_TIME; |
| 12486 | msg.bodyptr = g_time; |
| 12487 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12488 | if (!QDF_IS_STATUS_SUCCESS( |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 12489 | scheduler_post_message(QDF_MODULE_ID_SME, |
| 12490 | QDF_MODULE_ID_WMA, |
| 12491 | QDF_MODULE_ID_WMA, &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12492 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12493 | "%s: Not able to post SIR_HAL_CONFIG_GUARD_TIME to WMA!", |
| 12494 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12495 | qdf_mem_free(g_time); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12496 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12497 | } |
| 12498 | sme_release_global_lock(&mac->sme); |
| 12499 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12500 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12501 | "%s: sme_acquire_global_lock error!", |
| 12502 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12503 | qdf_mem_free(g_time); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12504 | } |
| 12505 | |
| 12506 | return status; |
| 12507 | } |
| 12508 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12509 | /* |
| 12510 | * sme_wifi_start_logger() - Send the start/stop logging command to WMA |
| 12511 | * to either start/stop logging |
| 12512 | * @hal: HAL context |
| 12513 | * @start_log: Structure containing the wifi start logger params |
| 12514 | * |
| 12515 | * This function sends the start/stop logging command to WMA |
| 12516 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12517 | * Return: QDF_STATUS_SUCCESS on successful posting |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12518 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12519 | QDF_STATUS sme_wifi_start_logger(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12520 | struct sir_wifi_start_log start_log) |
| 12521 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12522 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12523 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12524 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12525 | struct sir_wifi_start_log *req_msg; |
| 12526 | uint32_t len; |
| 12527 | |
| 12528 | len = sizeof(*req_msg); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12529 | req_msg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12530 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12531 | sme_err("qdf_mem_malloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12532 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12533 | } |
| 12534 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12535 | req_msg->verbose_level = start_log.verbose_level; |
Poddar, Siddarth | eefe348 | 2016-09-21 18:12:59 +0530 | [diff] [blame] | 12536 | req_msg->is_iwpriv_command = start_log.is_iwpriv_command; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12537 | req_msg->ring_id = start_log.ring_id; |
Srinivas Girigowda | c34f11d | 2016-02-25 16:02:42 -0800 | [diff] [blame] | 12538 | req_msg->ini_triggered = start_log.ini_triggered; |
| 12539 | req_msg->user_triggered = start_log.user_triggered; |
Poddar, Siddarth | 176c436 | 2016-10-03 12:25:00 +0530 | [diff] [blame] | 12540 | req_msg->size = start_log.size; |
Poddar, Siddarth | ab99a27 | 2017-04-10 12:53:26 +0530 | [diff] [blame] | 12541 | req_msg->is_pktlog_buff_clear = start_log.is_pktlog_buff_clear; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12542 | |
| 12543 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12544 | if (status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12545 | sme_err("sme_acquire_global_lock failed(status=%d)", status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12546 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12547 | return status; |
| 12548 | } |
| 12549 | |
| 12550 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 12551 | message.bodyptr = req_msg; |
| 12552 | message.type = SIR_HAL_START_STOP_LOGGING; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 12553 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 12554 | QDF_MODULE_ID_WMA, |
| 12555 | QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12556 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12557 | sme_err("scheduler_post_msg failed!(err=%d)", status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12558 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12559 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12560 | } |
| 12561 | sme_release_global_lock(&mac->sme); |
| 12562 | |
| 12563 | return status; |
| 12564 | } |
| 12565 | |
| 12566 | /** |
| 12567 | * sme_neighbor_middle_of_roaming() - Function to know if |
| 12568 | * STA is in the middle of roaming states |
| 12569 | * @hal: Handle returned by macOpen |
| 12570 | * @sessionId: sessionId of the STA session |
| 12571 | * |
| 12572 | * This function is a wrapper to call |
| 12573 | * csr_neighbor_middle_of_roaming to know STA is in the |
| 12574 | * middle of roaming states |
| 12575 | * |
| 12576 | * Return: True or False |
| 12577 | * |
| 12578 | */ |
| 12579 | bool sme_neighbor_middle_of_roaming(tHalHandle hHal, uint8_t sessionId) |
| 12580 | { |
Sandeep Puligilla | ca63161 | 2016-11-08 11:53:52 -0800 | [diff] [blame] | 12581 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hHal); |
| 12582 | bool val = false; |
| 12583 | |
| 12584 | if (CSR_IS_SESSION_VALID(mac_ctx, sessionId)) |
| 12585 | val = csr_neighbor_middle_of_roaming(mac_ctx, sessionId); |
| 12586 | else |
Rajeev Kumar | 9176ca4 | 2018-05-03 09:20:40 -0700 | [diff] [blame] | 12587 | sme_debug("Invalid Session: %d", sessionId); |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12588 | |
Sandeep Puligilla | ca63161 | 2016-11-08 11:53:52 -0800 | [diff] [blame] | 12589 | return val; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12590 | } |
| 12591 | |
Padma, Santhosh Kumar | 86747ec | 2018-05-29 18:28:29 +0530 | [diff] [blame] | 12592 | bool sme_is_any_session_in_middle_of_roaming(mac_handle_t hal) |
| 12593 | { |
| 12594 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 12595 | uint8_t session_id; |
| 12596 | |
| 12597 | for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) { |
| 12598 | if (CSR_IS_SESSION_VALID(mac_ctx, session_id) && |
| 12599 | csr_neighbor_middle_of_roaming(mac_ctx, session_id)) |
| 12600 | return true; |
| 12601 | } |
| 12602 | |
| 12603 | return false; |
| 12604 | } |
| 12605 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12606 | /* |
| 12607 | * sme_send_flush_logs_cmd_to_fw() - Flush FW logs |
| 12608 | * @mac: MAC handle |
| 12609 | * |
| 12610 | * This function is used to send the command that will |
| 12611 | * be used to flush the logs in the firmware |
| 12612 | * |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 12613 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12614 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12615 | QDF_STATUS sme_send_flush_logs_cmd_to_fw(tpAniSirGlobal mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12616 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12617 | QDF_STATUS status; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 12618 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12619 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12620 | /* Serialize the req through MC thread */ |
| 12621 | message.bodyptr = NULL; |
| 12622 | message.type = SIR_HAL_FLUSH_LOG_TO_FW; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 12623 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 12624 | QDF_MODULE_ID_WMA, |
| 12625 | QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12626 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 12627 | sme_err("scheduler_post_msg failed!(err=%d)", status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12628 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12629 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12630 | return status; |
| 12631 | } |
| 12632 | |
Jeff Johnson | a1e9261 | 2017-09-24 15:33:44 -0700 | [diff] [blame] | 12633 | QDF_STATUS sme_enable_uapsd_for_ac(uint8_t sta_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12634 | sme_ac_enum_type ac, uint8_t tid, |
| 12635 | uint8_t pri, uint32_t srvc_int, |
| 12636 | uint32_t sus_int, |
Abhishek Singh | 12be60f | 2017-08-11 13:52:42 +0530 | [diff] [blame] | 12637 | enum sme_qos_wmm_dir_type dir, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12638 | uint8_t psb, uint32_t sessionId, |
| 12639 | uint32_t delay_interval) |
| 12640 | { |
| 12641 | void *wma_handle; |
| 12642 | t_wma_trigger_uapsd_params uapsd_params; |
| 12643 | enum uapsd_ac access_category; |
| 12644 | |
| 12645 | if (!psb) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12646 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12647 | "No need to configure auto trigger:psb is 0"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12648 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12649 | } |
| 12650 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 12651 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12652 | if (!wma_handle) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12653 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12654 | "wma_handle is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12655 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12656 | } |
| 12657 | |
| 12658 | switch (ac) { |
| 12659 | case SME_AC_BK: |
| 12660 | access_category = UAPSD_BK; |
| 12661 | break; |
| 12662 | case SME_AC_BE: |
| 12663 | access_category = UAPSD_BE; |
| 12664 | break; |
| 12665 | case SME_AC_VI: |
| 12666 | access_category = UAPSD_VI; |
| 12667 | break; |
| 12668 | case SME_AC_VO: |
| 12669 | access_category = UAPSD_VO; |
| 12670 | break; |
| 12671 | default: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12672 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12673 | } |
| 12674 | |
| 12675 | uapsd_params.wmm_ac = access_category; |
| 12676 | uapsd_params.user_priority = pri; |
| 12677 | uapsd_params.service_interval = srvc_int; |
| 12678 | uapsd_params.delay_interval = delay_interval; |
| 12679 | uapsd_params.suspend_interval = sus_int; |
| 12680 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12681 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12682 | wma_trigger_uapsd_params(wma_handle, sessionId, &uapsd_params)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12683 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12684 | "Failed to Trigger Uapsd params for sessionId %d", |
| 12685 | sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12686 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12687 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12688 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12689 | } |
| 12690 | |
Jeff Johnson | a1e9261 | 2017-09-24 15:33:44 -0700 | [diff] [blame] | 12691 | QDF_STATUS sme_disable_uapsd_for_ac(uint8_t sta_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12692 | sme_ac_enum_type ac, |
| 12693 | uint32_t sessionId) |
| 12694 | { |
| 12695 | void *wma_handle; |
| 12696 | enum uapsd_ac access_category; |
| 12697 | |
| 12698 | switch (ac) { |
| 12699 | case SME_AC_BK: |
| 12700 | access_category = UAPSD_BK; |
| 12701 | break; |
| 12702 | case SME_AC_BE: |
| 12703 | access_category = UAPSD_BE; |
| 12704 | break; |
| 12705 | case SME_AC_VI: |
| 12706 | access_category = UAPSD_VI; |
| 12707 | break; |
| 12708 | case SME_AC_VO: |
| 12709 | access_category = UAPSD_VO; |
| 12710 | break; |
| 12711 | default: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12712 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12713 | } |
| 12714 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 12715 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12716 | if (!wma_handle) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12717 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12718 | "wma handle is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12719 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12720 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12721 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12722 | wma_disable_uapsd_per_ac(wma_handle, sessionId, access_category)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12723 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12724 | "Failed to disable uapsd for ac %d for sessionId %d", |
| 12725 | ac, sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12726 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12727 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12728 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12729 | } |
| 12730 | |
| 12731 | /** |
| 12732 | * sme_update_nss() - SME API to change the number for spatial streams |
| 12733 | * (1 or 2) |
| 12734 | * @hal: Handle returned by mac open |
| 12735 | * @nss: Number of spatial streams |
| 12736 | * |
| 12737 | * This function is used to update the number of spatial streams supported. |
| 12738 | * |
| 12739 | * Return: Success upon successfully changing nss else failure |
| 12740 | * |
| 12741 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12742 | QDF_STATUS sme_update_nss(tHalHandle h_hal, uint8_t nss) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12743 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12744 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12745 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(h_hal); |
Vignesh Viswanathan | 21c58cb | 2018-05-24 15:53:58 +0530 | [diff] [blame] | 12746 | uint32_t i; |
| 12747 | struct mlme_ht_capabilities_info *ht_cap_info; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 12748 | struct csr_roam_session *csr_session; |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 12749 | struct mlme_vht_capabilities_info vht_cap_info; |
| 12750 | |
| 12751 | vht_cap_info = mac_ctx->mlme_cfg->vht_caps.vht_cap_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12752 | |
| 12753 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 12754 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12755 | if (QDF_STATUS_SUCCESS == status) { |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 12756 | vht_cap_info.enable2x2 = (nss == 1) ? 0 : 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12757 | |
| 12758 | /* get the HT capability info*/ |
Vignesh Viswanathan | 21c58cb | 2018-05-24 15:53:58 +0530 | [diff] [blame] | 12759 | ht_cap_info = &mac_ctx->mlme_cfg->ht_caps.ht_cap_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12760 | |
| 12761 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 12762 | if (CSR_IS_SESSION_VALID(mac_ctx, i)) { |
| 12763 | csr_session = &mac_ctx->roam.roamSession[i]; |
| 12764 | csr_session->htConfig.ht_tx_stbc = |
Vignesh Viswanathan | 7818250 | 2018-08-06 15:13:30 +0530 | [diff] [blame] | 12765 | ht_cap_info->tx_stbc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12766 | } |
| 12767 | } |
| 12768 | |
| 12769 | sme_release_global_lock(&mac_ctx->sme); |
| 12770 | } |
| 12771 | return status; |
| 12772 | } |
| 12773 | |
| 12774 | /** |
Archana Ramachandran | 5041b25 | 2016-04-25 14:29:25 -0700 | [diff] [blame] | 12775 | * sme_update_user_configured_nss() - sets the nss based on user request |
| 12776 | * @hal: Pointer to HAL |
| 12777 | * @nss: number of streams |
| 12778 | * |
| 12779 | * Return: None |
| 12780 | */ |
| 12781 | void sme_update_user_configured_nss(tHalHandle hal, uint8_t nss) |
| 12782 | { |
| 12783 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 12784 | |
| 12785 | mac_ctx->user_configured_nss = nss; |
| 12786 | } |
| 12787 | |
Kiran Kumar Lokere | 6c7f3fa | 2018-05-14 18:12:27 -0700 | [diff] [blame] | 12788 | int sme_update_tx_bfee_supp(tHalHandle hal, uint8_t session_id, |
| 12789 | uint8_t cfg_val) |
| 12790 | { |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 12791 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Jeff Johnson | c18469b | 2018-06-11 06:48:59 -0700 | [diff] [blame] | 12792 | |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 12793 | mac_ctx->mlme_cfg->vht_caps.vht_cap_info.su_bformee = cfg_val; |
Kiran Kumar Lokere | 6c7f3fa | 2018-05-14 18:12:27 -0700 | [diff] [blame] | 12794 | |
| 12795 | return sme_update_he_tx_bfee_supp(hal, session_id, cfg_val); |
| 12796 | } |
Kiran Kumar Lokere | f304485 | 2018-06-27 14:14:24 -0700 | [diff] [blame] | 12797 | |
| 12798 | int sme_update_tx_bfee_nsts(mac_handle_t hal, uint8_t session_id, |
| 12799 | uint8_t usr_cfg_val, uint8_t nsts_val) |
| 12800 | { |
| 12801 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Kiran Kumar Lokere | f304485 | 2018-06-27 14:14:24 -0700 | [diff] [blame] | 12802 | uint8_t nsts_set_val; |
| 12803 | |
| 12804 | mac_ctx->usr_cfg_tx_bfee_nsts = usr_cfg_val; |
| 12805 | if (usr_cfg_val) |
| 12806 | nsts_set_val = usr_cfg_val; |
| 12807 | else |
| 12808 | nsts_set_val = nsts_val; |
Dustin Brown | 48f27fe | 2018-10-09 12:47:57 -0700 | [diff] [blame] | 12809 | |
| 12810 | mac_ctx->mlme_cfg->vht_caps.vht_cap_info.tx_bfee_ant_supp = |
| 12811 | nsts_set_val; |
Kiran Kumar Lokere | f304485 | 2018-06-27 14:14:24 -0700 | [diff] [blame] | 12812 | |
Kiran Kumar Lokere | 86e8559 | 2018-07-18 15:34:24 -0700 | [diff] [blame] | 12813 | if (usr_cfg_val) |
| 12814 | sme_set_he_tx_bf_cbf_rates(session_id); |
| 12815 | |
Kiran Kumar Lokere | f304485 | 2018-06-27 14:14:24 -0700 | [diff] [blame] | 12816 | return sme_update_he_tx_bfee_nsts(hal, session_id, nsts_set_val); |
| 12817 | } |
Kiran Kumar Lokere | 44a2943 | 2018-01-24 16:10:30 -0800 | [diff] [blame] | 12818 | #ifdef WLAN_FEATURE_11AX |
Jinwei Chen | ffaa467 | 2018-08-30 16:55:09 +0800 | [diff] [blame] | 12819 | void sme_update_tgt_he_cap(mac_handle_t mac_handle, |
| 12820 | struct wma_tgt_cfg *cfg, |
| 12821 | tDot11fIEhe_cap *he_cap_ini) |
Jinwei Chen | 998a1a0 | 2018-06-20 17:20:34 +0800 | [diff] [blame] | 12822 | { |
Jinwei Chen | ef742dc | 2018-06-27 12:57:50 +0800 | [diff] [blame] | 12823 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(mac_handle); |
Jinwei Chen | 998a1a0 | 2018-06-20 17:20:34 +0800 | [diff] [blame] | 12824 | |
| 12825 | qdf_mem_copy(&mac_ctx->he_cap_2g, |
Jinwei Chen | ef742dc | 2018-06-27 12:57:50 +0800 | [diff] [blame] | 12826 | &cfg->he_cap_2g, |
| 12827 | sizeof(tDot11fIEhe_cap)); |
Jinwei Chen | 998a1a0 | 2018-06-20 17:20:34 +0800 | [diff] [blame] | 12828 | |
| 12829 | qdf_mem_copy(&mac_ctx->he_cap_5g, |
Jinwei Chen | ef742dc | 2018-06-27 12:57:50 +0800 | [diff] [blame] | 12830 | &cfg->he_cap_5g, |
| 12831 | sizeof(tDot11fIEhe_cap)); |
Jinwei Chen | ffaa467 | 2018-08-30 16:55:09 +0800 | [diff] [blame] | 12832 | |
| 12833 | /* modify HE Caps field according to INI setting */ |
| 12834 | mac_ctx->he_cap_2g.bfee_sts_lt_80 = |
| 12835 | QDF_MIN(cfg->he_cap_2g.bfee_sts_lt_80, |
| 12836 | he_cap_ini->bfee_sts_lt_80); |
| 12837 | |
| 12838 | mac_ctx->he_cap_5g.bfee_sts_lt_80 = |
| 12839 | QDF_MIN(cfg->he_cap_5g.bfee_sts_lt_80, |
| 12840 | he_cap_ini->bfee_sts_lt_80); |
Jinwei Chen | 998a1a0 | 2018-06-20 17:20:34 +0800 | [diff] [blame] | 12841 | } |
| 12842 | |
Kiran Kumar Lokere | 44a2943 | 2018-01-24 16:10:30 -0800 | [diff] [blame] | 12843 | void sme_update_he_cap_nss(tHalHandle hal, uint8_t session_id, |
| 12844 | uint8_t nss) |
| 12845 | { |
| 12846 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 12847 | struct csr_roam_session *csr_session; |
| 12848 | uint32_t tx_mcs_map = 0; |
| 12849 | uint32_t rx_mcs_map = 0; |
Kiran Kumar Lokere | 8dba189 | 2018-07-24 17:09:52 -0700 | [diff] [blame] | 12850 | uint32_t mcs_map = 0; |
Kiran Kumar Lokere | 44a2943 | 2018-01-24 16:10:30 -0800 | [diff] [blame] | 12851 | |
| 12852 | if (!nss || (nss > 2)) { |
| 12853 | sme_err("invalid Nss value %d", nss); |
| 12854 | } |
| 12855 | csr_session = CSR_GET_SESSION(mac_ctx, session_id); |
Jeff Johnson | c18469b | 2018-06-11 06:48:59 -0700 | [diff] [blame] | 12856 | sme_cfg_get_int(hal, WNI_CFG_HE_RX_MCS_MAP_LT_80, &rx_mcs_map); |
| 12857 | sme_cfg_get_int(hal, WNI_CFG_HE_TX_MCS_MAP_LT_80, &tx_mcs_map); |
Kiran Kumar Lokere | 8dba189 | 2018-07-24 17:09:52 -0700 | [diff] [blame] | 12858 | mcs_map = rx_mcs_map & 0x3; |
Kiran Kumar Lokere | 44a2943 | 2018-01-24 16:10:30 -0800 | [diff] [blame] | 12859 | if (nss == 1) { |
| 12860 | tx_mcs_map = HE_SET_MCS_4_NSS(tx_mcs_map, HE_MCS_DISABLE, 2); |
| 12861 | rx_mcs_map = HE_SET_MCS_4_NSS(rx_mcs_map, HE_MCS_DISABLE, 2); |
| 12862 | } else { |
Kiran Kumar Lokere | 8dba189 | 2018-07-24 17:09:52 -0700 | [diff] [blame] | 12863 | tx_mcs_map = HE_SET_MCS_4_NSS(tx_mcs_map, mcs_map, 2); |
| 12864 | rx_mcs_map = HE_SET_MCS_4_NSS(rx_mcs_map, mcs_map, 2); |
Kiran Kumar Lokere | 44a2943 | 2018-01-24 16:10:30 -0800 | [diff] [blame] | 12865 | } |
| 12866 | sme_info("new HE Nss MCS MAP: Rx 0x%0X, Tx: 0x%0X", |
| 12867 | rx_mcs_map, tx_mcs_map); |
Jeff Johnson | c18469b | 2018-06-11 06:48:59 -0700 | [diff] [blame] | 12868 | sme_cfg_set_int(hal, WNI_CFG_HE_RX_MCS_MAP_LT_80, rx_mcs_map); |
| 12869 | sme_cfg_set_int(hal, WNI_CFG_HE_TX_MCS_MAP_LT_80, tx_mcs_map); |
Kiran Kumar Lokere | 44a2943 | 2018-01-24 16:10:30 -0800 | [diff] [blame] | 12870 | csr_update_session_he_cap(mac_ctx, csr_session); |
| 12871 | |
| 12872 | } |
Kiran Kumar Lokere | 96246e5 | 2018-01-24 16:44:35 -0800 | [diff] [blame] | 12873 | |
| 12874 | int sme_update_he_mcs(tHalHandle hal, uint8_t session_id, uint16_t he_mcs) |
| 12875 | { |
| 12876 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 12877 | struct csr_roam_session *csr_session; |
| 12878 | uint16_t mcs_val = 0; |
| 12879 | uint16_t mcs_map = HE_MCS_ALL_DISABLED; |
| 12880 | uint32_t wni_cfg_tx_param = 0; |
| 12881 | uint32_t wni_cfg_rx_param = 0; |
| 12882 | |
| 12883 | csr_session = CSR_GET_SESSION(mac_ctx, session_id); |
| 12884 | if (!csr_session) { |
| 12885 | sme_err("No session for id %d", session_id); |
| 12886 | return -EINVAL; |
| 12887 | } |
| 12888 | if ((he_mcs & 0x3) == HE_MCS_DISABLE) { |
| 12889 | sme_err("Invalid HE MCS 0x%0x, can't disable 0-7 for 1ss", |
| 12890 | he_mcs); |
| 12891 | return -EINVAL; |
| 12892 | } |
| 12893 | mcs_val = he_mcs & 0x3; |
| 12894 | switch (he_mcs) { |
| 12895 | case HE_80_MCS0_7: |
| 12896 | case HE_80_MCS0_9: |
| 12897 | case HE_80_MCS0_11: |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 12898 | if (mac_ctx->mlme_cfg->vht_caps.vht_cap_info.enable2x2) { |
Kiran Kumar Lokere | 96246e5 | 2018-01-24 16:44:35 -0800 | [diff] [blame] | 12899 | mcs_map = HE_SET_MCS_4_NSS(mcs_map, mcs_val, 1); |
| 12900 | mcs_map = HE_SET_MCS_4_NSS(mcs_map, mcs_val, 2); |
| 12901 | } else { |
| 12902 | mcs_map = HE_SET_MCS_4_NSS(mcs_map, mcs_val, 1); |
| 12903 | } |
| 12904 | wni_cfg_tx_param = WNI_CFG_HE_TX_MCS_MAP_LT_80; |
| 12905 | wni_cfg_rx_param = WNI_CFG_HE_RX_MCS_MAP_LT_80; |
| 12906 | break; |
| 12907 | |
| 12908 | case HE_160_MCS0_7: |
| 12909 | case HE_160_MCS0_9: |
| 12910 | case HE_160_MCS0_11: |
| 12911 | mcs_map = HE_SET_MCS_4_NSS(mcs_map, mcs_val, 1); |
| 12912 | wni_cfg_tx_param = WNI_CFG_HE_TX_MCS_MAP_160; |
| 12913 | wni_cfg_rx_param = WNI_CFG_HE_RX_MCS_MAP_160; |
| 12914 | break; |
| 12915 | |
| 12916 | case HE_80p80_MCS0_7: |
| 12917 | case HE_80p80_MCS0_9: |
| 12918 | case HE_80p80_MCS0_11: |
| 12919 | mcs_map = HE_SET_MCS_4_NSS(mcs_map, mcs_val, 1); |
| 12920 | wni_cfg_tx_param = WNI_CFG_HE_TX_MCS_MAP_80_80; |
| 12921 | wni_cfg_rx_param = WNI_CFG_HE_RX_MCS_MAP_80_80; |
| 12922 | break; |
| 12923 | |
| 12924 | default: |
| 12925 | sme_err("Invalid HE MCS 0x%0x", he_mcs); |
| 12926 | return -EINVAL; |
| 12927 | } |
| 12928 | sme_info("new HE MCS 0x%0x", mcs_map); |
Jeff Johnson | c18469b | 2018-06-11 06:48:59 -0700 | [diff] [blame] | 12929 | sme_cfg_set_int(hal, wni_cfg_tx_param, mcs_map); |
| 12930 | sme_cfg_set_int(hal, wni_cfg_rx_param, mcs_map); |
Kiran Kumar Lokere | 96246e5 | 2018-01-24 16:44:35 -0800 | [diff] [blame] | 12931 | csr_update_session_he_cap(mac_ctx, csr_session); |
| 12932 | |
| 12933 | return 0; |
| 12934 | } |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 12935 | |
| 12936 | static int sme_update_he_cap(tHalHandle hal, uint8_t session_id, |
| 12937 | uint16_t he_cap, int value) |
| 12938 | { |
| 12939 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 12940 | struct csr_roam_session *session; |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 12941 | |
| 12942 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 12943 | if (!session) { |
| 12944 | sme_err("No session for id %d", session_id); |
| 12945 | return -EINVAL; |
| 12946 | } |
Jeff Johnson | c18469b | 2018-06-11 06:48:59 -0700 | [diff] [blame] | 12947 | sme_cfg_set_int(hal, he_cap, value); |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 12948 | csr_update_session_he_cap(mac_ctx, session); |
| 12949 | |
| 12950 | return 0; |
| 12951 | } |
| 12952 | |
Kiran Kumar Lokere | f54b855 | 2018-07-10 00:53:38 -0700 | [diff] [blame] | 12953 | void sme_set_usr_cfg_mu_edca(mac_handle_t hal, bool val) |
| 12954 | { |
| 12955 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 12956 | |
| 12957 | mac_ctx->usr_cfg_mu_edca_params = val; |
| 12958 | } |
| 12959 | |
Kiran Kumar Lokere | fba2063 | 2018-07-05 16:51:27 -0700 | [diff] [blame] | 12960 | int sme_update_mu_edca_params(mac_handle_t hal, uint8_t session_id) |
| 12961 | { |
| 12962 | struct scheduler_msg msg = {0}; |
| 12963 | QDF_STATUS status; |
| 12964 | |
| 12965 | qdf_mem_zero(&msg, sizeof(msg)); |
| 12966 | msg.type = WNI_SME_UPDATE_MU_EDCA_PARAMS; |
| 12967 | msg.reserved = 0; |
| 12968 | msg.bodyval = session_id; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 12969 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 12970 | QDF_MODULE_ID_PE, |
| 12971 | QDF_MODULE_ID_PE, &msg); |
Kiran Kumar Lokere | fba2063 | 2018-07-05 16:51:27 -0700 | [diff] [blame] | 12972 | if (status != QDF_STATUS_SUCCESS) { |
| 12973 | sme_err("Not able to post update edca profile"); |
| 12974 | return -EIO; |
| 12975 | } |
| 12976 | |
| 12977 | return 0; |
| 12978 | } |
| 12979 | void sme_set_he_mu_edca_def_cfg(mac_handle_t hal) |
| 12980 | { |
| 12981 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 12982 | uint8_t i; |
| 12983 | |
Kiran Kumar Lokere | 8dba189 | 2018-07-24 17:09:52 -0700 | [diff] [blame] | 12984 | sme_debug("Set MU EDCA params to default"); |
Kiran Kumar Lokere | fba2063 | 2018-07-05 16:51:27 -0700 | [diff] [blame] | 12985 | for (i = 0; i < MAX_NUM_AC; i++) { |
| 12986 | mac_ctx->usr_mu_edca_params[i].aci.aifsn = MU_EDCA_DEF_AIFSN; |
| 12987 | mac_ctx->usr_mu_edca_params[i].aci.aci = i; |
| 12988 | mac_ctx->usr_mu_edca_params[i].cw.max = MU_EDCA_DEF_CW_MAX; |
| 12989 | mac_ctx->usr_mu_edca_params[i].cw.min = MU_EDCA_DEF_CW_MIN; |
| 12990 | mac_ctx->usr_mu_edca_params[i].mu_edca_timer = |
| 12991 | MU_EDCA_DEF_TIMER; |
| 12992 | } |
| 12993 | } |
| 12994 | |
Kiran Kumar Lokere | 6c7f3fa | 2018-05-14 18:12:27 -0700 | [diff] [blame] | 12995 | int sme_update_he_tx_bfee_supp(tHalHandle hal, uint8_t session_id, |
| 12996 | uint8_t cfg_val) |
| 12997 | { |
| 12998 | return sme_update_he_cap(hal, session_id, WNI_CFG_HE_SU_BEAMFORMEE, |
| 12999 | cfg_val); |
| 13000 | } |
| 13001 | |
Kiran Kumar Lokere | f54b855 | 2018-07-10 00:53:38 -0700 | [diff] [blame] | 13002 | int sme_update_he_trigger_frm_mac_pad(mac_handle_t hal, uint8_t session_id, |
| 13003 | uint8_t cfg_val) |
| 13004 | { |
| 13005 | return sme_update_he_cap(hal, session_id, WNI_CFG_HE_TRIG_PAD, |
| 13006 | cfg_val); |
| 13007 | } |
| 13008 | |
Kiran Kumar Lokere | f1a96f4 | 2018-08-29 18:53:47 -0700 | [diff] [blame] | 13009 | int sme_update_he_om_ctrl_supp(mac_handle_t hal, uint8_t session_id, |
| 13010 | uint8_t cfg_val) |
| 13011 | { |
| 13012 | return sme_update_he_cap(hal, session_id, WNI_CFG_HE_OMI, |
| 13013 | cfg_val); |
| 13014 | } |
| 13015 | |
Kiran Kumar Lokere | f304485 | 2018-06-27 14:14:24 -0700 | [diff] [blame] | 13016 | int sme_update_he_tx_bfee_nsts(mac_handle_t hal, uint8_t session_id, |
| 13017 | uint8_t cfg_val) |
| 13018 | { |
| 13019 | return sme_update_he_cap(hal, session_id, WNI_CFG_HE_BFEE_STS_LT80, |
| 13020 | cfg_val); |
| 13021 | } |
| 13022 | |
Kiran Kumar Lokere | 86e8559 | 2018-07-18 15:34:24 -0700 | [diff] [blame] | 13023 | void sme_set_he_tx_bf_cbf_rates(uint8_t session_id) |
| 13024 | { |
| 13025 | uint32_t tx_bf_cbf_rates_5g[] = {91, 1, 0, 3, 2, 4, 0}; |
| 13026 | uint32_t tx_bf_cbf_rates_2g[] = {91, 1, 1, 3, 1, 3, 0}; |
| 13027 | QDF_STATUS status; |
| 13028 | |
| 13029 | status = wma_form_unit_test_cmd_and_send(session_id, 0x48, 7, |
| 13030 | tx_bf_cbf_rates_5g); |
| 13031 | if (QDF_STATUS_SUCCESS != status) |
| 13032 | sme_err("send_unit_test_cmd returned %d", status); |
| 13033 | |
| 13034 | status = wma_form_unit_test_cmd_and_send(session_id, 0x48, 7, |
| 13035 | tx_bf_cbf_rates_2g); |
| 13036 | if (QDF_STATUS_SUCCESS != status) |
| 13037 | sme_err("send_unit_test_cmd returned %d", status); |
| 13038 | } |
| 13039 | |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13040 | int sme_update_he_tx_stbc_cap(tHalHandle hal, uint8_t session_id, int value) |
| 13041 | { |
| 13042 | int ret; |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13043 | uint32_t he_cap_val = 0; |
| 13044 | |
| 13045 | he_cap_val = value ? 1 : 0; |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13046 | |
| 13047 | ret = sme_update_he_cap(hal, session_id, |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13048 | WNI_CFG_HE_TX_STBC_LT80, he_cap_val); |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13049 | if (ret) |
| 13050 | return ret; |
| 13051 | |
| 13052 | return sme_update_he_cap(hal, session_id, |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13053 | WNI_CFG_HE_TX_STBC_GT80, he_cap_val); |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13054 | } |
| 13055 | |
| 13056 | int sme_update_he_rx_stbc_cap(tHalHandle hal, uint8_t session_id, int value) |
| 13057 | { |
| 13058 | int ret; |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13059 | uint32_t he_cap_val = 0; |
| 13060 | |
| 13061 | he_cap_val = value ? 1 : 0; |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13062 | |
| 13063 | ret = sme_update_he_cap(hal, session_id, |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13064 | WNI_CFG_HE_RX_STBC_LT80, he_cap_val); |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13065 | if (ret) |
| 13066 | return ret; |
| 13067 | |
| 13068 | return sme_update_he_cap(hal, session_id, |
Kiran Kumar Lokere | 5cc2f0d | 2018-02-08 17:10:05 -0800 | [diff] [blame] | 13069 | WNI_CFG_HE_RX_STBC_GT80, he_cap_val); |
| 13070 | } |
| 13071 | |
| 13072 | int sme_update_he_frag_supp(tHalHandle hal, uint8_t session_id, |
| 13073 | uint16_t he_frag) |
| 13074 | { |
| 13075 | return sme_update_he_cap(hal, session_id, |
| 13076 | WNI_CFG_HE_FRAGMENTATION, he_frag); |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 13077 | } |
Kiran Kumar Lokere | e43a458 | 2018-05-08 19:54:03 -0700 | [diff] [blame] | 13078 | |
| 13079 | int sme_update_he_ldpc_supp(tHalHandle hal, uint8_t session_id, |
| 13080 | uint16_t he_ldpc) |
| 13081 | { |
| 13082 | return sme_update_he_cap(hal, session_id, WNI_CFG_HE_LDPC, he_ldpc); |
| 13083 | } |
Kiran Kumar Lokere | 44a2943 | 2018-01-24 16:10:30 -0800 | [diff] [blame] | 13084 | #endif |
| 13085 | |
Archana Ramachandran | 5041b25 | 2016-04-25 14:29:25 -0700 | [diff] [blame] | 13086 | /** |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 13087 | * sme_set_nud_debug_stats_cb() - set nud debug stats callback |
| 13088 | * @hal: global hal handle |
| 13089 | * @cb: callback function pointer |
Dundi Raviteja | 3bcf3a8 | 2018-05-22 13:24:18 +0530 | [diff] [blame] | 13090 | * @context: callback context |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 13091 | * |
| 13092 | * This function stores nud debug stats callback function. |
| 13093 | * |
| 13094 | * Return: QDF_STATUS enumeration. |
| 13095 | */ |
| 13096 | QDF_STATUS sme_set_nud_debug_stats_cb(tHalHandle hal, |
Dundi Raviteja | 3bcf3a8 | 2018-05-22 13:24:18 +0530 | [diff] [blame] | 13097 | void (*cb)(void *, struct rsp_stats *, void *), |
| 13098 | void *context) |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 13099 | { |
| 13100 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13101 | tpAniSirGlobal mac; |
| 13102 | |
| 13103 | if (!hal) { |
| 13104 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13105 | FL("hal is not valid")); |
| 13106 | return QDF_STATUS_E_INVAL; |
| 13107 | } |
| 13108 | mac = PMAC_STRUCT(hal); |
| 13109 | |
| 13110 | status = sme_acquire_global_lock(&mac->sme); |
| 13111 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 13112 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13113 | FL("sme_acquire_global_lock failed!(status=%d)"), |
| 13114 | status); |
| 13115 | return status; |
| 13116 | } |
| 13117 | |
| 13118 | mac->sme.get_arp_stats_cb = cb; |
Dundi Raviteja | 3bcf3a8 | 2018-05-22 13:24:18 +0530 | [diff] [blame] | 13119 | mac->sme.get_arp_stats_context = context; |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 13120 | sme_release_global_lock(&mac->sme); |
| 13121 | return status; |
| 13122 | } |
| 13123 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13124 | /** |
| 13125 | * sme_is_any_session_in_connected_state() - SME wrapper API to |
| 13126 | * check if any session is in connected state or not. |
| 13127 | * |
| 13128 | * @hal: Handle returned by mac open |
| 13129 | * |
| 13130 | * This function is used to check if any valid sme session is in |
| 13131 | * connected state or not. |
| 13132 | * |
| 13133 | * Return: true if any session is connected, else false. |
| 13134 | * |
| 13135 | */ |
| 13136 | bool sme_is_any_session_in_connected_state(tHalHandle h_hal) |
| 13137 | { |
| 13138 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(h_hal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13139 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13140 | bool ret = false; |
| 13141 | |
| 13142 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13143 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13144 | ret = csr_is_any_session_in_connect_state(mac_ctx); |
| 13145 | sme_release_global_lock(&mac_ctx->sme); |
| 13146 | } |
| 13147 | return ret; |
| 13148 | } |
| 13149 | |
Jeff Johnson | b7fa256 | 2018-07-02 08:36:17 -0700 | [diff] [blame] | 13150 | QDF_STATUS sme_set_chip_pwr_save_fail_cb(mac_handle_t mac_handle, |
| 13151 | pwr_save_fail_cb cb) |
| 13152 | { |
| 13153 | QDF_STATUS status; |
| 13154 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Ravi Kumar Bokka | 05c14e5 | 2017-03-27 14:48:23 +0530 | [diff] [blame] | 13155 | |
| 13156 | status = sme_acquire_global_lock(&mac->sme); |
| 13157 | if (status != QDF_STATUS_SUCCESS) { |
| 13158 | sme_err("sme_AcquireGlobalLock failed!(status=%d)", status); |
| 13159 | return status; |
| 13160 | } |
| 13161 | mac->sme.chip_power_save_fail_cb = cb; |
| 13162 | sme_release_global_lock(&mac->sme); |
| 13163 | return status; |
| 13164 | } |
| 13165 | |
Qiwei Cai | e689a26 | 2018-07-26 15:50:22 +0800 | [diff] [blame] | 13166 | #ifdef FEATURE_RSSI_MONITOR |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13167 | /** |
| 13168 | * sme_set_rssi_monitoring() - set rssi monitoring |
| 13169 | * @hal: global hal handle |
| 13170 | * @input: request message |
| 13171 | * |
| 13172 | * This function constructs the vos message and fill in message type, |
| 13173 | * bodyptr with @input and posts it to WDA queue. |
| 13174 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13175 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13176 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13177 | QDF_STATUS sme_set_rssi_monitoring(tHalHandle hal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13178 | struct rssi_monitor_req *input) |
| 13179 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13180 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13181 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 13182 | struct scheduler_msg message = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13183 | struct rssi_monitor_req *req_msg; |
| 13184 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13185 | SME_ENTER(); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13186 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13187 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13188 | sme_err("memory allocation failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13189 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13190 | } |
| 13191 | |
| 13192 | *req_msg = *input; |
| 13193 | |
| 13194 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13195 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13196 | sme_err("sme_acquire_global_lock failed!(status=%d)", status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13197 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13198 | return status; |
| 13199 | } |
| 13200 | |
| 13201 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 13202 | message.bodyptr = req_msg; |
| 13203 | message.type = WMA_SET_RSSI_MONITOR_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 13204 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 13205 | QDF_MODULE_ID_WMA, |
| 13206 | QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13207 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13208 | sme_err("scheduler_post_msg failed!(err=%d)", status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13209 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13210 | } |
| 13211 | sme_release_global_lock(&mac->sme); |
| 13212 | |
| 13213 | return status; |
| 13214 | } |
| 13215 | |
Qiwei Cai | e689a26 | 2018-07-26 15:50:22 +0800 | [diff] [blame] | 13216 | QDF_STATUS sme_set_rssi_threshold_breached_cb(mac_handle_t mac_handle, |
| 13217 | rssi_threshold_breached_cb cb) |
| 13218 | { |
| 13219 | QDF_STATUS status; |
| 13220 | tpAniSirGlobal mac; |
| 13221 | |
| 13222 | mac = MAC_CONTEXT(mac_handle); |
| 13223 | if (!mac) { |
| 13224 | sme_err("Invalid mac context"); |
| 13225 | return QDF_STATUS_E_INVAL; |
| 13226 | } |
| 13227 | |
| 13228 | status = sme_acquire_global_lock(&mac->sme); |
| 13229 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 13230 | sme_err("sme_acquire_global_lock failed!(status=%d)", |
| 13231 | status); |
| 13232 | return status; |
| 13233 | } |
| 13234 | |
| 13235 | mac->sme.rssi_threshold_breached_cb = cb; |
| 13236 | sme_release_global_lock(&mac->sme); |
| 13237 | return status; |
| 13238 | } |
| 13239 | #endif /* FEATURE_RSSI_MONITOR */ |
| 13240 | |
| 13241 | QDF_STATUS sme_reset_rssi_threshold_breached_cb(mac_handle_t mac_handle) |
| 13242 | { |
| 13243 | return sme_set_rssi_threshold_breached_cb(mac_handle, NULL); |
| 13244 | } |
| 13245 | |
Varun Reddy Yeturu | 951de5d | 2018-09-10 21:36:22 -0700 | [diff] [blame] | 13246 | static enum band_info sme_get_connected_roaming_vdev_band(void) |
| 13247 | { |
| 13248 | enum band_info band = BAND_ALL; |
| 13249 | tpAniSirGlobal mac = sme_get_mac_context(); |
| 13250 | struct csr_roam_session *session; |
| 13251 | uint8_t session_id, channel; |
| 13252 | |
| 13253 | if (!mac) { |
| 13254 | sme_debug("MAC Context is NULL"); |
| 13255 | return band; |
| 13256 | } |
| 13257 | session_id = csr_get_roam_enabled_sta_sessionid(mac); |
| 13258 | if (session_id != CSR_SESSION_ID_INVALID) { |
| 13259 | session = CSR_GET_SESSION(mac, session_id); |
| 13260 | channel = session->connectedProfile.operationChannel; |
| 13261 | band = csr_get_rf_band(channel); |
| 13262 | return band; |
| 13263 | } |
| 13264 | |
| 13265 | return band; |
| 13266 | } |
| 13267 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13268 | /* |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 13269 | * 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] | 13270 | * @hal: Handle returned by macOpen |
| 13271 | * @msg: PCL channel list and length structure |
| 13272 | * |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 13273 | * 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] | 13274 | * Return: QDF_STATUS_SUCCESS on successful posting |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13275 | */ |
Krunal Soni | 8a090df | 2018-05-03 15:02:54 -0700 | [diff] [blame] | 13276 | QDF_STATUS sme_pdev_set_pcl(struct policy_mgr_pcl_list *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13277 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13278 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13279 | tpAniSirGlobal mac = sme_get_mac_context(); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 13280 | struct scheduler_msg message = {0}; |
Varun Reddy Yeturu | 951de5d | 2018-09-10 21:36:22 -0700 | [diff] [blame] | 13281 | struct set_pcl_req *req_msg; |
| 13282 | uint32_t i; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13283 | |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 13284 | if (!mac) { |
| 13285 | sme_err("mac is NULL"); |
| 13286 | return QDF_STATUS_E_FAILURE; |
| 13287 | } |
Krunal Soni | 8a090df | 2018-05-03 15:02:54 -0700 | [diff] [blame] | 13288 | |
| 13289 | if (!msg) { |
| 13290 | sme_err("msg is NULL"); |
| 13291 | return QDF_STATUS_E_FAILURE; |
| 13292 | } |
| 13293 | |
Varun Reddy Yeturu | 951de5d | 2018-09-10 21:36:22 -0700 | [diff] [blame] | 13294 | req_msg = qdf_mem_malloc(sizeof(*req_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13295 | if (!req_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13296 | sme_err("qdf_mem_malloc failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13297 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13298 | } |
| 13299 | |
Varun Reddy Yeturu | 951de5d | 2018-09-10 21:36:22 -0700 | [diff] [blame] | 13300 | req_msg->band = BAND_ALL; |
| 13301 | if (CSR_IS_ROAM_INTRA_BAND_ENABLED(mac)) { |
| 13302 | req_msg->band = sme_get_connected_roaming_vdev_band(); |
| 13303 | sme_debug("Connected STA band %d", req_msg->band); |
| 13304 | } |
Krunal Soni | 8a090df | 2018-05-03 15:02:54 -0700 | [diff] [blame] | 13305 | for (i = 0; i < msg->pcl_len; i++) { |
Varun Reddy Yeturu | 951de5d | 2018-09-10 21:36:22 -0700 | [diff] [blame] | 13306 | req_msg->chan_weights.pcl_list[i] = msg->pcl_list[i]; |
| 13307 | req_msg->chan_weights.weight_list[i] = msg->weight_list[i]; |
Manishekar Chandrasekaran | 7009f25 | 2016-04-21 19:14:15 +0530 | [diff] [blame] | 13308 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13309 | |
Varun Reddy Yeturu | 951de5d | 2018-09-10 21:36:22 -0700 | [diff] [blame] | 13310 | req_msg->chan_weights.pcl_len = msg->pcl_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13311 | |
| 13312 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13313 | if (status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13314 | sme_err("sme_acquire_global_lock failed!(status=%d)", status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13315 | qdf_mem_free(req_msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13316 | return status; |
| 13317 | } |
| 13318 | |
| 13319 | /* Serialize the req through MC thread */ |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 13320 | message.bodyptr = req_msg; |
| 13321 | message.type = SIR_HAL_PDEV_SET_PCL_TO_FW; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 13322 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 13323 | QDF_MODULE_ID_WMA, |
| 13324 | QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13325 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13326 | sme_err("scheduler_post_msg failed!(err=%d)", status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13327 | qdf_mem_free(req_msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13328 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13329 | } |
| 13330 | sme_release_global_lock(&mac->sme); |
| 13331 | |
| 13332 | return status; |
| 13333 | } |
| 13334 | |
| 13335 | /* |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 13336 | * 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] | 13337 | * @hal: Handle returned by macOpen |
| 13338 | * @msg: HW mode structure containing hw mode and callback details |
| 13339 | * |
Manishekar Chandrasekaran | d964034 | 2016-04-27 12:28:26 +0530 | [diff] [blame] | 13340 | * 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] | 13341 | * Return: QDF_STATUS_SUCCESS on successful posting |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13342 | */ |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13343 | 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] | 13344 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13345 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13346 | tpAniSirGlobal mac = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13347 | tSmeCmd *cmd = NULL; |
| 13348 | |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 13349 | if (!mac) { |
| 13350 | sme_err("mac is NULL"); |
| 13351 | return QDF_STATUS_E_FAILURE; |
| 13352 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13353 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13354 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13355 | sme_err("Failed to acquire lock"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13356 | return QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13357 | } |
| 13358 | |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 13359 | cmd = csr_get_command_buffer(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13360 | if (!cmd) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13361 | sme_err("Get command buffer failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13362 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13363 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13364 | } |
| 13365 | |
| 13366 | cmd->command = e_sme_command_set_hw_mode; |
Ganesh Kondabattini | ae1c6a2 | 2017-05-02 18:02:11 +0530 | [diff] [blame] | 13367 | cmd->sessionId = msg.session_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13368 | cmd->u.set_hw_mode_cmd.hw_mode_index = msg.hw_mode_index; |
| 13369 | 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] | 13370 | cmd->u.set_hw_mode_cmd.reason = msg.reason; |
| 13371 | cmd->u.set_hw_mode_cmd.session_id = msg.session_id; |
Tushnim Bhattacharyya | eab33dd | 2017-11-15 15:20:02 -0800 | [diff] [blame] | 13372 | cmd->u.set_hw_mode_cmd.next_action = msg.next_action; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13373 | cmd->u.set_hw_mode_cmd.context = msg.context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13374 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13375 | sme_debug("Queuing set hw mode to CSR, session: %d reason: %d", |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 13376 | cmd->u.set_hw_mode_cmd.session_id, |
| 13377 | cmd->u.set_hw_mode_cmd.reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13378 | csr_queue_sme_command(mac, cmd, false); |
| 13379 | |
| 13380 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13381 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13382 | } |
| 13383 | |
| 13384 | /** |
| 13385 | * sme_register_hw_mode_trans_cb() - HW mode transition callback registration |
| 13386 | * @hal: Handle returned by macOpen |
| 13387 | * @callback: HDD callback to be registered |
| 13388 | * |
| 13389 | * Registers the HDD callback with SME. This callback will be invoked when |
| 13390 | * HW mode transition event is received from the FW |
| 13391 | * |
| 13392 | * Return: None |
| 13393 | */ |
| 13394 | void sme_register_hw_mode_trans_cb(tHalHandle hal, |
| 13395 | hw_mode_transition_cb callback) |
| 13396 | { |
| 13397 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 13398 | |
| 13399 | mac->sme.sme_hw_mode_trans_cb = callback; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13400 | } |
| 13401 | |
| 13402 | /** |
| 13403 | * sme_nss_update_request() - Send beacon templete update to FW with new |
| 13404 | * nss value |
| 13405 | * @hal: Handle returned by macOpen |
| 13406 | * @vdev_id: the session id |
| 13407 | * @new_nss: the new nss value |
| 13408 | * @cback: hdd callback |
| 13409 | * @next_action: next action to happen at policy mgr after beacon update |
| 13410 | * |
| 13411 | * Sends the command to CSR to send to PE |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13412 | * Return: QDF_STATUS_SUCCESS on successful posting |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13413 | */ |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13414 | QDF_STATUS sme_nss_update_request(uint32_t vdev_id, |
| 13415 | uint8_t new_nss, policy_mgr_nss_update_cback cback, |
| 13416 | uint8_t next_action, struct wlan_objmgr_psoc *psoc, |
| 13417 | enum policy_mgr_conn_update_reason reason) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13418 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13419 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13420 | tpAniSirGlobal mac = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13421 | tSmeCmd *cmd = NULL; |
| 13422 | |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 13423 | if (!mac) { |
| 13424 | sme_err("mac is null"); |
| 13425 | return status; |
| 13426 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13427 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13428 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 13429 | cmd = csr_get_command_buffer(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13430 | if (!cmd) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13431 | sme_err("Get command buffer failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13432 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13433 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13434 | } |
| 13435 | cmd->command = e_sme_command_nss_update; |
| 13436 | /* Sessionized modules may require this info */ |
| 13437 | cmd->sessionId = vdev_id; |
| 13438 | cmd->u.nss_update_cmd.new_nss = new_nss; |
| 13439 | cmd->u.nss_update_cmd.session_id = vdev_id; |
| 13440 | cmd->u.nss_update_cmd.nss_update_cb = cback; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13441 | cmd->u.nss_update_cmd.context = psoc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13442 | cmd->u.nss_update_cmd.next_action = next_action; |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 13443 | cmd->u.nss_update_cmd.reason = reason; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13444 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13445 | sme_debug("Queuing e_sme_command_nss_update to CSR"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13446 | csr_queue_sme_command(mac, cmd, false); |
| 13447 | sme_release_global_lock(&mac->sme); |
| 13448 | } |
| 13449 | return status; |
| 13450 | } |
| 13451 | |
| 13452 | /** |
| 13453 | * sme_soc_set_dual_mac_config() - Set dual mac configurations |
| 13454 | * @hal: Handle returned by macOpen |
| 13455 | * @msg: Structure containing the dual mac config parameters |
| 13456 | * |
| 13457 | * Queues configuration information to CSR to configure |
| 13458 | * WLAN firmware for the dual MAC features |
| 13459 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13460 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13461 | */ |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13462 | 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] | 13463 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13464 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 13465 | tpAniSirGlobal mac = sme_get_mac_context(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13466 | tSmeCmd *cmd; |
| 13467 | |
Krunal Soni | 3fa80e2 | 2018-01-09 14:16:02 -0800 | [diff] [blame] | 13468 | if (!mac) { |
| 13469 | sme_err("mac is null"); |
| 13470 | return QDF_STATUS_E_FAILURE; |
| 13471 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13472 | status = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13473 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13474 | sme_err("Failed to acquire lock"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13475 | return QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13476 | } |
| 13477 | |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 13478 | cmd = csr_get_command_buffer(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13479 | if (!cmd) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13480 | sme_err("Get command buffer failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13481 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13482 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13483 | } |
| 13484 | |
| 13485 | cmd->command = e_sme_command_set_dual_mac_config; |
| 13486 | cmd->u.set_dual_mac_cmd.scan_config = msg.scan_config; |
| 13487 | cmd->u.set_dual_mac_cmd.fw_mode_config = msg.fw_mode_config; |
| 13488 | cmd->u.set_dual_mac_cmd.set_dual_mac_cb = msg.set_dual_mac_cb; |
| 13489 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13490 | 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] | 13491 | cmd->u.set_dual_mac_cmd.scan_config, |
| 13492 | cmd->u.set_dual_mac_cmd.fw_mode_config); |
| 13493 | csr_queue_sme_command(mac, cmd, false); |
| 13494 | |
| 13495 | sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13496 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13497 | } |
| 13498 | |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13499 | #ifdef FEATURE_LFR_SUBNET_DETECTION |
| 13500 | /** |
| 13501 | * sme_gateway_param_update() - to update gateway parameters with WMA |
| 13502 | * @Hal: hal handle |
| 13503 | * @gw_params: request parameters from HDD |
| 13504 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13505 | * Return: QDF_STATUS |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13506 | * |
| 13507 | * This routine will update gateway parameters to WMA |
| 13508 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13509 | QDF_STATUS sme_gateway_param_update(tHalHandle Hal, |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13510 | struct gateway_param_update_req *gw_params) |
| 13511 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13512 | QDF_STATUS qdf_status; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 13513 | struct scheduler_msg message = {0}; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13514 | struct gateway_param_update_req *request_buf; |
| 13515 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13516 | request_buf = qdf_mem_malloc(sizeof(*request_buf)); |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13517 | if (NULL == request_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13518 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 13519 | "Not able to allocate memory for gw param update request"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13520 | return QDF_STATUS_E_NOMEM; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13521 | } |
| 13522 | |
| 13523 | *request_buf = *gw_params; |
| 13524 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 13525 | message.type = WMA_GW_PARAM_UPDATE_REQ; |
| 13526 | message.reserved = 0; |
| 13527 | message.bodyptr = request_buf; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 13528 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 13529 | QDF_MODULE_ID_WMA, |
| 13530 | QDF_MODULE_ID_WMA, &message); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13531 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13532 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 13533 | "Not able to post WMA_GW_PARAM_UPDATE_REQ message to HAL"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13534 | qdf_mem_free(request_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13535 | return QDF_STATUS_E_FAILURE; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13536 | } |
| 13537 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13538 | return QDF_STATUS_SUCCESS; |
Ravi Joshi | 9e891ba | 2015-11-09 19:03:46 -0800 | [diff] [blame] | 13539 | } |
| 13540 | #endif /* FEATURE_LFR_SUBNET_DETECTION */ |
| 13541 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13542 | /** |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 13543 | * sme_soc_set_antenna_mode() - set antenna mode |
| 13544 | * @hal: Handle returned by macOpen |
| 13545 | * @msg: Structure containing the antenna mode parameters |
| 13546 | * |
| 13547 | * Send the command to CSR to send |
| 13548 | * WMI_SOC_SET_ANTENNA_MODE_CMDID to FW |
| 13549 | * |
| 13550 | * Return: QDF_STATUS |
| 13551 | */ |
| 13552 | QDF_STATUS sme_soc_set_antenna_mode(tHalHandle hal, |
| 13553 | struct sir_antenna_mode_param *msg) |
| 13554 | { |
| 13555 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 13556 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 13557 | tSmeCmd *cmd; |
| 13558 | |
| 13559 | if (NULL == msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13560 | sme_err("antenna mode mesg is NULL"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 13561 | return QDF_STATUS_E_FAILURE; |
| 13562 | } |
| 13563 | |
| 13564 | status = sme_acquire_global_lock(&mac->sme); |
| 13565 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13566 | sme_err("Failed to acquire lock"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 13567 | return QDF_STATUS_E_RESOURCES; |
| 13568 | } |
| 13569 | |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 13570 | cmd = csr_get_command_buffer(mac); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 13571 | if (!cmd) { |
| 13572 | sme_release_global_lock(&mac->sme); |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13573 | sme_err("Get command buffer failed"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 13574 | return QDF_STATUS_E_NULL_VALUE; |
| 13575 | } |
| 13576 | |
| 13577 | cmd->command = e_sme_command_set_antenna_mode; |
| 13578 | cmd->u.set_antenna_mode_cmd = *msg; |
| 13579 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13580 | sme_debug("Antenna mode rx_chains: %d tx_chains: %d", |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 13581 | cmd->u.set_antenna_mode_cmd.num_rx_chains, |
| 13582 | cmd->u.set_antenna_mode_cmd.num_tx_chains); |
| 13583 | |
| 13584 | csr_queue_sme_command(mac, cmd, false); |
| 13585 | sme_release_global_lock(&mac->sme); |
| 13586 | |
| 13587 | return QDF_STATUS_SUCCESS; |
| 13588 | } |
| 13589 | |
| 13590 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13591 | * sme_set_peer_authorized() - call peer authorized callback |
| 13592 | * @peer_addr: peer mac address |
| 13593 | * @auth_cb: auth callback |
| 13594 | * @vdev_id: vdev id |
| 13595 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 13596 | * Return: QDF Status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13597 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13598 | QDF_STATUS sme_set_peer_authorized(uint8_t *peer_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13599 | sme_peer_authorized_fp auth_cb, |
| 13600 | uint32_t vdev_id) |
| 13601 | { |
| 13602 | void *wma_handle; |
| 13603 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 13604 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13605 | if (!wma_handle) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13606 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13607 | "wma handle is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13608 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13609 | } |
| 13610 | |
| 13611 | wma_set_peer_authorized_cb(wma_handle, auth_cb); |
| 13612 | return wma_set_peer_param(wma_handle, peer_addr, WMI_PEER_AUTHORIZE, |
| 13613 | 1, vdev_id); |
| 13614 | } |
| 13615 | |
| 13616 | /* |
Amar Singhal | 7c1e898 | 2016-05-19 15:08:09 -0700 | [diff] [blame] | 13617 | * 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] | 13618 | * @hal: HAL pointer |
Amar Singhal | 83a047a | 2016-05-19 15:56:11 -0700 | [diff] [blame] | 13619 | * @fcc_constraint: flag to enable/disable the constraint |
| 13620 | * @scan_pending: whether there is pending scan |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13621 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13622 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13623 | */ |
Amar Singhal | 83a047a | 2016-05-19 15:56:11 -0700 | [diff] [blame] | 13624 | QDF_STATUS sme_handle_set_fcc_channel(tHalHandle hal, bool fcc_constraint, |
| 13625 | bool scan_pending) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13626 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13627 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13628 | tpAniSirGlobal mac_ptr = PMAC_STRUCT(hal); |
| 13629 | |
| 13630 | status = sme_acquire_global_lock(&mac_ptr->sme); |
| 13631 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13632 | if (QDF_STATUS_SUCCESS == status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13633 | |
| 13634 | if (fcc_constraint != mac_ptr->scan.fcc_constraint) { |
| 13635 | mac_ptr->scan.fcc_constraint = fcc_constraint; |
Amar Singhal | 83a047a | 2016-05-19 15:56:11 -0700 | [diff] [blame] | 13636 | if (scan_pending) |
| 13637 | mac_ptr->scan.defer_update_channel_list = true; |
| 13638 | else |
| 13639 | status = csr_update_channel_list(mac_ptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13640 | } |
| 13641 | |
| 13642 | sme_release_global_lock(&mac_ptr->sme); |
| 13643 | } |
| 13644 | |
| 13645 | return status; |
| 13646 | } |
| 13647 | /** |
| 13648 | * sme_setdef_dot11mode() - Updates pMac with default dot11mode |
| 13649 | * @hal: Global MAC pointer |
| 13650 | * |
| 13651 | * Return: NULL. |
| 13652 | */ |
| 13653 | void sme_setdef_dot11mode(tHalHandle hal) |
| 13654 | { |
| 13655 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 13656 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13657 | csr_set_default_dot11_mode(mac_ctx); |
| 13658 | } |
| 13659 | |
| 13660 | /** |
| 13661 | * sme_update_roam_scan_hi_rssi_scan_params() - update high rssi scan |
| 13662 | * params |
| 13663 | * @hal_handle - The handle returned by macOpen. |
| 13664 | * @session_id - Session Identifier |
| 13665 | * @notify_id - Identifies 1 of the 4 parameters to be modified |
| 13666 | * @val New value of the parameter |
| 13667 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13668 | * Return: QDF_STATUS - SME update config successful. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13669 | * Other status means SME failed to update |
| 13670 | */ |
| 13671 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13672 | 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] | 13673 | uint8_t session_id, |
| 13674 | uint32_t notify_id, |
| 13675 | int32_t val) |
| 13676 | { |
| 13677 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13678 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 13679 | struct csr_neighbor_roamconfig *nr_config = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13680 | tpCsrNeighborRoamControlInfo nr_info = NULL; |
| 13681 | uint32_t reason = 0; |
| 13682 | |
Naveen Rawat | c36f7eb | 2016-11-10 20:01:03 -0800 | [diff] [blame] | 13683 | if (session_id >= CSR_ROAM_SESSION_MAX) { |
| 13684 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13685 | FL("Invalid sme session id: %d"), session_id); |
| 13686 | return QDF_STATUS_E_INVAL; |
| 13687 | } |
| 13688 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13689 | status = sme_acquire_global_lock(&mac_ctx->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13690 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13691 | nr_config = &mac_ctx->roam.configParam.neighborRoamConfig; |
| 13692 | nr_info = &mac_ctx->roam.neighborRoamInfo[session_id]; |
| 13693 | switch (notify_id) { |
| 13694 | case eCSR_HI_RSSI_SCAN_MAXCOUNT_ID: |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 13695 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13696 | "%s: gRoamScanHirssiMaxCount %d => %d", |
| 13697 | __func__, nr_config->nhi_rssi_scan_max_count, |
| 13698 | val); |
| 13699 | nr_config->nhi_rssi_scan_max_count = val; |
| 13700 | nr_info->cfgParams.hi_rssi_scan_max_count = val; |
| 13701 | reason = REASON_ROAM_SCAN_HI_RSSI_MAXCOUNT_CHANGED; |
| 13702 | break; |
| 13703 | |
| 13704 | case eCSR_HI_RSSI_SCAN_RSSI_DELTA_ID: |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 13705 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13706 | FL("gRoamScanHiRssiDelta %d => %d"), |
| 13707 | nr_config->nhi_rssi_scan_rssi_delta, |
| 13708 | val); |
| 13709 | nr_config->nhi_rssi_scan_rssi_delta = val; |
| 13710 | nr_info->cfgParams.hi_rssi_scan_rssi_delta = val; |
| 13711 | reason = REASON_ROAM_SCAN_HI_RSSI_DELTA_CHANGED; |
| 13712 | break; |
| 13713 | |
| 13714 | case eCSR_HI_RSSI_SCAN_DELAY_ID: |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 13715 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13716 | FL("gRoamScanHiRssiDelay %d => %d"), |
| 13717 | nr_config->nhi_rssi_scan_delay, |
| 13718 | val); |
| 13719 | nr_config->nhi_rssi_scan_delay = val; |
| 13720 | nr_info->cfgParams.hi_rssi_scan_delay = val; |
| 13721 | reason = REASON_ROAM_SCAN_HI_RSSI_DELAY_CHANGED; |
| 13722 | break; |
| 13723 | |
| 13724 | case eCSR_HI_RSSI_SCAN_RSSI_UB_ID: |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 13725 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13726 | FL("gRoamScanHiRssiUpperBound %d => %d"), |
| 13727 | nr_config->nhi_rssi_scan_rssi_ub, |
| 13728 | val); |
| 13729 | nr_config->nhi_rssi_scan_rssi_ub = val; |
| 13730 | nr_info->cfgParams.hi_rssi_scan_rssi_ub = val; |
| 13731 | reason = REASON_ROAM_SCAN_HI_RSSI_UB_CHANGED; |
| 13732 | break; |
| 13733 | |
| 13734 | default: |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 13735 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13736 | FL("invalid parameter notify_id %d"), |
| 13737 | notify_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13738 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13739 | break; |
| 13740 | } |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 13741 | |
| 13742 | if (mac_ctx->roam.configParam.isRoamOffloadScanEnabled && |
| 13743 | status == QDF_STATUS_SUCCESS) { |
| 13744 | csr_roam_offload_scan(mac_ctx, session_id, |
| 13745 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, reason); |
| 13746 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13747 | sme_release_global_lock(&mac_ctx->sme); |
| 13748 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13749 | |
| 13750 | return status; |
| 13751 | } |
| 13752 | |
Krishna Kumaar Natarajan | 052c6e6 | 2015-09-28 15:32:55 -0700 | [diff] [blame] | 13753 | /** |
| 13754 | * sme_update_tgt_services() - update the target services config. |
| 13755 | * @hal: HAL pointer. |
| 13756 | * @cfg: wma_tgt_services parameters. |
| 13757 | * |
| 13758 | * update the target services config. |
| 13759 | * |
| 13760 | * Return: None. |
| 13761 | */ |
| 13762 | void sme_update_tgt_services(tHalHandle hal, struct wma_tgt_services *cfg) |
| 13763 | { |
| 13764 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 13765 | |
Liangwei Dong | 0da1426 | 2018-07-03 03:30:23 -0400 | [diff] [blame] | 13766 | mac_ctx->obss_scan_offload = cfg->obss_scan_offload; |
| 13767 | sme_debug("obss_scan_offload: %d", mac_ctx->obss_scan_offload); |
Krunal Soni | e6a1cda | 2017-09-27 15:23:02 -0700 | [diff] [blame] | 13768 | mac_ctx->lteCoexAntShare = cfg->lte_coex_ant_share; |
Krishna Kumaar Natarajan | 052c6e6 | 2015-09-28 15:32:55 -0700 | [diff] [blame] | 13769 | mac_ctx->beacon_offload = cfg->beacon_offload; |
mukul sharma | 72c8b22 | 2015-09-04 17:02:01 +0530 | [diff] [blame] | 13770 | mac_ctx->pmf_offload = cfg->pmf_offload; |
Abhishek Singh | e4a1f88 | 2017-08-10 17:59:44 +0530 | [diff] [blame] | 13771 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
mukul sharma | 72c8b22 | 2015-09-04 17:02:01 +0530 | [diff] [blame] | 13772 | FL("mac_ctx->pmf_offload: %d"), mac_ctx->pmf_offload); |
Vignesh Viswanathan | 731186f | 2017-09-18 13:47:37 +0530 | [diff] [blame] | 13773 | mac_ctx->is_fils_roaming_supported = |
| 13774 | cfg->is_fils_roaming_supported; |
Vignesh Viswanathan | 694e28e | 2018-01-18 20:53:57 +0530 | [diff] [blame] | 13775 | mac_ctx->is_11k_offload_supported = |
| 13776 | cfg->is_11k_offload_supported; |
| 13777 | sme_debug("pmf_offload: %d fils_roam support %d 11k_offload %d", |
| 13778 | mac_ctx->pmf_offload, mac_ctx->is_fils_roaming_supported, |
| 13779 | mac_ctx->is_11k_offload_supported); |
Krishna Kumaar Natarajan | 052c6e6 | 2015-09-28 15:32:55 -0700 | [diff] [blame] | 13780 | } |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 13781 | |
Chandrasekaran, Manishekar | 2859de4 | 2016-02-11 16:17:38 +0530 | [diff] [blame] | 13782 | /** |
| 13783 | * sme_is_session_id_valid() - Check if the session id is valid |
| 13784 | * @hal: Pointer to HAL |
| 13785 | * @session_id: Session id |
| 13786 | * |
| 13787 | * Checks if the session id is valid or not |
| 13788 | * |
| 13789 | * Return: True is the session id is valid, false otherwise |
| 13790 | */ |
| 13791 | bool sme_is_session_id_valid(tHalHandle hal, uint32_t session_id) |
| 13792 | { |
Pragaspathi Thilagaraj | b11dbe4 | 2018-07-23 16:42:17 +0530 | [diff] [blame] | 13793 | tpAniSirGlobal mac; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 13794 | |
Pragaspathi Thilagaraj | b11dbe4 | 2018-07-23 16:42:17 +0530 | [diff] [blame] | 13795 | if (NULL != hal) { |
| 13796 | mac = PMAC_STRUCT(hal); |
| 13797 | } else { |
Chandrasekaran, Manishekar | d3cb477 | 2016-02-22 22:21:10 +0530 | [diff] [blame] | 13798 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13799 | "%s: null mac pointer", __func__); |
Chandrasekaran, Manishekar | 2859de4 | 2016-02-11 16:17:38 +0530 | [diff] [blame] | 13800 | return false; |
| 13801 | } |
| 13802 | |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 13803 | if (CSR_IS_SESSION_VALID(mac, session_id)) |
Chandrasekaran, Manishekar | 2859de4 | 2016-02-11 16:17:38 +0530 | [diff] [blame] | 13804 | return true; |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 13805 | |
| 13806 | return false; |
Chandrasekaran, Manishekar | 2859de4 | 2016-02-11 16:17:38 +0530 | [diff] [blame] | 13807 | } |
| 13808 | |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 13809 | #ifdef FEATURE_WLAN_TDLS |
| 13810 | |
| 13811 | /** |
| 13812 | * sme_get_opclass() - determine operating class |
| 13813 | * @hal: Pointer to HAL |
| 13814 | * @channel: channel id |
| 13815 | * @bw_offset: bandwidth offset |
| 13816 | * @opclass: pointer to operating class |
| 13817 | * |
| 13818 | * Function will determine operating class from regdm_get_opclass_from_channel |
| 13819 | * |
| 13820 | * Return: none |
| 13821 | */ |
| 13822 | void sme_get_opclass(tHalHandle hal, uint8_t channel, uint8_t bw_offset, |
| 13823 | uint8_t *opclass) |
| 13824 | { |
| 13825 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 13826 | |
| 13827 | /* redgm opclass table contains opclass for 40MHz low primary, |
| 13828 | * 40MHz high primary and 20MHz. No support for 80MHz yet. So |
| 13829 | * first we will check if bit for 40MHz is set and if so find |
| 13830 | * matching opclass either with low primary or high primary |
| 13831 | * (a channel would never be in both) and then search for opclass |
| 13832 | * matching 20MHz, else for any BW. |
| 13833 | */ |
| 13834 | if (bw_offset & (1 << BW_40_OFFSET_BIT)) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 13835 | *opclass = wlan_reg_dmn_get_opclass_from_channel( |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 13836 | mac_ctx->scan.countryCodeCurrent, |
| 13837 | channel, BW40_LOW_PRIMARY); |
| 13838 | if (!(*opclass)) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 13839 | *opclass = wlan_reg_dmn_get_opclass_from_channel( |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 13840 | mac_ctx->scan.countryCodeCurrent, |
| 13841 | channel, BW40_HIGH_PRIMARY); |
| 13842 | } |
| 13843 | } else if (bw_offset & (1 << BW_20_OFFSET_BIT)) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 13844 | *opclass = wlan_reg_dmn_get_opclass_from_channel( |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 13845 | mac_ctx->scan.countryCodeCurrent, |
| 13846 | channel, BW20); |
| 13847 | } else { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 13848 | *opclass = wlan_reg_dmn_get_opclass_from_channel( |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 13849 | mac_ctx->scan.countryCodeCurrent, |
| 13850 | channel, BWALL); |
| 13851 | } |
| 13852 | } |
| 13853 | #endif |
Ryan Hsu | 3c8f79f | 2015-12-02 16:45:09 -0800 | [diff] [blame] | 13854 | |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 13855 | /** |
Anurag Chouhan | bf5e0e2 | 2016-09-12 12:54:09 +0530 | [diff] [blame] | 13856 | * sme_set_fw_test() - set fw test |
| 13857 | * @fw_test: fw test param |
| 13858 | * |
| 13859 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 13860 | */ |
| 13861 | QDF_STATUS sme_set_fw_test(struct set_fwtest_params *fw_test) |
| 13862 | { |
| 13863 | void *wma_handle; |
| 13864 | |
| 13865 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 13866 | if (!wma_handle) { |
| 13867 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13868 | "wma handle is NULL"); |
| 13869 | return QDF_STATUS_E_FAILURE; |
| 13870 | } |
| 13871 | wma_process_fw_test_cmd(wma_handle, fw_test); |
| 13872 | return QDF_STATUS_SUCCESS; |
| 13873 | } |
| 13874 | |
| 13875 | /** |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 13876 | * sme_ht40_stop_obss_scan() - ht40 obss stop scan |
| 13877 | * @hal: mac handel |
| 13878 | * @vdev_id: vdev identifier |
| 13879 | * |
| 13880 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 13881 | */ |
| 13882 | QDF_STATUS sme_ht40_stop_obss_scan(tHalHandle hal, uint32_t vdev_id) |
| 13883 | { |
| 13884 | void *wma_handle; |
| 13885 | |
| 13886 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 13887 | if (!wma_handle) { |
| 13888 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13889 | "wma handle is NULL"); |
| 13890 | return QDF_STATUS_E_FAILURE; |
| 13891 | } |
| 13892 | wma_ht40_stop_obss_scan(wma_handle, vdev_id); |
| 13893 | return QDF_STATUS_SUCCESS; |
| 13894 | } |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 13895 | |
| 13896 | /** |
| 13897 | * sme_update_mimo_power_save() - Update MIMO power save |
| 13898 | * configuration |
| 13899 | * @hal: The handle returned by macOpen |
| 13900 | * @is_ht_smps_enabled: enable/disable ht smps |
| 13901 | * @ht_smps_mode: smps mode disabled/static/dynamic |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 13902 | * @send_smps_action: flag to send smps force mode command |
| 13903 | * to FW |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 13904 | * |
| 13905 | * Return: QDF_STATUS if SME update mimo power save |
Jeff Johnson | 698eacd | 2018-05-12 17:00:03 -0700 | [diff] [blame] | 13906 | * configuration success else failure status |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 13907 | */ |
| 13908 | QDF_STATUS sme_update_mimo_power_save(tHalHandle hal, |
| 13909 | uint8_t is_ht_smps_enabled, |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 13910 | uint8_t ht_smps_mode, |
| 13911 | bool send_smps_action) |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 13912 | { |
| 13913 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 13914 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13915 | sme_debug("SMPS enable: %d mode: %d send action: %d", |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 13916 | is_ht_smps_enabled, ht_smps_mode, |
| 13917 | send_smps_action); |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 13918 | mac_ctx->roam.configParam.enableHtSmps = |
| 13919 | is_ht_smps_enabled; |
| 13920 | mac_ctx->roam.configParam.htSmps = ht_smps_mode; |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 13921 | mac_ctx->roam.configParam.send_smps_action = |
| 13922 | send_smps_action; |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 13923 | |
| 13924 | return QDF_STATUS_SUCCESS; |
| 13925 | } |
| 13926 | |
| 13927 | /** |
| 13928 | * sme_is_sta_smps_allowed() - check if the supported nss for |
| 13929 | * the session is greater than 1x1 to enable sta SMPS |
| 13930 | * @hal: The handle returned by macOpen |
| 13931 | * @session_id: session id |
| 13932 | * |
| 13933 | * Return: bool returns true if supported nss is greater than |
| 13934 | * 1x1 else false |
| 13935 | */ |
| 13936 | bool sme_is_sta_smps_allowed(tHalHandle hal, uint8_t session_id) |
| 13937 | { |
| 13938 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 13939 | struct csr_roam_session *csr_session; |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 13940 | |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 13941 | csr_session = CSR_GET_SESSION(mac_ctx, session_id); |
| 13942 | if (NULL == csr_session) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13943 | sme_err("SME session not valid: %d", session_id); |
Sreelakshmi Konamki | 58697e1 | 2016-05-25 17:30:18 +0530 | [diff] [blame] | 13944 | return false; |
| 13945 | } |
| 13946 | |
| 13947 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13948 | sme_err("CSR session not valid: %d", session_id); |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 13949 | return false; |
| 13950 | } |
| 13951 | |
| 13952 | return (csr_session->supported_nss_1x1 == true) ? false : true; |
| 13953 | } |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 13954 | |
| 13955 | /** |
| 13956 | * sme_add_beacon_filter() - set the beacon filter configuration |
| 13957 | * @hal: The handle returned by macOpen |
| 13958 | * @session_id: session id |
| 13959 | * @ie_map: bitwise array of IEs |
| 13960 | * |
| 13961 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 13962 | */ |
| 13963 | QDF_STATUS sme_add_beacon_filter(tHalHandle hal, |
| 13964 | uint32_t session_id, |
| 13965 | uint32_t *ie_map) |
| 13966 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 13967 | struct scheduler_msg message = {0}; |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 13968 | QDF_STATUS qdf_status; |
| 13969 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 13970 | struct beacon_filter_param *filter_param; |
| 13971 | |
| 13972 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 13973 | sme_err("CSR session not valid: %d", session_id); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 13974 | return QDF_STATUS_E_FAILURE; |
| 13975 | } |
| 13976 | |
| 13977 | filter_param = qdf_mem_malloc(sizeof(*filter_param)); |
| 13978 | if (NULL == filter_param) { |
| 13979 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13980 | "%s: fail to alloc filter_param", __func__); |
| 13981 | return QDF_STATUS_E_FAILURE; |
| 13982 | } |
| 13983 | |
| 13984 | filter_param->vdev_id = session_id; |
| 13985 | |
| 13986 | qdf_mem_copy(filter_param->ie_map, ie_map, |
| 13987 | BCN_FLT_MAX_ELEMS_IE_LIST * sizeof(uint32_t)); |
| 13988 | |
| 13989 | message.type = WMA_ADD_BCN_FILTER_CMDID; |
| 13990 | message.bodyptr = filter_param; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 13991 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 13992 | QDF_MODULE_ID_WMA, |
| 13993 | QDF_MODULE_ID_WMA, |
| 13994 | &message); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 13995 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 13996 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 13997 | "%s: Not able to post msg to WDA!", |
| 13998 | __func__); |
| 13999 | |
| 14000 | qdf_mem_free(filter_param); |
| 14001 | } |
| 14002 | return qdf_status; |
| 14003 | } |
| 14004 | |
| 14005 | /** |
| 14006 | * sme_remove_beacon_filter() - set the beacon filter configuration |
| 14007 | * @hal: The handle returned by macOpen |
| 14008 | * @session_id: session id |
| 14009 | * |
| 14010 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 14011 | */ |
| 14012 | QDF_STATUS sme_remove_beacon_filter(tHalHandle hal, uint32_t session_id) |
| 14013 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14014 | struct scheduler_msg message = {0}; |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 14015 | QDF_STATUS qdf_status; |
| 14016 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14017 | struct beacon_filter_param *filter_param; |
| 14018 | |
| 14019 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14020 | sme_err("CSR session not valid: %d", session_id); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 14021 | return QDF_STATUS_E_FAILURE; |
| 14022 | } |
| 14023 | |
| 14024 | filter_param = qdf_mem_malloc(sizeof(*filter_param)); |
| 14025 | if (NULL == filter_param) { |
| 14026 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14027 | "%s: fail to alloc filter_param", __func__); |
| 14028 | return QDF_STATUS_E_FAILURE; |
| 14029 | } |
| 14030 | |
| 14031 | filter_param->vdev_id = session_id; |
| 14032 | |
| 14033 | message.type = WMA_REMOVE_BCN_FILTER_CMDID; |
| 14034 | message.bodyptr = filter_param; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 14035 | qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 14036 | QDF_MODULE_ID_WMA, |
| 14037 | QDF_MODULE_ID_WMA, |
| 14038 | &message); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 14039 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 14040 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14041 | "%s: Not able to post msg to WDA!", |
| 14042 | __func__); |
| 14043 | |
| 14044 | qdf_mem_free(filter_param); |
| 14045 | } |
| 14046 | return qdf_status; |
| 14047 | } |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14048 | |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14049 | /** |
Kondabattini, Ganesh | 3f2d02c | 2016-09-13 12:23:47 +0530 | [diff] [blame] | 14050 | * sme_send_disassoc_req_frame - send disassoc req |
| 14051 | * @hal: handler to hal |
| 14052 | * @session_id: session id |
| 14053 | * @peer_mac: peer mac address |
| 14054 | * @reason: reason for disassociation |
| 14055 | * wait_for_ack: wait for acknowledgment |
| 14056 | * |
| 14057 | * function to send disassoc request to lim |
| 14058 | * |
| 14059 | * return: none |
| 14060 | */ |
| 14061 | void sme_send_disassoc_req_frame(tHalHandle hal, uint8_t session_id, |
| 14062 | uint8_t *peer_mac, uint16_t reason, uint8_t wait_for_ack) |
| 14063 | { |
| 14064 | struct sme_send_disassoc_frm_req *msg; |
| 14065 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 14066 | A_UINT8 *buf; |
| 14067 | A_UINT16 tmp; |
| 14068 | |
| 14069 | msg = qdf_mem_malloc(sizeof(struct sme_send_disassoc_frm_req)); |
| 14070 | |
| 14071 | if (NULL == msg) |
| 14072 | qdf_status = QDF_STATUS_E_FAILURE; |
| 14073 | else |
| 14074 | qdf_status = QDF_STATUS_SUCCESS; |
| 14075 | |
| 14076 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 14077 | return; |
| 14078 | |
Kondabattini, Ganesh | 3f2d02c | 2016-09-13 12:23:47 +0530 | [diff] [blame] | 14079 | msg->msg_type = (uint16_t) eWNI_SME_SEND_DISASSOC_FRAME; |
| 14080 | |
| 14081 | msg->length = (uint16_t) sizeof(struct sme_send_disassoc_frm_req); |
| 14082 | |
| 14083 | buf = &msg->session_id; |
| 14084 | |
| 14085 | /* session id */ |
| 14086 | *buf = (A_UINT8) session_id; |
| 14087 | buf += sizeof(A_UINT8); |
| 14088 | |
| 14089 | /* transaction id */ |
| 14090 | *buf = 0; |
| 14091 | *(buf + 1) = 0; |
| 14092 | buf += sizeof(A_UINT16); |
| 14093 | |
| 14094 | /* Set the peer MAC address before sending the message to LIM */ |
| 14095 | qdf_mem_copy(buf, peer_mac, QDF_MAC_ADDR_SIZE); |
| 14096 | |
| 14097 | buf += QDF_MAC_ADDR_SIZE; |
| 14098 | |
| 14099 | /* reasoncode */ |
| 14100 | tmp = (uint16_t) reason; |
| 14101 | qdf_mem_copy(buf, &tmp, sizeof(uint16_t)); |
| 14102 | buf += sizeof(uint16_t); |
| 14103 | |
| 14104 | *buf = wait_for_ack; |
| 14105 | buf += sizeof(uint8_t); |
| 14106 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14107 | qdf_status = umac_send_mb_message_to_mac(msg); |
Kondabattini, Ganesh | 3f2d02c | 2016-09-13 12:23:47 +0530 | [diff] [blame] | 14108 | |
| 14109 | if (qdf_status != QDF_STATUS_SUCCESS) |
| 14110 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14111 | FL("cds_send_mb_message Failed")); |
| 14112 | } |
| 14113 | |
Nachiket Kukade | 177b5b0 | 2018-05-22 20:52:17 +0530 | [diff] [blame] | 14114 | #ifdef FEATURE_WLAN_APF |
| 14115 | QDF_STATUS sme_get_apf_capabilities(tHalHandle hal, |
| 14116 | apf_get_offload_cb callback, |
| 14117 | void *context) |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14118 | { |
| 14119 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 14120 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14121 | struct scheduler_msg cds_msg = {0}; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14122 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14123 | SME_ENTER(); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14124 | |
| 14125 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 14126 | if (QDF_STATUS_SUCCESS == status) { |
| 14127 | /* Serialize the req through MC thread */ |
Nachiket Kukade | e547a48 | 2018-05-22 16:43:30 +0530 | [diff] [blame] | 14128 | mac_ctx->sme.apf_get_offload_cb = callback; |
| 14129 | mac_ctx->sme.apf_get_offload_context = context; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14130 | cds_msg.bodyptr = NULL; |
Nachiket Kukade | e547a48 | 2018-05-22 16:43:30 +0530 | [diff] [blame] | 14131 | cds_msg.type = WDA_APF_GET_CAPABILITIES_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 14132 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 14133 | QDF_MODULE_ID_WMA, |
| 14134 | QDF_MODULE_ID_WMA, &cds_msg); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14135 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 14136 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Nachiket Kukade | e547a48 | 2018-05-22 16:43:30 +0530 | [diff] [blame] | 14137 | FL("Post apf get offload msg fail")); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14138 | status = QDF_STATUS_E_FAILURE; |
| 14139 | } |
| 14140 | sme_release_global_lock(&mac_ctx->sme); |
| 14141 | } else { |
| 14142 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14143 | FL("sme_acquire_global_lock error")); |
| 14144 | } |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14145 | SME_EXIT(); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14146 | return status; |
| 14147 | } |
| 14148 | |
Nachiket Kukade | e547a48 | 2018-05-22 16:43:30 +0530 | [diff] [blame] | 14149 | QDF_STATUS sme_set_apf_instructions(tHalHandle hal, |
| 14150 | struct sir_apf_set_offload *req) |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14151 | { |
| 14152 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 14153 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14154 | struct scheduler_msg cds_msg = {0}; |
Nachiket Kukade | e547a48 | 2018-05-22 16:43:30 +0530 | [diff] [blame] | 14155 | struct sir_apf_set_offload *set_offload; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14156 | |
Arun Khandavalli | ca198b5 | 2016-04-26 20:53:35 +0530 | [diff] [blame] | 14157 | set_offload = qdf_mem_malloc(sizeof(*set_offload) + |
| 14158 | req->current_length); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14159 | |
| 14160 | if (NULL == set_offload) { |
| 14161 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14162 | FL("Failed to alloc set_offload")); |
| 14163 | return QDF_STATUS_E_NOMEM; |
| 14164 | } |
| 14165 | |
| 14166 | set_offload->session_id = req->session_id; |
| 14167 | set_offload->filter_id = req->filter_id; |
| 14168 | set_offload->current_offset = req->current_offset; |
| 14169 | set_offload->total_length = req->total_length; |
Rajeev Kumar | e5a1682 | 2016-07-27 13:11:42 -0700 | [diff] [blame] | 14170 | set_offload->current_length = req->current_length; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14171 | if (set_offload->total_length) { |
Arun Khandavalli | ca198b5 | 2016-04-26 20:53:35 +0530 | [diff] [blame] | 14172 | set_offload->program = ((uint8_t *)set_offload) + |
| 14173 | sizeof(*set_offload); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14174 | qdf_mem_copy(set_offload->program, req->program, |
| 14175 | set_offload->current_length); |
| 14176 | } |
| 14177 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 14178 | if (QDF_STATUS_SUCCESS == status) { |
| 14179 | /* Serialize the req through MC thread */ |
| 14180 | cds_msg.bodyptr = set_offload; |
Nachiket Kukade | e547a48 | 2018-05-22 16:43:30 +0530 | [diff] [blame] | 14181 | cds_msg.type = WDA_APF_SET_INSTRUCTIONS_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 14182 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 14183 | QDF_MODULE_ID_WMA, |
| 14184 | QDF_MODULE_ID_WMA, &cds_msg); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14185 | |
| 14186 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 14187 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Nachiket Kukade | e547a48 | 2018-05-22 16:43:30 +0530 | [diff] [blame] | 14188 | FL("Post APF set offload msg fail")); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14189 | status = QDF_STATUS_E_FAILURE; |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14190 | qdf_mem_free(set_offload); |
| 14191 | } |
| 14192 | sme_release_global_lock(&mac_ctx->sme); |
| 14193 | } else { |
| 14194 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14195 | FL("sme_acquire_global_lock failed")); |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14196 | qdf_mem_free(set_offload); |
| 14197 | } |
| 14198 | return status; |
| 14199 | } |
| 14200 | |
Nachiket Kukade | 177b5b0 | 2018-05-22 20:52:17 +0530 | [diff] [blame] | 14201 | QDF_STATUS sme_set_apf_enable_disable(tHalHandle hal, uint8_t vdev_id, |
| 14202 | bool apf_enable) |
| 14203 | { |
| 14204 | void *wma_handle; |
| 14205 | |
| 14206 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14207 | if (!wma_handle) { |
| 14208 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14209 | "wma handle is NULL"); |
| 14210 | return QDF_STATUS_E_FAILURE; |
| 14211 | } |
| 14212 | |
| 14213 | return wma_send_apf_enable_cmd(wma_handle, vdev_id, apf_enable); |
| 14214 | } |
| 14215 | |
| 14216 | QDF_STATUS |
| 14217 | sme_apf_write_work_memory(tHalHandle hal, |
| 14218 | struct wmi_apf_write_memory_params *write_params) |
| 14219 | { |
| 14220 | void *wma_handle; |
| 14221 | |
| 14222 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14223 | if (!wma_handle) { |
| 14224 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14225 | "wma handle is NULL"); |
| 14226 | return QDF_STATUS_E_FAILURE; |
| 14227 | } |
| 14228 | |
| 14229 | return wma_send_apf_write_work_memory_cmd(wma_handle, write_params); |
| 14230 | } |
| 14231 | |
| 14232 | QDF_STATUS |
| 14233 | sme_apf_read_work_memory(tHalHandle hal, |
| 14234 | struct wmi_apf_read_memory_params *read_params, |
| 14235 | apf_read_mem_cb callback) |
| 14236 | { |
| 14237 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 14238 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 14239 | void *wma_handle; |
| 14240 | |
| 14241 | status = sme_acquire_global_lock(&mac->sme); |
| 14242 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 14243 | mac->sme.apf_read_mem_cb = callback; |
| 14244 | sme_release_global_lock(&mac->sme); |
| 14245 | } else { |
| 14246 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14247 | FL("sme_acquire_global_lock failed")); |
| 14248 | } |
| 14249 | |
| 14250 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14251 | if (!wma_handle) { |
| 14252 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14253 | "wma handle is NULL"); |
| 14254 | return QDF_STATUS_E_FAILURE; |
| 14255 | } |
| 14256 | |
| 14257 | return wma_send_apf_read_work_memory_cmd(wma_handle, read_params); |
| 14258 | } |
| 14259 | #endif /* FEATURE_WLAN_APF */ |
| 14260 | |
Arun Khandavalli | 2476ef5 | 2016-04-26 20:19:43 +0530 | [diff] [blame] | 14261 | /** |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 14262 | * sme_get_wni_dot11_mode() - return configured wni dot11mode |
| 14263 | * @hal: hal pointer |
| 14264 | * |
| 14265 | * Return: wni dot11 mode. |
| 14266 | */ |
| 14267 | uint32_t sme_get_wni_dot11_mode(tHalHandle hal) |
| 14268 | { |
| 14269 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14270 | |
| 14271 | return csr_translate_to_wni_cfg_dot11_mode(mac_ctx, |
| 14272 | mac_ctx->roam.configParam.uCfgDot11Mode); |
| 14273 | } |
| 14274 | |
| 14275 | /** |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 14276 | * sme_create_mon_session() - post message to create PE session for monitormode |
| 14277 | * operation |
| 14278 | * @hal_handle: Handle to the HAL |
| 14279 | * @bssid: pointer to bssid |
Rajeev Kumar Sirasanagandla | e3b5991 | 2018-08-24 15:53:31 +0530 | [diff] [blame] | 14280 | * @vdev_id: sme session id |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 14281 | * |
| 14282 | * Return: QDF_STATUS_SUCCESS on success, non-zero error code on failure. |
| 14283 | */ |
Rajeev Kumar Sirasanagandla | e3b5991 | 2018-08-24 15:53:31 +0530 | [diff] [blame] | 14284 | QDF_STATUS sme_create_mon_session(tHalHandle hal_handle, tSirMacAddr bss_id, |
| 14285 | uint8_t vdev_id) |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 14286 | { |
| 14287 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 14288 | struct sir_create_session *msg; |
| 14289 | |
| 14290 | msg = qdf_mem_malloc(sizeof(*msg)); |
| 14291 | if (NULL != msg) { |
| 14292 | msg->type = eWNI_SME_MON_INIT_SESSION; |
Rajeev Kumar Sirasanagandla | e3b5991 | 2018-08-24 15:53:31 +0530 | [diff] [blame] | 14293 | msg->vdev_id = vdev_id; |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 14294 | msg->msg_len = sizeof(*msg); |
| 14295 | 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] | 14296 | status = umac_send_mb_message_to_mac(msg); |
Manjunathappa Prakash | 59f861d | 2016-04-21 10:33:31 -0700 | [diff] [blame] | 14297 | } |
| 14298 | return status; |
| 14299 | } |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 14300 | |
Kapil Gupta | 4f0c0c1 | 2017-02-07 15:21:15 +0530 | [diff] [blame] | 14301 | void sme_set_chan_info_callback(tHalHandle hal_handle, |
| 14302 | void (*callback)(struct scan_chan_info *chan_info)) |
| 14303 | { |
| 14304 | tpAniSirGlobal mac; |
| 14305 | |
| 14306 | if (hal_handle == NULL) { |
| 14307 | QDF_ASSERT(0); |
| 14308 | return; |
| 14309 | } |
| 14310 | mac = PMAC_STRUCT(hal_handle); |
| 14311 | mac->chan_info_cb = callback; |
| 14312 | } |
| 14313 | |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 14314 | /** |
| 14315 | * sme_set_adaptive_dwelltime_config() - Update Adaptive dwelltime configuration |
| 14316 | * @hal: The handle returned by macOpen |
| 14317 | * @params: adaptive_dwelltime_params config |
| 14318 | * |
| 14319 | * Return: QDF_STATUS if adaptive dwell time update |
Jeff Johnson | 698eacd | 2018-05-12 17:00:03 -0700 | [diff] [blame] | 14320 | * configuration success else failure status |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 14321 | */ |
| 14322 | QDF_STATUS sme_set_adaptive_dwelltime_config(tHalHandle hal, |
| 14323 | struct adaptive_dwelltime_params *params) |
| 14324 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14325 | struct scheduler_msg message = {0}; |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 14326 | QDF_STATUS status; |
| 14327 | struct adaptive_dwelltime_params *dwelltime_params; |
| 14328 | |
| 14329 | dwelltime_params = qdf_mem_malloc(sizeof(*dwelltime_params)); |
| 14330 | if (NULL == dwelltime_params) { |
| 14331 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14332 | "%s: fail to alloc dwelltime_params", __func__); |
| 14333 | return QDF_STATUS_E_NOMEM; |
| 14334 | } |
| 14335 | |
| 14336 | dwelltime_params->is_enabled = params->is_enabled; |
| 14337 | dwelltime_params->dwelltime_mode = params->dwelltime_mode; |
| 14338 | dwelltime_params->lpf_weight = params->lpf_weight; |
| 14339 | dwelltime_params->passive_mon_intval = params->passive_mon_intval; |
| 14340 | dwelltime_params->wifi_act_threshold = params->wifi_act_threshold; |
| 14341 | |
| 14342 | message.type = WMA_SET_ADAPT_DWELLTIME_CONF_PARAMS; |
| 14343 | message.bodyptr = dwelltime_params; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 14344 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 14345 | QDF_MODULE_ID_WMA, |
| 14346 | QDF_MODULE_ID_WMA, &message); |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 14347 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 14348 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14349 | "%s: Not able to post msg to WMA!", __func__); |
| 14350 | |
| 14351 | qdf_mem_free(dwelltime_params); |
| 14352 | } |
| 14353 | return status; |
| 14354 | } |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 14355 | |
| 14356 | /** |
| 14357 | * sme_set_vdev_ies_per_band() - sends the per band IEs to vdev |
| 14358 | * @hal: Pointer to HAL |
| 14359 | * @vdev_id: vdev_id for which IE is targeted |
| 14360 | * |
| 14361 | * Return: None |
| 14362 | */ |
| 14363 | void sme_set_vdev_ies_per_band(tHalHandle hal, uint8_t vdev_id) |
| 14364 | { |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 14365 | struct sir_set_vdev_ies_per_band *p_msg; |
| 14366 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 14367 | |
| 14368 | p_msg = qdf_mem_malloc(sizeof(*p_msg)); |
| 14369 | if (NULL == p_msg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14370 | sme_err("mem alloc failed for sme msg"); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 14371 | return; |
| 14372 | } |
| 14373 | |
| 14374 | p_msg->vdev_id = vdev_id; |
| 14375 | p_msg->msg_type = eWNI_SME_SET_VDEV_IES_PER_BAND; |
| 14376 | p_msg->len = sizeof(*p_msg); |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14377 | 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] | 14378 | vdev_id); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14379 | status = umac_send_mb_message_to_mac(p_msg); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 14380 | if (QDF_STATUS_SUCCESS != status) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14381 | sme_err("Send eWNI_SME_SET_VDEV_IES_PER_BAND fail"); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 14382 | } |
| 14383 | |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14384 | /** |
| 14385 | * sme_set_pdev_ht_vht_ies() - sends the set pdev IE req |
| 14386 | * @hal: Pointer to HAL |
| 14387 | * @enable2x2: 1x1 or 2x2 mode. |
| 14388 | * |
| 14389 | * Sends the set pdev IE req with Nss value. |
| 14390 | * |
| 14391 | * Return: None |
| 14392 | */ |
| 14393 | void sme_set_pdev_ht_vht_ies(tHalHandle hal, bool enable2x2) |
| 14394 | { |
| 14395 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14396 | struct sir_set_ht_vht_cfg *ht_vht_cfg; |
| 14397 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 14398 | |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14399 | if (!((mac_ctx->roam.configParam.uCfgDot11Mode == |
| 14400 | eCSR_CFG_DOT11_MODE_AUTO) || |
| 14401 | (mac_ctx->roam.configParam.uCfgDot11Mode == |
| 14402 | eCSR_CFG_DOT11_MODE_11N) || |
| 14403 | (mac_ctx->roam.configParam.uCfgDot11Mode == |
| 14404 | eCSR_CFG_DOT11_MODE_11N_ONLY) || |
| 14405 | (mac_ctx->roam.configParam.uCfgDot11Mode == |
| 14406 | eCSR_CFG_DOT11_MODE_11AC) || |
| 14407 | (mac_ctx->roam.configParam.uCfgDot11Mode == |
| 14408 | eCSR_CFG_DOT11_MODE_11AC_ONLY))) |
| 14409 | return; |
| 14410 | |
| 14411 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 14412 | if (QDF_STATUS_SUCCESS == status) { |
| 14413 | ht_vht_cfg = qdf_mem_malloc(sizeof(*ht_vht_cfg)); |
| 14414 | if (NULL == ht_vht_cfg) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14415 | sme_err("mem alloc failed for ht_vht_cfg"); |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14416 | sme_release_global_lock(&mac_ctx->sme); |
| 14417 | return; |
| 14418 | } |
| 14419 | |
| 14420 | ht_vht_cfg->pdev_id = 0; |
| 14421 | if (enable2x2) |
| 14422 | ht_vht_cfg->nss = 2; |
| 14423 | else |
| 14424 | ht_vht_cfg->nss = 1; |
| 14425 | ht_vht_cfg->dot11mode = |
| 14426 | (uint8_t)csr_translate_to_wni_cfg_dot11_mode(mac_ctx, |
| 14427 | mac_ctx->roam.configParam.uCfgDot11Mode); |
| 14428 | |
| 14429 | ht_vht_cfg->msg_type = eWNI_SME_PDEV_SET_HT_VHT_IE; |
| 14430 | ht_vht_cfg->len = sizeof(*ht_vht_cfg); |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14431 | sme_debug("SET_HT_VHT_IE with nss: %d, dot11mode: %d", |
| 14432 | ht_vht_cfg->nss, |
| 14433 | ht_vht_cfg->dot11mode); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14434 | status = umac_send_mb_message_to_mac(ht_vht_cfg); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 14435 | if (QDF_STATUS_SUCCESS != status) |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14436 | sme_err("Send SME_PDEV_SET_HT_VHT_IE fail"); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 14437 | |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14438 | sme_release_global_lock(&mac_ctx->sme); |
| 14439 | } |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14440 | } |
| 14441 | |
| 14442 | /** |
| 14443 | * sme_update_vdev_type_nss() - sets the nss per vdev type |
| 14444 | * @hal: Pointer to HAL |
| 14445 | * @max_supp_nss: max_supported Nss |
| 14446 | * @band: 5G or 2.4G band |
| 14447 | * |
| 14448 | * Sets the per band Nss for each vdev type based on INI and configured |
| 14449 | * chain mask value. |
| 14450 | * |
| 14451 | * Return: None |
| 14452 | */ |
| 14453 | 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] | 14454 | uint32_t vdev_type_nss, enum band_info band) |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14455 | { |
| 14456 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14457 | struct vdev_type_nss *vdev_nss; |
| 14458 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 14459 | if (BAND_5G == band) |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 14460 | vdev_nss = &mac_ctx->vdev_type_nss_5g; |
| 14461 | else |
| 14462 | vdev_nss = &mac_ctx->vdev_type_nss_2g; |
| 14463 | |
| 14464 | vdev_nss->sta = QDF_MIN(max_supp_nss, CFG_STA_NSS(vdev_type_nss)); |
| 14465 | vdev_nss->sap = QDF_MIN(max_supp_nss, CFG_SAP_NSS(vdev_type_nss)); |
| 14466 | vdev_nss->p2p_go = QDF_MIN(max_supp_nss, |
| 14467 | CFG_P2P_GO_NSS(vdev_type_nss)); |
| 14468 | vdev_nss->p2p_cli = QDF_MIN(max_supp_nss, |
| 14469 | CFG_P2P_CLI_NSS(vdev_type_nss)); |
| 14470 | vdev_nss->p2p_dev = QDF_MIN(max_supp_nss, |
| 14471 | CFG_P2P_DEV_NSS(vdev_type_nss)); |
| 14472 | vdev_nss->ibss = QDF_MIN(max_supp_nss, CFG_IBSS_NSS(vdev_type_nss)); |
| 14473 | vdev_nss->tdls = QDF_MIN(max_supp_nss, CFG_TDLS_NSS(vdev_type_nss)); |
| 14474 | vdev_nss->ocb = QDF_MIN(max_supp_nss, CFG_OCB_NSS(vdev_type_nss)); |
| 14475 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14476 | 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] | 14477 | band, vdev_nss->sta, vdev_nss->sap, vdev_nss->p2p_cli, |
| 14478 | vdev_nss->p2p_go, vdev_nss->p2p_dev, vdev_nss->ibss, |
| 14479 | vdev_nss->tdls, vdev_nss->ocb); |
| 14480 | } |
Peng Xu | 8fdaa49 | 2016-06-22 10:20:47 -0700 | [diff] [blame] | 14481 | |
Kiran Kumar Lokere | e6476b2 | 2017-10-16 23:40:32 -0700 | [diff] [blame] | 14482 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
| 14483 | #define MAX_BSS_COLOR_VAL 63 |
| 14484 | #define MIN_BSS_COLOR_VAL 1 |
| 14485 | |
| 14486 | QDF_STATUS sme_set_he_bss_color(tHalHandle hal, uint8_t session_id, |
| 14487 | uint8_t bss_color) |
| 14488 | |
| 14489 | { |
| 14490 | struct sir_set_he_bss_color *bss_color_msg; |
| 14491 | uint8_t len; |
| 14492 | |
| 14493 | if (!hal) { |
| 14494 | sme_err("Invalid hal pointer"); |
| 14495 | return QDF_STATUS_E_FAULT; |
| 14496 | } |
| 14497 | |
| 14498 | sme_debug("Set HE bss_color %d", bss_color); |
| 14499 | |
| 14500 | if (bss_color < MIN_BSS_COLOR_VAL || bss_color > MAX_BSS_COLOR_VAL) { |
| 14501 | sme_debug("Invalid HE bss_color %d", bss_color); |
| 14502 | return QDF_STATUS_E_INVAL; |
| 14503 | } |
| 14504 | len = sizeof(*bss_color_msg); |
| 14505 | bss_color_msg = qdf_mem_malloc(len); |
| 14506 | if (!bss_color_msg) { |
| 14507 | sme_err("mem alloc failed"); |
| 14508 | return QDF_STATUS_E_NOMEM; |
| 14509 | } |
| 14510 | bss_color_msg->message_type = eWNI_SME_SET_HE_BSS_COLOR; |
| 14511 | bss_color_msg->length = len; |
| 14512 | bss_color_msg->session_id = session_id; |
| 14513 | bss_color_msg->bss_color = bss_color; |
| 14514 | return umac_send_mb_message_to_mac(bss_color_msg); |
| 14515 | } |
| 14516 | #endif |
| 14517 | |
Peng Xu | 8fdaa49 | 2016-06-22 10:20:47 -0700 | [diff] [blame] | 14518 | /** |
Nitesh Shah | db5ea0d | 2017-03-22 15:17:47 +0530 | [diff] [blame] | 14519 | * sme_update_hw_dbs_capable() - sets the HW DBS capability |
| 14520 | * @hal: Pointer to HAL |
| 14521 | * @hw_dbs_capable: HW DBS capability |
| 14522 | * |
| 14523 | * Sets HW DBS capability based on INI and fw capability. |
| 14524 | * |
| 14525 | * Return: None |
| 14526 | */ |
| 14527 | void sme_update_hw_dbs_capable(tHalHandle hal, uint8_t hw_dbs_capable) |
| 14528 | { |
| 14529 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 14530 | |
Nitesh Shah | db5ea0d | 2017-03-22 15:17:47 +0530 | [diff] [blame] | 14531 | mac_ctx->hw_dbs_capable = hw_dbs_capable; |
| 14532 | } |
| 14533 | |
Rachit Kankane | 026e77a | 2018-07-31 16:21:09 +0530 | [diff] [blame] | 14534 | #ifdef FEATURE_P2P_LISTEN_OFFLOAD |
Nitesh Shah | db5ea0d | 2017-03-22 15:17:47 +0530 | [diff] [blame] | 14535 | /** |
Peng Xu | 8fdaa49 | 2016-06-22 10:20:47 -0700 | [diff] [blame] | 14536 | * sme_register_p2p_lo_event() - Register for the p2p lo event |
| 14537 | * @hHal: reference to the HAL |
| 14538 | * @context: the context of the call |
| 14539 | * @callback: the callback to hdd |
| 14540 | * |
| 14541 | * This function registers the callback function for P2P listen |
| 14542 | * offload stop event. |
| 14543 | * |
| 14544 | * Return: none |
| 14545 | */ |
| 14546 | void sme_register_p2p_lo_event(tHalHandle hHal, void *context, |
Jeff Johnson | f7e36d6 | 2018-07-04 21:14:02 -0700 | [diff] [blame] | 14547 | p2p_lo_callback callback) |
Peng Xu | 8fdaa49 | 2016-06-22 10:20:47 -0700 | [diff] [blame] | 14548 | { |
| 14549 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 14550 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 14551 | |
| 14552 | status = sme_acquire_global_lock(&pMac->sme); |
| 14553 | pMac->sme.p2p_lo_event_callback = callback; |
| 14554 | pMac->sme.p2p_lo_event_context = context; |
| 14555 | sme_release_global_lock(&pMac->sme); |
| 14556 | } |
Rachit Kankane | 026e77a | 2018-07-31 16:21:09 +0530 | [diff] [blame] | 14557 | #endif |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 14558 | |
| 14559 | /** |
| 14560 | * sme_process_mac_pwr_dbg_cmd() - enable mac pwr debugging |
| 14561 | * @hal: The handle returned by macOpen |
| 14562 | * @session_id: session id |
| 14563 | * @dbg_args: args for mac pwr debug command |
| 14564 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 14565 | */ |
| 14566 | QDF_STATUS sme_process_mac_pwr_dbg_cmd(tHalHandle hal, uint32_t session_id, |
| 14567 | struct sir_mac_pwr_dbg_cmd* |
| 14568 | dbg_args) |
| 14569 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14570 | struct scheduler_msg message = {0}; |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 14571 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14572 | struct sir_mac_pwr_dbg_cmd *req; |
| 14573 | int i; |
| 14574 | |
| 14575 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14576 | sme_err("CSR session not valid: %d", session_id); |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 14577 | return QDF_STATUS_E_FAILURE; |
| 14578 | } |
| 14579 | |
| 14580 | req = qdf_mem_malloc(sizeof(*req)); |
| 14581 | if (NULL == req) { |
| 14582 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14583 | "%s: fail to alloc mac_pwr_dbg_args", __func__); |
| 14584 | return QDF_STATUS_E_FAILURE; |
| 14585 | } |
| 14586 | req->module_id = dbg_args->module_id; |
| 14587 | req->pdev_id = dbg_args->pdev_id; |
| 14588 | req->num_args = dbg_args->num_args; |
| 14589 | for (i = 0; i < req->num_args; i++) |
| 14590 | req->args[i] = dbg_args->args[i]; |
| 14591 | |
| 14592 | message.type = SIR_HAL_POWER_DBG_CMD; |
| 14593 | message.bodyptr = req; |
| 14594 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 14595 | if (!QDF_IS_STATUS_SUCCESS(scheduler_post_message(QDF_MODULE_ID_SME, |
| 14596 | QDF_MODULE_ID_WMA, |
| 14597 | QDF_MODULE_ID_WMA, |
| 14598 | &message))) { |
Manjeet Singh | f82ed07 | 2016-07-08 11:40:00 +0530 | [diff] [blame] | 14599 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14600 | "%s: Not able to post msg to WDA!", |
| 14601 | __func__); |
| 14602 | qdf_mem_free(req); |
| 14603 | } |
| 14604 | return QDF_STATUS_SUCCESS; |
| 14605 | } |
Tushnim Bhattacharyya | f44a9d8 | 2016-07-05 10:52:06 -0700 | [diff] [blame] | 14606 | /** |
| 14607 | * sme_get_vdev_type_nss() - gets the nss per vdev type |
Tushnim Bhattacharyya | f44a9d8 | 2016-07-05 10:52:06 -0700 | [diff] [blame] | 14608 | * @dev_mode: connection type. |
| 14609 | * @nss2g: Pointer to the 2G Nss parameter. |
| 14610 | * @nss5g: Pointer to the 5G Nss parameter. |
| 14611 | * |
| 14612 | * Fills the 2G and 5G Nss values based on connection type. |
| 14613 | * |
| 14614 | * Return: None |
| 14615 | */ |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 14616 | void sme_get_vdev_type_nss(enum QDF_OPMODE dev_mode, |
| 14617 | uint8_t *nss_2g, uint8_t *nss_5g) |
Tushnim Bhattacharyya | f44a9d8 | 2016-07-05 10:52:06 -0700 | [diff] [blame] | 14618 | { |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 14619 | tpAniSirGlobal mac_ctx = sme_get_mac_context(); |
| 14620 | |
| 14621 | if (NULL == mac_ctx) { |
| 14622 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14623 | FL("Invalid MAC context")); |
| 14624 | return; |
| 14625 | } |
Tushnim Bhattacharyya | f44a9d8 | 2016-07-05 10:52:06 -0700 | [diff] [blame] | 14626 | csr_get_vdev_type_nss(mac_ctx, dev_mode, nss_2g, nss_5g); |
| 14627 | } |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14628 | |
| 14629 | /** |
| 14630 | * sme_update_sta_roam_policy() - update sta roam policy for |
| 14631 | * unsafe and DFS channels. |
| 14632 | * @hal_handle: hal handle for getting global mac struct |
| 14633 | * @dfs_mode: dfs mode which tell if dfs channel needs to be |
| 14634 | * skipped or not |
| 14635 | * @skip_unsafe_channels: Param to tell if driver needs to |
| 14636 | * skip unsafe channels or not. |
| 14637 | * @param session_id: sme_session_id |
Agrawal, Ashish | 9f84c40 | 2016-11-30 16:19:44 +0530 | [diff] [blame] | 14638 | * @sap_operating_band: Band on which SAP is operating |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14639 | * |
| 14640 | * sme_update_sta_roam_policy update sta rome policies to csr |
| 14641 | * this function will call csrUpdateChannelList as well |
| 14642 | * to include/exclude DFS channels and unsafe channels. |
| 14643 | * |
| 14644 | * Return: eHAL_STATUS_SUCCESS or non-zero on failure. |
| 14645 | */ |
| 14646 | QDF_STATUS sme_update_sta_roam_policy(tHalHandle hal_handle, |
| 14647 | enum sta_roam_policy_dfs_mode dfs_mode, |
| 14648 | bool skip_unsafe_channels, |
Agrawal, Ashish | 9f84c40 | 2016-11-30 16:19:44 +0530 | [diff] [blame] | 14649 | uint8_t session_id, uint8_t sap_operating_band) |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14650 | { |
| 14651 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); |
| 14652 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 14653 | tSmeConfigParams *sme_config; |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14654 | |
| 14655 | if (!mac_ctx) { |
| 14656 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
| 14657 | "%s: mac_ctx is null", __func__); |
| 14658 | return QDF_STATUS_E_FAILURE; |
| 14659 | } |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14660 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 14661 | sme_config = qdf_mem_malloc(sizeof(*sme_config)); |
| 14662 | if (!sme_config) { |
| 14663 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14664 | FL("failed to allocate memory for sme_config")); |
| 14665 | return QDF_STATUS_E_FAILURE; |
| 14666 | } |
| 14667 | qdf_mem_zero(sme_config, sizeof(*sme_config)); |
| 14668 | sme_get_config_param(hal_handle, sme_config); |
| 14669 | |
| 14670 | sme_config->csrConfig.sta_roam_policy_params.dfs_mode = |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14671 | dfs_mode; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 14672 | sme_config->csrConfig.sta_roam_policy_params.skip_unsafe_channels = |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14673 | skip_unsafe_channels; |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 14674 | sme_config->csrConfig.sta_roam_policy_params.sap_operating_band = |
Agrawal, Ashish | 9f84c40 | 2016-11-30 16:19:44 +0530 | [diff] [blame] | 14675 | sap_operating_band; |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14676 | |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 14677 | sme_update_config(hal_handle, sme_config); |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14678 | |
| 14679 | status = csr_update_channel_list(mac_ctx); |
| 14680 | if (QDF_STATUS_SUCCESS != status) { |
| 14681 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14682 | FL("failed to update the supported channel list")); |
| 14683 | } |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 14684 | |
| 14685 | if (mac_ctx->roam.configParam.isRoamOffloadScanEnabled) { |
| 14686 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 14687 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 14688 | csr_roam_offload_scan(mac_ctx, session_id, |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14689 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 14690 | REASON_ROAM_SCAN_STA_ROAM_POLICY_CHANGED); |
Vignesh Viswanathan | 4e65e8e | 2018-05-01 12:04:16 +0530 | [diff] [blame] | 14691 | sme_release_global_lock(&mac_ctx->sme); |
| 14692 | } else { |
| 14693 | sme_err("Failed to acquire SME lock"); |
| 14694 | } |
| 14695 | } |
Sridhar Selvaraj | 48c4709 | 2017-07-31 18:18:14 +0530 | [diff] [blame] | 14696 | qdf_mem_free(sme_config); |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 14697 | return status; |
| 14698 | } |
| 14699 | |
| 14700 | /** |
| 14701 | * sme_enable_disable_chanavoidind_event - configure ca event ind |
| 14702 | * @hal: handler to hal |
| 14703 | * @set_value: enable/disable |
| 14704 | * |
| 14705 | * function to enable/disable chan avoidance indication |
| 14706 | * |
| 14707 | * Return: QDF_STATUS |
| 14708 | */ |
| 14709 | QDF_STATUS sme_enable_disable_chanavoidind_event(tHalHandle hal, |
| 14710 | uint8_t set_value) |
| 14711 | { |
| 14712 | QDF_STATUS status; |
| 14713 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14714 | struct scheduler_msg msg = {0}; |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 14715 | |
Vignesh Viswanathan | a1f3a1a | 2018-10-04 13:10:46 +0530 | [diff] [blame] | 14716 | if (!mac_ctx->mlme_cfg->gen.optimize_ca_event) { |
| 14717 | sme_err("optimize_ca_event not enabled in ini"); |
| 14718 | return QDF_STATUS_E_NOSUPPORT; |
| 14719 | } |
| 14720 | |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14721 | sme_debug("set_value: %d", set_value); |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 14722 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 14723 | if (QDF_STATUS_SUCCESS == status) { |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 14724 | qdf_mem_zero(&msg, sizeof(struct scheduler_msg)); |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 14725 | msg.type = WMA_SEND_FREQ_RANGE_CONTROL_IND; |
| 14726 | msg.bodyval = set_value; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 14727 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 14728 | QDF_MODULE_ID_WMA, |
| 14729 | QDF_MODULE_ID_WMA, &msg); |
Selvaraj, Sridhar | ebda0f2 | 2016-08-29 16:05:23 +0530 | [diff] [blame] | 14730 | sme_release_global_lock(&mac_ctx->sme); |
| 14731 | return status; |
| 14732 | } |
Deepak Dhamdhere | b106ae5 | 2016-08-10 20:55:30 +0530 | [diff] [blame] | 14733 | return status; |
| 14734 | } |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14735 | |
Deepak Dhamdhere | b106ae5 | 2016-08-10 20:55:30 +0530 | [diff] [blame] | 14736 | /* |
| 14737 | * sme_set_default_scan_ie() - API to send default scan IE to LIM |
| 14738 | * @hal: reference to the HAL |
| 14739 | * @session_id: current session ID |
| 14740 | * @ie_data: Pointer to Scan IE data |
| 14741 | * @ie_len: Length of @ie_data |
| 14742 | * |
| 14743 | * Return: QDF_STATUS |
| 14744 | */ |
| 14745 | QDF_STATUS sme_set_default_scan_ie(tHalHandle hal, uint16_t session_id, |
| 14746 | uint8_t *ie_data, uint16_t ie_len) |
| 14747 | { |
| 14748 | QDF_STATUS status; |
| 14749 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 14750 | struct hdd_default_scan_ie *set_ie_params; |
| 14751 | |
Rajeev Kumar | 5d17dd5 | 2017-12-19 16:17:42 -0800 | [diff] [blame] | 14752 | if (!ie_data) |
| 14753 | return QDF_STATUS_E_INVAL; |
| 14754 | |
Deepak Dhamdhere | b106ae5 | 2016-08-10 20:55:30 +0530 | [diff] [blame] | 14755 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 14756 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 14757 | set_ie_params = qdf_mem_malloc(sizeof(*set_ie_params)); |
| 14758 | if (!set_ie_params) |
| 14759 | status = QDF_STATUS_E_NOMEM; |
| 14760 | else { |
| 14761 | set_ie_params->message_type = eWNI_SME_DEFAULT_SCAN_IE; |
| 14762 | set_ie_params->length = sizeof(*set_ie_params); |
| 14763 | set_ie_params->session_id = session_id; |
| 14764 | set_ie_params->ie_len = ie_len; |
| 14765 | qdf_mem_copy(set_ie_params->ie_data, ie_data, ie_len); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14766 | status = umac_send_mb_message_to_mac(set_ie_params); |
Deepak Dhamdhere | b106ae5 | 2016-08-10 20:55:30 +0530 | [diff] [blame] | 14767 | } |
| 14768 | sme_release_global_lock(&mac_ctx->sme); |
| 14769 | } |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 14770 | return status; |
| 14771 | } |
Padma, Santhosh Kumar | d7cc079 | 2016-06-28 18:54:12 +0530 | [diff] [blame] | 14772 | |
Jeff Johnson | f0e54b0 | 2017-12-18 15:22:25 -0800 | [diff] [blame] | 14773 | QDF_STATUS sme_get_sar_power_limits(tHalHandle hal, |
| 14774 | wma_sar_cb callback, void *context) |
| 14775 | { |
| 14776 | void *wma_handle; |
| 14777 | |
| 14778 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14779 | if (!wma_handle) { |
| 14780 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14781 | "wma handle is NULL"); |
| 14782 | return QDF_STATUS_E_FAILURE; |
| 14783 | } |
| 14784 | |
| 14785 | return wma_get_sar_limit(wma_handle, callback, context); |
| 14786 | } |
| 14787 | |
Kabilan Kannan | 3c0a735 | 2016-12-02 18:49:38 -0800 | [diff] [blame] | 14788 | QDF_STATUS sme_set_sar_power_limits(tHalHandle hal, |
| 14789 | struct sar_limit_cmd_params *sar_limit_cmd) |
| 14790 | { |
| 14791 | void *wma_handle; |
| 14792 | |
| 14793 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14794 | if (!wma_handle) { |
| 14795 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14796 | "wma handle is NULL"); |
| 14797 | return QDF_STATUS_E_FAILURE; |
| 14798 | } |
| 14799 | |
| 14800 | return wma_set_sar_limit(wma_handle, sar_limit_cmd); |
| 14801 | } |
| 14802 | |
Dundi Raviteja | 3b63709 | 2018-09-12 13:42:50 +0530 | [diff] [blame] | 14803 | QDF_STATUS sme_send_coex_config_cmd(struct coex_config_params *coex_cfg_params) |
| 14804 | { |
| 14805 | void *wma_handle; |
| 14806 | |
| 14807 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14808 | if (!wma_handle) { |
| 14809 | sme_err("wma handle is NULL"); |
| 14810 | return QDF_STATUS_E_FAILURE; |
| 14811 | } |
| 14812 | return wma_send_coex_config_cmd(wma_handle, coex_cfg_params); |
| 14813 | } |
| 14814 | |
Jeff Johnson | 6136fb9 | 2017-03-30 15:21:49 -0700 | [diff] [blame] | 14815 | #ifdef WLAN_FEATURE_FIPS |
| 14816 | QDF_STATUS sme_fips_request(tHalHandle hal, struct fips_params *param, |
| 14817 | wma_fips_cb callback, void *context) |
| 14818 | { |
| 14819 | void *wma_handle; |
| 14820 | |
| 14821 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14822 | if (!wma_handle) { |
| 14823 | sme_err("wma handle is NULL"); |
| 14824 | return QDF_STATUS_E_FAILURE; |
| 14825 | } |
| 14826 | |
| 14827 | return wma_fips_request(wma_handle, param, callback, context); |
| 14828 | } |
| 14829 | #endif |
| 14830 | |
Agrawal Ashish | b2d1a45 | 2016-05-05 12:23:58 +0530 | [diff] [blame] | 14831 | QDF_STATUS sme_set_cts2self_for_p2p_go(tHalHandle hal_handle) |
| 14832 | { |
Agrawal Ashish | b2d1a45 | 2016-05-05 12:23:58 +0530 | [diff] [blame] | 14833 | void *wma_handle; |
| 14834 | |
| 14835 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 14836 | if (!wma_handle) { |
| 14837 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14838 | "wma_handle is NULL"); |
| 14839 | return QDF_STATUS_E_FAILURE; |
| 14840 | } |
Agrawal Ashish | b2d1a45 | 2016-05-05 12:23:58 +0530 | [diff] [blame] | 14841 | if (QDF_STATUS_SUCCESS != |
| 14842 | wma_set_cts2self_for_p2p_go(wma_handle, true)) { |
| 14843 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14844 | "%s: Failed to set cts2self for p2p GO to firmware", |
| 14845 | __func__); |
| 14846 | return QDF_STATUS_E_FAILURE; |
| 14847 | } |
| 14848 | return QDF_STATUS_SUCCESS; |
| 14849 | } |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 14850 | |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14851 | /** |
| 14852 | * sme_update_tx_fail_cnt_threshold() - update tx fail count Threshold |
| 14853 | * @hal: Handle returned by mac_open |
| 14854 | * @session_id: Session ID on which tx fail count needs to be updated to FW |
| 14855 | * @tx_fail_count: Count for tx fail threshold after which FW will disconnect |
| 14856 | * |
| 14857 | * This function is used to set tx fail count threshold to firmware. |
| 14858 | * firmware will issue disocnnect with peer device once this threshold is |
| 14859 | * reached. |
| 14860 | * |
| 14861 | * Return: Return QDF_STATUS, otherwise appropriate failure code |
| 14862 | */ |
| 14863 | QDF_STATUS sme_update_tx_fail_cnt_threshold(tHalHandle hal_handle, |
| 14864 | uint8_t session_id, uint32_t tx_fail_count) |
| 14865 | { |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14866 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 14867 | struct sme_tx_fail_cnt_threshold *tx_fail_cnt; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14868 | struct scheduler_msg msg = {0}; |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14869 | |
| 14870 | tx_fail_cnt = qdf_mem_malloc(sizeof(*tx_fail_cnt)); |
| 14871 | if (NULL == tx_fail_cnt) { |
| 14872 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14873 | "%s: fail to alloc filter_param", __func__); |
| 14874 | return QDF_STATUS_E_FAILURE; |
| 14875 | } |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 14876 | sme_debug("session_id: %d tx_fail_count: %d", |
| 14877 | session_id, tx_fail_count); |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14878 | tx_fail_cnt->session_id = session_id; |
| 14879 | tx_fail_cnt->tx_fail_cnt_threshold = tx_fail_count; |
| 14880 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 14881 | qdf_mem_zero(&msg, sizeof(struct scheduler_msg)); |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14882 | msg.type = SIR_HAL_UPDATE_TX_FAIL_CNT_TH; |
| 14883 | msg.reserved = 0; |
| 14884 | msg.bodyptr = tx_fail_cnt; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 14885 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 14886 | QDF_MODULE_ID_WMA, |
| 14887 | QDF_MODULE_ID_WMA, &msg); |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14888 | |
| 14889 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 14890 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 14891 | FL("Not able to post Tx fail count message to WDA")); |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14892 | qdf_mem_free(tx_fail_cnt); |
| 14893 | } |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 14894 | return status; |
| 14895 | } |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14896 | |
Jeff Johnson | dc198ec | 2018-07-04 17:39:53 -0700 | [diff] [blame] | 14897 | QDF_STATUS sme_set_lost_link_info_cb(mac_handle_t mac_handle, |
| 14898 | lost_link_info_cb cb) |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 14899 | { |
Jeff Johnson | dc198ec | 2018-07-04 17:39:53 -0700 | [diff] [blame] | 14900 | QDF_STATUS status; |
| 14901 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 14902 | |
| 14903 | status = sme_acquire_global_lock(&mac->sme); |
| 14904 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 14905 | mac->sme.lost_link_info_cb = cb; |
| 14906 | sme_release_global_lock(&mac->sme); |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 14907 | } else { |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 14908 | sme_err("sme_acquire_global_lock error status: %d", status); |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 14909 | } |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 14910 | |
Agrawal, Ashish | 35b251d | 2016-09-08 19:21:03 +0530 | [diff] [blame] | 14911 | return status; |
| 14912 | } |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 14913 | |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 14914 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 14915 | 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] | 14916 | { |
| 14917 | return roam_info->isESEAssoc; |
| 14918 | } |
Manjeet Singh | 2f78506 | 2017-03-08 18:14:18 +0530 | [diff] [blame] | 14919 | #endif |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 14920 | |
| 14921 | bool sme_neighbor_roam_is11r_assoc(tHalHandle hal_ctx, uint8_t session_id) |
| 14922 | { |
| 14923 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx); |
Yeshwanth Sriram Guntuka | 04b0bb2 | 2017-09-26 11:38:08 +0530 | [diff] [blame] | 14924 | |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 14925 | return csr_neighbor_roam_is11r_assoc(mac_ctx, session_id); |
| 14926 | } |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 14927 | |
| 14928 | #ifdef WLAN_FEATURE_WOW_PULSE |
| 14929 | /** |
| 14930 | * sme_set_wow_pulse() - set wow pulse info |
| 14931 | * @wow_pulse_set_info: wow_pulse_mode structure pointer |
| 14932 | * |
| 14933 | * Return: QDF_STATUS |
| 14934 | */ |
| 14935 | QDF_STATUS sme_set_wow_pulse(struct wow_pulse_mode *wow_pulse_set_info) |
| 14936 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 14937 | struct scheduler_msg message = {0}; |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 14938 | QDF_STATUS status; |
| 14939 | struct wow_pulse_mode *wow_pulse_set_cmd; |
| 14940 | |
| 14941 | if (!wow_pulse_set_info) { |
| 14942 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14943 | "%s: invalid wow_pulse_set_info pointer", __func__); |
| 14944 | return QDF_STATUS_E_FAILURE; |
| 14945 | } |
| 14946 | |
| 14947 | wow_pulse_set_cmd = qdf_mem_malloc(sizeof(*wow_pulse_set_cmd)); |
| 14948 | if (NULL == wow_pulse_set_cmd) { |
| 14949 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14950 | "%s: fail to alloc wow_pulse_set_cmd", __func__); |
| 14951 | return QDF_STATUS_E_NOMEM; |
| 14952 | } |
| 14953 | |
| 14954 | *wow_pulse_set_cmd = *wow_pulse_set_info; |
| 14955 | |
| 14956 | message.type = WMA_SET_WOW_PULSE_CMD; |
| 14957 | message.bodyptr = wow_pulse_set_cmd; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 14958 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 14959 | QDF_MODULE_ID_WMA, |
| 14960 | QDF_MODULE_ID_WMA, |
Yingying Tang | 9540997 | 2016-10-20 15:16:15 +0800 | [diff] [blame] | 14961 | &message); |
| 14962 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 14963 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14964 | "%s: Not able to post msg to WDA!", |
| 14965 | __func__); |
| 14966 | qdf_mem_free(wow_pulse_set_cmd); |
| 14967 | status = QDF_STATUS_E_FAILURE; |
| 14968 | } |
| 14969 | |
| 14970 | return status; |
| 14971 | } |
| 14972 | #endif |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 14973 | |
| 14974 | /** |
| 14975 | * sme_prepare_beacon_from_bss_descp() - prepares beacon frame by populating |
| 14976 | * different fields and IEs from bss descriptor. |
| 14977 | * @frame_buf: frame buffer to populate |
| 14978 | * @bss_descp: bss descriptor |
| 14979 | * @bssid: bssid of the beacon frame to populate |
| 14980 | * @ie_len: length of IE fields |
| 14981 | * |
| 14982 | * Return: None |
| 14983 | */ |
| 14984 | static void sme_prepare_beacon_from_bss_descp(uint8_t *frame_buf, |
| 14985 | tSirBssDescription *bss_descp, |
| 14986 | const tSirMacAddr bssid, |
Naveen Rawat | 6dabf4e | 2017-02-08 15:55:49 -0800 | [diff] [blame] | 14987 | uint32_t ie_len) |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 14988 | { |
| 14989 | tDot11fBeacon1 *bcn_fixed; |
| 14990 | tpSirMacMgmtHdr mac_hdr = (tpSirMacMgmtHdr)frame_buf; |
| 14991 | |
| 14992 | /* populate mac header first to indicate beacon */ |
| 14993 | mac_hdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 14994 | mac_hdr->fc.type = SIR_MAC_MGMT_FRAME; |
| 14995 | mac_hdr->fc.subType = SIR_MAC_MGMT_BEACON; |
| 14996 | qdf_mem_copy((uint8_t *) mac_hdr->da, |
| 14997 | (uint8_t *) "\xFF\xFF\xFF\xFF\xFF\xFF", |
| 14998 | sizeof(struct qdf_mac_addr)); |
| 14999 | qdf_mem_copy((uint8_t *) mac_hdr->sa, bssid, |
| 15000 | sizeof(struct qdf_mac_addr)); |
| 15001 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, bssid, |
| 15002 | sizeof(struct qdf_mac_addr)); |
| 15003 | |
| 15004 | /* now populate fixed params */ |
| 15005 | bcn_fixed = (tDot11fBeacon1 *)(frame_buf + SIR_MAC_HDR_LEN_3A); |
| 15006 | /* populate timestamp */ |
| 15007 | qdf_mem_copy(&bcn_fixed->TimeStamp.timestamp, &bss_descp->timeStamp, |
| 15008 | sizeof(bss_descp->timeStamp)); |
| 15009 | /* populate beacon interval */ |
| 15010 | bcn_fixed->BeaconInterval.interval = bss_descp->beaconInterval; |
| 15011 | /* populate capability */ |
| 15012 | qdf_mem_copy(&bcn_fixed->Capabilities, &bss_descp->capabilityInfo, |
| 15013 | sizeof(bss_descp->capabilityInfo)); |
| 15014 | |
| 15015 | /* copy IEs now */ |
| 15016 | qdf_mem_copy(frame_buf + SIR_MAC_HDR_LEN_3A |
| 15017 | + SIR_MAC_B_PR_SSID_OFFSET, |
| 15018 | &bss_descp->ieFields, ie_len); |
| 15019 | } |
| 15020 | |
Hanumanth Reddy Pothula | 9005178 | 2017-05-04 22:14:43 +0530 | [diff] [blame] | 15021 | QDF_STATUS sme_get_rssi_snr_by_bssid(tHalHandle hal, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 15022 | struct csr_roam_profile *profile, |
Hanumanth Reddy Pothula | 9005178 | 2017-05-04 22:14:43 +0530 | [diff] [blame] | 15023 | const uint8_t *bssid, |
| 15024 | int8_t *rssi, int8_t *snr) |
| 15025 | { |
| 15026 | tSirBssDescription *bss_descp; |
| 15027 | tCsrScanResultFilter *scan_filter; |
| 15028 | struct scan_result_list *bss_list; |
| 15029 | tScanResultHandle result_handle = NULL; |
| 15030 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15031 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15032 | |
| 15033 | scan_filter = qdf_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 15034 | if (NULL == scan_filter) { |
| 15035 | sme_err("memory allocation failed"); |
| 15036 | status = QDF_STATUS_E_NOMEM; |
| 15037 | goto free_scan_flter; |
| 15038 | } |
| 15039 | |
| 15040 | status = csr_roam_prepare_filter_from_profile(mac_ctx, |
| 15041 | profile, scan_filter); |
| 15042 | if (QDF_STATUS_SUCCESS != status) { |
| 15043 | sme_err("prepare_filter failed"); |
| 15044 | goto free_scan_flter; |
| 15045 | } |
| 15046 | |
| 15047 | /* update filter to get scan result with just target BSSID */ |
| 15048 | if (NULL == scan_filter->BSSIDs.bssid) { |
| 15049 | scan_filter->BSSIDs.bssid = |
| 15050 | qdf_mem_malloc(sizeof(struct qdf_mac_addr)); |
| 15051 | if (scan_filter->BSSIDs.bssid == NULL) { |
| 15052 | sme_err("malloc failed"); |
| 15053 | status = QDF_STATUS_E_NOMEM; |
| 15054 | goto free_scan_flter; |
| 15055 | } |
| 15056 | } |
| 15057 | |
| 15058 | scan_filter->BSSIDs.numOfBSSIDs = 1; |
| 15059 | qdf_mem_copy(scan_filter->BSSIDs.bssid[0].bytes, |
| 15060 | bssid, sizeof(struct qdf_mac_addr)); |
| 15061 | |
| 15062 | status = csr_scan_get_result(mac_ctx, scan_filter, &result_handle); |
| 15063 | if (QDF_STATUS_SUCCESS != status) { |
| 15064 | sme_err("parse_scan_result failed"); |
| 15065 | goto free_scan_flter; |
| 15066 | } |
| 15067 | |
| 15068 | bss_list = (struct scan_result_list *)result_handle; |
| 15069 | bss_descp = csr_get_fst_bssdescr_ptr(bss_list); |
| 15070 | if (!bss_descp) { |
| 15071 | sme_err("unable to fetch bss descriptor"); |
| 15072 | status = QDF_STATUS_E_FAULT; |
| 15073 | goto free_scan_flter; |
| 15074 | } |
| 15075 | |
| 15076 | sme_debug("snr: %d, rssi: %d, raw_rssi: %d", |
| 15077 | bss_descp->sinr, bss_descp->rssi, bss_descp->rssi_raw); |
| 15078 | |
| 15079 | if (rssi) |
| 15080 | *rssi = bss_descp->rssi; |
| 15081 | if (snr) |
| 15082 | *snr = bss_descp->sinr; |
| 15083 | |
| 15084 | free_scan_flter: |
| 15085 | /* free scan filter and exit */ |
| 15086 | if (scan_filter) { |
| 15087 | csr_free_scan_filter(mac_ctx, scan_filter); |
| 15088 | qdf_mem_free(scan_filter); |
| 15089 | } |
| 15090 | |
| 15091 | if (result_handle) |
| 15092 | csr_scan_result_purge(mac_ctx, result_handle); |
| 15093 | |
| 15094 | return status; |
| 15095 | } |
| 15096 | |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 15097 | QDF_STATUS sme_get_beacon_frm(tHalHandle hal, struct csr_roam_profile *profile, |
| 15098 | const tSirMacAddr bssid, |
| 15099 | uint8_t **frame_buf, uint32_t *frame_len, |
| 15100 | int *channel) |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15101 | { |
| 15102 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Naveen Rawat | 56b4de8 | 2017-02-17 14:38:49 -0800 | [diff] [blame] | 15103 | tScanResultHandle result_handle = NULL; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15104 | tCsrScanResultFilter *scan_filter; |
| 15105 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15106 | tSirBssDescription *bss_descp; |
Yeshwanth Sriram Guntuka | 36c0990 | 2017-09-26 11:34:26 +0530 | [diff] [blame] | 15107 | struct scan_result_list *bss_list; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15108 | uint32_t ie_len; |
| 15109 | |
| 15110 | scan_filter = qdf_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 15111 | if (NULL == scan_filter) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 15112 | sme_err("memory allocation failed"); |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15113 | status = QDF_STATUS_E_NOMEM; |
| 15114 | goto free_scan_flter; |
| 15115 | } |
| 15116 | status = csr_roam_prepare_filter_from_profile(mac_ctx, |
| 15117 | profile, scan_filter); |
| 15118 | if (QDF_IS_STATUS_ERROR(status)) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 15119 | sme_err("prepare_filter failed"); |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15120 | status = QDF_STATUS_E_FAULT; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15121 | goto free_scan_flter; |
| 15122 | } |
| 15123 | |
| 15124 | /* update filter to get scan result with just target BSSID */ |
| 15125 | if (NULL == scan_filter->BSSIDs.bssid) { |
| 15126 | scan_filter->BSSIDs.bssid = |
| 15127 | qdf_mem_malloc(sizeof(struct qdf_mac_addr)); |
| 15128 | if (scan_filter->BSSIDs.bssid == NULL) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 15129 | sme_err("malloc failed"); |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15130 | status = QDF_STATUS_E_NOMEM; |
| 15131 | goto free_scan_flter; |
| 15132 | } |
| 15133 | } |
| 15134 | scan_filter->BSSIDs.numOfBSSIDs = 1; |
| 15135 | qdf_mem_copy(scan_filter->BSSIDs.bssid[0].bytes, |
| 15136 | bssid, sizeof(struct qdf_mac_addr)); |
| 15137 | |
| 15138 | status = csr_scan_get_result(mac_ctx, scan_filter, &result_handle); |
| 15139 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 15140 | sme_err("parse_scan_result failed"); |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15141 | status = QDF_STATUS_E_FAULT; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15142 | goto free_scan_flter; |
| 15143 | } |
| 15144 | |
Yeshwanth Sriram Guntuka | 36c0990 | 2017-09-26 11:34:26 +0530 | [diff] [blame] | 15145 | bss_list = (struct scan_result_list *)result_handle; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15146 | bss_descp = csr_get_fst_bssdescr_ptr(bss_list); |
Naveen Rawat | ae0aaa8 | 2017-02-17 14:41:19 -0800 | [diff] [blame] | 15147 | if (!bss_descp) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 15148 | sme_err("unable to fetch bss descriptor"); |
Naveen Rawat | ae0aaa8 | 2017-02-17 14:41:19 -0800 | [diff] [blame] | 15149 | status = QDF_STATUS_E_FAULT; |
| 15150 | goto free_scan_flter; |
| 15151 | } |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15152 | |
Naveen Rawat | 81f058c | 2017-06-02 16:02:39 -0700 | [diff] [blame] | 15153 | /** |
| 15154 | * Length of BSS descriptor is without length of |
| 15155 | * length itself and length of pointer that holds ieFields. |
| 15156 | * |
| 15157 | * tSirBssDescription |
| 15158 | * +--------+---------------------------------+---------------+ |
| 15159 | * | length | other fields | pointer to IEs| |
| 15160 | * +--------+---------------------------------+---------------+ |
| 15161 | * ^ |
| 15162 | * ieFields |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15163 | */ |
Naveen Rawat | 81f058c | 2017-06-02 16:02:39 -0700 | [diff] [blame] | 15164 | ie_len = bss_descp->length + sizeof(bss_descp->length) |
| 15165 | - (uint16_t)(offsetof(tSirBssDescription, ieFields[0])); |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15166 | sme_debug("found bss_descriptor ie_len: %d channel %d", |
| 15167 | ie_len, bss_descp->channelId); |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15168 | |
| 15169 | /* include mac header and fixed params along with IEs in frame */ |
| 15170 | *frame_len = SIR_MAC_HDR_LEN_3A + SIR_MAC_B_PR_SSID_OFFSET + ie_len; |
| 15171 | *frame_buf = qdf_mem_malloc(*frame_len); |
| 15172 | if (NULL == *frame_buf) { |
Srinivas Girigowda | 2da81e2 | 2017-03-16 21:22:19 -0700 | [diff] [blame] | 15173 | sme_err("memory allocation failed"); |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15174 | status = QDF_STATUS_E_NOMEM; |
| 15175 | goto free_scan_flter; |
| 15176 | } |
| 15177 | |
| 15178 | sme_prepare_beacon_from_bss_descp(*frame_buf, bss_descp, bssid, ie_len); |
| 15179 | |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15180 | if (!*channel) |
| 15181 | *channel = bss_descp->channelId; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15182 | free_scan_flter: |
| 15183 | /* free scan filter and exit */ |
| 15184 | if (scan_filter) { |
| 15185 | csr_free_scan_filter(mac_ctx, scan_filter); |
| 15186 | qdf_mem_free(scan_filter); |
| 15187 | } |
Arif Hussain | fdb25e2 | 2017-02-05 17:38:16 -0800 | [diff] [blame] | 15188 | if (result_handle) |
| 15189 | csr_scan_result_purge(mac_ctx, result_handle); |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15190 | |
Naveen Rawat | ae0aaa8 | 2017-02-17 14:41:19 -0800 | [diff] [blame] | 15191 | return status; |
Naveen Rawat | 664a7cb | 2017-01-19 17:58:14 -0800 | [diff] [blame] | 15192 | } |
| 15193 | |
Paul Zhang | c3fc0a8 | 2018-01-09 16:38:20 +0800 | [diff] [blame] | 15194 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 15195 | QDF_STATUS sme_fast_reassoc(tHalHandle hal, struct csr_roam_profile *profile, |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15196 | const tSirMacAddr bssid, int channel, |
Krunal Soni | 332f4af | 2017-06-01 14:36:17 -0700 | [diff] [blame] | 15197 | uint8_t vdev_id, const tSirMacAddr connected_bssid) |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15198 | { |
| 15199 | QDF_STATUS status; |
| 15200 | struct wma_roam_invoke_cmd *fastreassoc; |
| 15201 | struct scheduler_msg msg = {0}; |
Padma, Santhosh Kumar | 5bc0c24 | 2017-11-29 15:44:27 +0530 | [diff] [blame] | 15202 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Abhinav Kumar | eab2593 | 2018-07-13 11:48:43 +0530 | [diff] [blame] | 15203 | struct csr_roam_session *session; |
| 15204 | struct csr_roam_profile *roam_profile; |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15205 | |
Abhinav Kumar | eab2593 | 2018-07-13 11:48:43 +0530 | [diff] [blame] | 15206 | session = CSR_GET_SESSION(mac_ctx, vdev_id); |
| 15207 | if (!session || !session->pCurRoamProfile) { |
| 15208 | sme_err("session %d not found", vdev_id); |
| 15209 | return QDF_STATUS_E_FAILURE; |
| 15210 | } |
| 15211 | |
| 15212 | roam_profile = session->pCurRoamProfile; |
| 15213 | if (roam_profile->supplicant_disabled_roaming || |
| 15214 | roam_profile->driver_disabled_roaming) { |
| 15215 | sme_debug("roaming status in Supplicant %d and in driver %d", |
| 15216 | roam_profile->supplicant_disabled_roaming, |
| 15217 | roam_profile->driver_disabled_roaming); |
| 15218 | return QDF_STATUS_E_FAILURE; |
| 15219 | } |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15220 | fastreassoc = qdf_mem_malloc(sizeof(*fastreassoc)); |
| 15221 | if (NULL == fastreassoc) { |
| 15222 | sme_err("qdf_mem_malloc failed for fastreassoc"); |
| 15223 | return QDF_STATUS_E_NOMEM; |
| 15224 | } |
Krunal Soni | 332f4af | 2017-06-01 14:36:17 -0700 | [diff] [blame] | 15225 | /* if both are same then set the flag */ |
| 15226 | if (!qdf_mem_cmp(connected_bssid, bssid, ETH_ALEN)) { |
| 15227 | fastreassoc->is_same_bssid = true; |
| 15228 | sme_debug("bssid same, bssid[%pM]", bssid); |
| 15229 | } |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15230 | fastreassoc->vdev_id = vdev_id; |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15231 | fastreassoc->bssid[0] = bssid[0]; |
| 15232 | fastreassoc->bssid[1] = bssid[1]; |
| 15233 | fastreassoc->bssid[2] = bssid[2]; |
| 15234 | fastreassoc->bssid[3] = bssid[3]; |
| 15235 | fastreassoc->bssid[4] = bssid[4]; |
| 15236 | fastreassoc->bssid[5] = bssid[5]; |
| 15237 | |
| 15238 | status = sme_get_beacon_frm(hal, profile, bssid, |
| 15239 | &fastreassoc->frame_buf, |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15240 | &fastreassoc->frame_len, |
| 15241 | &channel); |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15242 | |
Selvaraj, Sridhar | 64b0a9c | 2017-05-11 16:50:15 +0530 | [diff] [blame] | 15243 | if (!channel) { |
| 15244 | sme_err("channel retrieval from BSS desc fails!"); |
| 15245 | qdf_mem_free(fastreassoc); |
| 15246 | return QDF_STATUS_E_FAULT; |
| 15247 | } |
| 15248 | |
| 15249 | fastreassoc->channel = channel; |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15250 | if (QDF_STATUS_SUCCESS != status) { |
| 15251 | sme_warn("sme_get_beacon_frm failed"); |
| 15252 | fastreassoc->frame_buf = NULL; |
| 15253 | fastreassoc->frame_len = 0; |
| 15254 | } |
| 15255 | |
Padma, Santhosh Kumar | 5bc0c24 | 2017-11-29 15:44:27 +0530 | [diff] [blame] | 15256 | if (csr_is_auth_type_ese(mac_ctx->roam.roamSession[vdev_id]. |
| 15257 | connectedProfile.AuthType)) { |
| 15258 | sme_debug("Beacon is not required for ESE"); |
| 15259 | if (fastreassoc->frame_len) { |
| 15260 | qdf_mem_free(fastreassoc->frame_buf); |
| 15261 | fastreassoc->frame_buf = NULL; |
| 15262 | fastreassoc->frame_len = 0; |
| 15263 | } |
| 15264 | } |
| 15265 | |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15266 | msg.type = SIR_HAL_ROAM_INVOKE; |
| 15267 | msg.reserved = 0; |
| 15268 | msg.bodyptr = fastreassoc; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 15269 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 15270 | QDF_MODULE_ID_WMA, |
| 15271 | QDF_MODULE_ID_WMA, &msg); |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15272 | if (QDF_STATUS_SUCCESS != status) { |
| 15273 | sme_err("Not able to post ROAM_INVOKE_CMD message to WMA"); |
| 15274 | qdf_mem_free(fastreassoc); |
| 15275 | } |
| 15276 | |
| 15277 | return status; |
| 15278 | } |
Paul Zhang | c3fc0a8 | 2018-01-09 16:38:20 +0800 | [diff] [blame] | 15279 | #endif |
Naveen Rawat | 4195c5e | 2017-05-22 17:07:45 -0700 | [diff] [blame] | 15280 | |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 15281 | QDF_STATUS sme_set_del_pmkid_cache(tHalHandle hal, uint8_t session_id, |
| 15282 | tPmkidCacheInfo *pmk_cache_info, |
| 15283 | bool is_add) |
| 15284 | { |
| 15285 | struct wmi_unified_pmk_cache *pmk_cache; |
| 15286 | struct scheduler_msg msg; |
| 15287 | |
| 15288 | pmk_cache = qdf_mem_malloc(sizeof(*pmk_cache)); |
| 15289 | if (!pmk_cache) { |
| 15290 | sme_err("Memory allocation failure"); |
| 15291 | return QDF_STATUS_E_NOMEM; |
| 15292 | } |
| 15293 | |
Vignesh Viswanathan | e8a26b2 | 2017-10-11 20:38:47 +0530 | [diff] [blame] | 15294 | qdf_mem_set(pmk_cache, sizeof(*pmk_cache), 0); |
| 15295 | |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 15296 | pmk_cache->session_id = session_id; |
| 15297 | |
Vignesh Viswanathan | e8a26b2 | 2017-10-11 20:38:47 +0530 | [diff] [blame] | 15298 | if (!pmk_cache_info) |
| 15299 | goto send_flush_cmd; |
| 15300 | |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 15301 | if (!pmk_cache_info->ssid_len) { |
| 15302 | pmk_cache->cat_flag = WMI_PMK_CACHE_CAT_FLAG_BSSID; |
| 15303 | WMI_CHAR_ARRAY_TO_MAC_ADDR(pmk_cache_info->BSSID.bytes, |
| 15304 | &pmk_cache->bssid); |
| 15305 | } else { |
| 15306 | pmk_cache->cat_flag = WMI_PMK_CACHE_CAT_FLAG_SSID_CACHE_ID; |
| 15307 | pmk_cache->ssid.length = pmk_cache_info->ssid_len; |
| 15308 | qdf_mem_copy(pmk_cache->ssid.mac_ssid, |
| 15309 | pmk_cache_info->ssid, |
| 15310 | pmk_cache->ssid.length); |
| 15311 | } |
| 15312 | pmk_cache->cache_id = (uint32_t) (pmk_cache_info->cache_id[0] << 8 | |
| 15313 | pmk_cache_info->cache_id[1]); |
| 15314 | |
| 15315 | if (is_add) |
| 15316 | pmk_cache->action_flag = WMI_PMK_CACHE_ACTION_FLAG_ADD_ENTRY; |
| 15317 | else |
| 15318 | pmk_cache->action_flag = WMI_PMK_CACHE_ACTION_FLAG_DEL_ENTRY; |
| 15319 | |
| 15320 | pmk_cache->pmkid_len = CSR_RSN_PMKID_SIZE; |
| 15321 | qdf_mem_copy(pmk_cache->pmkid, pmk_cache_info->PMKID, |
| 15322 | CSR_RSN_PMKID_SIZE); |
| 15323 | |
| 15324 | pmk_cache->pmk_len = pmk_cache_info->pmk_len; |
| 15325 | qdf_mem_copy(pmk_cache->pmk, pmk_cache_info->pmk, |
| 15326 | pmk_cache->pmk_len); |
| 15327 | |
Vignesh Viswanathan | e8a26b2 | 2017-10-11 20:38:47 +0530 | [diff] [blame] | 15328 | send_flush_cmd: |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 15329 | msg.type = SIR_HAL_SET_DEL_PMKID_CACHE; |
| 15330 | msg.reserved = 0; |
| 15331 | msg.bodyptr = pmk_cache; |
| 15332 | if (QDF_STATUS_SUCCESS != |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 15333 | scheduler_post_message(QDF_MODULE_ID_SME, |
| 15334 | QDF_MODULE_ID_WMA, |
| 15335 | QDF_MODULE_ID_WMA, &msg)) { |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 15336 | sme_err("Not able to post message to WDA"); |
| 15337 | qdf_mem_free(pmk_cache); |
| 15338 | return QDF_STATUS_E_FAILURE; |
| 15339 | } |
| 15340 | |
| 15341 | return QDF_STATUS_SUCCESS; |
| 15342 | } |
| 15343 | |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 15344 | /* ARP DEBUG STATS */ |
| 15345 | |
| 15346 | /** |
| 15347 | * sme_set_nud_debug_stats() - sme api to set nud debug stats |
| 15348 | * @hal: handle to hal |
| 15349 | * @set_stats_param: pointer to set stats param |
| 15350 | * |
| 15351 | * Return: Return QDF_STATUS. |
| 15352 | */ |
| 15353 | QDF_STATUS sme_set_nud_debug_stats(tHalHandle hal, |
| 15354 | struct set_arp_stats_params |
| 15355 | *set_stats_param) |
| 15356 | { |
| 15357 | struct set_arp_stats_params *arp_set_param; |
| 15358 | struct scheduler_msg msg; |
| 15359 | |
| 15360 | arp_set_param = qdf_mem_malloc(sizeof(*arp_set_param)); |
| 15361 | if (arp_set_param == NULL) { |
| 15362 | sme_err("Memory allocation failure"); |
| 15363 | return QDF_STATUS_E_NOMEM; |
| 15364 | } |
| 15365 | |
| 15366 | qdf_mem_copy(arp_set_param, set_stats_param, sizeof(*arp_set_param)); |
| 15367 | |
| 15368 | msg.type = WMA_SET_ARP_STATS_REQ; |
| 15369 | msg.reserved = 0; |
| 15370 | msg.bodyptr = arp_set_param; |
| 15371 | |
| 15372 | if (QDF_STATUS_SUCCESS != |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 15373 | scheduler_post_message(QDF_MODULE_ID_SME, |
| 15374 | QDF_MODULE_ID_WMA, |
| 15375 | QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 15376 | sme_err("Not able to post message to WDA"); |
| 15377 | qdf_mem_free(arp_set_param); |
| 15378 | return QDF_STATUS_E_FAILURE; |
| 15379 | } |
| 15380 | |
| 15381 | return QDF_STATUS_SUCCESS; |
| 15382 | } |
| 15383 | |
| 15384 | /** |
| 15385 | * sme_get_nud_debug_stats() - sme api to get nud debug stats |
| 15386 | * @hal: handle to hal |
| 15387 | * @get_stats_param: pointer to set stats param |
| 15388 | * |
| 15389 | * Return: Return QDF_STATUS. |
| 15390 | */ |
| 15391 | QDF_STATUS sme_get_nud_debug_stats(tHalHandle hal, |
| 15392 | struct get_arp_stats_params |
| 15393 | *get_stats_param) |
| 15394 | { |
| 15395 | struct get_arp_stats_params *arp_get_param; |
| 15396 | struct scheduler_msg msg; |
| 15397 | |
| 15398 | arp_get_param = qdf_mem_malloc(sizeof(*arp_get_param)); |
| 15399 | if (arp_get_param == NULL) { |
| 15400 | sme_err("Memory allocation failure"); |
| 15401 | return QDF_STATUS_E_NOMEM; |
| 15402 | } |
| 15403 | |
| 15404 | qdf_mem_copy(arp_get_param, get_stats_param, sizeof(*arp_get_param)); |
| 15405 | |
| 15406 | msg.type = WMA_GET_ARP_STATS_REQ; |
| 15407 | msg.reserved = 0; |
| 15408 | msg.bodyptr = arp_get_param; |
| 15409 | |
| 15410 | if (QDF_STATUS_SUCCESS != |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 15411 | scheduler_post_message(QDF_MODULE_ID_SME, |
| 15412 | QDF_MODULE_ID_WMA, |
| 15413 | QDF_MODULE_ID_WMA, &msg)) { |
Anurag Chouhan | 3920c0f | 2017-09-11 17:10:56 +0530 | [diff] [blame] | 15414 | sme_err("Not able to post message to WDA"); |
| 15415 | qdf_mem_free(arp_get_param); |
| 15416 | return QDF_STATUS_E_FAILURE; |
| 15417 | } |
| 15418 | |
| 15419 | return QDF_STATUS_SUCCESS; |
| 15420 | } |
| 15421 | |
Krishna Kumaar Natarajan | f1581df | 2017-02-21 13:42:08 -0800 | [diff] [blame] | 15422 | QDF_STATUS sme_set_peer_param(uint8_t *peer_addr, uint32_t param_id, |
| 15423 | uint32_t param_value, uint32_t vdev_id) |
| 15424 | { |
| 15425 | void *wma_handle; |
| 15426 | |
| 15427 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 15428 | if (!wma_handle) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 15429 | sme_err("wma handle is NULL"); |
Krishna Kumaar Natarajan | f1581df | 2017-02-21 13:42:08 -0800 | [diff] [blame] | 15430 | return QDF_STATUS_E_FAILURE; |
| 15431 | } |
| 15432 | |
| 15433 | return wma_set_peer_param(wma_handle, peer_addr, param_id, |
| 15434 | param_value, vdev_id); |
| 15435 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 15436 | |
| 15437 | QDF_STATUS sme_register_set_connection_info_cb(tHalHandle hHal, |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 15438 | bool (*set_connection_info_cb)(bool), |
| 15439 | bool (*get_connection_info_cb)(uint8_t *session_id, |
| 15440 | enum scan_reject_states *reason)) |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 15441 | { |
| 15442 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15443 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 15444 | |
| 15445 | status = sme_acquire_global_lock(&pMac->sme); |
| 15446 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 15447 | pMac->sme.set_connection_info_cb = set_connection_info_cb; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 15448 | pMac->sme.get_connection_info_cb = get_connection_info_cb; |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 15449 | sme_release_global_lock(&pMac->sme); |
| 15450 | } |
| 15451 | return status; |
| 15452 | } |
Sreelakshmi Konamki | 88a2a41 | 2017-04-14 15:11:55 +0530 | [diff] [blame] | 15453 | |
Jeff Johnson | 4397514 | 2018-07-04 15:33:47 -0700 | [diff] [blame] | 15454 | QDF_STATUS sme_rso_cmd_status_cb(mac_handle_t mac_handle, |
| 15455 | rso_cmd_status_cb cb) |
Sreelakshmi Konamki | 88a2a41 | 2017-04-14 15:11:55 +0530 | [diff] [blame] | 15456 | { |
| 15457 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 4397514 | 2018-07-04 15:33:47 -0700 | [diff] [blame] | 15458 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Sreelakshmi Konamki | 88a2a41 | 2017-04-14 15:11:55 +0530 | [diff] [blame] | 15459 | |
| 15460 | mac->sme.rso_cmd_status_cb = cb; |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 15461 | sme_debug("Registered RSO command status callback"); |
Sreelakshmi Konamki | 88a2a41 | 2017-04-14 15:11:55 +0530 | [diff] [blame] | 15462 | return status; |
| 15463 | } |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 15464 | |
Nitesh Shah | f9a09ff | 2017-05-22 15:46:25 +0530 | [diff] [blame] | 15465 | QDF_STATUS sme_set_dbs_scan_selection_config(tHalHandle hal, |
| 15466 | struct wmi_dbs_scan_sel_params *params) |
| 15467 | { |
| 15468 | struct scheduler_msg message = {0}; |
| 15469 | QDF_STATUS status; |
| 15470 | struct wmi_dbs_scan_sel_params *dbs_scan_params; |
| 15471 | uint32_t i; |
| 15472 | |
| 15473 | if (0 == params->num_clients) { |
| 15474 | sme_err("Num of clients is 0"); |
| 15475 | return QDF_STATUS_E_FAILURE; |
| 15476 | } |
| 15477 | |
| 15478 | dbs_scan_params = qdf_mem_malloc(sizeof(*dbs_scan_params)); |
| 15479 | if (!dbs_scan_params) { |
| 15480 | sme_err("fail to alloc dbs_scan_params"); |
| 15481 | return QDF_STATUS_E_NOMEM; |
| 15482 | } |
| 15483 | |
| 15484 | dbs_scan_params->num_clients = params->num_clients; |
| 15485 | dbs_scan_params->pdev_id = params->pdev_id; |
| 15486 | for (i = 0; i < params->num_clients; i++) { |
| 15487 | dbs_scan_params->module_id[i] = params->module_id[i]; |
| 15488 | dbs_scan_params->num_dbs_scans[i] = params->num_dbs_scans[i]; |
| 15489 | dbs_scan_params->num_non_dbs_scans[i] = |
| 15490 | params->num_non_dbs_scans[i]; |
| 15491 | } |
| 15492 | message.type = WMA_SET_DBS_SCAN_SEL_CONF_PARAMS; |
| 15493 | message.bodyptr = dbs_scan_params; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 15494 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 15495 | QDF_MODULE_ID_WMA, |
| 15496 | QDF_MODULE_ID_WMA, &message); |
Nitesh Shah | f9a09ff | 2017-05-22 15:46:25 +0530 | [diff] [blame] | 15497 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 15498 | sme_err("Not able to post msg to WMA!"); |
| 15499 | qdf_mem_free(dbs_scan_params); |
| 15500 | } |
| 15501 | |
| 15502 | return status; |
| 15503 | } |
| 15504 | |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 15505 | QDF_STATUS sme_get_rcpi(tHalHandle hal, struct sme_rcpi_req *rcpi) |
| 15506 | { |
| 15507 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 15508 | tpAniSirGlobal pMac = PMAC_STRUCT(hal); |
Naveen Rawat | b7be1ed | 2017-11-16 16:52:08 -0800 | [diff] [blame] | 15509 | struct scheduler_msg msg = {0}; |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 15510 | struct sme_rcpi_req *rcpi_req; |
| 15511 | |
| 15512 | rcpi_req = qdf_mem_malloc(sizeof(*rcpi_req)); |
| 15513 | if (rcpi_req == NULL) { |
| 15514 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15515 | "%s: Not able to allocate memory for rcpi req", |
| 15516 | __func__); |
| 15517 | return QDF_STATUS_E_NOMEM; |
| 15518 | } |
| 15519 | qdf_mem_copy(rcpi_req, rcpi, sizeof(*rcpi_req)); |
| 15520 | |
| 15521 | status = sme_acquire_global_lock(&pMac->sme); |
| 15522 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 15523 | msg.bodyptr = rcpi_req; |
| 15524 | msg.type = WMA_GET_RCPI_REQ; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 15525 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 15526 | QDF_MODULE_ID_WMA, |
| 15527 | QDF_MODULE_ID_WMA, &msg); |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 15528 | sme_release_global_lock(&pMac->sme); |
| 15529 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 15530 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15531 | FL("post get rcpi req failed")); |
| 15532 | status = QDF_STATUS_E_FAILURE; |
| 15533 | qdf_mem_free(rcpi_req); |
| 15534 | } |
| 15535 | } else { |
| 15536 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15537 | FL("sme_acquire_global_lock failed")); |
| 15538 | qdf_mem_free(rcpi_req); |
| 15539 | } |
| 15540 | |
| 15541 | return status; |
| 15542 | } |
| 15543 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 15544 | void sme_store_pdev(tHalHandle hal, struct wlan_objmgr_pdev *pdev) |
| 15545 | { |
| 15546 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15547 | void *wma_handle; |
| 15548 | QDF_STATUS status; |
| 15549 | |
Kiran Kumar Lokere | f089a3a | 2017-04-20 21:39:26 -0700 | [diff] [blame] | 15550 | 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] | 15551 | if (QDF_STATUS_SUCCESS != status) { |
| 15552 | mac_ctx->pdev = NULL; |
| 15553 | return; |
| 15554 | } |
| 15555 | mac_ctx->pdev = pdev; |
| 15556 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 15557 | if (!wma_handle) { |
| 15558 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | f089a3a | 2017-04-20 21:39:26 -0700 | [diff] [blame] | 15559 | FL("wma handle is NULL")); |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 15560 | return; |
| 15561 | } |
| 15562 | wma_store_pdev(wma_handle, pdev); |
| 15563 | } |
| 15564 | |
Padma, Santhosh Kumar | 16dacfb | 2017-03-21 19:05:40 +0530 | [diff] [blame] | 15565 | QDF_STATUS sme_congestion_register_callback(tHalHandle hal, |
Jeff Johnson | f6182e4 | 2018-07-03 14:46:17 -0700 | [diff] [blame] | 15566 | congestion_cb congestion_cb) |
Padma, Santhosh Kumar | 16dacfb | 2017-03-21 19:05:40 +0530 | [diff] [blame] | 15567 | { |
| 15568 | QDF_STATUS status; |
| 15569 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 15570 | |
| 15571 | status = sme_acquire_global_lock(&mac->sme); |
| 15572 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 15573 | mac->sme.congestion_cb = congestion_cb; |
| 15574 | sme_release_global_lock(&mac->sme); |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 15575 | sme_debug("congestion callback set"); |
Padma, Santhosh Kumar | 16dacfb | 2017-03-21 19:05:40 +0530 | [diff] [blame] | 15576 | } else { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 15577 | sme_err("Aquiring lock failed %d", status); |
Padma, Santhosh Kumar | 16dacfb | 2017-03-21 19:05:40 +0530 | [diff] [blame] | 15578 | } |
| 15579 | |
| 15580 | return status; |
| 15581 | } |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 15582 | |
Jeff Johnson | da2afa4 | 2018-07-04 10:25:42 -0700 | [diff] [blame] | 15583 | QDF_STATUS sme_register_tx_queue_cb(mac_handle_t mac_handle, |
| 15584 | tx_queue_cb tx_queue_cb) |
Varun Reddy Yeturu | 076eaa8 | 2018-01-16 12:16:14 -0800 | [diff] [blame] | 15585 | { |
| 15586 | QDF_STATUS status; |
Jeff Johnson | da2afa4 | 2018-07-04 10:25:42 -0700 | [diff] [blame] | 15587 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Varun Reddy Yeturu | 076eaa8 | 2018-01-16 12:16:14 -0800 | [diff] [blame] | 15588 | |
| 15589 | status = sme_acquire_global_lock(&mac->sme); |
| 15590 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 15591 | mac->sme.tx_queue_cb = tx_queue_cb; |
| 15592 | sme_release_global_lock(&mac->sme); |
| 15593 | sme_debug("Tx queue callback set"); |
| 15594 | } else { |
| 15595 | sme_err("Aquiring lock failed %d", status); |
| 15596 | } |
| 15597 | |
| 15598 | return status; |
| 15599 | } |
| 15600 | |
Jeff Johnson | da2afa4 | 2018-07-04 10:25:42 -0700 | [diff] [blame] | 15601 | QDF_STATUS sme_deregister_tx_queue_cb(mac_handle_t mac_handle) |
Varun Reddy Yeturu | 076eaa8 | 2018-01-16 12:16:14 -0800 | [diff] [blame] | 15602 | { |
Jeff Johnson | da2afa4 | 2018-07-04 10:25:42 -0700 | [diff] [blame] | 15603 | return sme_register_tx_queue_cb(mac_handle, NULL); |
Varun Reddy Yeturu | 076eaa8 | 2018-01-16 12:16:14 -0800 | [diff] [blame] | 15604 | } |
| 15605 | |
Varun Reddy Yeturu | d33033f | 2018-06-11 10:58:30 -0700 | [diff] [blame] | 15606 | #ifdef WLAN_SUPPORT_TWT |
Jeff Johnson | 3a08ff9 | 2018-07-03 19:40:44 -0700 | [diff] [blame] | 15607 | QDF_STATUS sme_register_twt_enable_complete_cb(mac_handle_t mac_handle, |
| 15608 | twt_enable_cb twt_enable_cb) |
Varun Reddy Yeturu | 3c9f89c | 2018-04-18 19:10:34 -0700 | [diff] [blame] | 15609 | { |
| 15610 | QDF_STATUS status; |
Jeff Johnson | 3a08ff9 | 2018-07-03 19:40:44 -0700 | [diff] [blame] | 15611 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Varun Reddy Yeturu | 3c9f89c | 2018-04-18 19:10:34 -0700 | [diff] [blame] | 15612 | |
| 15613 | status = sme_acquire_global_lock(&mac->sme); |
| 15614 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 15615 | mac->sme.twt_enable_cb = twt_enable_cb; |
| 15616 | sme_release_global_lock(&mac->sme); |
| 15617 | sme_debug("TWT: enable callback set"); |
| 15618 | } else { |
| 15619 | sme_err("Aquiring lock failed %d", status); |
| 15620 | } |
| 15621 | |
| 15622 | return status; |
| 15623 | } |
| 15624 | |
Jeff Johnson | 3a08ff9 | 2018-07-03 19:40:44 -0700 | [diff] [blame] | 15625 | QDF_STATUS sme_register_twt_disable_complete_cb(mac_handle_t mac_handle, |
| 15626 | twt_disable_cb twt_disable_cb) |
Varun Reddy Yeturu | 3c9f89c | 2018-04-18 19:10:34 -0700 | [diff] [blame] | 15627 | { |
| 15628 | QDF_STATUS status; |
Jeff Johnson | 3a08ff9 | 2018-07-03 19:40:44 -0700 | [diff] [blame] | 15629 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Varun Reddy Yeturu | 3c9f89c | 2018-04-18 19:10:34 -0700 | [diff] [blame] | 15630 | |
| 15631 | status = sme_acquire_global_lock(&mac->sme); |
| 15632 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 15633 | mac->sme.twt_disable_cb = twt_disable_cb; |
| 15634 | sme_release_global_lock(&mac->sme); |
| 15635 | sme_debug("TWT: disable callback set"); |
| 15636 | } else { |
| 15637 | sme_err("Aquiring lock failed %d", status); |
| 15638 | } |
| 15639 | |
| 15640 | return status; |
| 15641 | } |
| 15642 | |
Jeff Johnson | 3a08ff9 | 2018-07-03 19:40:44 -0700 | [diff] [blame] | 15643 | QDF_STATUS sme_deregister_twt_enable_complete_cb(mac_handle_t mac_handle) |
Varun Reddy Yeturu | 3c9f89c | 2018-04-18 19:10:34 -0700 | [diff] [blame] | 15644 | { |
Jeff Johnson | 3a08ff9 | 2018-07-03 19:40:44 -0700 | [diff] [blame] | 15645 | return sme_register_twt_enable_complete_cb(mac_handle, NULL); |
Varun Reddy Yeturu | 3c9f89c | 2018-04-18 19:10:34 -0700 | [diff] [blame] | 15646 | } |
| 15647 | |
Jeff Johnson | 3a08ff9 | 2018-07-03 19:40:44 -0700 | [diff] [blame] | 15648 | QDF_STATUS sme_deregister_twt_disable_complete_cb(mac_handle_t mac_handle) |
Varun Reddy Yeturu | 3c9f89c | 2018-04-18 19:10:34 -0700 | [diff] [blame] | 15649 | { |
Jeff Johnson | 3a08ff9 | 2018-07-03 19:40:44 -0700 | [diff] [blame] | 15650 | return sme_register_twt_disable_complete_cb(mac_handle, NULL); |
Varun Reddy Yeturu | 3c9f89c | 2018-04-18 19:10:34 -0700 | [diff] [blame] | 15651 | } |
| 15652 | #endif |
| 15653 | |
Ashish Kumar Dhanotiya | b28338c | 2017-07-21 20:12:34 +0530 | [diff] [blame] | 15654 | QDF_STATUS sme_set_smps_cfg(uint32_t vdev_id, uint32_t param_id, |
| 15655 | uint32_t param_val) |
| 15656 | { |
| 15657 | return wma_configure_smps_params(vdev_id, param_id, param_val); |
| 15658 | } |
| 15659 | |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 15660 | QDF_STATUS sme_ipa_uc_stat_request(tHalHandle hal, uint32_t vdev_id, |
| 15661 | uint32_t param_id, uint32_t param_val, uint32_t req_cat) |
| 15662 | { |
Sandeep Puligilla | e64099d | 2017-05-11 16:38:27 -0700 | [diff] [blame] | 15663 | wma_cli_set_cmd_t *iwcmd; |
| 15664 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 15665 | |
Sandeep Puligilla | e64099d | 2017-05-11 16:38:27 -0700 | [diff] [blame] | 15666 | iwcmd = qdf_mem_malloc(sizeof(*iwcmd)); |
| 15667 | if (!iwcmd) { |
| 15668 | sme_err("Failed alloc memory for iwcmd"); |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 15669 | return QDF_STATUS_E_NOMEM; |
| 15670 | } |
Sandeep Puligilla | e64099d | 2017-05-11 16:38:27 -0700 | [diff] [blame] | 15671 | |
| 15672 | qdf_mem_zero(iwcmd, sizeof(*iwcmd)); |
| 15673 | iwcmd->param_sec_value = 0; |
| 15674 | iwcmd->param_vdev_id = vdev_id; |
| 15675 | iwcmd->param_id = param_id; |
| 15676 | iwcmd->param_vp_dev = req_cat; |
| 15677 | iwcmd->param_value = param_val; |
| 15678 | wma_ipa_uc_stat_request(iwcmd); |
| 15679 | qdf_mem_free(iwcmd); |
Sandeep Puligilla | f587adf | 2017-04-27 19:53:21 -0700 | [diff] [blame] | 15680 | |
| 15681 | return status; |
| 15682 | } |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 15683 | |
| 15684 | QDF_STATUS sme_set_reorder_timeout(tHalHandle hal, |
| 15685 | struct sir_set_rx_reorder_timeout_val *req) |
| 15686 | { |
| 15687 | QDF_STATUS status; |
Zhang Qian | 1e7649e | 2018-06-04 13:07:18 +0800 | [diff] [blame] | 15688 | tp_wma_handle wma_handle; |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 15689 | |
Zhang Qian | 1e7649e | 2018-06-04 13:07:18 +0800 | [diff] [blame] | 15690 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 15691 | status = wma_set_rx_reorder_timeout_val(wma_handle, req); |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 15692 | |
| 15693 | return status; |
| 15694 | } |
| 15695 | |
| 15696 | QDF_STATUS sme_set_rx_set_blocksize(tHalHandle hal, |
| 15697 | struct sir_peer_set_rx_blocksize *req) |
| 15698 | { |
| 15699 | QDF_STATUS status; |
Zhang Qian | 1e7649e | 2018-06-04 13:07:18 +0800 | [diff] [blame] | 15700 | tp_wma_handle wma_handle; |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 15701 | |
Zhang Qian | 1e7649e | 2018-06-04 13:07:18 +0800 | [diff] [blame] | 15702 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 15703 | status = wma_set_rx_blocksize(wma_handle, req); |
lifeng | 6683166 | 2017-05-19 16:01:35 +0800 | [diff] [blame] | 15704 | |
| 15705 | return status; |
| 15706 | } |
Naveen Rawat | 247a868 | 2017-06-05 15:00:31 -0700 | [diff] [blame] | 15707 | |
| 15708 | int sme_cli_set_command(int vdev_id, int param_id, int sval, int vpdev) |
| 15709 | { |
| 15710 | return wma_cli_set_command(vdev_id, param_id, sval, vpdev); |
| 15711 | } |
Vidyullatha Kanchanapally | be0ebb3 | 2017-03-23 14:36:21 +0530 | [diff] [blame] | 15712 | |
Vignesh Viswanathan | a851d75 | 2018-10-03 19:44:38 +0530 | [diff] [blame] | 15713 | int sme_set_enable_mem_deep_sleep(mac_handle_t mac_handle, int vdev_id) |
| 15714 | { |
| 15715 | tpAniSirGlobal mac_ctx = MAC_CONTEXT(mac_handle); |
| 15716 | |
| 15717 | return wma_cli_set_command(vdev_id, WMI_PDEV_PARAM_HYST_EN, |
| 15718 | mac_ctx->mlme_cfg->gen.memory_deep_sleep, |
| 15719 | PDEV_CMD); |
| 15720 | } |
| 15721 | |
| 15722 | int sme_set_cck_tx_fir_override(mac_handle_t mac_handle, int vdev_id) |
| 15723 | { |
| 15724 | tpAniSirGlobal mac_ctx = MAC_CONTEXT(mac_handle); |
| 15725 | |
| 15726 | return wma_cli_set_command(vdev_id, |
| 15727 | WMI_PDEV_PARAM_ENABLE_CCK_TXFIR_OVERRIDE, |
| 15728 | mac_ctx->mlme_cfg->gen.cck_tx_fir_override, |
| 15729 | PDEV_CMD); |
| 15730 | } |
| 15731 | |
Jeff Johnson | d0b6c7e | 2018-07-04 14:53:06 -0700 | [diff] [blame] | 15732 | QDF_STATUS sme_set_bt_activity_info_cb(mac_handle_t mac_handle, |
| 15733 | bt_activity_info_cb cb) |
Vidyullatha Kanchanapally | be0ebb3 | 2017-03-23 14:36:21 +0530 | [diff] [blame] | 15734 | { |
| 15735 | QDF_STATUS status; |
Jeff Johnson | d0b6c7e | 2018-07-04 14:53:06 -0700 | [diff] [blame] | 15736 | tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); |
Vidyullatha Kanchanapally | be0ebb3 | 2017-03-23 14:36:21 +0530 | [diff] [blame] | 15737 | |
| 15738 | status = sme_acquire_global_lock(&mac->sme); |
| 15739 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 15740 | mac->sme.bt_activity_info_cb = cb; |
| 15741 | sme_release_global_lock(&mac->sme); |
| 15742 | sme_debug("bt activity info callback set"); |
| 15743 | } else { |
| 15744 | sme_debug("sme_acquire_global_lock failed %d", status); |
| 15745 | } |
| 15746 | |
| 15747 | return status; |
| 15748 | } |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 15749 | |
| 15750 | QDF_STATUS sme_get_chain_rssi(tHalHandle hal, |
| 15751 | struct get_chain_rssi_req_params *input, |
| 15752 | get_chain_rssi_callback callback, |
| 15753 | void *context) |
| 15754 | { |
| 15755 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 15756 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Zhang Qian | 1e7649e | 2018-06-04 13:07:18 +0800 | [diff] [blame] | 15757 | tp_wma_handle wma_handle; |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 15758 | |
| 15759 | SME_ENTER(); |
| 15760 | |
| 15761 | if (NULL == input) { |
| 15762 | sme_err("Invalid req params"); |
| 15763 | return QDF_STATUS_E_INVAL; |
| 15764 | } |
| 15765 | |
| 15766 | mac_ctx->sme.get_chain_rssi_cb = callback; |
| 15767 | mac_ctx->sme.get_chain_rssi_context = context; |
Zhang Qian | 1e7649e | 2018-06-04 13:07:18 +0800 | [diff] [blame] | 15768 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 15769 | wma_get_chain_rssi(wma_handle, input); |
lifeng | d217d19 | 2017-05-09 19:44:16 +0800 | [diff] [blame] | 15770 | |
| 15771 | SME_EXIT(); |
| 15772 | return status; |
| 15773 | } |
Vignesh Viswanathan | 66c951d | 2017-09-06 12:23:42 +0530 | [diff] [blame] | 15774 | |
Jeff Johnson | 5f9ce2d | 2018-06-09 21:20:45 -0700 | [diff] [blame] | 15775 | QDF_STATUS sme_process_msg_callback(tpAniSirGlobal mac, |
| 15776 | struct scheduler_msg *msg) |
Sandeep Puligilla | 1426d61 | 2017-04-12 18:22:06 -0700 | [diff] [blame] | 15777 | { |
| 15778 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 15779 | |
| 15780 | if (msg == NULL) { |
| 15781 | sme_err("Empty message for SME Msg callback"); |
| 15782 | return status; |
| 15783 | } |
Jeff Johnson | 5f9ce2d | 2018-06-09 21:20:45 -0700 | [diff] [blame] | 15784 | status = sme_process_msg(mac, msg); |
Sandeep Puligilla | 1426d61 | 2017-04-12 18:22:06 -0700 | [diff] [blame] | 15785 | return status; |
| 15786 | } |
| 15787 | |
Vignesh Viswanathan | 66c951d | 2017-09-06 12:23:42 +0530 | [diff] [blame] | 15788 | void sme_display_disconnect_stats(tHalHandle hal, uint8_t session_id) |
| 15789 | { |
| 15790 | struct csr_roam_session *session; |
| 15791 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15792 | |
| 15793 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
| 15794 | sme_err("%s Invalid session id: %d", __func__, session_id); |
| 15795 | return; |
| 15796 | } |
| 15797 | |
| 15798 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 15799 | if (!session) { |
| 15800 | sme_err("%s Failed to get session for id: %d", |
| 15801 | __func__, session_id); |
| 15802 | return; |
| 15803 | } |
| 15804 | |
Nirav Shah | e6194ac | 2018-07-13 11:04:41 +0530 | [diff] [blame] | 15805 | sme_nofl_info("Total No. of Disconnections: %d", |
| 15806 | session->disconnect_stats.disconnection_cnt); |
Vignesh Viswanathan | 66c951d | 2017-09-06 12:23:42 +0530 | [diff] [blame] | 15807 | |
Nirav Shah | e6194ac | 2018-07-13 11:04:41 +0530 | [diff] [blame] | 15808 | sme_nofl_info("No. of Diconnects Triggered by Application: %d", |
| 15809 | session->disconnect_stats.disconnection_by_app); |
Vignesh Viswanathan | 66c951d | 2017-09-06 12:23:42 +0530 | [diff] [blame] | 15810 | |
Nirav Shah | e6194ac | 2018-07-13 11:04:41 +0530 | [diff] [blame] | 15811 | sme_nofl_info("No. of Disassoc Sent by Peer: %d", |
| 15812 | session->disconnect_stats.disassoc_by_peer); |
Vignesh Viswanathan | 66c951d | 2017-09-06 12:23:42 +0530 | [diff] [blame] | 15813 | |
Nirav Shah | e6194ac | 2018-07-13 11:04:41 +0530 | [diff] [blame] | 15814 | sme_nofl_info("No. of Deauth Sent by Peer: %d", |
| 15815 | session->disconnect_stats.deauth_by_peer); |
Vignesh Viswanathan | 66c951d | 2017-09-06 12:23:42 +0530 | [diff] [blame] | 15816 | |
Nirav Shah | e6194ac | 2018-07-13 11:04:41 +0530 | [diff] [blame] | 15817 | sme_nofl_info("No. of Disconnections due to Beacon Miss: %d", |
| 15818 | session->disconnect_stats.bmiss); |
Vignesh Viswanathan | 66c951d | 2017-09-06 12:23:42 +0530 | [diff] [blame] | 15819 | |
Nirav Shah | e6194ac | 2018-07-13 11:04:41 +0530 | [diff] [blame] | 15820 | sme_nofl_info("No. of Disconnections due to Peer Kickout: %d", |
| 15821 | session->disconnect_stats.peer_kickout); |
Vignesh Viswanathan | 66c951d | 2017-09-06 12:23:42 +0530 | [diff] [blame] | 15822 | } |
Nachiket Kukade | aaf8a71 | 2017-07-27 19:15:36 +0530 | [diff] [blame] | 15823 | |
Rachit Kankane | f6834c4 | 2018-08-02 18:47:50 +0530 | [diff] [blame] | 15824 | #ifdef FEATURE_WLAN_DYNAMIC_CVM |
Nachiket Kukade | 8983cf6 | 2017-10-12 18:14:48 +0530 | [diff] [blame] | 15825 | /** |
| 15826 | * sme_set_vc_mode_config() - Set voltage corner config to FW |
| 15827 | * @bitmap: Bitmap that referes to voltage corner config with |
| 15828 | * different phymode and bw configuration |
| 15829 | * |
| 15830 | * Return: QDF_STATUS |
| 15831 | */ |
| 15832 | QDF_STATUS sme_set_vc_mode_config(uint32_t vc_bitmap) |
| 15833 | { |
| 15834 | void *wma_handle; |
| 15835 | |
| 15836 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
| 15837 | if (!wma_handle) { |
| 15838 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15839 | "wma_handle is NULL"); |
| 15840 | return QDF_STATUS_E_FAILURE; |
| 15841 | } |
| 15842 | if (QDF_STATUS_SUCCESS != |
| 15843 | wma_set_vc_mode_config(wma_handle, vc_bitmap)) { |
| 15844 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 15845 | "%s: Failed to set Voltage Control config to FW", |
| 15846 | __func__); |
| 15847 | return QDF_STATUS_E_FAILURE; |
| 15848 | } |
| 15849 | return QDF_STATUS_SUCCESS; |
| 15850 | } |
Rachit Kankane | f6834c4 | 2018-08-02 18:47:50 +0530 | [diff] [blame] | 15851 | #endif |
Nachiket Kukade | 8983cf6 | 2017-10-12 18:14:48 +0530 | [diff] [blame] | 15852 | |
Nachiket Kukade | aaf8a71 | 2017-07-27 19:15:36 +0530 | [diff] [blame] | 15853 | /** |
| 15854 | * sme_set_bmiss_bcnt() - set bmiss config parameters |
| 15855 | * @vdev_id: virtual device for the command |
| 15856 | * @first_cnt: bmiss first value |
| 15857 | * @final_cnt: bmiss final value |
| 15858 | * |
| 15859 | * Return: QDF_STATUS_SUCCESS or non-zero on failure |
| 15860 | */ |
| 15861 | QDF_STATUS sme_set_bmiss_bcnt(uint32_t vdev_id, uint32_t first_cnt, |
| 15862 | uint32_t final_cnt) |
| 15863 | { |
| 15864 | return wma_config_bmiss_bcnt_params(vdev_id, first_cnt, final_cnt); |
| 15865 | } |
Ganesh Kondabattini | 479a8ae | 2017-10-03 16:49:24 +0530 | [diff] [blame] | 15866 | |
| 15867 | QDF_STATUS sme_send_limit_off_channel_params(tHalHandle hal, uint8_t vdev_id, |
| 15868 | bool is_tos_active, uint32_t max_off_chan_time, |
| 15869 | uint32_t rest_time, bool skip_dfs_chan) |
| 15870 | { |
| 15871 | struct sir_limit_off_chan *cmd; |
| 15872 | struct scheduler_msg msg = {0}; |
| 15873 | |
| 15874 | cmd = qdf_mem_malloc(sizeof(*cmd)); |
| 15875 | if (!cmd) { |
| 15876 | sme_err("qdf_mem_malloc failed for limit off channel"); |
| 15877 | return QDF_STATUS_E_NOMEM; |
| 15878 | } |
| 15879 | |
| 15880 | cmd->vdev_id = vdev_id; |
| 15881 | cmd->is_tos_active = is_tos_active; |
| 15882 | cmd->max_off_chan_time = max_off_chan_time; |
| 15883 | cmd->rest_time = rest_time; |
| 15884 | cmd->skip_dfs_chans = skip_dfs_chan; |
| 15885 | |
| 15886 | msg.type = WMA_SET_LIMIT_OFF_CHAN; |
| 15887 | msg.reserved = 0; |
| 15888 | msg.bodyptr = cmd; |
| 15889 | |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 15890 | if (!QDF_IS_STATUS_SUCCESS(scheduler_post_message(QDF_MODULE_ID_SME, |
| 15891 | QDF_MODULE_ID_WMA, |
| 15892 | QDF_MODULE_ID_WMA, |
| 15893 | &msg))) { |
Ganesh Kondabattini | 479a8ae | 2017-10-03 16:49:24 +0530 | [diff] [blame] | 15894 | sme_err("Not able to post WMA_SET_LIMIT_OFF_CHAN to WMA"); |
| 15895 | qdf_mem_free(cmd); |
| 15896 | return QDF_STATUS_E_FAILURE; |
| 15897 | } |
| 15898 | |
| 15899 | return QDF_STATUS_SUCCESS; |
| 15900 | } |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 15901 | |
Qiwei Cai | e689a26 | 2018-07-26 15:50:22 +0800 | [diff] [blame] | 15902 | uint32_t sme_unpack_rsn_ie(tHalHandle hal, uint8_t *buf, |
| 15903 | uint8_t buf_len, tDot11fIERSN *rsn_ie, |
| 15904 | bool append_ie) |
| 15905 | { |
| 15906 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 15907 | |
| 15908 | return dot11f_unpack_ie_rsn(mac_ctx, buf, buf_len, rsn_ie, append_ie); |
| 15909 | } |
| 15910 | |
| 15911 | #ifdef FEATURE_BSS_TRANSITION |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 15912 | /** |
| 15913 | * sme_get_status_for_candidate() - Get bss transition status for candidate |
| 15914 | * @hal: Handle for HAL |
| 15915 | * @conn_bss_desc: connected bss descriptor |
| 15916 | * @bss_desc: candidate bss descriptor |
| 15917 | * @info: candiadate bss information |
| 15918 | * @trans_reason: transition reason code |
| 15919 | * @is_bt_in_progress: bt activity indicator |
| 15920 | * |
| 15921 | * Return : true if candidate is rejected and reject reason is filled |
| 15922 | * @info->status. Otherwise returns false. |
| 15923 | */ |
Jeff Johnson | 22256fe | 2018-06-04 20:25:53 -0700 | [diff] [blame] | 15924 | static bool sme_get_status_for_candidate(tHalHandle hal, |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 15925 | tSirBssDescription *conn_bss_desc, |
| 15926 | tSirBssDescription *bss_desc, |
| 15927 | struct bss_candidate_info *info, |
| 15928 | uint8_t trans_reason, |
| 15929 | bool is_bt_in_progress) |
| 15930 | { |
| 15931 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
Pragaspathi Thilagaraj | cd6aef0 | 2018-09-11 20:30:23 +0530 | [diff] [blame] | 15932 | struct wlan_mlme_mbo *mbo_cfg; |
| 15933 | int8_t current_rssi_mcc_thres; |
| 15934 | |
| 15935 | if (!(mac_ctx->mlme_cfg)) { |
| 15936 | pe_err("mlme cfg is NULL"); |
| 15937 | return false; |
| 15938 | } |
| 15939 | mbo_cfg = &mac_ctx->mlme_cfg->mbo_cfg; |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 15940 | |
| 15941 | /* |
| 15942 | * Low RSSI based rejection |
| 15943 | * If candidate rssi is less than mbo_candidate_rssi_thres and connected |
| 15944 | * bss rssi is greater than mbo_current_rssi_thres, then reject the |
| 15945 | * candidate with MBO reason code 4. |
| 15946 | */ |
Pragaspathi Thilagaraj | cd6aef0 | 2018-09-11 20:30:23 +0530 | [diff] [blame] | 15947 | if ((bss_desc->rssi < mbo_cfg->mbo_candidate_rssi_thres) && |
| 15948 | (conn_bss_desc->rssi > mbo_cfg->mbo_current_rssi_thres)) { |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 15949 | sme_err("Candidate BSS "MAC_ADDRESS_STR" has LOW RSSI(%d), hence reject", |
| 15950 | MAC_ADDR_ARRAY(bss_desc->bssId), bss_desc->rssi); |
| 15951 | info->status = QCA_STATUS_REJECT_LOW_RSSI; |
| 15952 | return true; |
| 15953 | } |
| 15954 | |
| 15955 | if (trans_reason == MBO_TRANSITION_REASON_LOAD_BALANCING || |
| 15956 | trans_reason == MBO_TRANSITION_REASON_TRANSITIONING_TO_PREMIUM_AP) { |
| 15957 | /* |
| 15958 | * MCC rejection |
| 15959 | * If moving to candidate's channel will result in MCC scenario |
| 15960 | * and the rssi of connected bss is greater than |
| 15961 | * mbo_current_rssi_mss_thres, then reject the candidate with |
| 15962 | * MBO reason code 3. |
| 15963 | */ |
Pragaspathi Thilagaraj | cd6aef0 | 2018-09-11 20:30:23 +0530 | [diff] [blame] | 15964 | current_rssi_mcc_thres = mbo_cfg->mbo_current_rssi_mcc_thres; |
| 15965 | if ((conn_bss_desc->rssi > current_rssi_mcc_thres) && |
Jeff Johnson | 9d11885 | 2018-06-10 16:54:59 -0700 | [diff] [blame] | 15966 | csr_is_mcc_channel(mac_ctx, bss_desc->channelId)) { |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 15967 | sme_err("Candidate BSS "MAC_ADDRESS_STR" causes MCC, hence reject", |
| 15968 | MAC_ADDR_ARRAY(bss_desc->bssId)); |
| 15969 | info->status = |
| 15970 | QCA_STATUS_REJECT_INSUFFICIENT_QOS_CAPACITY; |
| 15971 | return true; |
| 15972 | } |
| 15973 | |
| 15974 | /* |
| 15975 | * BT coex rejection |
| 15976 | * If AP is trying to move the client from 5G to 2.4G and moving |
| 15977 | * to 2.4G will result in BT coex and candidate channel rssi is |
| 15978 | * less than mbo_candidate_rssi_btc_thres, then reject the |
| 15979 | * candidate with MBO reason code 2. |
| 15980 | */ |
| 15981 | if (WLAN_REG_IS_5GHZ_CH(conn_bss_desc->channelId) && |
| 15982 | WLAN_REG_IS_24GHZ_CH(bss_desc->channelId) && |
| 15983 | is_bt_in_progress && |
Pragaspathi Thilagaraj | cd6aef0 | 2018-09-11 20:30:23 +0530 | [diff] [blame] | 15984 | (bss_desc->rssi < mbo_cfg->mbo_candidate_rssi_btc_thres)) { |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 15985 | sme_err("Candidate BSS "MAC_ADDRESS_STR" causes BT coex, hence reject", |
| 15986 | MAC_ADDR_ARRAY(bss_desc->bssId)); |
| 15987 | info->status = |
| 15988 | QCA_STATUS_REJECT_EXCESSIVE_DELAY_EXPECTED; |
| 15989 | return true; |
| 15990 | } |
| 15991 | |
| 15992 | /* |
| 15993 | * LTE coex rejection |
| 15994 | * If moving to candidate's channel can cause LTE coex, then |
| 15995 | * reject the candidate with MBO reason code 5. |
| 15996 | */ |
| 15997 | if (policy_mgr_is_safe_channel(mac_ctx->psoc, |
| 15998 | conn_bss_desc->channelId) && |
| 15999 | !(policy_mgr_is_safe_channel(mac_ctx->psoc, |
| 16000 | bss_desc->channelId))) { |
| 16001 | sme_err("High interference expected if transitioned to BSS " |
| 16002 | MAC_ADDRESS_STR" hence reject", |
| 16003 | MAC_ADDR_ARRAY(bss_desc->bssId)); |
| 16004 | info->status = |
| 16005 | QCA_STATUS_REJECT_HIGH_INTERFERENCE; |
| 16006 | return true; |
| 16007 | } |
| 16008 | } |
| 16009 | |
| 16010 | return false; |
| 16011 | } |
| 16012 | |
| 16013 | /** |
| 16014 | * wlan_hdd_get_bss_transition_status() - get bss transition status all cadidates |
| 16015 | * @adapter : Pointer to adapter |
| 16016 | * @transition_reason : Transition reason |
| 16017 | * @info : bss candidate information |
| 16018 | * @n_candidates : number of candidates |
| 16019 | * |
| 16020 | * Return : 0 on success otherwise errno |
| 16021 | */ |
| 16022 | int sme_get_bss_transition_status(tHalHandle hal, |
| 16023 | uint8_t transition_reason, |
| 16024 | struct qdf_mac_addr *bssid, |
| 16025 | struct bss_candidate_info *info, |
| 16026 | uint16_t n_candidates, |
| 16027 | bool is_bt_in_progress) |
| 16028 | { |
| 16029 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 16030 | tSirBssDescription *bss_desc, *conn_bss_desc; |
| 16031 | tCsrScanResultInfo *res, *conn_res; |
| 16032 | uint16_t i; |
| 16033 | |
| 16034 | if (!n_candidates || !info) { |
| 16035 | sme_err("No candidate info available"); |
| 16036 | return QDF_STATUS_E_INVAL; |
| 16037 | } |
| 16038 | |
| 16039 | conn_res = qdf_mem_malloc(sizeof(tCsrScanResultInfo)); |
| 16040 | if (!conn_res) { |
| 16041 | sme_err("Failed to allocate memory for conn_res"); |
| 16042 | return QDF_STATUS_E_NOMEM; |
| 16043 | } |
| 16044 | |
| 16045 | res = qdf_mem_malloc(sizeof(tCsrScanResultInfo)); |
| 16046 | if (!res) { |
| 16047 | sme_err("Failed to allocate memory for conn_res"); |
| 16048 | status = QDF_STATUS_E_NOMEM; |
| 16049 | goto free; |
| 16050 | } |
| 16051 | |
| 16052 | /* Get the connected BSS descriptor */ |
| 16053 | status = sme_scan_get_result_for_bssid(hal, bssid, conn_res); |
| 16054 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 16055 | sme_err("Failed to find connected BSS in scan list"); |
| 16056 | goto free; |
| 16057 | } |
| 16058 | conn_bss_desc = &conn_res->BssDescriptor; |
| 16059 | |
| 16060 | for (i = 0; i < n_candidates; i++) { |
| 16061 | /* Get candidate BSS descriptors */ |
| 16062 | status = sme_scan_get_result_for_bssid(hal, &info[i].bssid, |
| 16063 | res); |
| 16064 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 16065 | sme_err("BSS "MAC_ADDRESS_STR" not present in scan list", |
| 16066 | MAC_ADDR_ARRAY(info[i].bssid.bytes)); |
| 16067 | info[i].status = QCA_STATUS_REJECT_UNKNOWN; |
| 16068 | continue; |
| 16069 | } |
| 16070 | |
| 16071 | bss_desc = &res->BssDescriptor; |
| 16072 | if (!sme_get_status_for_candidate(hal, conn_bss_desc, bss_desc, |
| 16073 | &info[i], transition_reason, is_bt_in_progress)) { |
| 16074 | /* |
| 16075 | * If status is not over written, it means it is a |
| 16076 | * candidate for accept. |
| 16077 | */ |
| 16078 | info[i].status = QCA_STATUS_ACCEPT; |
| 16079 | } |
| 16080 | } |
| 16081 | |
| 16082 | /* success */ |
| 16083 | status = QDF_STATUS_SUCCESS; |
| 16084 | |
| 16085 | free: |
| 16086 | /* free allocated memory */ |
| 16087 | if (conn_res) |
| 16088 | qdf_mem_free(conn_res); |
| 16089 | if (res) |
| 16090 | qdf_mem_free(res); |
| 16091 | |
| 16092 | return status; |
| 16093 | } |
Qiwei Cai | e689a26 | 2018-07-26 15:50:22 +0800 | [diff] [blame] | 16094 | #endif /* FEATURE_BSS_TRANSITION */ |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 16095 | |
Vignesh Viswanathan | 79f7e3f | 2018-09-30 23:56:10 +0530 | [diff] [blame] | 16096 | bool sme_is_conn_state_connected(mac_handle_t hal, uint8_t session_id) |
| 16097 | { |
| 16098 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16099 | |
| 16100 | return csr_is_conn_state_connected(mac_ctx, session_id); |
| 16101 | } |
| 16102 | |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 16103 | void sme_enable_roaming_on_connected_sta(tHalHandle hal) |
| 16104 | { |
| 16105 | uint8_t session_id; |
| 16106 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16107 | QDF_STATUS status; |
| 16108 | |
| 16109 | session_id = csr_get_roam_enabled_sta_sessionid(mac_ctx); |
| 16110 | if (session_id != CSR_SESSION_ID_INVALID) |
| 16111 | return; |
| 16112 | |
| 16113 | session_id = csr_get_connected_infra(mac_ctx); |
| 16114 | if (session_id == CSR_SESSION_ID_INVALID) { |
| 16115 | sme_debug("No STA in conencted state"); |
| 16116 | return; |
| 16117 | } |
| 16118 | |
| 16119 | sme_debug("Roaming not enabled on any STA, enable roaming on session %d", |
| 16120 | session_id); |
| 16121 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 16122 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 16123 | csr_roam_offload_scan(mac_ctx, session_id, |
| 16124 | ROAM_SCAN_OFFLOAD_START, |
| 16125 | REASON_CTX_INIT); |
| 16126 | sme_release_global_lock(&mac_ctx->sme); |
| 16127 | } |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 16128 | } |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 16129 | |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 16130 | int16_t sme_get_oper_chan_freq(struct wlan_objmgr_vdev *vdev) |
| 16131 | { |
| 16132 | uint8_t vdev_id, chan; |
| 16133 | struct csr_roam_session *session; |
| 16134 | tpAniSirGlobal mac_ctx; |
| 16135 | tHalHandle h_hal; |
| 16136 | int16_t freq = 0; |
| 16137 | |
| 16138 | if (vdev == NULL) { |
| 16139 | sme_err("Invalid vdev id is passed"); |
| 16140 | return 0; |
| 16141 | } |
| 16142 | |
| 16143 | h_hal = cds_get_context(QDF_MODULE_ID_SME); |
Arif Hussain | d15902c | 2018-03-02 00:08:29 -0800 | [diff] [blame] | 16144 | if (!h_hal) { |
| 16145 | sme_err("h_hal is null"); |
| 16146 | return 0; |
| 16147 | } |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 16148 | mac_ctx = PMAC_STRUCT(h_hal); |
| 16149 | vdev_id = wlan_vdev_get_id(vdev); |
| 16150 | if (!CSR_IS_SESSION_VALID(mac_ctx, vdev_id)) { |
| 16151 | sme_err("Invalid vdev id is passed"); |
| 16152 | return 0; |
| 16153 | } |
| 16154 | |
| 16155 | session = CSR_GET_SESSION(mac_ctx, vdev_id); |
| 16156 | chan = csr_get_infra_operation_channel(mac_ctx, vdev_id); |
| 16157 | if (chan) |
| 16158 | freq = cds_chan_to_freq(chan); |
| 16159 | |
| 16160 | return freq; |
| 16161 | } |
| 16162 | |
| 16163 | enum phy_ch_width sme_get_oper_ch_width(struct wlan_objmgr_vdev *vdev) |
| 16164 | { |
| 16165 | uint8_t vdev_id; |
| 16166 | struct csr_roam_session *session; |
| 16167 | tpAniSirGlobal mac_ctx; |
| 16168 | tHalHandle h_hal; |
| 16169 | enum phy_ch_width ch_width = CH_WIDTH_20MHZ; |
| 16170 | |
| 16171 | if (vdev == NULL) { |
| 16172 | sme_err("Invalid vdev id is passed"); |
| 16173 | return CH_WIDTH_INVALID; |
| 16174 | } |
| 16175 | |
| 16176 | h_hal = cds_get_context(QDF_MODULE_ID_SME); |
Arif Hussain | d15902c | 2018-03-02 00:08:29 -0800 | [diff] [blame] | 16177 | if (!h_hal) { |
| 16178 | sme_err("h_hal is null"); |
| 16179 | return CH_WIDTH_INVALID; |
| 16180 | } |
Sandeep Puligilla | 063a434 | 2018-01-10 02:50:14 -0800 | [diff] [blame] | 16181 | mac_ctx = PMAC_STRUCT(h_hal); |
| 16182 | vdev_id = wlan_vdev_get_id(vdev); |
| 16183 | if (!CSR_IS_SESSION_VALID(mac_ctx, vdev_id)) { |
| 16184 | sme_err("Invalid vdev id is passed"); |
| 16185 | return CH_WIDTH_INVALID; |
| 16186 | } |
| 16187 | |
| 16188 | session = CSR_GET_SESSION(mac_ctx, vdev_id); |
| 16189 | |
| 16190 | if (csr_is_conn_state_connected(mac_ctx, vdev_id)) |
| 16191 | ch_width = session->connectedProfile.vht_channel_width; |
| 16192 | |
| 16193 | return ch_width; |
| 16194 | } |
| 16195 | |
| 16196 | int sme_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev, |
| 16197 | uint16_t *sec20chan_freq) |
| 16198 | { |
| 16199 | uint8_t vdev_id; |
| 16200 | |
| 16201 | vdev_id = wlan_vdev_get_id(vdev); |
| 16202 | /* Need to extend */ |
| 16203 | return 0; |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 16204 | } |
| 16205 | |
Padma, Santhosh Kumar | dd3f485 | 2018-01-16 18:51:51 +0530 | [diff] [blame] | 16206 | #ifdef WLAN_FEATURE_SAE |
| 16207 | QDF_STATUS sme_handle_sae_msg(tHalHandle hal, uint8_t session_id, |
| 16208 | uint8_t sae_status) |
| 16209 | { |
| 16210 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 16211 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 16212 | struct sir_sae_msg *sae_msg; |
| 16213 | struct scheduler_msg sch_msg = {0}; |
| 16214 | |
| 16215 | qdf_status = sme_acquire_global_lock(&mac->sme); |
| 16216 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 16217 | sae_msg = qdf_mem_malloc(sizeof(*sae_msg)); |
| 16218 | if (!sae_msg) { |
| 16219 | qdf_status = QDF_STATUS_E_NOMEM; |
| 16220 | sme_err("SAE: memory allocation failed"); |
| 16221 | } else { |
| 16222 | sae_msg->message_type = eWNI_SME_SEND_SAE_MSG; |
| 16223 | sae_msg->length = sizeof(*sae_msg); |
| 16224 | sae_msg->session_id = session_id; |
| 16225 | sae_msg->sae_status = sae_status; |
| 16226 | sme_debug("SAE: sae_status %d session_id %d", |
| 16227 | sae_msg->sae_status, |
| 16228 | sae_msg->session_id); |
| 16229 | |
| 16230 | sch_msg.type = eWNI_SME_SEND_SAE_MSG; |
| 16231 | sch_msg.bodyptr = sae_msg; |
| 16232 | |
| 16233 | qdf_status = |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 16234 | scheduler_post_message(QDF_MODULE_ID_SME, |
| 16235 | QDF_MODULE_ID_PE, |
| 16236 | QDF_MODULE_ID_PE, |
| 16237 | &sch_msg); |
Padma, Santhosh Kumar | dd3f485 | 2018-01-16 18:51:51 +0530 | [diff] [blame] | 16238 | } |
| 16239 | sme_release_global_lock(&mac->sme); |
| 16240 | } |
| 16241 | |
| 16242 | return qdf_status; |
| 16243 | } |
| 16244 | #endif |
Vignesh Viswanathan | 0a56929 | 2018-02-14 15:34:47 +0530 | [diff] [blame] | 16245 | |
| 16246 | bool sme_is_sta_key_exchange_in_progress(tHalHandle hal, uint8_t session_id) |
| 16247 | { |
| 16248 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16249 | |
| 16250 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
| 16251 | sme_err("Invalid session id: %d", session_id); |
| 16252 | return false; |
| 16253 | } |
| 16254 | |
| 16255 | return CSR_IS_WAIT_FOR_KEY(mac_ctx, session_id); |
| 16256 | } |
Vignesh Viswanathan | a2f5ce58 | 2018-05-09 20:38:39 +0530 | [diff] [blame] | 16257 | |
| 16258 | bool sme_validate_channel_list(tHalHandle hal, |
| 16259 | uint8_t *chan_list, |
| 16260 | uint8_t num_channels) |
| 16261 | { |
| 16262 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16263 | uint8_t i = 0; |
| 16264 | uint8_t j; |
| 16265 | bool found; |
| 16266 | struct csr_channel *ch_lst_info = &mac_ctx->scan.base_channels; |
| 16267 | |
| 16268 | if (!chan_list || !num_channels) { |
| 16269 | sme_err("Chan list empty %pK or num_channels is 0", chan_list); |
| 16270 | return false; |
| 16271 | } |
| 16272 | |
| 16273 | while (i < num_channels) { |
| 16274 | found = false; |
| 16275 | for (j = 0; j < ch_lst_info->numChannels; j++) { |
| 16276 | if (ch_lst_info->channelList[j] == chan_list[i]) { |
| 16277 | found = true; |
| 16278 | break; |
| 16279 | } |
| 16280 | } |
| 16281 | |
| 16282 | if (!found) { |
| 16283 | sme_debug("Invalid channel %d", chan_list[i]); |
| 16284 | return false; |
| 16285 | } |
| 16286 | |
| 16287 | i++; |
| 16288 | } |
Arif Hussain | 0e24680 | 2018-05-01 18:13:44 -0700 | [diff] [blame] | 16289 | |
Vignesh Viswanathan | a2f5ce58 | 2018-05-09 20:38:39 +0530 | [diff] [blame] | 16290 | return true; |
| 16291 | } |
Arif Hussain | 0e24680 | 2018-05-01 18:13:44 -0700 | [diff] [blame] | 16292 | |
| 16293 | void sme_set_amsdu(tHalHandle hal, bool enable) |
| 16294 | { |
| 16295 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16296 | mac_ctx->is_usr_cfg_amsdu_enabled = enable; |
| 16297 | } |
Naveen Rawat | fa2a100 | 2018-05-17 16:06:37 -0700 | [diff] [blame] | 16298 | |
| 16299 | uint8_t sme_get_mcs_idx(uint16_t max_rate, uint8_t rate_flags, |
Hanumanth Reddy Pothula | 834f943 | 2018-05-30 14:20:32 +0530 | [diff] [blame] | 16300 | uint8_t *nss, uint8_t *mcs_rate_flags) |
Naveen Rawat | fa2a100 | 2018-05-17 16:06:37 -0700 | [diff] [blame] | 16301 | { |
| 16302 | return wma_get_mcs_idx(max_rate, rate_flags, nss, mcs_rate_flags); |
| 16303 | } |
Chaoli Zhou | 75b062f | 2018-06-11 12:36:54 +0800 | [diff] [blame] | 16304 | |
| 16305 | bool sme_find_session_by_bssid(tHalHandle hal, uint8_t *bssid) |
| 16306 | { |
| 16307 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16308 | bool ret; |
| 16309 | |
| 16310 | ret = csr_find_session_by_bssid(mac_ctx, bssid); |
| 16311 | |
| 16312 | return ret; |
| 16313 | } |
Rajeev Kumar Sirasanagandla | 4f20b67 | 2018-03-12 13:52:50 +0530 | [diff] [blame] | 16314 | |
| 16315 | QDF_STATUS |
| 16316 | sme_get_roam_scan_stats(tHalHandle hal, roam_scan_stats_cb cb, void *context, |
| 16317 | uint32_t vdev_id) |
| 16318 | { |
| 16319 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 16320 | tpAniSirGlobal mac = PMAC_STRUCT(hal); |
| 16321 | struct scheduler_msg msg = {0}; |
| 16322 | struct sir_roam_scan_stats *req; |
| 16323 | |
| 16324 | req = qdf_mem_malloc(sizeof(*req)); |
| 16325 | if (!req) { |
| 16326 | sme_err("Failed allocate memory for roam scan stats req"); |
| 16327 | return QDF_STATUS_E_NOMEM; |
| 16328 | } |
| 16329 | |
| 16330 | req->vdev_id = vdev_id; |
| 16331 | req->cb = cb; |
| 16332 | req->context = context; |
| 16333 | |
| 16334 | status = sme_acquire_global_lock(&mac->sme); |
| 16335 | if (QDF_IS_STATUS_SUCCESS(status)) { |
| 16336 | msg.bodyptr = req; |
| 16337 | msg.type = WMA_GET_ROAM_SCAN_STATS; |
| 16338 | msg.reserved = 0; |
gaurank kathpalia | 36b0c58 | 2018-08-28 17:45:43 +0530 | [diff] [blame] | 16339 | status = scheduler_post_message(QDF_MODULE_ID_SME, |
| 16340 | QDF_MODULE_ID_WMA, |
| 16341 | QDF_MODULE_ID_WMA, |
| 16342 | &msg); |
Rajeev Kumar Sirasanagandla | 4f20b67 | 2018-03-12 13:52:50 +0530 | [diff] [blame] | 16343 | sme_release_global_lock(&mac->sme); |
| 16344 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 16345 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 16346 | FL("post roam scan stats req failed")); |
| 16347 | status = QDF_STATUS_E_FAILURE; |
| 16348 | qdf_mem_free(req); |
| 16349 | } |
| 16350 | } else { |
| 16351 | sme_err("sme_acquire_global_lock failed"); |
| 16352 | qdf_mem_free(req); |
| 16353 | } |
| 16354 | |
| 16355 | return status; |
| 16356 | } |
Vignesh Viswanathan | 987f0bb | 2018-09-17 17:00:29 +0530 | [diff] [blame] | 16357 | |
| 16358 | void sme_update_score_config(tHalHandle hal, |
| 16359 | struct scoring_config *score_config) |
| 16360 | { |
| 16361 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); |
| 16362 | struct wlan_mlme_scoring_cfg *mlme_scoring_cfg; |
| 16363 | |
| 16364 | mlme_scoring_cfg = &mac_ctx->mlme_cfg->scoring; |
| 16365 | |
| 16366 | score_config->weight_cfg.rssi_weightage = |
| 16367 | mlme_scoring_cfg->weight_cfg.rssi_weightage; |
| 16368 | score_config->weight_cfg.ht_caps_weightage = |
| 16369 | mlme_scoring_cfg->weight_cfg.ht_caps_weightage; |
| 16370 | score_config->weight_cfg.vht_caps_weightage = |
| 16371 | mlme_scoring_cfg->weight_cfg.vht_caps_weightage; |
| 16372 | score_config->weight_cfg.he_caps_weightage = |
| 16373 | mlme_scoring_cfg->weight_cfg.he_caps_weightage; |
| 16374 | score_config->weight_cfg.chan_width_weightage = |
| 16375 | mlme_scoring_cfg->weight_cfg.chan_width_weightage; |
| 16376 | score_config->weight_cfg.chan_band_weightage = |
| 16377 | mlme_scoring_cfg->weight_cfg.chan_band_weightage; |
| 16378 | score_config->weight_cfg.nss_weightage = |
| 16379 | mlme_scoring_cfg->weight_cfg.nss_weightage; |
| 16380 | score_config->weight_cfg.beamforming_cap_weightage = |
| 16381 | mlme_scoring_cfg->weight_cfg.beamforming_cap_weightage; |
| 16382 | score_config->weight_cfg.pcl_weightage = |
| 16383 | mlme_scoring_cfg->weight_cfg.pcl_weightage; |
| 16384 | score_config->weight_cfg.channel_congestion_weightage = |
| 16385 | mlme_scoring_cfg->weight_cfg.channel_congestion_weightage; |
| 16386 | score_config->weight_cfg.oce_wan_weightage = |
| 16387 | mlme_scoring_cfg->weight_cfg.oce_wan_weightage; |
| 16388 | |
| 16389 | score_config->bandwidth_weight_per_index = |
| 16390 | mlme_scoring_cfg->bandwidth_weight_per_index; |
| 16391 | score_config->nss_weight_per_index = |
| 16392 | mlme_scoring_cfg->nss_weight_per_index; |
| 16393 | score_config->band_weight_per_index = |
| 16394 | mlme_scoring_cfg->band_weight_per_index; |
| 16395 | |
| 16396 | score_config->rssi_score.best_rssi_threshold = |
| 16397 | mlme_scoring_cfg->rssi_score.best_rssi_threshold; |
| 16398 | score_config->rssi_score.good_rssi_threshold = |
| 16399 | mlme_scoring_cfg->rssi_score.good_rssi_threshold; |
| 16400 | score_config->rssi_score.bad_rssi_threshold = |
| 16401 | mlme_scoring_cfg->rssi_score.bad_rssi_threshold; |
| 16402 | score_config->rssi_score.good_rssi_pcnt = |
| 16403 | mlme_scoring_cfg->rssi_score.good_rssi_pcnt; |
| 16404 | score_config->rssi_score.bad_rssi_pcnt = |
| 16405 | mlme_scoring_cfg->rssi_score.bad_rssi_pcnt; |
| 16406 | score_config->rssi_score.good_rssi_bucket_size = |
| 16407 | mlme_scoring_cfg->rssi_score.good_rssi_bucket_size; |
| 16408 | score_config->rssi_score.bad_rssi_bucket_size = |
| 16409 | mlme_scoring_cfg->rssi_score.bad_rssi_bucket_size; |
| 16410 | score_config->rssi_score.rssi_pref_5g_rssi_thresh = |
| 16411 | mlme_scoring_cfg->rssi_score.rssi_pref_5g_rssi_thresh; |
| 16412 | |
| 16413 | score_config->esp_qbss_scoring.num_slot = |
| 16414 | mlme_scoring_cfg->esp_qbss_scoring.num_slot; |
| 16415 | score_config->esp_qbss_scoring.score_pcnt3_to_0 = |
| 16416 | mlme_scoring_cfg->esp_qbss_scoring.score_pcnt3_to_0; |
| 16417 | score_config->esp_qbss_scoring.score_pcnt7_to_4 = |
| 16418 | mlme_scoring_cfg->esp_qbss_scoring.score_pcnt7_to_4; |
| 16419 | score_config->esp_qbss_scoring.score_pcnt11_to_8 = |
| 16420 | mlme_scoring_cfg->esp_qbss_scoring.score_pcnt11_to_8; |
| 16421 | score_config->esp_qbss_scoring.score_pcnt15_to_12 = |
| 16422 | mlme_scoring_cfg->esp_qbss_scoring.score_pcnt15_to_12; |
| 16423 | |
| 16424 | score_config->oce_wan_scoring.num_slot = |
| 16425 | mlme_scoring_cfg->oce_wan_scoring.num_slot; |
| 16426 | score_config->oce_wan_scoring.score_pcnt3_to_0 = |
| 16427 | mlme_scoring_cfg->oce_wan_scoring.score_pcnt3_to_0; |
| 16428 | score_config->oce_wan_scoring.score_pcnt7_to_4 = |
| 16429 | mlme_scoring_cfg->oce_wan_scoring.score_pcnt7_to_4; |
| 16430 | score_config->oce_wan_scoring.score_pcnt11_to_8 = |
| 16431 | mlme_scoring_cfg->oce_wan_scoring.score_pcnt11_to_8; |
| 16432 | score_config->oce_wan_scoring.score_pcnt15_to_12 = |
| 16433 | mlme_scoring_cfg->oce_wan_scoring.score_pcnt15_to_12; |
| 16434 | } |