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