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