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