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