Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Nitesh Shah | 82c5281 | 2016-12-27 12:27:51 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /* |
| 29 | * This file lim_send_sme_rspMessages.cc contains the functions |
| 30 | * for sending SME response/notification messages to applications |
| 31 | * above MAC software. |
| 32 | * Author: Chandra Modumudi |
| 33 | * Date: 02/13/02 |
| 34 | * History:- |
| 35 | * Date Modified by Modification Information |
| 36 | * -------------------------------------------------------------------- |
| 37 | */ |
| 38 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 39 | #include "qdf_types.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 40 | #include "wni_api.h" |
| 41 | #include "sir_common.h" |
| 42 | #include "ani_global.h" |
| 43 | |
| 44 | #include "wni_cfg.h" |
| 45 | #include "sys_def.h" |
| 46 | #include "cfg_api.h" |
| 47 | |
| 48 | #include "sch_api.h" |
| 49 | #include "utils_api.h" |
| 50 | #include "lim_utils.h" |
| 51 | #include "lim_security_utils.h" |
| 52 | #include "lim_ser_des_utils.h" |
| 53 | #include "lim_send_sme_rsp_messages.h" |
| 54 | #include "lim_ibss_peer_mgmt.h" |
| 55 | #include "lim_session_utils.h" |
| 56 | #include "lim_types.h" |
| 57 | #include "sir_api.h" |
Naveen Rawat | 3b6068c | 2016-04-14 19:01:06 -0700 | [diff] [blame] | 58 | #include "cds_regdomain.h" |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 59 | #include "lim_send_messages.h" |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 60 | #include "nan_datapath.h" |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 61 | #include "lim_assoc_utils.h" |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 62 | #include "wlan_reg_services_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 63 | |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 64 | #ifdef CONVERGED_TDLS_ENABLE |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 65 | #include "wlan_tdls_tgt_api.h" |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 66 | #endif |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 67 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 68 | static void lim_handle_join_rsp_status(tpAniSirGlobal mac_ctx, |
| 69 | tpPESession session_entry, tSirResultCodes result_code, |
| 70 | tpSirSmeJoinRsp sme_join_rsp); |
| 71 | |
| 72 | /** |
| 73 | * lim_send_sme_rsp() - Send Response to upper layers |
| 74 | * @mac_ctx: Pointer to Global MAC structure |
| 75 | * @msg_type: Indicates message type |
| 76 | * @result_code: Indicates the result of previously issued |
| 77 | * eWNI_SME_msg_type_REQ message |
| 78 | * |
| 79 | * This function is called by lim_process_sme_req_messages() to send |
| 80 | * eWNI_SME_START_RSP, eWNI_SME_STOP_BSS_RSP |
| 81 | * or eWNI_SME_SWITCH_CHL_RSP messages to applications above MAC |
| 82 | * Software. |
| 83 | * |
| 84 | * Return: None |
| 85 | */ |
| 86 | |
| 87 | void |
| 88 | lim_send_sme_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type, |
| 89 | tSirResultCodes result_code, uint8_t sme_session_id, |
| 90 | uint16_t sme_transaction_id) |
| 91 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 92 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 93 | tSirSmeRsp *sme_rsp; |
| 94 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 95 | pe_debug("Sending message: %s with reasonCode: %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 96 | lim_msg_str(msg_type), lim_result_code_str(result_code)); |
| 97 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 98 | sme_rsp = qdf_mem_malloc(sizeof(tSirSmeRsp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 99 | if (NULL == sme_rsp) { |
| 100 | /* Buffer not available. Log error */ |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 101 | pe_err("call to AllocateMemory failed for eWNI_SME_*_RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 102 | return; |
| 103 | } |
| 104 | |
| 105 | sme_rsp->messageType = msg_type; |
| 106 | sme_rsp->length = sizeof(tSirSmeRsp); |
| 107 | sme_rsp->statusCode = result_code; |
| 108 | |
| 109 | sme_rsp->sessionId = sme_session_id; |
| 110 | sme_rsp->transactionId = sme_transaction_id; |
| 111 | |
| 112 | msg.type = msg_type; |
| 113 | msg.bodyptr = sme_rsp; |
| 114 | msg.bodyval = 0; |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 115 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_TX_SME_MSG, |
| 116 | sme_session_id, msg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 117 | |
| 118 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 119 | switch (msg_type) { |
| 120 | case eWNI_SME_STOP_BSS_RSP: |
| 121 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_STOP_BSS_RSP_EVENT, |
| 122 | NULL, (uint16_t) result_code, 0); |
| 123 | break; |
| 124 | } |
| 125 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 126 | lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT); |
| 127 | } |
| 128 | |
| 129 | |
| 130 | |
| 131 | /** |
| 132 | * lim_send_sme_roc_rsp() - Send Response to SME |
| 133 | * @mac_ctx: Pointer to Global MAC structure |
| 134 | * @status: Resume link status |
| 135 | * @result_code: Result of the ROC request |
| 136 | * @sme_session_id: SME sesson Id |
| 137 | * @scan_id: Scan Identifier |
| 138 | * |
| 139 | * This function is called to send ROC rsp |
| 140 | * message to SME. |
| 141 | * |
| 142 | * Return: None |
| 143 | */ |
| 144 | void |
| 145 | lim_send_sme_roc_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type, |
| 146 | tSirResultCodes result_code, uint8_t sme_session_id, |
| 147 | uint32_t scan_id) |
| 148 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 149 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 150 | struct sir_roc_rsp *sme_rsp; |
| 151 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 152 | pe_debug("Sending message: %s with reasonCode: %s scanId: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 153 | lim_msg_str(msg_type), lim_result_code_str(result_code), |
| 154 | scan_id); |
| 155 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 156 | sme_rsp = qdf_mem_malloc(sizeof(struct sir_roc_rsp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 157 | if (NULL == sme_rsp) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 158 | pe_err("call to AllocateMemory failed for eWNI_SME_*_RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 159 | return; |
| 160 | } |
| 161 | |
| 162 | sme_rsp->message_type = msg_type; |
| 163 | sme_rsp->length = sizeof(struct sir_roc_rsp); |
| 164 | sme_rsp->status = result_code; |
| 165 | |
| 166 | sme_rsp->session_id = sme_session_id; |
| 167 | sme_rsp->scan_id = scan_id; |
| 168 | |
| 169 | msg.type = msg_type; |
| 170 | msg.bodyptr = sme_rsp; |
| 171 | msg.bodyval = 0; |
| 172 | MTRACE(mac_trace_msg_tx(mac_ctx, sme_session_id, msg.type)); |
| 173 | lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT); |
| 174 | } |
| 175 | |
| 176 | |
| 177 | /** |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 178 | * lim_get_max_rate_flags() - Get rate flags |
| 179 | * @mac_ctx: Pointer to global MAC structure |
| 180 | * @sta_ds: Pointer to station ds structure |
| 181 | * |
| 182 | * This function is called to get the rate flags for a connection |
| 183 | * from the station ds structure depending on the ht and the vht |
| 184 | * channel width supported. |
| 185 | * |
| 186 | * Return: Returns the populated rate_flags |
| 187 | */ |
| 188 | uint32_t lim_get_max_rate_flags(tpAniSirGlobal mac_ctx, tpDphHashNode sta_ds) |
| 189 | { |
| 190 | uint32_t rate_flags = 0; |
| 191 | |
| 192 | if (sta_ds == NULL) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 193 | pe_err("sta_ds is NULL"); |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 194 | return rate_flags; |
| 195 | } |
| 196 | |
| 197 | if (!sta_ds->mlmStaContext.htCapability && |
| 198 | !sta_ds->mlmStaContext.vhtCapability) { |
| 199 | rate_flags |= eHAL_TX_RATE_LEGACY; |
| 200 | } else { |
| 201 | if (sta_ds->mlmStaContext.vhtCapability) { |
| 202 | if (WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ == |
| 203 | sta_ds->vhtSupportedChannelWidthSet) { |
| 204 | rate_flags |= eHAL_TX_RATE_VHT80; |
| 205 | } else if (WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ == |
| 206 | sta_ds->vhtSupportedChannelWidthSet) { |
| 207 | if (sta_ds->htSupportedChannelWidthSet) |
| 208 | rate_flags |= eHAL_TX_RATE_VHT40; |
| 209 | else |
| 210 | rate_flags |= eHAL_TX_RATE_VHT20; |
| 211 | } |
| 212 | } else if (sta_ds->mlmStaContext.htCapability) { |
| 213 | if (sta_ds->htSupportedChannelWidthSet) |
| 214 | rate_flags |= eHAL_TX_RATE_HT40; |
| 215 | else |
| 216 | rate_flags |= eHAL_TX_RATE_HT20; |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | if (sta_ds->htShortGI20Mhz || sta_ds->htShortGI40Mhz) |
| 221 | rate_flags |= eHAL_TX_RATE_SGI; |
| 222 | |
| 223 | return rate_flags; |
| 224 | } |
| 225 | |
| 226 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 227 | * lim_send_sme_join_reassoc_rsp_after_resume() - Send Response to SME |
| 228 | * @mac_ctx Pointer to Global MAC structure |
| 229 | * @status Resume link status |
| 230 | * @ctx context passed while calling resmune link. |
| 231 | * (join response to be sent) |
| 232 | * |
| 233 | * This function is called to send Join/Reassoc rsp |
| 234 | * message to SME after the resume link. |
| 235 | * |
| 236 | * Return: None |
| 237 | */ |
| 238 | static void lim_send_sme_join_reassoc_rsp_after_resume(tpAniSirGlobal mac_ctx, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 239 | QDF_STATUS status, uint32_t *ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 240 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 241 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 242 | tpSirSmeJoinRsp sme_join_rsp = (tpSirSmeJoinRsp) ctx; |
| 243 | |
| 244 | msg.type = sme_join_rsp->messageType; |
| 245 | msg.bodyptr = sme_join_rsp; |
| 246 | msg.bodyval = 0; |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 247 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_TX_SME_MSG, NO_SESSION, msg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 248 | lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT); |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * lim_handle_join_rsp_status() - Handle the response. |
| 253 | * @mac_ctx: Pointer to Global MAC structure |
| 254 | * @session_entry: PE Session Info |
| 255 | * @result_code: Indicates the result of previously issued |
| 256 | * eWNI_SME_msgType_REQ message |
| 257 | * @sme_join_rsp The received response. |
| 258 | * |
| 259 | * This function will handle both the success and failure status |
| 260 | * of the received response. |
| 261 | * |
| 262 | * Return: None |
| 263 | */ |
| 264 | static void lim_handle_join_rsp_status(tpAniSirGlobal mac_ctx, |
| 265 | tpPESession session_entry, tSirResultCodes result_code, |
| 266 | tpSirSmeJoinRsp sme_join_rsp) |
| 267 | { |
Naveen Rawat | c4a0e66 | 2017-05-19 08:06:57 -0700 | [diff] [blame] | 268 | uint16_t bss_ie_len; |
| 269 | void *bss_ies; |
| 270 | bool is_vendor_ap_1_present; |
Wu Gao | 2968fc9 | 2017-06-19 19:18:34 +0800 | [diff] [blame^] | 271 | tpSirSmeJoinReq join_reassoc_req = NULL; |
Naveen Rawat | c4a0e66 | 2017-05-19 08:06:57 -0700 | [diff] [blame] | 272 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 273 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 274 | tSirSmeHTProfile *ht_profile; |
| 275 | #endif |
| 276 | if (result_code == eSIR_SME_SUCCESS) { |
| 277 | if (session_entry->beacon != NULL) { |
| 278 | sme_join_rsp->beaconLength = session_entry->bcnLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 279 | qdf_mem_copy(sme_join_rsp->frames, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 280 | session_entry->beacon, |
| 281 | sme_join_rsp->beaconLength); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 282 | qdf_mem_free(session_entry->beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 283 | session_entry->beacon = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 284 | session_entry->bcnLen = 0; |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 285 | pe_debug("Beacon: %d", |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 286 | sme_join_rsp->beaconLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 287 | } |
| 288 | if (session_entry->assocReq != NULL) { |
| 289 | sme_join_rsp->assocReqLength = |
| 290 | session_entry->assocReqLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 291 | qdf_mem_copy(sme_join_rsp->frames + |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 292 | sme_join_rsp->beaconLength, |
| 293 | session_entry->assocReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 294 | sme_join_rsp->assocReqLength); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 295 | qdf_mem_free(session_entry->assocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 296 | session_entry->assocReq = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 297 | session_entry->assocReqLen = 0; |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 298 | pe_debug("AssocReq: %d", |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 299 | sme_join_rsp->assocReqLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 300 | } |
| 301 | if (session_entry->assocRsp != NULL) { |
| 302 | sme_join_rsp->assocRspLength = |
| 303 | session_entry->assocRspLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 304 | qdf_mem_copy(sme_join_rsp->frames + |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 305 | sme_join_rsp->beaconLength + |
| 306 | sme_join_rsp->assocReqLength, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 307 | session_entry->assocRsp, |
| 308 | sme_join_rsp->assocRspLength); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 309 | qdf_mem_free(session_entry->assocRsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 310 | session_entry->assocRsp = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 311 | session_entry->assocRspLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 312 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 313 | if (session_entry->ricData != NULL) { |
| 314 | sme_join_rsp->parsedRicRspLen = |
| 315 | session_entry->RICDataLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 316 | qdf_mem_copy(sme_join_rsp->frames + |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 317 | sme_join_rsp->beaconLength + |
| 318 | sme_join_rsp->assocReqLength + |
| 319 | sme_join_rsp->assocRspLength, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 320 | session_entry->ricData, |
| 321 | sme_join_rsp->parsedRicRspLen); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 322 | qdf_mem_free(session_entry->ricData); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 323 | session_entry->ricData = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 324 | session_entry->RICDataLen = 0; |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 325 | pe_debug("RicLength: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 326 | sme_join_rsp->parsedRicRspLen); |
| 327 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 328 | #ifdef FEATURE_WLAN_ESE |
| 329 | if (session_entry->tspecIes != NULL) { |
| 330 | sme_join_rsp->tspecIeLen = |
| 331 | session_entry->tspecLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 332 | qdf_mem_copy(sme_join_rsp->frames + |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 333 | sme_join_rsp->beaconLength + |
| 334 | sme_join_rsp->assocReqLength + |
| 335 | sme_join_rsp->assocRspLength + |
| 336 | sme_join_rsp->parsedRicRspLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 337 | session_entry->tspecIes, |
| 338 | sme_join_rsp->tspecIeLen); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 339 | qdf_mem_free(session_entry->tspecIes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 340 | session_entry->tspecIes = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 341 | session_entry->tspecLen = 0; |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 342 | pe_debug("ESE-TspecLen: %d", |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 343 | sme_join_rsp->tspecIeLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 344 | } |
| 345 | #endif |
| 346 | sme_join_rsp->aid = session_entry->limAID; |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 347 | pe_debug("AssocRsp: %d", |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 348 | sme_join_rsp->assocRspLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 349 | sme_join_rsp->vht_channel_width = |
| 350 | session_entry->ch_width; |
| 351 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 352 | if (session_entry->cc_switch_mode != |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 353 | QDF_MCC_TO_SCC_SWITCH_DISABLE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 354 | ht_profile = &sme_join_rsp->HTProfile; |
| 355 | ht_profile->htSupportedChannelWidthSet = |
| 356 | session_entry->htSupportedChannelWidthSet; |
| 357 | ht_profile->htRecommendedTxWidthSet = |
| 358 | session_entry->htRecommendedTxWidthSet; |
| 359 | ht_profile->htSecondaryChannelOffset = |
| 360 | session_entry->htSecondaryChannelOffset; |
| 361 | ht_profile->dot11mode = session_entry->dot11mode; |
| 362 | ht_profile->htCapability = session_entry->htCapability; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 363 | ht_profile->vhtCapability = |
| 364 | session_entry->vhtCapability; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 365 | ht_profile->apCenterChan = session_entry->ch_center_freq_seg0; |
| 366 | ht_profile->apChanWidth = session_entry->ch_width; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 367 | } |
| 368 | #endif |
Wu Gao | 2968fc9 | 2017-06-19 19:18:34 +0800 | [diff] [blame^] | 369 | pe_debug("pLimJoinReq:%p, pLimReAssocReq:%p", |
| 370 | session_entry->pLimJoinReq, |
| 371 | session_entry->pLimReAssocReq); |
| 372 | |
| 373 | if (session_entry->pLimJoinReq) |
| 374 | join_reassoc_req = session_entry->pLimJoinReq; |
| 375 | |
| 376 | if (session_entry->pLimReAssocReq) |
| 377 | join_reassoc_req = session_entry->pLimReAssocReq; |
| 378 | |
| 379 | if (!join_reassoc_req) { |
| 380 | pe_err("both pLimJoinReq and pLimReAssocReq NULL"); |
| 381 | return; |
| 382 | } |
| 383 | |
Naveen Rawat | c4a0e66 | 2017-05-19 08:06:57 -0700 | [diff] [blame] | 384 | bss_ie_len = lim_get_ielen_from_bss_description( |
Wu Gao | 2968fc9 | 2017-06-19 19:18:34 +0800 | [diff] [blame^] | 385 | &join_reassoc_req->bssDescription); |
| 386 | bss_ies = &join_reassoc_req->bssDescription.ieFields; |
Naveen Rawat | c4a0e66 | 2017-05-19 08:06:57 -0700 | [diff] [blame] | 387 | is_vendor_ap_1_present = (cfg_get_vendor_ie_ptr_from_oui(mac_ctx, |
| 388 | SIR_MAC_VENDOR_AP_1_OUI, SIR_MAC_VENDOR_AP_1_OUI_LEN, |
| 389 | bss_ies, bss_ie_len) != NULL); |
| 390 | |
| 391 | if (mac_ctx->roam.configParam.is_force_1x1 && |
| 392 | is_vendor_ap_1_present && (session_entry->nss == 2) && |
| 393 | (mac_ctx->lteCoexAntShare == 0 || |
| 394 | IS_5G_CH(session_entry->currentOperChannel))) { |
| 395 | /* SET vdev param */ |
| 396 | pe_debug("sending SMPS intolrent vdev_param"); |
| 397 | wma_cli_set_command(session_entry->smeSessionId, |
| 398 | (int)WMI_VDEV_PARAM_SMPS_INTOLERANT, |
| 399 | 1, VDEV_CMD); |
| 400 | |
| 401 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 402 | } else { |
| 403 | if (session_entry->beacon != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 404 | qdf_mem_free(session_entry->beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 405 | session_entry->beacon = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 406 | session_entry->bcnLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 407 | } |
| 408 | if (session_entry->assocReq != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 409 | qdf_mem_free(session_entry->assocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 410 | session_entry->assocReq = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 411 | session_entry->assocReqLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 412 | } |
| 413 | if (session_entry->assocRsp != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 414 | qdf_mem_free(session_entry->assocRsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 415 | session_entry->assocRsp = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 416 | session_entry->assocRspLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 417 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 418 | if (session_entry->ricData != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 419 | qdf_mem_free(session_entry->ricData); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 420 | session_entry->ricData = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 421 | session_entry->RICDataLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 422 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 423 | #ifdef FEATURE_WLAN_ESE |
| 424 | if (session_entry->tspecIes != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 425 | qdf_mem_free(session_entry->tspecIes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 426 | session_entry->tspecIes = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 427 | session_entry->tspecLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 428 | } |
| 429 | #endif |
| 430 | } |
| 431 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 432 | |
| 433 | /** |
| 434 | * lim_add_bss_info() - copy data from session entry to join rsp |
Selvaraj, Sridhar | e01e073 | 2016-09-13 12:45:22 +0530 | [diff] [blame] | 435 | * @sta_ds: Station dph entry |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 436 | * @sme_join_rsp: Join response buffer to be filled up |
| 437 | * |
| 438 | * Return: None |
| 439 | */ |
Jeff Johnson | 6db011e | 2016-10-07 07:31:39 -0700 | [diff] [blame] | 440 | static void lim_add_bss_info(tpDphHashNode sta_ds, tpSirSmeJoinRsp sme_join_rsp) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 441 | { |
Selvaraj, Sridhar | e01e073 | 2016-09-13 12:45:22 +0530 | [diff] [blame] | 442 | struct parsed_ies *parsed_ies = &sta_ds->parsed_ies; |
| 443 | |
| 444 | if (parsed_ies->hs20vendor_ie.present) |
| 445 | sme_join_rsp->hs20vendor_ie = parsed_ies->hs20vendor_ie; |
| 446 | if (parsed_ies->vht_caps.present) |
| 447 | sme_join_rsp->vht_caps = parsed_ies->vht_caps; |
| 448 | if (parsed_ies->ht_caps.present) |
| 449 | sme_join_rsp->ht_caps = parsed_ies->ht_caps; |
| 450 | if (parsed_ies->ht_operation.present) |
| 451 | sme_join_rsp->ht_operation = parsed_ies->ht_operation; |
| 452 | if (parsed_ies->vht_operation.present) |
| 453 | sme_join_rsp->vht_operation = parsed_ies->vht_operation; |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 454 | } |
| 455 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 456 | /** |
| 457 | * lim_send_sme_join_reassoc_rsp() - Send Response to Upper Layers |
| 458 | * @mac_ctx: Pointer to Global MAC structure |
| 459 | * @msg_type: Indicates message type |
| 460 | * @result_code: Indicates the result of previously issued |
| 461 | * eWNI_SME_msgType_REQ message |
| 462 | * @prot_status_code: Protocol Status Code |
| 463 | * @session_entry: PE Session Info |
| 464 | * @sme_session_id: SME Session ID |
| 465 | * @sme_transaction_id: SME Transaction ID |
| 466 | * |
| 467 | * This function is called by lim_process_sme_req_messages() to send |
| 468 | * eWNI_SME_JOIN_RSP or eWNI_SME_REASSOC_RSP messages to applications |
| 469 | * above MAC Software. |
| 470 | * |
| 471 | * Return: None |
| 472 | */ |
| 473 | |
| 474 | void |
| 475 | lim_send_sme_join_reassoc_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type, |
| 476 | tSirResultCodes result_code, uint16_t prot_status_code, |
| 477 | tpPESession session_entry, uint8_t sme_session_id, |
| 478 | uint16_t sme_transaction_id) |
| 479 | { |
| 480 | tpSirSmeJoinRsp sme_join_rsp; |
| 481 | uint32_t rsp_len; |
| 482 | tpDphHashNode sta_ds = NULL; |
| 483 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 484 | if (msg_type == eWNI_SME_REASSOC_RSP) |
| 485 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_REASSOC_RSP_EVENT, |
| 486 | session_entry, (uint16_t) result_code, 0); |
| 487 | else |
| 488 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_JOIN_RSP_EVENT, |
| 489 | session_entry, (uint16_t) result_code, 0); |
| 490 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 491 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 492 | pe_debug("Sending message: %s with reasonCode: %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 493 | lim_msg_str(msg_type), lim_result_code_str(result_code)); |
| 494 | |
| 495 | if (session_entry == NULL) { |
| 496 | rsp_len = sizeof(tSirSmeJoinRsp); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 497 | sme_join_rsp = qdf_mem_malloc(rsp_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 498 | if (NULL == sme_join_rsp) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 499 | pe_err("Mem Alloc fail - JOIN/REASSOC_RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 500 | return; |
| 501 | } |
| 502 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 503 | sme_join_rsp->beaconLength = 0; |
| 504 | sme_join_rsp->assocReqLength = 0; |
| 505 | sme_join_rsp->assocRspLength = 0; |
| 506 | } else { |
| 507 | rsp_len = session_entry->assocReqLen + |
| 508 | session_entry->assocRspLen + session_entry->bcnLen + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 509 | session_entry->RICDataLen + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 510 | #ifdef FEATURE_WLAN_ESE |
| 511 | session_entry->tspecLen + |
| 512 | #endif |
| 513 | sizeof(tSirSmeJoinRsp) - sizeof(uint8_t); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 514 | sme_join_rsp = qdf_mem_malloc(rsp_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 515 | if (NULL == sme_join_rsp) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 516 | pe_err("MemAlloc fail - JOIN/REASSOC_RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 517 | return; |
| 518 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 519 | if (result_code == eSIR_SME_SUCCESS) { |
| 520 | sta_ds = dph_get_hash_entry(mac_ctx, |
| 521 | DPH_STA_HASH_INDEX_PEER, |
| 522 | &session_entry->dph.dphHashTable); |
| 523 | if (sta_ds == NULL) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 524 | pe_err("Get Self Sta Entry fail"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 525 | } else { |
| 526 | /* Pass the peer's staId */ |
| 527 | sme_join_rsp->staId = sta_ds->staIndex; |
| 528 | sme_join_rsp->ucastSig = |
| 529 | sta_ds->ucUcastSig; |
| 530 | sme_join_rsp->bcastSig = |
| 531 | sta_ds->ucBcastSig; |
| 532 | sme_join_rsp->timingMeasCap = |
| 533 | sta_ds->timingMeasCap; |
| 534 | #ifdef FEATURE_WLAN_TDLS |
| 535 | sme_join_rsp->tdls_prohibited = |
| 536 | session_entry->tdls_prohibited; |
| 537 | sme_join_rsp->tdls_chan_swit_prohibited = |
| 538 | session_entry->tdls_chan_swit_prohibited; |
| 539 | #endif |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 540 | sme_join_rsp->nss = sta_ds->nss; |
| 541 | sme_join_rsp->max_rate_flags = |
| 542 | lim_get_max_rate_flags(mac_ctx, sta_ds); |
Selvaraj, Sridhar | e01e073 | 2016-09-13 12:45:22 +0530 | [diff] [blame] | 543 | lim_add_bss_info(sta_ds, sme_join_rsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 544 | } |
| 545 | } |
| 546 | sme_join_rsp->beaconLength = 0; |
| 547 | sme_join_rsp->assocReqLength = 0; |
| 548 | sme_join_rsp->assocRspLength = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 549 | sme_join_rsp->parsedRicRspLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 550 | #ifdef FEATURE_WLAN_ESE |
| 551 | sme_join_rsp->tspecIeLen = 0; |
| 552 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 553 | lim_handle_join_rsp_status(mac_ctx, session_entry, result_code, |
| 554 | sme_join_rsp); |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 555 | |
| 556 | /* Send supported NSS 1x1 to SME */ |
| 557 | sme_join_rsp->supported_nss_1x1 = |
| 558 | session_entry->supported_nss_1x1; |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 559 | pe_debug("SME Join Rsp is supported NSS 1X1: %d", |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 560 | sme_join_rsp->supported_nss_1x1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 561 | } |
| 562 | |
| 563 | sme_join_rsp->messageType = msg_type; |
| 564 | sme_join_rsp->length = (uint16_t) rsp_len; |
| 565 | sme_join_rsp->statusCode = result_code; |
| 566 | sme_join_rsp->protStatusCode = prot_status_code; |
| 567 | |
| 568 | sme_join_rsp->sessionId = sme_session_id; |
| 569 | sme_join_rsp->transactionId = sme_transaction_id; |
| 570 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 571 | lim_send_sme_join_reassoc_rsp_after_resume(mac_ctx, QDF_STATUS_SUCCESS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 572 | (uint32_t *)sme_join_rsp); |
| 573 | } |
| 574 | |
| 575 | /** |
| 576 | * lim_send_sme_start_bss_rsp() |
| 577 | * |
| 578 | ***FUNCTION: |
| 579 | * This function is called to send eWNI_SME_START_BSS_RSP |
| 580 | * message to applications above MAC Software. |
| 581 | * |
| 582 | ***PARAMS: |
| 583 | * |
| 584 | ***LOGIC: |
| 585 | * |
| 586 | ***ASSUMPTIONS: |
| 587 | * NA |
| 588 | * |
| 589 | ***NOTE: |
| 590 | * NA |
| 591 | * |
| 592 | * @param pMac Pointer to Global MAC structure |
| 593 | * @param msgType Indicates message type |
| 594 | * @param resultCode Indicates the result of previously issued |
| 595 | * eWNI_SME_msgType_REQ message |
| 596 | * |
| 597 | * @return None |
| 598 | */ |
| 599 | |
| 600 | void |
| 601 | lim_send_sme_start_bss_rsp(tpAniSirGlobal pMac, |
| 602 | uint16_t msgType, tSirResultCodes resultCode, |
| 603 | tpPESession psessionEntry, uint8_t smesessionId, |
| 604 | uint16_t smetransactionId) |
| 605 | { |
| 606 | |
| 607 | uint16_t size = 0; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 608 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 609 | tSirSmeStartBssRsp *pSirSmeRsp; |
| 610 | uint16_t ieLen; |
| 611 | uint16_t ieOffset, curLen; |
| 612 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 613 | pe_debug("Sending message: %s with reasonCode: %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 614 | lim_msg_str(msgType), lim_result_code_str(resultCode)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 615 | |
| 616 | size = sizeof(tSirSmeStartBssRsp); |
| 617 | |
| 618 | if (psessionEntry == NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 619 | pSirSmeRsp = qdf_mem_malloc(size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 620 | if (NULL == pSirSmeRsp) { |
| 621 | /* / Buffer not available. Log error */ |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 622 | pe_err("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 623 | return; |
| 624 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 625 | } else { |
| 626 | /* subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID */ |
| 627 | ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET; |
| 628 | ieLen = psessionEntry->schBeaconOffsetBegin |
| 629 | + psessionEntry->schBeaconOffsetEnd - ieOffset; |
| 630 | /* calculate the memory size to allocate */ |
| 631 | size += ieLen; |
| 632 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 633 | pSirSmeRsp = qdf_mem_malloc(size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 634 | if (NULL == pSirSmeRsp) { |
| 635 | /* / Buffer not available. Log error */ |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 636 | pe_err("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 637 | return; |
| 638 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 639 | size = sizeof(tSirSmeStartBssRsp); |
| 640 | if (resultCode == eSIR_SME_SUCCESS) { |
| 641 | |
| 642 | sir_copy_mac_addr(pSirSmeRsp->bssDescription.bssId, |
| 643 | psessionEntry->bssId); |
| 644 | |
| 645 | /* Read beacon interval from session */ |
| 646 | pSirSmeRsp->bssDescription.beaconInterval = |
| 647 | (uint16_t) psessionEntry->beaconParams. |
| 648 | beaconInterval; |
| 649 | pSirSmeRsp->bssType = psessionEntry->bssType; |
| 650 | |
| 651 | if (cfg_get_capability_info |
| 652 | (pMac, &pSirSmeRsp->bssDescription.capabilityInfo, |
| 653 | psessionEntry) |
| 654 | != eSIR_SUCCESS) |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 655 | pe_err("could not retrieve Capabilities value"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 656 | |
| 657 | lim_get_phy_mode(pMac, |
| 658 | (uint32_t *) &pSirSmeRsp->bssDescription. |
| 659 | nwType, psessionEntry); |
| 660 | |
| 661 | pSirSmeRsp->bssDescription.channelId = |
| 662 | psessionEntry->currentOperChannel; |
| 663 | |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 664 | if (!LIM_IS_NDI_ROLE(psessionEntry)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 665 | curLen = psessionEntry->schBeaconOffsetBegin - ieOffset; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 666 | qdf_mem_copy((uint8_t *) &pSirSmeRsp->bssDescription. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 667 | ieFields, |
| 668 | psessionEntry->pSchBeaconFrameBegin + |
| 669 | ieOffset, (uint32_t) curLen); |
| 670 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 671 | qdf_mem_copy(((uint8_t *) &pSirSmeRsp->bssDescription. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 672 | ieFields) + curLen, |
| 673 | psessionEntry->pSchBeaconFrameEnd, |
| 674 | (uint32_t) psessionEntry-> |
| 675 | schBeaconOffsetEnd); |
| 676 | |
Abhishek Singh | 34a4d86 | 2016-10-26 16:01:51 +0530 | [diff] [blame] | 677 | pSirSmeRsp->bssDescription.length = (uint16_t) |
| 678 | (offsetof(tSirBssDescription, ieFields[0]) |
| 679 | - sizeof(pSirSmeRsp->bssDescription.length) |
| 680 | + ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 681 | /* This is the size of the message, subtracting the size of the pointer to ieFields */ |
| 682 | size += ieLen - sizeof(uint32_t); |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 683 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 684 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 685 | if (psessionEntry->cc_switch_mode |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 686 | != QDF_MCC_TO_SCC_SWITCH_DISABLE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 687 | pSirSmeRsp->HTProfile. |
| 688 | htSupportedChannelWidthSet = |
| 689 | psessionEntry->htSupportedChannelWidthSet; |
| 690 | pSirSmeRsp->HTProfile.htRecommendedTxWidthSet = |
| 691 | psessionEntry->htRecommendedTxWidthSet; |
| 692 | pSirSmeRsp->HTProfile.htSecondaryChannelOffset = |
| 693 | psessionEntry->htSecondaryChannelOffset; |
| 694 | pSirSmeRsp->HTProfile.dot11mode = |
| 695 | psessionEntry->dot11mode; |
| 696 | pSirSmeRsp->HTProfile.htCapability = |
| 697 | psessionEntry->htCapability; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 698 | pSirSmeRsp->HTProfile.vhtCapability = |
| 699 | psessionEntry->vhtCapability; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 700 | pSirSmeRsp->HTProfile.apCenterChan = |
| 701 | psessionEntry->ch_center_freq_seg0; |
| 702 | pSirSmeRsp->HTProfile.apChanWidth = |
| 703 | psessionEntry->ch_width; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 704 | } |
| 705 | #endif |
| 706 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 707 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 708 | pSirSmeRsp->messageType = msgType; |
| 709 | pSirSmeRsp->length = size; |
| 710 | |
| 711 | /* Update SME session Id and transaction Id */ |
| 712 | pSirSmeRsp->sessionId = smesessionId; |
| 713 | pSirSmeRsp->transactionId = smetransactionId; |
| 714 | pSirSmeRsp->statusCode = resultCode; |
| 715 | if (psessionEntry != NULL) |
| 716 | pSirSmeRsp->staId = psessionEntry->staId; /* else it will be always zero smeRsp StaID = 0 */ |
| 717 | |
| 718 | mmhMsg.type = msgType; |
| 719 | mmhMsg.bodyptr = pSirSmeRsp; |
| 720 | mmhMsg.bodyval = 0; |
| 721 | if (psessionEntry == NULL) { |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 722 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, |
| 723 | NO_SESSION, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 724 | } else { |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 725 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, |
| 726 | psessionEntry->peSessionId, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 727 | } |
| 728 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 729 | lim_diag_event_report(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, |
| 730 | psessionEntry, (uint16_t) resultCode, 0); |
| 731 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 732 | |
| 733 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 734 | } /*** end lim_send_sme_start_bss_rsp() ***/ |
| 735 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 736 | /** |
| 737 | * lim_send_sme_scan_rsp() - Send scan response to SME |
| 738 | * @pMac: Pointer to Global MAC structure |
| 739 | * @length: Indicates length of message |
| 740 | * @resultCode: Indicates the result of previously issued |
| 741 | * eWNI_SME_SCAN_REQ message |
| 742 | * @scan_id: scan identifier |
| 743 | * |
| 744 | * This function is called by lim_process_sme_req_messages() to send |
| 745 | * eWNI_SME_SCAN_RSP message to applications above MAC |
| 746 | * |
| 747 | * return: None |
| 748 | */ |
| 749 | |
| 750 | void |
| 751 | lim_send_sme_scan_rsp(tpAniSirGlobal pMac, tSirResultCodes resultCode, |
| 752 | uint8_t smesessionId, uint16_t smetranscationId, |
| 753 | uint32_t scan_id) |
| 754 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 755 | lim_post_sme_scan_rsp_message(pMac, resultCode, smesessionId, |
| 756 | smetranscationId, scan_id); |
| 757 | } |
| 758 | |
| 759 | /** |
| 760 | * lim_post_sme_scan_rsp_message() |
| 761 | * |
| 762 | ***FUNCTION: |
| 763 | * This function is called by lim_send_sme_scan_rsp() to send |
| 764 | * eWNI_SME_SCAN_RSP message with failed result code |
| 765 | * |
| 766 | ***NOTE: |
| 767 | * NA |
| 768 | * |
| 769 | * @param pMac Pointer to Global MAC structure |
| 770 | * @param length Indicates length of message |
| 771 | * @param resultCode failed result code |
| 772 | * |
| 773 | * @return None |
| 774 | */ |
| 775 | |
| 776 | void |
| 777 | lim_post_sme_scan_rsp_message(tpAniSirGlobal pMac, |
| 778 | tSirResultCodes resultCode, uint8_t smesessionId, |
| 779 | uint16_t smetransactionId, |
| 780 | uint32_t scan_id) |
| 781 | { |
| 782 | tpSirSmeScanRsp pSirSmeScanRsp; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 783 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 784 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 785 | pe_debug("send SME_SCAN_RSP reasonCode: %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 786 | lim_result_code_str(resultCode)); |
| 787 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 788 | pSirSmeScanRsp = qdf_mem_malloc(sizeof(tSirSmeScanRsp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 789 | if (NULL == pSirSmeScanRsp) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 790 | pe_err("AllocateMemory failed for eWNI_SME_SCAN_RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 791 | return; |
| 792 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 793 | |
| 794 | pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP; |
| 795 | pSirSmeScanRsp->statusCode = resultCode; |
| 796 | |
| 797 | /*Update SME session Id and transaction Id */ |
| 798 | pSirSmeScanRsp->sessionId = smesessionId; |
| 799 | pSirSmeScanRsp->transcationId = smetransactionId; |
| 800 | pSirSmeScanRsp->scan_id = scan_id; |
| 801 | |
| 802 | mmhMsg.type = eWNI_SME_SCAN_RSP; |
| 803 | mmhMsg.bodyptr = pSirSmeScanRsp; |
| 804 | mmhMsg.bodyval = 0; |
| 805 | |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 806 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 807 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 808 | lim_diag_event_report(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, |
| 809 | (uint16_t) resultCode, 0); |
| 810 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 811 | |
| 812 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 813 | return; |
| 814 | |
| 815 | } /*** lim_post_sme_scan_rsp_message ***/ |
| 816 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 817 | void lim_send_sme_disassoc_deauth_ntf(tpAniSirGlobal pMac, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 818 | QDF_STATUS status, uint32_t *pCtx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 819 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 820 | struct scheduler_msg mmhMsg = {0}; |
Rajeev Kumar | 416b73f | 2017-01-21 16:45:21 -0800 | [diff] [blame] | 821 | struct scheduler_msg *pMsg = (struct scheduler_msg *) pCtx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 822 | |
| 823 | mmhMsg.type = pMsg->type; |
| 824 | mmhMsg.bodyptr = pMsg; |
| 825 | mmhMsg.bodyval = 0; |
| 826 | |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 827 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 828 | |
| 829 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 830 | } |
| 831 | |
| 832 | /** |
| 833 | * lim_send_sme_disassoc_ntf() |
| 834 | * |
| 835 | ***FUNCTION: |
| 836 | * This function is called by limProcessSmeMessages() to send |
| 837 | * eWNI_SME_DISASSOC_RSP/IND message to host |
| 838 | * |
| 839 | ***PARAMS: |
| 840 | * |
| 841 | ***LOGIC: |
| 842 | * |
| 843 | ***ASSUMPTIONS: |
| 844 | * NA |
| 845 | * |
| 846 | ***NOTE: |
| 847 | * This function is used for sending eWNI_SME_DISASSOC_CNF, |
| 848 | * or eWNI_SME_DISASSOC_IND to host depending on |
| 849 | * disassociation trigger. |
| 850 | * |
| 851 | * @param peerMacAddr Indicates the peer MAC addr to which |
| 852 | * disassociate was initiated |
| 853 | * @param reasonCode Indicates the reason for Disassociation |
| 854 | * @param disassocTrigger Indicates the trigger for Disassociation |
| 855 | * @param aid Indicates the STAID. This parameter is |
| 856 | * present only on AP. |
| 857 | * |
| 858 | * @return None |
| 859 | */ |
| 860 | void |
| 861 | lim_send_sme_disassoc_ntf(tpAniSirGlobal pMac, |
| 862 | tSirMacAddr peerMacAddr, |
| 863 | tSirResultCodes reasonCode, |
| 864 | uint16_t disassocTrigger, |
| 865 | uint16_t aid, |
| 866 | uint8_t smesessionId, |
| 867 | uint16_t smetransactionId, tpPESession psessionEntry) |
| 868 | { |
| 869 | |
| 870 | uint8_t *pBuf; |
| 871 | tSirSmeDisassocRsp *pSirSmeDisassocRsp; |
| 872 | tSirSmeDisassocInd *pSirSmeDisassocInd; |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 873 | uint32_t *pMsg = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 874 | bool failure = false; |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 875 | tpPESession session = NULL; |
| 876 | uint16_t i, assoc_id; |
| 877 | tpDphHashNode sta_ds = NULL; |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 878 | struct sir_sme_discon_done_ind *sir_sme_dis_ind; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 879 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 880 | pe_debug("Disassoc Ntf with trigger : %d reasonCode: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 881 | disassocTrigger, reasonCode); |
| 882 | |
| 883 | switch (disassocTrigger) { |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 884 | case eLIM_DUPLICATE_ENTRY: |
| 885 | /* |
| 886 | * Duplicate entry is removed at LIM. |
| 887 | * Initiate new entry for other session |
| 888 | */ |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 889 | pe_debug("Rcvd eLIM_DUPLICATE_ENTRY for " MAC_ADDRESS_STR, |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 890 | MAC_ADDR_ARRAY(peerMacAddr)); |
| 891 | |
| 892 | for (i = 0; i < pMac->lim.maxBssId; i++) { |
| 893 | if ((&pMac->lim.gpSession[i] != NULL) && |
| 894 | (pMac->lim.gpSession[i].valid) && |
| 895 | (pMac->lim.gpSession[i].pePersona == |
| 896 | QDF_SAP_MODE)) { |
| 897 | /* Find the sta ds entry in another session */ |
| 898 | session = &pMac->lim.gpSession[i]; |
| 899 | sta_ds = dph_lookup_hash_entry(pMac, |
| 900 | peerMacAddr, &assoc_id, |
| 901 | &session->dph.dphHashTable); |
| 902 | } |
| 903 | } |
| 904 | if (sta_ds |
| 905 | #ifdef WLAN_FEATURE_11W |
| 906 | && (!sta_ds->rmfEnabled) |
| 907 | #endif |
| 908 | ) { |
| 909 | if (lim_add_sta(pMac, sta_ds, false, session) != |
| 910 | eSIR_SUCCESS) |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 911 | pe_err("could not Add STA with assocId: %d", |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 912 | sta_ds->assocId); |
| 913 | } |
| 914 | failure = true; |
| 915 | break; |
| 916 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 917 | case eLIM_HOST_DISASSOC: |
| 918 | /** |
| 919 | * Disassociation response due to |
| 920 | * host triggered disassociation |
| 921 | */ |
| 922 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 923 | pSirSmeDisassocRsp = qdf_mem_malloc(sizeof(tSirSmeDisassocRsp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 924 | if (NULL == pSirSmeDisassocRsp) { |
| 925 | /* Log error */ |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 926 | pe_err("Memory allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 927 | failure = true; |
| 928 | goto error; |
| 929 | } |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 930 | pe_debug("send eWNI_SME_DISASSOC_RSP with retCode: %d for " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 931 | reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); |
| 932 | pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP; |
| 933 | pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp); |
| 934 | /* sessionId */ |
| 935 | pBuf = (uint8_t *) &pSirSmeDisassocRsp->sessionId; |
| 936 | *pBuf = smesessionId; |
| 937 | pBuf++; |
| 938 | |
| 939 | /* transactionId */ |
| 940 | lim_copy_u16(pBuf, smetransactionId); |
| 941 | pBuf += sizeof(uint16_t); |
| 942 | |
| 943 | /* statusCode */ |
| 944 | lim_copy_u32(pBuf, reasonCode); |
| 945 | pBuf += sizeof(tSirResultCodes); |
| 946 | |
| 947 | /* peerMacAddr */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 948 | qdf_mem_copy(pBuf, peerMacAddr, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 949 | pBuf += sizeof(tSirMacAddr); |
| 950 | |
| 951 | /* Clear Station Stats */ |
| 952 | /* for sta, it is always 1, IBSS is handled at halInitSta */ |
| 953 | |
| 954 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 955 | |
| 956 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT, |
| 957 | psessionEntry, (uint16_t) reasonCode, 0); |
| 958 | #endif |
| 959 | pMsg = (uint32_t *) pSirSmeDisassocRsp; |
| 960 | break; |
| 961 | |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 962 | case eLIM_PEER_ENTITY_DISASSOC: |
| 963 | case eLIM_LINK_MONITORING_DISASSOC: |
| 964 | sir_sme_dis_ind = |
| 965 | qdf_mem_malloc(sizeof(*sir_sme_dis_ind)); |
| 966 | if (!sir_sme_dis_ind) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 967 | pe_err("call to AllocateMemory failed for disconnect indication"); |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 968 | return; |
| 969 | } |
| 970 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 971 | pe_debug("send eWNI_SME_DISCONNECT_DONE_IND with retCode: %d", |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 972 | reasonCode); |
| 973 | |
| 974 | sir_sme_dis_ind->message_type = |
| 975 | eWNI_SME_DISCONNECT_DONE_IND; |
| 976 | sir_sme_dis_ind->length = |
| 977 | sizeof(*sir_sme_dis_ind); |
| 978 | qdf_mem_copy(sir_sme_dis_ind->peer_mac, peerMacAddr, |
| 979 | sizeof(tSirMacAddr)); |
| 980 | sir_sme_dis_ind->session_id = smesessionId; |
| 981 | sir_sme_dis_ind->reason_code = reasonCode; |
Selvaraj, Sridhar | c7d8089 | 2016-09-29 11:56:45 +0530 | [diff] [blame] | 982 | /* |
| 983 | * Instead of sending deauth reason code as 505 which is |
| 984 | * internal value(eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE) |
| 985 | * Send reason code as zero to Supplicant |
| 986 | */ |
| 987 | if (reasonCode == eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE) |
| 988 | sir_sme_dis_ind->reason_code = 0; |
| 989 | else |
| 990 | sir_sme_dis_ind->reason_code = reasonCode; |
| 991 | |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 992 | pMsg = (uint32_t *)sir_sme_dis_ind; |
| 993 | |
| 994 | break; |
| 995 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 996 | default: |
| 997 | /** |
| 998 | * Disassociation indication due to Disassociation |
| 999 | * frame reception from peer entity or due to |
| 1000 | * loss of link with peer entity. |
| 1001 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1002 | pSirSmeDisassocInd = qdf_mem_malloc(sizeof(tSirSmeDisassocInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1003 | if (NULL == pSirSmeDisassocInd) { |
| 1004 | /* Log error */ |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1005 | pe_err("Memory allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1006 | failure = true; |
| 1007 | goto error; |
| 1008 | } |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1009 | pe_debug("send eWNI_SME_DISASSOC_IND with retCode: %d for " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1010 | reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); |
| 1011 | pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND; |
| 1012 | pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd); |
| 1013 | |
| 1014 | /* Update SME session Id and Transaction Id */ |
| 1015 | pSirSmeDisassocInd->sessionId = smesessionId; |
| 1016 | pSirSmeDisassocInd->transactionId = smetransactionId; |
| 1017 | pSirSmeDisassocInd->reasonCode = reasonCode; |
| 1018 | pBuf = (uint8_t *) &pSirSmeDisassocInd->statusCode; |
| 1019 | |
| 1020 | lim_copy_u32(pBuf, reasonCode); |
| 1021 | pBuf += sizeof(tSirResultCodes); |
| 1022 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1023 | qdf_mem_copy(pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1024 | pBuf += sizeof(tSirMacAddr); |
| 1025 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1026 | qdf_mem_copy(pBuf, peerMacAddr, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1027 | |
| 1028 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1029 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, |
| 1030 | psessionEntry, (uint16_t) reasonCode, 0); |
| 1031 | #endif |
| 1032 | pMsg = (uint32_t *) pSirSmeDisassocInd; |
| 1033 | |
| 1034 | break; |
| 1035 | } |
| 1036 | |
| 1037 | error: |
| 1038 | /* Delete the PE session Created */ |
Rajeev Kumar | cf835a0 | 2016-04-15 15:01:31 -0700 | [diff] [blame] | 1039 | if ((psessionEntry != NULL) && LIM_IS_STA_ROLE(psessionEntry)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1040 | pe_delete_session(pMac, psessionEntry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1041 | |
| 1042 | if (false == failure) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1043 | lim_send_sme_disassoc_deauth_ntf(pMac, QDF_STATUS_SUCCESS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1044 | (uint32_t *) pMsg); |
| 1045 | } /*** end lim_send_sme_disassoc_ntf() ***/ |
| 1046 | |
| 1047 | /** ----------------------------------------------------------------- |
| 1048 | \brief lim_send_sme_disassoc_ind() - sends SME_DISASSOC_IND |
| 1049 | |
| 1050 | After receiving disassociation frame from peer entity, this |
| 1051 | function sends a eWNI_SME_DISASSOC_IND to SME with a specific |
| 1052 | reason code. |
| 1053 | |
| 1054 | \param pMac - global mac structure |
| 1055 | \param pStaDs - station dph hash node |
| 1056 | \return none |
| 1057 | \sa |
| 1058 | ----------------------------------------------------------------- */ |
| 1059 | void |
| 1060 | lim_send_sme_disassoc_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 1061 | tpPESession psessionEntry) |
| 1062 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1063 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1064 | tSirSmeDisassocInd *pSirSmeDisassocInd; |
| 1065 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1066 | pSirSmeDisassocInd = qdf_mem_malloc(sizeof(tSirSmeDisassocInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1067 | if (NULL == pSirSmeDisassocInd) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1068 | pe_err("AllocateMemory failed for eWNI_SME_DISASSOC_IND"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1069 | return; |
| 1070 | } |
| 1071 | |
| 1072 | pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND; |
| 1073 | pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd); |
| 1074 | |
| 1075 | pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId; |
| 1076 | pSirSmeDisassocInd->transactionId = psessionEntry->transactionId; |
Padma, Santhosh Kumar | 0228921 | 2016-09-30 13:30:08 +0530 | [diff] [blame] | 1077 | pSirSmeDisassocInd->statusCode = eSIR_SME_DEAUTH_STATUS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1078 | pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason; |
| 1079 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1080 | qdf_mem_copy(pSirSmeDisassocInd->bssid.bytes, psessionEntry->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1081 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1082 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1083 | qdf_mem_copy(pSirSmeDisassocInd->peer_macaddr.bytes, pStaDs->staAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1084 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1085 | |
| 1086 | pSirSmeDisassocInd->staId = pStaDs->staIndex; |
| 1087 | |
| 1088 | mmhMsg.type = eWNI_SME_DISASSOC_IND; |
| 1089 | mmhMsg.bodyptr = pSirSmeDisassocInd; |
| 1090 | mmhMsg.bodyval = 0; |
| 1091 | |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 1092 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, |
| 1093 | psessionEntry->peSessionId, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1094 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1095 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, |
| 1096 | 0, (uint16_t) pStaDs->mlmStaContext.disassocReason); |
| 1097 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1098 | |
| 1099 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1100 | |
| 1101 | } /*** end lim_send_sme_disassoc_ind() ***/ |
| 1102 | |
| 1103 | /** ----------------------------------------------------------------- |
| 1104 | \brief lim_send_sme_deauth_ind() - sends SME_DEAUTH_IND |
| 1105 | |
| 1106 | After receiving deauthentication frame from peer entity, this |
| 1107 | function sends a eWNI_SME_DEAUTH_IND to SME with a specific |
| 1108 | reason code. |
| 1109 | |
| 1110 | \param pMac - global mac structure |
| 1111 | \param pStaDs - station dph hash node |
| 1112 | \return none |
| 1113 | \sa |
| 1114 | ----------------------------------------------------------------- */ |
| 1115 | void |
| 1116 | lim_send_sme_deauth_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 1117 | tpPESession psessionEntry) |
| 1118 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1119 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1120 | tSirSmeDeauthInd *pSirSmeDeauthInd; |
| 1121 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1122 | pSirSmeDeauthInd = qdf_mem_malloc(sizeof(tSirSmeDeauthInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1123 | if (NULL == pSirSmeDeauthInd) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1124 | pe_err("AllocateMemory failed for eWNI_SME_DEAUTH_IND"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1125 | return; |
| 1126 | } |
| 1127 | |
| 1128 | pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND; |
| 1129 | pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd); |
| 1130 | |
| 1131 | pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId; |
| 1132 | pSirSmeDeauthInd->transactionId = psessionEntry->transactionId; |
| 1133 | if (eSIR_INFRA_AP_MODE == psessionEntry->bssType) { |
| 1134 | pSirSmeDeauthInd->statusCode = |
| 1135 | (tSirResultCodes) pStaDs->mlmStaContext.cleanupTrigger; |
| 1136 | } else { |
| 1137 | /* Need to indicatet he reascon code over the air */ |
| 1138 | pSirSmeDeauthInd->statusCode = |
| 1139 | (tSirResultCodes) pStaDs->mlmStaContext.disassocReason; |
| 1140 | } |
| 1141 | /* BSSID */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1142 | qdf_mem_copy(pSirSmeDeauthInd->bssid.bytes, psessionEntry->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1143 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1144 | /* peerMacAddr */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1145 | qdf_mem_copy(pSirSmeDeauthInd->peer_macaddr.bytes, pStaDs->staAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1146 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1147 | pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason; |
| 1148 | |
| 1149 | pSirSmeDeauthInd->staId = pStaDs->staIndex; |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1150 | if (eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON == |
| 1151 | pStaDs->mlmStaContext.disassocReason) |
| 1152 | pSirSmeDeauthInd->rssi = pStaDs->del_sta_ctx_rssi; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1153 | |
| 1154 | mmhMsg.type = eWNI_SME_DEAUTH_IND; |
| 1155 | mmhMsg.bodyptr = pSirSmeDeauthInd; |
| 1156 | mmhMsg.bodyval = 0; |
| 1157 | |
| 1158 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1159 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1160 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, |
| 1161 | 0, pStaDs->mlmStaContext.cleanupTrigger); |
| 1162 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1163 | |
| 1164 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1165 | return; |
| 1166 | } /*** end lim_send_sme_deauth_ind() ***/ |
| 1167 | |
| 1168 | #ifdef FEATURE_WLAN_TDLS |
| 1169 | /** |
| 1170 | * lim_send_sme_tdls_del_sta_ind() |
| 1171 | * |
| 1172 | ***FUNCTION: |
| 1173 | * This function is called to send the TDLS STA context deletion to SME. |
| 1174 | * |
| 1175 | ***LOGIC: |
| 1176 | * |
| 1177 | ***ASSUMPTIONS: |
| 1178 | * |
| 1179 | ***NOTE: |
| 1180 | * NA |
| 1181 | * |
| 1182 | * @param pMac - Pointer to global MAC structure |
| 1183 | * @param pStaDs - Pointer to internal STA Datastructure |
| 1184 | * @param psessionEntry - Pointer to the session entry |
| 1185 | * @param reasonCode - Reason for TDLS sta deletion |
| 1186 | * @return None |
| 1187 | */ |
| 1188 | void |
| 1189 | lim_send_sme_tdls_del_sta_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 1190 | tpPESession psessionEntry, uint16_t reasonCode) |
| 1191 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1192 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1193 | tSirTdlsDelStaInd *pSirTdlsDelStaInd; |
| 1194 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1195 | pSirTdlsDelStaInd = qdf_mem_malloc(sizeof(tSirTdlsDelStaInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1196 | if (NULL == pSirTdlsDelStaInd) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1197 | pe_err("AllocateMemory failed for eWNI_SME_TDLS_DEL_STA_IND"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1198 | return; |
| 1199 | } |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1200 | pe_debug("Delete TDLS Peer "MAC_ADDRESS_STR "with reason code: %d", |
Nitesh Shah | 82c5281 | 2016-12-27 12:27:51 +0530 | [diff] [blame] | 1201 | MAC_ADDR_ARRAY(pStaDs->staAddr), reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1202 | /* messageType */ |
| 1203 | pSirTdlsDelStaInd->messageType = eWNI_SME_TDLS_DEL_STA_IND; |
| 1204 | pSirTdlsDelStaInd->length = sizeof(tSirTdlsDelStaInd); |
| 1205 | |
| 1206 | /* sessionId */ |
| 1207 | pSirTdlsDelStaInd->sessionId = psessionEntry->smeSessionId; |
| 1208 | |
| 1209 | /* peerMacAddr */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1210 | qdf_mem_copy(pSirTdlsDelStaInd->peermac.bytes, pStaDs->staAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1211 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1212 | |
| 1213 | /* staId */ |
| 1214 | lim_copy_u16((uint8_t *) (&pSirTdlsDelStaInd->staId), |
| 1215 | (uint16_t) pStaDs->staIndex); |
| 1216 | |
| 1217 | /* reasonCode */ |
| 1218 | lim_copy_u16((uint8_t *) (&pSirTdlsDelStaInd->reasonCode), reasonCode); |
| 1219 | |
| 1220 | mmhMsg.type = eWNI_SME_TDLS_DEL_STA_IND; |
| 1221 | mmhMsg.bodyptr = pSirTdlsDelStaInd; |
| 1222 | mmhMsg.bodyval = 0; |
| 1223 | |
| 1224 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1225 | return; |
| 1226 | } /*** end lim_send_sme_tdls_del_sta_ind() ***/ |
| 1227 | |
| 1228 | /** |
| 1229 | * lim_send_sme_tdls_delete_all_peer_ind() |
| 1230 | * |
| 1231 | ***FUNCTION: |
| 1232 | * This function is called to send the eWNI_SME_TDLS_DEL_ALL_PEER_IND |
| 1233 | * message to SME. |
| 1234 | * |
| 1235 | ***LOGIC: |
| 1236 | * |
| 1237 | ***ASSUMPTIONS: |
| 1238 | * |
| 1239 | ***NOTE: |
| 1240 | * NA |
| 1241 | * |
| 1242 | * @param pMac - Pointer to global MAC structure |
| 1243 | * @param psessionEntry - Pointer to the session entry |
| 1244 | * @return None |
| 1245 | */ |
| 1246 | void |
| 1247 | lim_send_sme_tdls_delete_all_peer_ind(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 1248 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1249 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1250 | tSirTdlsDelAllPeerInd *pSirTdlsDelAllPeerInd; |
| 1251 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1252 | pSirTdlsDelAllPeerInd = qdf_mem_malloc(sizeof(tSirTdlsDelAllPeerInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1253 | if (NULL == pSirTdlsDelAllPeerInd) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1254 | pe_err("AllocateMemory failed for eWNI_SME_TDLS_DEL_ALL_PEER_IND"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1255 | return; |
| 1256 | } |
| 1257 | /* messageType */ |
| 1258 | pSirTdlsDelAllPeerInd->messageType = eWNI_SME_TDLS_DEL_ALL_PEER_IND; |
| 1259 | pSirTdlsDelAllPeerInd->length = sizeof(tSirTdlsDelAllPeerInd); |
| 1260 | |
| 1261 | /* sessionId */ |
| 1262 | pSirTdlsDelAllPeerInd->sessionId = psessionEntry->smeSessionId; |
| 1263 | |
| 1264 | mmhMsg.type = eWNI_SME_TDLS_DEL_ALL_PEER_IND; |
| 1265 | mmhMsg.bodyptr = pSirTdlsDelAllPeerInd; |
| 1266 | mmhMsg.bodyval = 0; |
| 1267 | |
| 1268 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1269 | return; |
| 1270 | } /*** end lim_send_sme_tdls_delete_all_peer_ind() ***/ |
| 1271 | |
| 1272 | /** |
| 1273 | * lim_send_sme_mgmt_tx_completion() |
| 1274 | * |
| 1275 | ***FUNCTION: |
| 1276 | * This function is called to send the eWNI_SME_MGMT_FRM_TX_COMPLETION_IND |
| 1277 | * message to SME. |
| 1278 | * |
| 1279 | ***LOGIC: |
| 1280 | * |
| 1281 | ***ASSUMPTIONS: |
| 1282 | * |
| 1283 | ***NOTE: |
| 1284 | * NA |
| 1285 | * |
| 1286 | * @param pMac - Pointer to global MAC structure |
| 1287 | * @param psessionEntry - Pointer to the session entry |
| 1288 | * @param txCompleteStatus - TX Complete Status of Mgmt Frames |
| 1289 | * @return None |
| 1290 | */ |
| 1291 | void |
| 1292 | lim_send_sme_mgmt_tx_completion(tpAniSirGlobal pMac, |
Ganesh Kondabattini | ac57007 | 2016-12-21 12:45:48 +0530 | [diff] [blame] | 1293 | uint32_t sme_session_id, |
| 1294 | uint32_t txCompleteStatus) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1295 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1296 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1297 | tSirMgmtTxCompletionInd *pSirMgmtTxCompletionInd; |
| 1298 | |
| 1299 | pSirMgmtTxCompletionInd = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1300 | qdf_mem_malloc(sizeof(tSirMgmtTxCompletionInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1301 | if (NULL == pSirMgmtTxCompletionInd) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1302 | pe_err("AllocateMemory failed for eWNI_SME_MGMT_FRM_TX_COMPLETION_IND"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1303 | return; |
| 1304 | } |
| 1305 | /* messageType */ |
| 1306 | pSirMgmtTxCompletionInd->messageType = |
| 1307 | eWNI_SME_MGMT_FRM_TX_COMPLETION_IND; |
| 1308 | pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd); |
| 1309 | |
| 1310 | /* sessionId */ |
Ganesh Kondabattini | ac57007 | 2016-12-21 12:45:48 +0530 | [diff] [blame] | 1311 | pSirMgmtTxCompletionInd->sessionId = sme_session_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1312 | |
| 1313 | pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus; |
| 1314 | |
| 1315 | mmhMsg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND; |
| 1316 | mmhMsg.bodyptr = pSirMgmtTxCompletionInd; |
| 1317 | mmhMsg.bodyval = 0; |
| 1318 | |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 1319 | #ifdef CONVERGED_TDLS_ENABLE |
| 1320 | pSirMgmtTxCompletionInd->psoc = pMac->psoc; |
| 1321 | mmhMsg.callback = tgt_tdls_send_mgmt_tx_completion; |
| 1322 | scheduler_post_msg(QDF_MODULE_ID_TARGET_IF, &mmhMsg); |
| 1323 | return; |
| 1324 | #else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1325 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1326 | return; |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 1327 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1328 | } /*** end lim_send_sme_tdls_delete_all_peer_ind() ***/ |
| 1329 | |
| 1330 | void lim_send_sme_tdls_event_notify(tpAniSirGlobal pMac, uint16_t msgType, |
| 1331 | void *events) |
| 1332 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1333 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1334 | |
| 1335 | switch (msgType) { |
| 1336 | case SIR_HAL_TDLS_SHOULD_DISCOVER: |
| 1337 | mmhMsg.type = eWNI_SME_TDLS_SHOULD_DISCOVER; |
| 1338 | break; |
| 1339 | case SIR_HAL_TDLS_SHOULD_TEARDOWN: |
| 1340 | mmhMsg.type = eWNI_SME_TDLS_SHOULD_TEARDOWN; |
| 1341 | break; |
| 1342 | case SIR_HAL_TDLS_PEER_DISCONNECTED: |
| 1343 | mmhMsg.type = eWNI_SME_TDLS_PEER_DISCONNECTED; |
| 1344 | break; |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 1345 | case SIR_HAL_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
| 1346 | mmhMsg.type = eWNI_SME_TDLS_CONNECTION_TRACKER_NOTIFICATION; |
| 1347 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1348 | } |
| 1349 | |
| 1350 | mmhMsg.bodyptr = events; |
| 1351 | mmhMsg.bodyval = 0; |
| 1352 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1353 | return; |
| 1354 | } |
| 1355 | #endif /* FEATURE_WLAN_TDLS */ |
| 1356 | |
| 1357 | /** |
| 1358 | * lim_send_sme_deauth_ntf() |
| 1359 | * |
| 1360 | ***FUNCTION: |
| 1361 | * This function is called by limProcessSmeMessages() to send |
| 1362 | * eWNI_SME_DISASSOC_RSP/IND message to host |
| 1363 | * |
| 1364 | ***PARAMS: |
| 1365 | * |
| 1366 | ***LOGIC: |
| 1367 | * |
| 1368 | ***ASSUMPTIONS: |
| 1369 | * NA |
| 1370 | * |
| 1371 | ***NOTE: |
| 1372 | * This function is used for sending eWNI_SME_DEAUTH_CNF or |
| 1373 | * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger. |
| 1374 | * |
| 1375 | * @param peerMacAddr Indicates the peer MAC addr to which |
| 1376 | * deauthentication was initiated |
| 1377 | * @param reasonCode Indicates the reason for Deauthetication |
| 1378 | * @param deauthTrigger Indicates the trigger for Deauthetication |
| 1379 | * @param aid Indicates the STAID. This parameter is present |
| 1380 | * only on AP. |
| 1381 | * |
| 1382 | * @return None |
| 1383 | */ |
| 1384 | void |
| 1385 | lim_send_sme_deauth_ntf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, |
| 1386 | tSirResultCodes reasonCode, uint16_t deauthTrigger, |
| 1387 | uint16_t aid, uint8_t smesessionId, |
| 1388 | uint16_t smetransactionId) |
| 1389 | { |
| 1390 | uint8_t *pBuf; |
| 1391 | tSirSmeDeauthRsp *pSirSmeDeauthRsp; |
| 1392 | tSirSmeDeauthInd *pSirSmeDeauthInd; |
| 1393 | tpPESession psessionEntry; |
| 1394 | uint8_t sessionId; |
| 1395 | uint32_t *pMsg; |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 1396 | struct sir_sme_discon_done_ind *sir_sme_dis_ind; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1397 | |
| 1398 | psessionEntry = pe_find_session_by_bssid(pMac, peerMacAddr, &sessionId); |
| 1399 | switch (deauthTrigger) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1400 | case eLIM_HOST_DEAUTH: |
| 1401 | /** |
| 1402 | * Deauthentication response to host triggered |
| 1403 | * deauthentication. |
| 1404 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1405 | pSirSmeDeauthRsp = qdf_mem_malloc(sizeof(tSirSmeDeauthRsp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1406 | if (NULL == pSirSmeDeauthRsp) { |
| 1407 | /* Log error */ |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1408 | pe_err("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1409 | return; |
| 1410 | } |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1411 | pe_debug("send eWNI_SME_DEAUTH_RSP with retCode: %d for" MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1412 | reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); |
| 1413 | pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP; |
| 1414 | pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp); |
| 1415 | pSirSmeDeauthRsp->statusCode = reasonCode; |
| 1416 | pSirSmeDeauthRsp->sessionId = smesessionId; |
| 1417 | pSirSmeDeauthRsp->transactionId = smetransactionId; |
| 1418 | |
Srinivas Girigowda | 9cf95c5 | 2016-01-04 16:17:15 -0800 | [diff] [blame] | 1419 | pBuf = (uint8_t *) pSirSmeDeauthRsp->peer_macaddr.bytes; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1420 | qdf_mem_copy(pBuf, peerMacAddr, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1421 | |
| 1422 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1423 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT, |
| 1424 | psessionEntry, 0, (uint16_t) reasonCode); |
| 1425 | #endif |
| 1426 | pMsg = (uint32_t *) pSirSmeDeauthRsp; |
| 1427 | |
| 1428 | break; |
| 1429 | |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 1430 | case eLIM_PEER_ENTITY_DEAUTH: |
| 1431 | case eLIM_LINK_MONITORING_DEAUTH: |
| 1432 | sir_sme_dis_ind = |
| 1433 | qdf_mem_malloc(sizeof(*sir_sme_dis_ind)); |
| 1434 | if (!sir_sme_dis_ind) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1435 | pe_err("call to AllocateMemory failed for disconnect indication"); |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 1436 | return; |
| 1437 | } |
| 1438 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1439 | pe_debug("send eWNI_SME_DISCONNECT_DONE_IND withretCode: %d", |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 1440 | reasonCode); |
| 1441 | |
| 1442 | sir_sme_dis_ind->message_type = |
| 1443 | eWNI_SME_DISCONNECT_DONE_IND; |
| 1444 | sir_sme_dis_ind->length = |
| 1445 | sizeof(*sir_sme_dis_ind); |
| 1446 | sir_sme_dis_ind->session_id = smesessionId; |
| 1447 | sir_sme_dis_ind->reason_code = reasonCode; |
| 1448 | qdf_mem_copy(sir_sme_dis_ind->peer_mac, peerMacAddr, |
| 1449 | ETH_ALEN); |
Selvaraj, Sridhar | c7d8089 | 2016-09-29 11:56:45 +0530 | [diff] [blame] | 1450 | /* |
| 1451 | * Instead of sending deauth reason code as 505 which is |
| 1452 | * internal value(eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE) |
| 1453 | * Send reason code as zero to Supplicant |
| 1454 | */ |
| 1455 | if (reasonCode == eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE) |
| 1456 | sir_sme_dis_ind->reason_code = 0; |
| 1457 | else |
| 1458 | sir_sme_dis_ind->reason_code = reasonCode; |
| 1459 | |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 1460 | pMsg = (uint32_t *)sir_sme_dis_ind; |
| 1461 | |
| 1462 | break; |
| 1463 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1464 | default: |
| 1465 | /** |
| 1466 | * Deauthentication indication due to Deauthentication |
| 1467 | * frame reception from peer entity or due to |
| 1468 | * loss of link with peer entity. |
| 1469 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1470 | pSirSmeDeauthInd = qdf_mem_malloc(sizeof(tSirSmeDeauthInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1471 | if (NULL == pSirSmeDeauthInd) { |
| 1472 | /* Log error */ |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1473 | pe_err("call to AllocateMemory failed for eWNI_SME_DEAUTH_Ind"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1474 | return; |
| 1475 | } |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1476 | pe_debug("send eWNI_SME_DEAUTH_IND with retCode: %d for " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1477 | reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); |
| 1478 | pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND; |
| 1479 | pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd); |
| 1480 | pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 1481 | |
| 1482 | /* sessionId */ |
| 1483 | pBuf = (uint8_t *) &pSirSmeDeauthInd->sessionId; |
| 1484 | *pBuf++ = smesessionId; |
| 1485 | |
| 1486 | /* transaction ID */ |
| 1487 | lim_copy_u16(pBuf, smetransactionId); |
| 1488 | pBuf += sizeof(uint16_t); |
| 1489 | |
| 1490 | /* status code */ |
| 1491 | lim_copy_u32(pBuf, reasonCode); |
| 1492 | pBuf += sizeof(tSirResultCodes); |
| 1493 | |
| 1494 | /* bssId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1495 | qdf_mem_copy(pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1496 | pBuf += sizeof(tSirMacAddr); |
| 1497 | |
| 1498 | /* peerMacAddr */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1499 | qdf_mem_copy(pSirSmeDeauthInd->peer_macaddr.bytes, peerMacAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1500 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1501 | |
| 1502 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1503 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, |
| 1504 | psessionEntry, 0, (uint16_t) reasonCode); |
| 1505 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1506 | pMsg = (uint32_t *) pSirSmeDeauthInd; |
| 1507 | |
| 1508 | break; |
| 1509 | } |
| 1510 | |
| 1511 | /*Delete the PE session created */ |
| 1512 | if (psessionEntry != NULL) { |
| 1513 | pe_delete_session(pMac, psessionEntry); |
| 1514 | } |
| 1515 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1516 | lim_send_sme_disassoc_deauth_ntf(pMac, QDF_STATUS_SUCCESS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1517 | (uint32_t *) pMsg); |
| 1518 | |
| 1519 | } /*** end lim_send_sme_deauth_ntf() ***/ |
| 1520 | |
| 1521 | /** |
| 1522 | * lim_send_sme_wm_status_change_ntf() - Send Notification |
| 1523 | * @mac_ctx: Global MAC Context |
| 1524 | * @status_change_code: Indicates the change in the wireless medium. |
| 1525 | * @status_change_info: Indicates the information associated with |
| 1526 | * change in the wireless medium. |
| 1527 | * @info_len: Indicates the length of status change information |
| 1528 | * being sent. |
| 1529 | * @session_id SessionID |
| 1530 | * |
| 1531 | * This function is called by limProcessSmeMessages() to send |
| 1532 | * eWNI_SME_WM_STATUS_CHANGE_NTF message to host. |
| 1533 | * |
| 1534 | * Return: None |
| 1535 | */ |
| 1536 | void |
| 1537 | lim_send_sme_wm_status_change_ntf(tpAniSirGlobal mac_ctx, |
| 1538 | tSirSmeStatusChangeCode status_change_code, |
| 1539 | uint32_t *status_change_info, uint16_t info_len, uint8_t session_id) |
| 1540 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1541 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1542 | tSirSmeWmStatusChangeNtf *wm_status_change_ntf; |
Naveen Rawat | e01ed17 | 2016-11-17 11:34:50 -0800 | [diff] [blame] | 1543 | uint32_t max_info_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1544 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1545 | wm_status_change_ntf = qdf_mem_malloc(sizeof(tSirSmeWmStatusChangeNtf)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1546 | if (NULL == wm_status_change_ntf) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1547 | pe_err("Mem Alloc failed - eWNI_SME_WM_STATUS_CHANGE_NTF"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1548 | return; |
| 1549 | } |
| 1550 | |
| 1551 | msg.type = eWNI_SME_WM_STATUS_CHANGE_NTF; |
| 1552 | msg.bodyval = 0; |
| 1553 | msg.bodyptr = wm_status_change_ntf; |
| 1554 | |
| 1555 | switch (status_change_code) { |
Naveen Rawat | e01ed17 | 2016-11-17 11:34:50 -0800 | [diff] [blame] | 1556 | case eSIR_SME_AP_CAPS_CHANGED: |
| 1557 | max_info_len = sizeof(tSirSmeApNewCaps); |
| 1558 | break; |
| 1559 | case eSIR_SME_JOINED_NEW_BSS: |
| 1560 | max_info_len = sizeof(tSirSmeNewBssInfo); |
| 1561 | break; |
| 1562 | default: |
| 1563 | max_info_len = sizeof(wm_status_change_ntf->statusChangeInfo); |
| 1564 | break; |
| 1565 | } |
| 1566 | |
| 1567 | switch (status_change_code) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1568 | case eSIR_SME_RADAR_DETECTED: |
| 1569 | break; |
| 1570 | default: |
| 1571 | wm_status_change_ntf->messageType = |
| 1572 | eWNI_SME_WM_STATUS_CHANGE_NTF; |
| 1573 | wm_status_change_ntf->statusChangeCode = status_change_code; |
| 1574 | wm_status_change_ntf->length = sizeof(tSirSmeWmStatusChangeNtf); |
| 1575 | wm_status_change_ntf->sessionId = session_id; |
Naveen Rawat | e01ed17 | 2016-11-17 11:34:50 -0800 | [diff] [blame] | 1576 | if (info_len <= max_info_len && status_change_info) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1577 | qdf_mem_copy( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1578 | (uint8_t *) &wm_status_change_ntf->statusChangeInfo, |
| 1579 | (uint8_t *) status_change_info, info_len); |
| 1580 | } |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1581 | pe_debug("StatusChg code: 0x%x length: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1582 | status_change_code, info_len); |
| 1583 | break; |
| 1584 | } |
| 1585 | |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 1586 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_TX_SME_MSG, session_id, msg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1587 | if (eSIR_SUCCESS != lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1588 | qdf_mem_free(wm_status_change_ntf); |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1589 | pe_err("lim_sys_process_mmh_msg_api failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1590 | } |
| 1591 | |
| 1592 | } /*** end lim_send_sme_wm_status_change_ntf() ***/ |
| 1593 | |
| 1594 | /** |
| 1595 | * lim_send_sme_set_context_rsp() |
| 1596 | * |
| 1597 | ***FUNCTION: |
| 1598 | * This function is called by limProcessSmeMessages() to send |
| 1599 | * eWNI_SME_SETCONTEXT_RSP message to host |
| 1600 | * |
| 1601 | ***PARAMS: |
| 1602 | * |
| 1603 | ***LOGIC: |
| 1604 | * |
| 1605 | ***ASSUMPTIONS: |
| 1606 | * NA |
| 1607 | * |
| 1608 | ***NOTE: |
| 1609 | * |
| 1610 | * @param pMac Pointer to Global MAC structure |
| 1611 | * @param peerMacAddr Indicates the peer MAC addr to which |
| 1612 | * setContext was performed |
| 1613 | * @param aid Indicates the aid corresponding to the peer MAC |
| 1614 | * address |
| 1615 | * @param resultCode Indicates the result of previously issued |
| 1616 | * eWNI_SME_SETCONTEXT_RSP message |
| 1617 | * |
| 1618 | * @return None |
| 1619 | */ |
| 1620 | void |
| 1621 | lim_send_sme_set_context_rsp(tpAniSirGlobal pMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1622 | struct qdf_mac_addr peer_macaddr, uint16_t aid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1623 | tSirResultCodes resultCode, |
| 1624 | tpPESession psessionEntry, uint8_t smesessionId, |
| 1625 | uint16_t smetransactionId) |
| 1626 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1627 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1628 | tSirSmeSetContextRsp *pSirSmeSetContextRsp; |
| 1629 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1630 | pSirSmeSetContextRsp = qdf_mem_malloc(sizeof(tSirSmeSetContextRsp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1631 | if (NULL == pSirSmeSetContextRsp) { |
| 1632 | /* Log error */ |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1633 | pe_err("call to AllocateMemory failed for SmeSetContextRsp"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1634 | return; |
| 1635 | } |
| 1636 | |
| 1637 | pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP; |
| 1638 | pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp); |
| 1639 | pSirSmeSetContextRsp->statusCode = resultCode; |
| 1640 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1641 | qdf_copy_macaddr(&pSirSmeSetContextRsp->peer_macaddr, &peer_macaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1642 | |
| 1643 | /* Update SME session and transaction Id */ |
| 1644 | pSirSmeSetContextRsp->sessionId = smesessionId; |
| 1645 | pSirSmeSetContextRsp->transactionId = smetransactionId; |
| 1646 | |
| 1647 | mmhMsg.type = eWNI_SME_SETCONTEXT_RSP; |
| 1648 | mmhMsg.bodyptr = pSirSmeSetContextRsp; |
| 1649 | mmhMsg.bodyval = 0; |
| 1650 | if (NULL == psessionEntry) { |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 1651 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, |
| 1652 | NO_SESSION, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1653 | } else { |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 1654 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, |
| 1655 | psessionEntry->peSessionId, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1656 | } |
| 1657 | |
| 1658 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1659 | lim_diag_event_report(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, |
| 1660 | psessionEntry, (uint16_t) resultCode, 0); |
| 1661 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1662 | |
| 1663 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1664 | } /*** end lim_send_sme_set_context_rsp() ***/ |
| 1665 | |
| 1666 | /** |
| 1667 | * lim_send_sme_neighbor_bss_ind() |
| 1668 | * |
| 1669 | ***FUNCTION: |
| 1670 | * This function is called by lim_lookup_nadd_hash_entry() to send |
| 1671 | * eWNI_SME_NEIGHBOR_BSS_IND message to host |
| 1672 | * |
| 1673 | ***PARAMS: |
| 1674 | * |
| 1675 | ***LOGIC: |
| 1676 | * |
| 1677 | ***ASSUMPTIONS: |
| 1678 | * NA |
| 1679 | * |
| 1680 | ***NOTE: |
| 1681 | * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to |
| 1682 | * host upon detecting new BSS during background scanning if CFG |
| 1683 | * option is enabled for sending such indication |
| 1684 | * |
| 1685 | * @param pMac - Pointer to Global MAC structure |
| 1686 | * @return None |
| 1687 | */ |
| 1688 | |
| 1689 | void |
| 1690 | lim_send_sme_neighbor_bss_ind(tpAniSirGlobal pMac, tLimScanResultNode *pBssDescr) |
| 1691 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1692 | struct scheduler_msg msgQ = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1693 | uint32_t val; |
| 1694 | tSirSmeNeighborBssInd *pNewBssInd; |
| 1695 | |
| 1696 | if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) || |
| 1697 | ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) && |
| 1698 | pMac->lim.gLimRspReqd)) { |
| 1699 | /* LIM is not in background scan state OR */ |
| 1700 | /* current scan is initiated by HDD. */ |
| 1701 | /* No need to send new BSS indication to HDD */ |
| 1702 | return; |
| 1703 | } |
| 1704 | |
| 1705 | if (wlan_cfg_get_int(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != |
| 1706 | eSIR_SUCCESS) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1707 | pe_err("could not get NEIGHBOR_BSS_IND from CFG"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1708 | return; |
| 1709 | } |
| 1710 | |
| 1711 | if (val == 0) |
| 1712 | return; |
| 1713 | |
| 1714 | /** |
| 1715 | * Need to indicate new BSSs found during |
| 1716 | * background scanning to host. |
| 1717 | * Allocate buffer for sending indication. |
| 1718 | * Length of buffer is length of BSS description |
| 1719 | * and length of header itself |
| 1720 | */ |
| 1721 | val = pBssDescr->bssDescription.length + sizeof(uint16_t) + |
| 1722 | sizeof(uint32_t) + sizeof(uint8_t); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1723 | pNewBssInd = qdf_mem_malloc(val); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1724 | if (NULL == pNewBssInd) { |
| 1725 | /* Log error */ |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1726 | pe_err("call to AllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1727 | return; |
| 1728 | } |
| 1729 | |
| 1730 | pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND; |
| 1731 | pNewBssInd->length = (uint16_t) val; |
| 1732 | pNewBssInd->sessionId = 0; |
| 1733 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1734 | qdf_mem_copy((uint8_t *) pNewBssInd->bssDescription, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1735 | (uint8_t *) &pBssDescr->bssDescription, |
| 1736 | pBssDescr->bssDescription.length + sizeof(uint16_t)); |
| 1737 | |
| 1738 | msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND; |
| 1739 | msgQ.bodyptr = pNewBssInd; |
| 1740 | msgQ.bodyval = 0; |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 1741 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, msgQ.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1742 | lim_sys_process_mmh_msg_api(pMac, &msgQ, ePROT); |
| 1743 | } /*** end lim_send_sme_neighbor_bss_ind() ***/ |
| 1744 | |
| 1745 | /** ----------------------------------------------------------------- |
| 1746 | \brief lim_send_sme_addts_rsp() - sends SME ADDTS RSP |
| 1747 | \ This function sends a eWNI_SME_ADDTS_RSP to SME. |
| 1748 | \ SME only looks at rc and tspec field. |
| 1749 | \param pMac - global mac structure |
| 1750 | \param rspReqd - is SmeAddTsRsp required |
| 1751 | \param status - status code of SME_ADD_TS_RSP |
| 1752 | \return tspec |
| 1753 | \sa |
| 1754 | ----------------------------------------------------------------- */ |
| 1755 | void |
| 1756 | lim_send_sme_addts_rsp(tpAniSirGlobal pMac, uint8_t rspReqd, uint32_t status, |
| 1757 | tpPESession psessionEntry, tSirMacTspecIE tspec, |
| 1758 | uint8_t smesessionId, uint16_t smetransactionId) |
| 1759 | { |
| 1760 | tpSirAddtsRsp rsp; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1761 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1762 | |
| 1763 | if (!rspReqd) |
| 1764 | return; |
| 1765 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1766 | rsp = qdf_mem_malloc(sizeof(tSirAddtsRsp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1767 | if (NULL == rsp) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1768 | pe_err("AllocateMemory failed for ADDTS_RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1769 | return; |
| 1770 | } |
| 1771 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1772 | rsp->messageType = eWNI_SME_ADDTS_RSP; |
| 1773 | rsp->rc = status; |
| 1774 | rsp->rsp.status = (enum eSirMacStatusCodes)status; |
| 1775 | rsp->rsp.tspec = tspec; |
| 1776 | /* Update SME session Id and transcation Id */ |
| 1777 | rsp->sessionId = smesessionId; |
| 1778 | rsp->transactionId = smetransactionId; |
| 1779 | |
| 1780 | mmhMsg.type = eWNI_SME_ADDTS_RSP; |
| 1781 | mmhMsg.bodyptr = rsp; |
| 1782 | mmhMsg.bodyval = 0; |
| 1783 | if (NULL == psessionEntry) { |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 1784 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, |
| 1785 | NO_SESSION, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1786 | } else { |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 1787 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, |
| 1788 | psessionEntry->peSessionId, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1789 | } |
| 1790 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1791 | lim_diag_event_report(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, |
| 1792 | 0); |
| 1793 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1794 | |
| 1795 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1796 | return; |
| 1797 | } |
| 1798 | |
| 1799 | void |
| 1800 | lim_send_sme_delts_rsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, uint32_t status, |
| 1801 | tpPESession psessionEntry, uint8_t smesessionId, |
| 1802 | uint16_t smetransactionId) |
| 1803 | { |
| 1804 | tpSirDeltsRsp rsp; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1805 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1806 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1807 | pe_debug("SendSmeDeltsRsp aid: %d tsid: %d up: %d status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1808 | delts->aid, |
| 1809 | delts->req.tsinfo.traffic.tsid, |
| 1810 | delts->req.tsinfo.traffic.userPrio, status); |
| 1811 | if (!delts->rspReqd) |
| 1812 | return; |
| 1813 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1814 | rsp = qdf_mem_malloc(sizeof(tSirDeltsRsp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1815 | if (NULL == rsp) { |
| 1816 | /* Log error */ |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1817 | pe_err("AllocateMemory failed for DELTS_RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1818 | return; |
| 1819 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1820 | |
| 1821 | if (psessionEntry != NULL) { |
| 1822 | |
| 1823 | rsp->aid = delts->aid; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1824 | qdf_copy_macaddr(&rsp->macaddr, &delts->macaddr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1825 | qdf_mem_copy((uint8_t *) &rsp->rsp, (uint8_t *) &delts->req, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1826 | sizeof(tSirDeltsReqInfo)); |
| 1827 | } |
| 1828 | |
| 1829 | rsp->messageType = eWNI_SME_DELTS_RSP; |
| 1830 | rsp->rc = status; |
| 1831 | |
| 1832 | /* Update SME session Id and transcation Id */ |
| 1833 | rsp->sessionId = smesessionId; |
| 1834 | rsp->transactionId = smetransactionId; |
| 1835 | |
| 1836 | mmhMsg.type = eWNI_SME_DELTS_RSP; |
| 1837 | mmhMsg.bodyptr = rsp; |
| 1838 | mmhMsg.bodyval = 0; |
| 1839 | if (NULL == psessionEntry) { |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 1840 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, |
| 1841 | NO_SESSION, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1842 | } else { |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 1843 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, |
| 1844 | psessionEntry->peSessionId, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1845 | } |
| 1846 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1847 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, |
| 1848 | (uint16_t) status, 0); |
| 1849 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1850 | |
| 1851 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1852 | } |
| 1853 | |
| 1854 | void |
| 1855 | lim_send_sme_delts_ind(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, uint16_t aid, |
| 1856 | tpPESession psessionEntry) |
| 1857 | { |
| 1858 | tpSirDeltsRsp rsp; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1859 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1860 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1861 | pe_debug("SendSmeDeltsInd aid: %d tsid: %d up: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1862 | aid, delts->tsinfo.traffic.tsid, delts->tsinfo.traffic.userPrio); |
| 1863 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1864 | rsp = qdf_mem_malloc(sizeof(tSirDeltsRsp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1865 | if (NULL == rsp) { |
| 1866 | /* Log error */ |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1867 | pe_err("AllocateMemory failed for DELTS_IND"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1868 | return; |
| 1869 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1870 | |
| 1871 | rsp->messageType = eWNI_SME_DELTS_IND; |
| 1872 | rsp->rc = eSIR_SUCCESS; |
| 1873 | rsp->aid = aid; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1874 | qdf_mem_copy((uint8_t *) &rsp->rsp, (uint8_t *) delts, sizeof(*delts)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1875 | |
| 1876 | /* Update SME session Id and SME transaction Id */ |
| 1877 | |
| 1878 | rsp->sessionId = psessionEntry->smeSessionId; |
| 1879 | rsp->transactionId = psessionEntry->transactionId; |
| 1880 | |
| 1881 | mmhMsg.type = eWNI_SME_DELTS_IND; |
| 1882 | mmhMsg.bodyptr = rsp; |
| 1883 | mmhMsg.bodyval = 0; |
| 1884 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1885 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1886 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, |
| 1887 | 0); |
| 1888 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1889 | |
| 1890 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1891 | } |
| 1892 | |
| 1893 | /** |
| 1894 | * lim_send_sme_pe_statistics_rsp() |
| 1895 | * |
| 1896 | ***FUNCTION: |
| 1897 | * This function is called to send 802.11 statistics response to HDD. |
| 1898 | * This function posts the result back to HDD. This is a response to |
| 1899 | * HDD's request for statistics. |
| 1900 | * |
| 1901 | ***PARAMS: |
| 1902 | * |
| 1903 | ***LOGIC: |
| 1904 | * |
| 1905 | ***ASSUMPTIONS: |
| 1906 | * NA |
| 1907 | * |
| 1908 | ***NOTE: |
| 1909 | * NA |
| 1910 | * |
| 1911 | * @param pMac Pointer to Global MAC structure |
| 1912 | * @param p80211Stats Statistics sent in response |
| 1913 | * @param resultCode TODO: |
| 1914 | * |
| 1915 | * |
| 1916 | * @return none |
| 1917 | */ |
| 1918 | |
| 1919 | void |
| 1920 | lim_send_sme_pe_statistics_rsp(tpAniSirGlobal pMac, uint16_t msgType, void *stats) |
| 1921 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1922 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1923 | uint8_t sessionId; |
| 1924 | tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats; |
| 1925 | tpPESession pPeSessionEntry; |
| 1926 | |
| 1927 | /* Get the Session Id based on Sta Id */ |
| 1928 | pPeSessionEntry = |
| 1929 | pe_find_session_by_sta_id(pMac, pPeStats->staId, &sessionId); |
| 1930 | |
| 1931 | /* Fill the Session Id */ |
| 1932 | if (NULL != pPeSessionEntry) { |
| 1933 | /* Fill the Session Id */ |
| 1934 | pPeStats->sessionId = pPeSessionEntry->smeSessionId; |
| 1935 | } |
| 1936 | |
| 1937 | pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP; |
| 1938 | |
| 1939 | /* msgType should be WMA_GET_STATISTICS_RSP */ |
| 1940 | mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP; |
| 1941 | |
| 1942 | mmhMsg.bodyptr = stats; |
| 1943 | mmhMsg.bodyval = 0; |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 1944 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1945 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1946 | |
| 1947 | return; |
| 1948 | |
| 1949 | } /*** end lim_send_sme_pe_statistics_rsp() ***/ |
| 1950 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1951 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1952 | /** |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1953 | * lim_send_sme_pe_ese_tsm_rsp() - send tsm response |
| 1954 | * @pMac: Pointer to global pMac structure |
| 1955 | * @pStats: Pointer to TSM Stats |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1956 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1957 | * This function is called to send tsm stats response to HDD. |
| 1958 | * This function posts the result back to HDD. This is a response to |
| 1959 | * HDD's request to get tsm stats. |
| 1960 | * |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1961 | * Return: None |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1962 | */ |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1963 | void lim_send_sme_pe_ese_tsm_rsp(tpAniSirGlobal pMac, |
| 1964 | tAniGetTsmStatsRsp *pStats) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1965 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1966 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1967 | uint8_t sessionId; |
| 1968 | tAniGetTsmStatsRsp *pPeStats = (tAniGetTsmStatsRsp *) pStats; |
| 1969 | tpPESession pPeSessionEntry = NULL; |
| 1970 | |
| 1971 | /* Get the Session Id based on Sta Id */ |
| 1972 | pPeSessionEntry = |
| 1973 | pe_find_session_by_sta_id(pMac, pPeStats->staId, &sessionId); |
| 1974 | |
| 1975 | /* Fill the Session Id */ |
| 1976 | if (NULL != pPeSessionEntry) { |
| 1977 | /* Fill the Session Id */ |
| 1978 | pPeStats->sessionId = pPeSessionEntry->smeSessionId; |
| 1979 | } else { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 1980 | pe_err("Session not found for the Sta id: %d", |
Nishank Aggarwal | d5941bb | 2017-03-11 14:41:24 +0530 | [diff] [blame] | 1981 | pPeStats->staId); |
Manikandan Mohan | 41e2d6f | 2017-04-10 16:17:39 +0530 | [diff] [blame] | 1982 | qdf_mem_free(pPeStats->tsmStatsReq); |
| 1983 | qdf_mem_free(pPeStats); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1984 | return; |
| 1985 | } |
| 1986 | |
| 1987 | pPeStats->msgType = eWNI_SME_GET_TSM_STATS_RSP; |
| 1988 | pPeStats->tsmMetrics.RoamingCount |
| 1989 | = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingCount; |
| 1990 | pPeStats->tsmMetrics.RoamingDly |
| 1991 | = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly; |
| 1992 | |
| 1993 | mmhMsg.type = eWNI_SME_GET_TSM_STATS_RSP; |
| 1994 | mmhMsg.bodyptr = pStats; |
| 1995 | mmhMsg.bodyval = 0; |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 1996 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1997 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1998 | |
| 1999 | return; |
| 2000 | } /*** end lim_send_sme_pe_ese_tsm_rsp() ***/ |
| 2001 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 2002 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2003 | |
| 2004 | void |
| 2005 | lim_send_sme_ibss_peer_ind(tpAniSirGlobal pMac, |
| 2006 | tSirMacAddr peerMacAddr, |
| 2007 | uint16_t staIndex, |
| 2008 | uint8_t ucastIdx, |
| 2009 | uint8_t bcastIdx, |
| 2010 | uint8_t *beacon, |
| 2011 | uint16_t beaconLen, uint16_t msgType, uint8_t sessionId) |
| 2012 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 2013 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2014 | tSmeIbssPeerInd *pNewPeerInd; |
| 2015 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2016 | pNewPeerInd = qdf_mem_malloc(sizeof(tSmeIbssPeerInd) + beaconLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2017 | if (NULL == pNewPeerInd) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2018 | pe_err("Failed to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2019 | return; |
| 2020 | } |
| 2021 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2022 | qdf_mem_copy((uint8_t *) pNewPeerInd->peer_addr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2023 | peerMacAddr, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2024 | pNewPeerInd->staId = staIndex; |
| 2025 | pNewPeerInd->ucastSig = ucastIdx; |
| 2026 | pNewPeerInd->bcastSig = bcastIdx; |
| 2027 | pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen; |
| 2028 | pNewPeerInd->mesgType = msgType; |
| 2029 | pNewPeerInd->sessionId = sessionId; |
| 2030 | |
| 2031 | if (beacon != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2032 | qdf_mem_copy((void *)((uint8_t *) pNewPeerInd + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2033 | sizeof(tSmeIbssPeerInd)), (void *)beacon, |
| 2034 | beaconLen); |
| 2035 | } |
| 2036 | |
| 2037 | mmhMsg.type = msgType; |
| 2038 | mmhMsg.bodyptr = pNewPeerInd; |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 2039 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2040 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2041 | |
| 2042 | } |
| 2043 | |
Kiran Kumar Lokere | fc8feea | 2016-10-27 17:07:00 -0700 | [diff] [blame] | 2044 | /** |
| 2045 | * lim_process_csa_wbw_ie() - Process CSA Wide BW IE |
| 2046 | * @mac_ctx: pointer to global adapter context |
| 2047 | * @csa_params: pointer to CSA parameters |
| 2048 | * @chnl_switch_info:pointer to channel switch parameters |
| 2049 | * @session_entry: session pointer |
| 2050 | * |
| 2051 | * Return: None |
| 2052 | */ |
| 2053 | static void lim_process_csa_wbw_ie(tpAniSirGlobal mac_ctx, |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2054 | struct csa_offload_params *csa_params, |
| 2055 | tLimWiderBWChannelSwitchInfo *chnl_switch_info, |
| 2056 | tpPESession session_entry) |
| 2057 | { |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 2058 | struct ch_params ch_params = {0}; |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2059 | uint8_t ap_new_ch_width; |
| 2060 | bool new_ch_width_dfn = false; |
| 2061 | uint8_t center_freq_diff; |
| 2062 | |
| 2063 | ap_new_ch_width = csa_params->new_ch_width + 1; |
| 2064 | if ((ap_new_ch_width == CH_WIDTH_80MHZ) && |
| 2065 | csa_params->new_ch_freq_seg2) { |
| 2066 | new_ch_width_dfn = true; |
| 2067 | if (csa_params->new_ch_freq_seg2 > |
| 2068 | csa_params->new_ch_freq_seg1) |
| 2069 | center_freq_diff = csa_params->new_ch_freq_seg2 - |
| 2070 | csa_params->new_ch_freq_seg1; |
| 2071 | else |
| 2072 | center_freq_diff = csa_params->new_ch_freq_seg1 - |
| 2073 | csa_params->new_ch_freq_seg2; |
| 2074 | if (center_freq_diff == CENTER_FREQ_DIFF_160MHz) |
| 2075 | ap_new_ch_width = CH_WIDTH_160MHZ; |
| 2076 | else if (center_freq_diff > CENTER_FREQ_DIFF_80P80MHz) |
| 2077 | ap_new_ch_width = CH_WIDTH_80P80MHZ; |
| 2078 | else |
| 2079 | ap_new_ch_width = CH_WIDTH_80MHZ; |
| 2080 | } |
| 2081 | session_entry->gLimChannelSwitch.state = |
| 2082 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2083 | if ((ap_new_ch_width == CH_WIDTH_160MHZ) && |
| 2084 | !new_ch_width_dfn) { |
| 2085 | ch_params.ch_width = CH_WIDTH_160MHZ; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 2086 | wlan_reg_set_channel_params(mac_ctx->pdev, |
| 2087 | csa_params->channel, 0, &ch_params); |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2088 | ap_new_ch_width = ch_params.ch_width; |
| 2089 | csa_params->new_ch_freq_seg1 = ch_params.center_freq_seg0; |
| 2090 | csa_params->new_ch_freq_seg2 = ch_params.center_freq_seg1; |
| 2091 | } |
| 2092 | chnl_switch_info->newChanWidth = ap_new_ch_width; |
| 2093 | chnl_switch_info->newCenterChanFreq0 = csa_params->new_ch_freq_seg1; |
| 2094 | chnl_switch_info->newCenterChanFreq1 = csa_params->new_ch_freq_seg2; |
| 2095 | |
| 2096 | if (session_entry->ch_width == ap_new_ch_width) |
| 2097 | goto prnt_log; |
| 2098 | |
| 2099 | if (session_entry->ch_width == CH_WIDTH_80MHZ) { |
| 2100 | chnl_switch_info->newChanWidth = CH_WIDTH_80MHZ; |
| 2101 | chnl_switch_info->newCenterChanFreq1 = 0; |
| 2102 | } else { |
| 2103 | session_entry->ch_width = ap_new_ch_width; |
| 2104 | chnl_switch_info->newChanWidth = ap_new_ch_width; |
| 2105 | } |
| 2106 | prnt_log: |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2107 | pe_debug("new channel: %d new_ch_width: %d seg0: %d seg1: %d", |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2108 | csa_params->channel, |
| 2109 | chnl_switch_info->newChanWidth, |
| 2110 | chnl_switch_info->newCenterChanFreq0, |
| 2111 | chnl_switch_info->newCenterChanFreq1); |
| 2112 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2113 | /** |
| 2114 | * lim_handle_csa_offload_msg() - Handle CSA offload message |
| 2115 | * @mac_ctx: pointer to global adapter context |
| 2116 | * @msg: Message pointer. |
| 2117 | * |
| 2118 | * Return: None |
| 2119 | */ |
Rajeev Kumar | feb9638 | 2017-01-22 19:42:09 -0800 | [diff] [blame] | 2120 | void lim_handle_csa_offload_msg(tpAniSirGlobal mac_ctx, |
| 2121 | struct scheduler_msg *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2122 | { |
| 2123 | tpPESession session_entry; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 2124 | struct scheduler_msg mmh_msg = {0}; |
Chandrasekaran, Manishekar | 5c19dc5 | 2016-02-04 14:58:26 +0530 | [diff] [blame] | 2125 | struct csa_offload_params *csa_params = |
| 2126 | (struct csa_offload_params *) (msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2127 | tpSmeCsaOffloadInd csa_offload_ind; |
| 2128 | tpDphHashNode sta_ds = NULL; |
| 2129 | uint8_t session_id; |
| 2130 | uint16_t aid = 0; |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2131 | uint16_t chan_space = 0; |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 2132 | struct ch_params ch_params; |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2133 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2134 | tLimWiderBWChannelSwitchInfo *chnl_switch_info = NULL; |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2135 | tLimChannelSwitchInfo *lim_ch_switch = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2136 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2137 | pe_debug("handle csa offload msg"); |
Chandrasekaran, Manishekar | 5c19dc5 | 2016-02-04 14:58:26 +0530 | [diff] [blame] | 2138 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2139 | if (!csa_params) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2140 | pe_err("limMsgQ body ptr is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2141 | return; |
| 2142 | } |
| 2143 | |
| 2144 | session_entry = |
| 2145 | pe_find_session_by_bssid(mac_ctx, |
| 2146 | csa_params->bssId, &session_id); |
| 2147 | if (!session_entry) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2148 | pe_err("Session does not exists for %pM", |
Chandrasekaran, Manishekar | 5c19dc5 | 2016-02-04 14:58:26 +0530 | [diff] [blame] | 2149 | csa_params->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2150 | goto err; |
| 2151 | } |
| 2152 | |
| 2153 | sta_ds = dph_lookup_hash_entry(mac_ctx, session_entry->bssId, &aid, |
| 2154 | &session_entry->dph.dphHashTable); |
| 2155 | |
| 2156 | if (!sta_ds) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2157 | pe_err("sta_ds does not exist"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2158 | goto err; |
| 2159 | } |
| 2160 | |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2161 | if (!LIM_IS_STA_ROLE(session_entry)) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2162 | pe_debug("Invalid role to handle CSA"); |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2163 | goto err; |
| 2164 | } |
Masti, Narayanraddi | 1c63044 | 2015-11-02 12:03:50 +0530 | [diff] [blame] | 2165 | |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2166 | /* |
| 2167 | * on receiving channel switch announcement from AP, delete all |
| 2168 | * TDLS peers before leaving BSS and proceed for channel switch |
| 2169 | */ |
| 2170 | lim_delete_tdls_peers(mac_ctx, session_entry); |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2171 | |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2172 | lim_ch_switch = &session_entry->gLimChannelSwitch; |
| 2173 | session_entry->gLimChannelSwitch.switchMode = |
| 2174 | csa_params->switch_mode; |
| 2175 | /* timer already started by firmware, switch immediately */ |
| 2176 | session_entry->gLimChannelSwitch.switchCount = 0; |
| 2177 | session_entry->gLimChannelSwitch.primaryChannel = |
| 2178 | csa_params->channel; |
| 2179 | session_entry->gLimChannelSwitch.state = |
| 2180 | eLIM_CHANNEL_SWITCH_PRIMARY_ONLY; |
| 2181 | session_entry->gLimChannelSwitch.ch_width = CH_WIDTH_20MHZ; |
| 2182 | lim_ch_switch->sec_ch_offset = |
| 2183 | session_entry->htSecondaryChannelOffset; |
| 2184 | session_entry->gLimChannelSwitch.ch_center_freq_seg0 = 0; |
| 2185 | session_entry->gLimChannelSwitch.ch_center_freq_seg1 = 0; |
| 2186 | chnl_switch_info = |
| 2187 | &session_entry->gLimWiderBWChannelSwitch; |
| 2188 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2189 | pe_debug("vht: %d ht: %d flag: %x chan: %d", |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 2190 | session_entry->vhtCapability, |
| 2191 | session_entry->htSupportedChannelWidthSet, |
| 2192 | csa_params->ies_present_flag, |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2193 | csa_params->channel); |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2194 | pe_debug("seg1: %d seg2: %d width: %d country: %s class: %d", |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2195 | csa_params->new_ch_freq_seg1, |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 2196 | csa_params->new_ch_freq_seg2, |
| 2197 | csa_params->new_ch_width, |
| 2198 | mac_ctx->scan.countryCodeCurrent, |
| 2199 | csa_params->new_op_class); |
| 2200 | |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2201 | if (session_entry->vhtCapability && |
| 2202 | session_entry->htSupportedChannelWidthSet) { |
| 2203 | if (csa_params->ies_present_flag & lim_wbw_ie_present) { |
Kiran Kumar Lokere | fc8feea | 2016-10-27 17:07:00 -0700 | [diff] [blame] | 2204 | lim_process_csa_wbw_ie(mac_ctx, csa_params, |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2205 | chnl_switch_info, session_entry); |
| 2206 | lim_ch_switch->sec_ch_offset = |
Abhishek Singh | af639b4 | 2017-06-16 14:14:36 +0530 | [diff] [blame] | 2207 | PHY_SINGLE_CHANNEL_CENTERED; |
| 2208 | if (chnl_switch_info->newChanWidth) { |
| 2209 | if (csa_params->channel < |
| 2210 | csa_params->new_ch_freq_seg1) |
| 2211 | lim_ch_switch->sec_ch_offset = |
| 2212 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 2213 | else |
| 2214 | lim_ch_switch->sec_ch_offset = |
| 2215 | PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 2216 | } |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2217 | } else if (csa_params->ies_present_flag |
| 2218 | & lim_xcsa_ie_present) { |
| 2219 | chan_space = |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 2220 | wlan_reg_dmn_get_chanwidth_from_opclass( |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2221 | mac_ctx->scan.countryCodeCurrent, |
| 2222 | csa_params->channel, |
| 2223 | csa_params->new_op_class); |
| 2224 | session_entry->gLimChannelSwitch.state = |
| 2225 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2226 | |
| 2227 | if (chan_space == 80) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2228 | chnl_switch_info->newChanWidth = |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2229 | CH_WIDTH_80MHZ; |
| 2230 | } else if (chan_space == 40) { |
| 2231 | chnl_switch_info->newChanWidth = |
| 2232 | CH_WIDTH_40MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2233 | } else { |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2234 | chnl_switch_info->newChanWidth = |
| 2235 | CH_WIDTH_20MHZ; |
| 2236 | lim_ch_switch->state = |
| 2237 | eLIM_CHANNEL_SWITCH_PRIMARY_ONLY; |
| 2238 | } |
| 2239 | |
| 2240 | ch_params.ch_width = |
| 2241 | chnl_switch_info->newChanWidth; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 2242 | wlan_reg_set_channel_params(mac_ctx->pdev, |
| 2243 | csa_params->channel, 0, &ch_params); |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2244 | chnl_switch_info->newCenterChanFreq0 = |
| 2245 | ch_params.center_freq_seg0; |
| 2246 | /* |
| 2247 | * This is not applicable for 20/40/80 MHz. |
| 2248 | * Only used when we support 80+80 MHz operation. |
| 2249 | * In case of 80+80 MHz, this parameter indicates |
| 2250 | * center channel frequency index of 80 MHz |
| 2251 | * channel offrequency segment 1. |
| 2252 | */ |
| 2253 | chnl_switch_info->newCenterChanFreq1 = |
| 2254 | ch_params.center_freq_seg1; |
| 2255 | lim_ch_switch->sec_ch_offset = |
| 2256 | ch_params.sec_ch_offset; |
| 2257 | |
| 2258 | } |
| 2259 | session_entry->gLimChannelSwitch.ch_center_freq_seg0 = |
| 2260 | chnl_switch_info->newCenterChanFreq0; |
| 2261 | session_entry->gLimChannelSwitch.ch_center_freq_seg1 = |
| 2262 | chnl_switch_info->newCenterChanFreq1; |
| 2263 | session_entry->gLimChannelSwitch.ch_width = |
| 2264 | chnl_switch_info->newChanWidth; |
| 2265 | |
| 2266 | } else if (session_entry->htSupportedChannelWidthSet) { |
| 2267 | if (csa_params->ies_present_flag |
| 2268 | & lim_xcsa_ie_present) { |
| 2269 | chan_space = |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 2270 | wlan_reg_dmn_get_chanwidth_from_opclass( |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2271 | mac_ctx->scan.countryCodeCurrent, |
| 2272 | csa_params->channel, |
| 2273 | csa_params->new_op_class); |
| 2274 | lim_ch_switch->state = |
| 2275 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2276 | if (chan_space == 40) { |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2277 | lim_ch_switch->ch_width = |
| 2278 | CH_WIDTH_40MHZ; |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2279 | chnl_switch_info->newChanWidth = |
| 2280 | CH_WIDTH_40MHZ; |
| 2281 | ch_params.ch_width = |
| 2282 | chnl_switch_info->newChanWidth; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 2283 | wlan_reg_set_channel_params(mac_ctx->pdev, |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2284 | csa_params->channel, |
Sandeep Puligilla | 1cc23f6 | 2016-04-27 16:52:49 -0700 | [diff] [blame] | 2285 | 0, &ch_params); |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2286 | lim_ch_switch->ch_center_freq_seg0 = |
| 2287 | ch_params.center_freq_seg0; |
| 2288 | lim_ch_switch->sec_ch_offset = |
| 2289 | ch_params.sec_ch_offset; |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2290 | } else { |
| 2291 | lim_ch_switch->ch_width = |
| 2292 | CH_WIDTH_20MHZ; |
| 2293 | chnl_switch_info->newChanWidth = |
| 2294 | CH_WIDTH_40MHZ; |
| 2295 | lim_ch_switch->state = |
| 2296 | eLIM_CHANNEL_SWITCH_PRIMARY_ONLY; |
| 2297 | lim_ch_switch->sec_ch_offset = |
| 2298 | PHY_SINGLE_CHANNEL_CENTERED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2299 | } |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2300 | } else { |
| 2301 | lim_ch_switch->ch_width = |
| 2302 | CH_WIDTH_40MHZ; |
| 2303 | lim_ch_switch->state = |
| 2304 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2305 | ch_params.ch_width = CH_WIDTH_40MHZ; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 2306 | wlan_reg_set_channel_params(mac_ctx->pdev, |
| 2307 | csa_params->channel, 0, &ch_params); |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2308 | lim_ch_switch->ch_center_freq_seg0 = |
| 2309 | ch_params.center_freq_seg0; |
| 2310 | lim_ch_switch->sec_ch_offset = |
| 2311 | ch_params.sec_ch_offset; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2312 | } |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2313 | |
| 2314 | } |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2315 | pe_debug("new ch width: %d space: %d", |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 2316 | session_entry->gLimChannelSwitch.ch_width, chan_space); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2317 | |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2318 | lim_prepare_for11h_channel_switch(mac_ctx, session_entry); |
| 2319 | csa_offload_ind = qdf_mem_malloc(sizeof(tSmeCsaOffloadInd)); |
| 2320 | if (NULL == csa_offload_ind) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2321 | pe_err("memalloc fail eWNI_SME_CSA_OFFLOAD_EVENT"); |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2322 | goto err; |
| 2323 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2324 | |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2325 | csa_offload_ind->mesgType = eWNI_SME_CSA_OFFLOAD_EVENT; |
| 2326 | csa_offload_ind->mesgLen = sizeof(tSmeCsaOffloadInd); |
| 2327 | qdf_mem_copy(csa_offload_ind->bssid.bytes, session_entry->bssId, |
| 2328 | QDF_MAC_ADDR_SIZE); |
| 2329 | mmh_msg.type = eWNI_SME_CSA_OFFLOAD_EVENT; |
| 2330 | mmh_msg.bodyptr = csa_offload_ind; |
| 2331 | mmh_msg.bodyval = 0; |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2332 | pe_debug("Sending eWNI_SME_CSA_OFFLOAD_EVENT to SME"); |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2333 | MTRACE(mac_trace_msg_tx |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2334 | (mac_ctx, session_entry->peSessionId, mmh_msg.type)); |
| 2335 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2336 | lim_diag_event_report(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2337 | WLAN_PE_DIAG_SWITCH_CHL_IND_EVENT, session_entry, |
| 2338 | eSIR_SUCCESS, eSIR_SUCCESS); |
| 2339 | #endif |
Kiran Kumar Lokere | e38f4d2 | 2016-10-20 17:30:59 -0700 | [diff] [blame] | 2340 | lim_sys_process_mmh_msg_api(mac_ctx, &mmh_msg, ePROT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2341 | |
| 2342 | err: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2343 | qdf_mem_free(csa_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2344 | } |
| 2345 | |
| 2346 | /*-------------------------------------------------------------------------- |
| 2347 | \brief pe_delete_session() - Handle the Delete BSS Response from HAL. |
| 2348 | |
| 2349 | \param pMac - pointer to global adapter context |
| 2350 | \param sessionId - Message pointer. |
| 2351 | |
| 2352 | \sa |
| 2353 | --------------------------------------------------------------------------*/ |
| 2354 | |
Rajeev Kumar | 416b73f | 2017-01-21 16:45:21 -0800 | [diff] [blame] | 2355 | void lim_handle_delete_bss_rsp(tpAniSirGlobal pMac, struct scheduler_msg *MsgQ) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2356 | { |
| 2357 | tpPESession psessionEntry; |
| 2358 | tpDeleteBssParams pDelBss = (tpDeleteBssParams) (MsgQ->bodyptr); |
| 2359 | |
| 2360 | psessionEntry = |
| 2361 | pe_find_session_by_session_id(pMac, pDelBss->sessionId); |
| 2362 | if (psessionEntry == NULL) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2363 | pe_err("Session Does not exist for given sessionID: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2364 | pDelBss->sessionId); |
Naveen Rawat | 0c81edc | 2016-06-08 10:08:30 -0700 | [diff] [blame] | 2365 | qdf_mem_free(MsgQ->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2366 | return; |
| 2367 | } |
Deepak Dhamdhere | 2dae1bd | 2016-10-27 10:58:29 -0700 | [diff] [blame] | 2368 | /* |
| 2369 | * During DEL BSS handling, the PE Session will be deleted, but it is |
| 2370 | * better to clear this flag if the session is hanging around due |
| 2371 | * to some error conditions so that the next DEL_BSS request does |
| 2372 | * not take the HO_FAIL path |
| 2373 | */ |
| 2374 | psessionEntry->process_ho_fail = false; |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 2375 | if (LIM_IS_IBSS_ROLE(psessionEntry)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2376 | lim_ibss_del_bss_rsp(pMac, MsgQ->bodyptr, psessionEntry); |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 2377 | else if (LIM_IS_UNKNOWN_ROLE(psessionEntry)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2378 | lim_process_sme_del_bss_rsp(pMac, MsgQ->bodyval, psessionEntry); |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 2379 | else if (LIM_IS_NDI_ROLE(psessionEntry)) |
| 2380 | lim_ndi_del_bss_rsp(pMac, MsgQ->bodyptr, psessionEntry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2381 | else |
| 2382 | lim_process_mlm_del_bss_rsp(pMac, MsgQ, psessionEntry); |
| 2383 | |
| 2384 | } |
| 2385 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2386 | /** ----------------------------------------------------------------- |
| 2387 | \brief lim_send_sme_aggr_qos_rsp() - sends SME FT AGGR QOS RSP |
| 2388 | \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME. |
| 2389 | \ SME only looks at rc and tspec field. |
| 2390 | \param pMac - global mac structure |
| 2391 | \param rspReqd - is SmeAddTsRsp required |
| 2392 | \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP |
| 2393 | \return tspec |
| 2394 | \sa |
| 2395 | ----------------------------------------------------------------- */ |
| 2396 | void |
| 2397 | lim_send_sme_aggr_qos_rsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp, |
| 2398 | uint8_t smesessionId) |
| 2399 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 2400 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2401 | |
| 2402 | mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP; |
| 2403 | mmhMsg.bodyptr = aggrQosRsp; |
| 2404 | mmhMsg.bodyval = 0; |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 2405 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, |
| 2406 | smesessionId, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2407 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2408 | |
| 2409 | return; |
| 2410 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2411 | |
| 2412 | void lim_send_sme_max_assoc_exceeded_ntf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, |
| 2413 | uint8_t smesessionId) |
| 2414 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 2415 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2416 | tSmeMaxAssocInd *pSmeMaxAssocInd; |
| 2417 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2418 | pSmeMaxAssocInd = qdf_mem_malloc(sizeof(tSmeMaxAssocInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2419 | if (NULL == pSmeMaxAssocInd) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2420 | pe_err("Failed to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2421 | return; |
| 2422 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2423 | qdf_mem_copy((uint8_t *) pSmeMaxAssocInd->peer_mac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2424 | (uint8_t *) peerMacAddr, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2425 | pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED; |
| 2426 | pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd); |
| 2427 | pSmeMaxAssocInd->sessionId = smesessionId; |
| 2428 | mmhMsg.type = pSmeMaxAssocInd->mesgType; |
| 2429 | mmhMsg.bodyptr = pSmeMaxAssocInd; |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2430 | pe_debug("msgType: %s peerMacAddr "MAC_ADDRESS_STR "sme session id %d", |
| 2431 | "eWNI_SME_MAX_ASSOC_EXCEEDED", MAC_ADDR_ARRAY(peerMacAddr), |
| 2432 | pSmeMaxAssocInd->sessionId); |
Sreelakshmi Konamki | beacc2e | 2016-09-01 16:14:56 +0530 | [diff] [blame] | 2433 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, |
| 2434 | smesessionId, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2435 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2436 | |
| 2437 | return; |
| 2438 | } |
| 2439 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2440 | /*-------------------------------------------------------------------------- |
| 2441 | \brief lim_send_dfs_chan_sw_ie_update() |
| 2442 | This timer handler updates the channel switch IE in beacon template |
| 2443 | |
| 2444 | \param pMac - pointer to global adapter context |
| 2445 | \return - channel to scan from valid session else zero. |
| 2446 | \sa |
| 2447 | --------------------------------------------------------------------------*/ |
| 2448 | static void |
| 2449 | lim_send_dfs_chan_sw_ie_update(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 2450 | { |
| 2451 | |
| 2452 | /* Update the beacon template and send to FW */ |
| 2453 | if (sch_set_fixed_beacon_fields(pMac, psessionEntry) != eSIR_SUCCESS) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2454 | pe_err("Unable to set CSA IE in beacon"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2455 | return; |
| 2456 | } |
| 2457 | |
| 2458 | /* Send update beacon template message */ |
| 2459 | lim_send_beacon_ind(pMac, psessionEntry); |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2460 | pe_debug("Updated CSA IE, IE COUNT: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2461 | psessionEntry->gLimChannelSwitch.switchCount); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2462 | |
| 2463 | return; |
| 2464 | } |
| 2465 | |
| 2466 | /** ----------------------------------------------------------------- |
| 2467 | \brief lim_send_sme_ap_channel_switch_resp() - sends |
| 2468 | eWNI_SME_CHANNEL_CHANGE_RSP |
| 2469 | After receiving WMA_SWITCH_CHANNEL_RSP indication this |
| 2470 | function sends a eWNI_SME_CHANNEL_CHANGE_RSP to SME to notify |
| 2471 | that the Channel change has been done to the specified target |
| 2472 | channel in the Channel change request |
| 2473 | \param pMac - global mac structure |
| 2474 | \param psessionEntry - session info |
| 2475 | \param pChnlParams - Channel switch params |
| 2476 | --------------------------------------------------------------------*/ |
| 2477 | void |
| 2478 | lim_send_sme_ap_channel_switch_resp(tpAniSirGlobal pMac, |
| 2479 | tpPESession psessionEntry, |
| 2480 | tpSwitchChannelParams pChnlParams) |
| 2481 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 2482 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2483 | tpSwitchChannelParams pSmeSwithChnlParams; |
| 2484 | uint8_t channelId; |
Sandeep Puligilla | 2111d3c | 2016-02-03 01:46:15 -0800 | [diff] [blame] | 2485 | bool is_ch_dfs = false; |
Kiran Kumar Lokere | 1364467 | 2016-02-29 15:40:10 -0800 | [diff] [blame] | 2486 | enum phy_ch_width ch_width; |
Sandeep Puligilla | 2111d3c | 2016-02-03 01:46:15 -0800 | [diff] [blame] | 2487 | uint8_t ch_center_freq_seg1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2488 | |
| 2489 | pSmeSwithChnlParams = (tSwitchChannelParams *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2490 | qdf_mem_malloc(sizeof(tSwitchChannelParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2491 | if (NULL == pSmeSwithChnlParams) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2492 | pe_err("AllocateMemory failed for pSmeSwithChnlParams"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2493 | return; |
| 2494 | } |
| 2495 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2496 | qdf_mem_copy(pSmeSwithChnlParams, pChnlParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2497 | sizeof(tSwitchChannelParams)); |
| 2498 | |
| 2499 | channelId = pSmeSwithChnlParams->channelNumber; |
Sandeep Puligilla | 2111d3c | 2016-02-03 01:46:15 -0800 | [diff] [blame] | 2500 | ch_width = pSmeSwithChnlParams->ch_width; |
| 2501 | ch_center_freq_seg1 = pSmeSwithChnlParams->ch_center_freq_seg1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2502 | |
| 2503 | /* |
| 2504 | * Pass the sme sessionID to SME instead |
| 2505 | * PE session ID. |
| 2506 | */ |
| 2507 | pSmeSwithChnlParams->peSessionId = psessionEntry->smeSessionId; |
| 2508 | |
| 2509 | mmhMsg.type = eWNI_SME_CHANNEL_CHANGE_RSP; |
| 2510 | mmhMsg.bodyptr = (void *)pSmeSwithChnlParams; |
| 2511 | mmhMsg.bodyval = 0; |
| 2512 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2513 | |
| 2514 | /* |
| 2515 | * We should start beacon transmission only if the new |
| 2516 | * channel after channel change is Non-DFS. For a DFS |
| 2517 | * channel, PE will receive an explicit request from |
| 2518 | * upper layers to start the beacon transmission . |
| 2519 | */ |
| 2520 | |
Sandeep Puligilla | 2111d3c | 2016-02-03 01:46:15 -0800 | [diff] [blame] | 2521 | if (ch_width == CH_WIDTH_160MHZ) { |
| 2522 | is_ch_dfs = true; |
| 2523 | } else if (ch_width == CH_WIDTH_80P80MHZ) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 2524 | if (wlan_reg_get_channel_state(pMac->pdev, channelId) == |
| 2525 | CHANNEL_STATE_DFS || |
| 2526 | wlan_reg_get_channel_state(pMac->pdev, |
| 2527 | ch_center_freq_seg1 - |
| 2528 | SIR_80MHZ_START_CENTER_CH_DIFF) == |
Sandeep Puligilla | 2111d3c | 2016-02-03 01:46:15 -0800 | [diff] [blame] | 2529 | CHANNEL_STATE_DFS) |
| 2530 | is_ch_dfs = true; |
| 2531 | } else { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 2532 | if (wlan_reg_get_channel_state(pMac->pdev, channelId) == |
| 2533 | CHANNEL_STATE_DFS) |
Sandeep Puligilla | 2111d3c | 2016-02-03 01:46:15 -0800 | [diff] [blame] | 2534 | is_ch_dfs = true; |
| 2535 | } |
| 2536 | |
| 2537 | if (!is_ch_dfs) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2538 | if (channelId == psessionEntry->currentOperChannel) { |
| 2539 | lim_apply_configuration(pMac, psessionEntry); |
| 2540 | lim_send_beacon_ind(pMac, psessionEntry); |
| 2541 | } else { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2542 | pe_debug("Failed to Transmit Beacons on channel: %d after AP channel change response", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2543 | psessionEntry->bcnLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2544 | } |
| 2545 | } |
| 2546 | return; |
| 2547 | } |
| 2548 | |
Peng Xu | 6363ec6 | 2017-05-15 11:06:33 -0700 | [diff] [blame] | 2549 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
| 2550 | /** |
| 2551 | * lim_send_bss_color_change_ie_update() - update bss color change IE in |
| 2552 | * beacon template |
| 2553 | * |
| 2554 | * @mac_ctx: pointer to global adapter context |
| 2555 | * @session: session pointer |
| 2556 | * |
| 2557 | * Return: none |
| 2558 | */ |
| 2559 | static void |
| 2560 | lim_send_bss_color_change_ie_update(tpAniSirGlobal mac_ctx, |
| 2561 | tpPESession session) |
| 2562 | { |
| 2563 | /* Update the beacon template and send to FW */ |
| 2564 | if (sch_set_fixed_beacon_fields(mac_ctx, session) != eSIR_SUCCESS) { |
| 2565 | pe_err("Unable to set BSS color change IE in beacon"); |
| 2566 | return; |
| 2567 | } |
| 2568 | |
| 2569 | /* Send update beacon template message */ |
| 2570 | lim_send_beacon_ind(mac_ctx, session); |
| 2571 | pe_info("Updated BSS color change countdown = %d", |
| 2572 | session->he_bss_color_change.countdown); |
| 2573 | } |
| 2574 | |
| 2575 | static void |
| 2576 | lim_handle_bss_color_change_ie(tpAniSirGlobal mac_ctx, |
| 2577 | tpPESession session) |
| 2578 | { |
| 2579 | /* handle bss color change IE */ |
| 2580 | if (LIM_IS_AP_ROLE(session) && |
| 2581 | session->he_op.bss_col_disabled) { |
| 2582 | if (session->he_bss_color_change.countdown > 0) { |
| 2583 | session->he_bss_color_change.countdown--; |
| 2584 | } else { |
| 2585 | session->bss_color_changing = 0; |
| 2586 | if (session->he_bss_color_change.new_color != 0) |
| 2587 | session->he_op.bss_col_disabled = 0; |
| 2588 | } |
| 2589 | |
| 2590 | lim_send_bss_color_change_ie_update(mac_ctx, session); |
| 2591 | } |
| 2592 | } |
| 2593 | |
| 2594 | #else |
| 2595 | static void |
| 2596 | lim_handle_bss_color_change_ie(tpAniSirGlobal mac_ctx, |
| 2597 | tpPESession session) |
| 2598 | { |
| 2599 | } |
| 2600 | #endif |
| 2601 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2602 | /** ----------------------------------------------------------------- |
| 2603 | \brief lim_process_beacon_tx_success_ind() - This function is used |
| 2604 | explicitely to handle successful beacon transmission indication |
| 2605 | from the FW. This is a generic event generated by the FW afer the |
| 2606 | first beacon is sent out after the beacon template update by the |
| 2607 | host |
| 2608 | \param pMac - global mac structure |
| 2609 | \param psessionEntry - session info |
| 2610 | \return none |
| 2611 | \sa |
| 2612 | ----------------------------------------------------------------- */ |
| 2613 | void |
| 2614 | lim_process_beacon_tx_success_ind(tpAniSirGlobal pMac, uint16_t msgType, void *event) |
| 2615 | { |
| 2616 | /* Currently, this event is used only for DFS channel switch announcement |
| 2617 | * IE update in the template. If required to be used for other IE updates |
| 2618 | * add appropriate code by introducing a state variable |
| 2619 | */ |
| 2620 | tpPESession psessionEntry; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 2621 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2622 | tSirSmeCSAIeTxCompleteRsp *pChanSwTxResponse; |
| 2623 | struct sir_beacon_tx_complete_rsp *beacon_tx_comp_rsp_ptr; |
| 2624 | uint8_t length = sizeof(tSirSmeCSAIeTxCompleteRsp); |
| 2625 | tpSirFirstBeaconTxCompleteInd pBcnTxInd = |
| 2626 | (tSirFirstBeaconTxCompleteInd *) event; |
| 2627 | |
| 2628 | psessionEntry = pe_find_session_by_bss_idx(pMac, pBcnTxInd->bssIdx); |
| 2629 | if (psessionEntry == NULL) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2630 | pe_err("Session Does not exist for given sessionID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2631 | return; |
| 2632 | } |
| 2633 | |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2634 | pe_debug("role: %d swIe: %d opIe: %d", |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 2635 | GET_LIM_SYSTEM_ROLE(psessionEntry), |
| 2636 | psessionEntry->dfsIncludeChanSwIe, |
| 2637 | psessionEntry->gLimOperatingMode.present); |
| 2638 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2639 | if (LIM_IS_AP_ROLE(psessionEntry) && |
| 2640 | true == psessionEntry->dfsIncludeChanSwIe) { |
| 2641 | /* Send only 5 beacons with CSA IE Set in when a radar is detected */ |
| 2642 | if (psessionEntry->gLimChannelSwitch.switchCount > 0) { |
| 2643 | /* |
| 2644 | * Send the next beacon with updated CSA IE count |
| 2645 | */ |
| 2646 | lim_send_dfs_chan_sw_ie_update(pMac, psessionEntry); |
| 2647 | /* Decrement the IE count */ |
| 2648 | psessionEntry->gLimChannelSwitch.switchCount--; |
| 2649 | } else { |
| 2650 | /* Done with CSA IE update, send response back to SME */ |
| 2651 | psessionEntry->gLimChannelSwitch.switchCount = 0; |
| 2652 | if (pMac->sap.SapDfsInfo.disable_dfs_ch_switch == false) |
| 2653 | psessionEntry->gLimChannelSwitch.switchMode = 0; |
| 2654 | psessionEntry->dfsIncludeChanSwIe = false; |
| 2655 | psessionEntry->dfsIncludeChanWrapperIe = false; |
| 2656 | |
| 2657 | pChanSwTxResponse = (tSirSmeCSAIeTxCompleteRsp *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2658 | qdf_mem_malloc(length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2659 | |
| 2660 | if (NULL == pChanSwTxResponse) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2661 | pe_err("AllocateMemory failed for tSirSmeCSAIeTxCompleteRsp"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2662 | return; |
| 2663 | } |
| 2664 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2665 | pChanSwTxResponse->sessionId = |
| 2666 | psessionEntry->smeSessionId; |
| 2667 | pChanSwTxResponse->chanSwIeTxStatus = |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2668 | QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2669 | |
| 2670 | mmhMsg.type = eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND; |
| 2671 | mmhMsg.bodyptr = pChanSwTxResponse; |
| 2672 | mmhMsg.bodyval = 0; |
| 2673 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2674 | } |
| 2675 | } |
| 2676 | |
| 2677 | if (LIM_IS_AP_ROLE(psessionEntry) && |
| 2678 | psessionEntry->gLimOperatingMode.present) { |
| 2679 | /* Done with nss update, send response back to SME */ |
| 2680 | psessionEntry->gLimOperatingMode.present = 0; |
| 2681 | beacon_tx_comp_rsp_ptr = (struct sir_beacon_tx_complete_rsp *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2682 | qdf_mem_malloc(sizeof(*beacon_tx_comp_rsp_ptr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2683 | if (NULL == beacon_tx_comp_rsp_ptr) { |
Nishank Aggarwal | 2d6162b | 2017-03-24 17:38:12 +0530 | [diff] [blame] | 2684 | pe_err("AllocateMemory failed for beacon_tx_comp_rsp_ptr"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2685 | return; |
| 2686 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2687 | beacon_tx_comp_rsp_ptr->session_id = |
| 2688 | psessionEntry->smeSessionId; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2689 | beacon_tx_comp_rsp_ptr->tx_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2690 | mmhMsg.type = eWNI_SME_NSS_UPDATE_RSP; |
| 2691 | mmhMsg.bodyptr = beacon_tx_comp_rsp_ptr; |
| 2692 | mmhMsg.bodyval = 0; |
| 2693 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2694 | } |
Peng Xu | 6363ec6 | 2017-05-15 11:06:33 -0700 | [diff] [blame] | 2695 | |
| 2696 | lim_handle_bss_color_change_ie(pMac, psessionEntry); |
| 2697 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2698 | return; |
| 2699 | } |