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