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