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