Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Deepak Dhamdhere | d97bfb3 | 2015-10-11 15:16:18 -0700 | [diff] [blame] | 2 | * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | #include "wni_api.h" |
| 29 | #include "wni_cfg.h" |
| 30 | #include "cfg_api.h" |
| 31 | #include "sir_api.h" |
| 32 | #include "sch_api.h" |
| 33 | #include "utils_api.h" |
| 34 | #include "lim_utils.h" |
| 35 | #include "lim_assoc_utils.h" |
| 36 | #include "lim_security_utils.h" |
| 37 | #include "lim_ser_des_utils.h" |
| 38 | #include "lim_timer_utils.h" |
| 39 | #include "lim_send_messages.h" |
| 40 | #include "lim_admit_control.h" |
| 41 | #include "lim_send_messages.h" |
| 42 | #include "lim_ibss_peer_mgmt.h" |
| 43 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 44 | #include "lim_ft.h" |
| 45 | #include "lim_ft_defs.h" |
| 46 | #endif |
| 47 | #include "lim_session.h" |
| 48 | #include "lim_session_utils.h" |
| 49 | #if defined WLAN_FEATURE_VOWIFI |
| 50 | #include "rrm_api.h" |
| 51 | #endif |
| 52 | #include "wma_types.h" |
| 53 | #include "cds_utils.h" |
| 54 | #include "lim_types.h" |
| 55 | |
| 56 | #define MAX_SUPPORTED_PEERS_WEP 16 |
| 57 | |
| 58 | static void lim_handle_sme_join_result(tpAniSirGlobal, tSirResultCodes, uint16_t, |
| 59 | tpPESession); |
| 60 | static void lim_handle_sme_reaasoc_result(tpAniSirGlobal, tSirResultCodes, uint16_t, |
| 61 | tpPESession); |
| 62 | |
| 63 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 64 | void lim_process_mlm_oem_data_req_cnf(tpAniSirGlobal, uint32_t *); |
| 65 | #endif |
| 66 | void lim_process_mlm_join_cnf(tpAniSirGlobal, uint32_t *); |
| 67 | void lim_process_mlm_auth_cnf(tpAniSirGlobal, uint32_t *); |
| 68 | void lim_process_mlm_start_cnf(tpAniSirGlobal, uint32_t *); |
| 69 | void lim_process_mlm_assoc_ind(tpAniSirGlobal, uint32_t *); |
| 70 | void lim_process_mlm_assoc_cnf(tpAniSirGlobal, uint32_t *); |
| 71 | void lim_process_mlm_reassoc_cnf(tpAniSirGlobal, uint32_t *); |
| 72 | void lim_process_mlm_reassoc_ind(tpAniSirGlobal, uint32_t *); |
| 73 | void lim_process_mlm_set_keys_cnf(tpAniSirGlobal, uint32_t *); |
| 74 | void lim_process_mlm_disassoc_ind(tpAniSirGlobal, uint32_t *); |
| 75 | void lim_process_mlm_disassoc_cnf(tpAniSirGlobal, uint32_t *); |
| 76 | void lim_process_mlm_deauth_ind(tpAniSirGlobal, uint32_t *); |
| 77 | void lim_process_mlm_deauth_cnf(tpAniSirGlobal, uint32_t *); |
| 78 | void lim_process_mlm_purge_sta_ind(tpAniSirGlobal, uint32_t *); |
| 79 | static void lim_handle_del_bss_in_re_assoc_context(tpAniSirGlobal pMac, |
| 80 | tpDphHashNode pStaDs, |
| 81 | tpPESession psessionEntry); |
| 82 | void lim_get_session_info(tpAniSirGlobal pMac, uint8_t *, uint8_t *, uint16_t *); |
| 83 | static void |
| 84 | lim_process_btamp_add_bss_rsp(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, |
| 85 | tpPESession psessionEntry); |
| 86 | /** |
| 87 | * lim_process_mlm_rsp_messages() |
| 88 | * |
| 89 | ***FUNCTION: |
| 90 | * This function is called to processes various MLM response (CNF/IND |
| 91 | * messages from MLM State machine. |
| 92 | * |
| 93 | ***LOGIC: |
| 94 | * |
| 95 | ***ASSUMPTIONS: |
| 96 | * |
| 97 | ***NOTE: |
| 98 | * |
| 99 | * @param pMac Pointer to Global MAC structure |
| 100 | * @param msgType Indicates the MLM message type |
| 101 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 102 | * |
| 103 | * @return None |
| 104 | */ |
| 105 | void |
| 106 | lim_process_mlm_rsp_messages(tpAniSirGlobal pMac, uint32_t msgType, |
| 107 | uint32_t *pMsgBuf) |
| 108 | { |
| 109 | |
| 110 | if (pMsgBuf == NULL) { |
| 111 | PELOGE(lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL"));) |
| 112 | return; |
| 113 | } |
| 114 | MTRACE(mac_trace(pMac, TRACE_CODE_TX_LIM_MSG, 0, msgType)); |
| 115 | switch (msgType) { |
| 116 | |
| 117 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 118 | case LIM_MLM_OEM_DATA_CNF: |
| 119 | lim_process_mlm_oem_data_req_cnf(pMac, pMsgBuf); |
| 120 | pMsgBuf = NULL; |
| 121 | break; |
| 122 | #endif |
| 123 | |
| 124 | case LIM_MLM_AUTH_CNF: |
| 125 | lim_process_mlm_auth_cnf(pMac, pMsgBuf); |
| 126 | break; |
| 127 | case LIM_MLM_ASSOC_CNF: |
| 128 | lim_process_mlm_assoc_cnf(pMac, pMsgBuf); |
| 129 | break; |
| 130 | case LIM_MLM_START_CNF: |
| 131 | lim_process_mlm_start_cnf(pMac, pMsgBuf); |
| 132 | break; |
| 133 | case LIM_MLM_JOIN_CNF: |
| 134 | lim_process_mlm_join_cnf(pMac, pMsgBuf); |
| 135 | break; |
| 136 | case LIM_MLM_ASSOC_IND: |
| 137 | lim_process_mlm_assoc_ind(pMac, pMsgBuf); |
| 138 | break; |
| 139 | case LIM_MLM_REASSOC_CNF: |
| 140 | lim_process_mlm_reassoc_cnf(pMac, pMsgBuf); |
| 141 | break; |
| 142 | case LIM_MLM_DISASSOC_CNF: |
| 143 | lim_process_mlm_disassoc_cnf(pMac, pMsgBuf); |
| 144 | break; |
| 145 | case LIM_MLM_DISASSOC_IND: |
| 146 | lim_process_mlm_disassoc_ind(pMac, pMsgBuf); |
| 147 | break; |
| 148 | case LIM_MLM_PURGE_STA_IND: |
| 149 | lim_process_mlm_purge_sta_ind(pMac, pMsgBuf); |
| 150 | break; |
| 151 | case LIM_MLM_DEAUTH_CNF: |
| 152 | lim_process_mlm_deauth_cnf(pMac, pMsgBuf); |
| 153 | break; |
| 154 | case LIM_MLM_DEAUTH_IND: |
| 155 | lim_process_mlm_deauth_ind(pMac, pMsgBuf); |
| 156 | break; |
| 157 | case LIM_MLM_SETKEYS_CNF: |
| 158 | lim_process_mlm_set_keys_cnf(pMac, pMsgBuf); |
| 159 | break; |
| 160 | case LIM_MLM_TSPEC_CNF: |
| 161 | break; |
| 162 | default: |
| 163 | break; |
| 164 | } /* switch (msgType) */ |
| 165 | return; |
| 166 | } /*** end lim_process_mlm_rsp_messages() ***/ |
| 167 | |
| 168 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 169 | |
| 170 | /** |
| 171 | * lim_process_mlm_oem_data_req_cnf() |
| 172 | * |
| 173 | ***FUNCTION: |
| 174 | * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF |
| 175 | * message from MLM State machine. |
| 176 | * |
| 177 | ***LOGIC: |
| 178 | * |
| 179 | ***ASSUMPTIONS: |
| 180 | * |
| 181 | ***NOTE: |
| 182 | * |
| 183 | * @param pMac Pointer to Global MAC structure |
| 184 | * @param pMsgBuf A pointer to the MLM message buffer |
| 185 | * |
| 186 | * @return None |
| 187 | */ |
| 188 | |
| 189 | void lim_process_mlm_oem_data_req_cnf(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 190 | { |
| 191 | tLimMlmOemDataRsp *measRsp; |
| 192 | |
| 193 | tSirResultCodes resultCode = eSIR_SME_SUCCESS; |
| 194 | |
| 195 | measRsp = (tLimMlmOemDataRsp *) (pMsgBuf); |
| 196 | |
| 197 | /* Now send the meas confirm message to the sme */ |
| 198 | lim_send_sme_oem_data_rsp(pMac, (uint32_t *) measRsp, resultCode); |
| 199 | |
| 200 | /* Dont free the memory here. It will be freed up by the callee */ |
| 201 | |
| 202 | return; |
| 203 | } |
| 204 | #endif |
| 205 | |
| 206 | /** |
| 207 | * lim_process_mlm_start_cnf() |
| 208 | * |
| 209 | ***FUNCTION: |
| 210 | * This function is called to processes MLM_START_CNF |
| 211 | * message from MLM State machine. |
| 212 | * |
| 213 | ***LOGIC: |
| 214 | * |
| 215 | ***ASSUMPTIONS: |
| 216 | * |
| 217 | ***NOTE: |
| 218 | * |
| 219 | * @param pMac Pointer to Global MAC structure |
| 220 | * @param pMsgBuf A pointer to the MLM message buffer |
| 221 | * |
| 222 | * @return None |
| 223 | */ |
| 224 | void lim_process_mlm_start_cnf(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 225 | { |
| 226 | tpPESession psessionEntry = NULL; |
| 227 | tLimMlmStartCnf *pLimMlmStartCnf; |
| 228 | uint8_t smesessionId; |
| 229 | uint16_t smetransactionId; |
| 230 | uint8_t channelId; |
| 231 | |
| 232 | if (pMsgBuf == NULL) { |
| 233 | PELOGE(lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL"));) |
| 234 | return; |
| 235 | } |
| 236 | pLimMlmStartCnf = (tLimMlmStartCnf *) pMsgBuf; |
| 237 | psessionEntry = pe_find_session_by_session_id(pMac, |
| 238 | pLimMlmStartCnf->sessionId); |
| 239 | if (psessionEntry == NULL) { |
| 240 | PELOGE(lim_log(pMac, LOGE, FL( |
| 241 | "Session does Not exist with given sessionId "));) |
| 242 | return; |
| 243 | } |
| 244 | smesessionId = psessionEntry->smeSessionId; |
| 245 | smetransactionId = psessionEntry->transactionId; |
| 246 | |
| 247 | if (psessionEntry->limSmeState != eLIM_SME_WT_START_BSS_STATE) { |
| 248 | /* |
| 249 | * Should not have received Start confirm from MLM |
| 250 | * in other states. Log error. |
| 251 | */ |
| 252 | PELOGE(lim_log(pMac, LOGE, FL |
| 253 | ("received unexpected MLM_START_CNF in state %X"), |
| 254 | psessionEntry->limSmeState);) |
| 255 | return; |
| 256 | } |
| 257 | if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS) { |
| 258 | |
| 259 | /* |
| 260 | * Update global SME state so that Beacon Generation |
| 261 | * module starts writing Beacon frames into TFP's |
| 262 | * Beacon file register. |
| 263 | */ |
| 264 | psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE; |
| 265 | MTRACE(mac_trace |
| 266 | (pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, |
| 267 | psessionEntry->limSmeState)); |
| 268 | if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) { |
| 269 | lim_log(pMac, LOG1, |
| 270 | FL("*** Started BSS in BT_AMP STA SIDE***")); |
| 271 | } else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE) { |
| 272 | lim_log(pMac, LOG1, |
| 273 | FL("*** Started BSS in BT_AMP AP SIDE***")); |
| 274 | } else if (psessionEntry->bssType == eSIR_INFRA_AP_MODE) { |
| 275 | lim_log(pMac, LOG1, |
| 276 | FL("*** Started BSS in INFRA AP SIDE***")); |
| 277 | } else |
| 278 | PELOG1(lim_log(pMac, LOG1, FL("*** Started BSS ***"));) |
| 279 | } else { |
| 280 | /* Start BSS is a failure */ |
| 281 | pe_delete_session(pMac, psessionEntry); |
| 282 | psessionEntry = NULL; |
| 283 | PELOGE(lim_log(pMac, LOGE, FL("Start BSS Failed "));) |
| 284 | } |
| 285 | /* Send response to Host */ |
| 286 | lim_send_sme_start_bss_rsp(pMac, eWNI_SME_START_BSS_RSP, |
| 287 | ((tLimMlmStartCnf *)pMsgBuf)->resultCode, |
| 288 | psessionEntry, smesessionId, smetransactionId); |
| 289 | if ((psessionEntry != NULL) && |
| 290 | (((tLimMlmStartCnf *) pMsgBuf)->resultCode == |
| 291 | eSIR_SME_SUCCESS)) { |
| 292 | channelId = psessionEntry->pLimStartBssReq->channelId; |
| 293 | |
| 294 | /* We should start beacon transmission only if the channel |
| 295 | * on which we are operating is non-DFS until the channel |
| 296 | * availability check is done. The PE will receive an explicit |
| 297 | * request from upper layers to start the beacon transmission |
| 298 | */ |
| 299 | |
| 300 | if (LIM_IS_IBSS_ROLE(psessionEntry) || |
| 301 | (LIM_IS_AP_ROLE(psessionEntry) && |
| 302 | (cds_get_channel_state(channelId) != |
| 303 | CHANNEL_STATE_DFS))) { |
| 304 | /* Configure beacon and send beacons to HAL */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 305 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 306 | FL("Start Beacon with ssid %s Ch %d"), |
| 307 | psessionEntry->ssId.ssId, |
| 308 | psessionEntry->currentOperChannel); |
| 309 | lim_send_beacon_ind(pMac, psessionEntry); |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | /*** end lim_process_mlm_start_cnf() ***/ |
| 315 | |
| 316 | /** |
| 317 | * lim_process_mlm_join_cnf() - Processes join confirmation |
| 318 | * @mac_ctx: Pointer to Global MAC structure |
| 319 | * @msg: A pointer to the MLM message buffer |
| 320 | * |
| 321 | * This Function handles the join confirmation message |
| 322 | * LIM_MLM_JOIN_CNF. |
| 323 | * |
| 324 | * Return: None |
| 325 | */ |
| 326 | void lim_process_mlm_join_cnf(tpAniSirGlobal mac_ctx, |
| 327 | uint32_t *msg) |
| 328 | { |
| 329 | tSirResultCodes result_code; |
| 330 | tLimMlmJoinCnf *join_cnf; |
| 331 | tpPESession session_entry; |
| 332 | |
| 333 | join_cnf = (tLimMlmJoinCnf *) msg; |
| 334 | session_entry = pe_find_session_by_session_id(mac_ctx, |
| 335 | join_cnf->sessionId); |
| 336 | if (session_entry == NULL) { |
| 337 | lim_log(mac_ctx, LOGE, FL("SessionId:%d does not exist"), |
| 338 | join_cnf->sessionId); |
| 339 | return; |
| 340 | } |
| 341 | |
| 342 | if (session_entry->limSmeState != eLIM_SME_WT_JOIN_STATE) { |
| 343 | lim_log(mac_ctx, LOGE, |
| 344 | FL("received unexpected MLM_JOIN_CNF in state %X"), |
| 345 | session_entry->limSmeState); |
| 346 | return; |
| 347 | } |
| 348 | |
| 349 | result_code = ((tLimMlmJoinCnf *) msg)->resultCode; |
| 350 | /* Process Join confirm from MLM */ |
| 351 | if (result_code == eSIR_SME_SUCCESS) { |
| 352 | lim_log(mac_ctx, LOG1, FL("***SessionId:%d Joined ESS ***"), |
| 353 | join_cnf->sessionId); |
| 354 | /* Setup hardware upfront */ |
| 355 | if (lim_sta_send_add_bss_pre_assoc(mac_ctx, false, |
| 356 | session_entry) == eSIR_SUCCESS) |
| 357 | return; |
| 358 | else |
| 359 | result_code = eSIR_SME_REFUSED; |
| 360 | } |
| 361 | |
| 362 | /* Join failure */ |
| 363 | session_entry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE; |
| 364 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 365 | session_entry->peSessionId, |
| 366 | session_entry->limSmeState)); |
| 367 | /* Send Join response to Host */ |
| 368 | lim_handle_sme_join_result(mac_ctx, result_code, |
| 369 | ((tLimMlmJoinCnf *) msg)->protStatusCode, session_entry); |
| 370 | return; |
| 371 | } |
| 372 | |
| 373 | /** |
| 374 | * lim_send_mlm_assoc_req() - Association request will be processed |
| 375 | * mac_ctx: Pointer to Global MAC structure |
| 376 | * session_entry: Pointer to session etnry |
| 377 | * |
| 378 | * This function is sends ASSOC request MLM message to MLM State machine. |
| 379 | * ASSOC request packet would be by picking parameters from psessionEntry |
| 380 | * automatically based on the current state of MLM state machine. |
| 381 | * ASSUMPTIONS: |
| 382 | * this function is called in middle of connection state machine and is |
| 383 | * expected to be called after auth cnf has been received or after ASSOC rsp |
| 384 | * with TRY_AGAIN_LATER was received and required time has elapsed after that. |
| 385 | * |
| 386 | * Return: None |
| 387 | */ |
| 388 | |
| 389 | void lim_send_mlm_assoc_req(tpAniSirGlobal mac_ctx, |
| 390 | tpPESession session_entry) |
| 391 | { |
| 392 | tLimMlmAssocReq *assoc_req; |
| 393 | uint32_t val; |
| 394 | uint16_t caps; |
| 395 | uint32_t tele_bcn = 0; |
| 396 | tpSirMacCapabilityInfo cap_info; |
| 397 | |
| 398 | /* Successful MAC based authentication. Trigger Association with BSS */ |
| 399 | lim_log(mac_ctx, LOG1, FL("SessionId:%d Authenticated with BSS"), |
| 400 | session_entry->peSessionId); |
| 401 | |
| 402 | if (NULL == session_entry->pLimJoinReq) { |
| 403 | lim_log(mac_ctx, LOGE, FL("Join Request is NULL.")); |
| 404 | /* No need to Assert. JOIN timeout will handle this error */ |
| 405 | return; |
| 406 | } |
| 407 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 408 | assoc_req = qdf_mem_malloc(sizeof(tLimMlmAssocReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 409 | if (NULL == assoc_req) { |
| 410 | lim_log(mac_ctx, LOGP, |
| 411 | FL("call to AllocateMemory failed for mlmAssocReq")); |
| 412 | return; |
| 413 | } |
| 414 | val = sizeof(tSirMacAddr); |
| 415 | sir_copy_mac_addr(assoc_req->peerMacAddr, session_entry->bssId); |
| 416 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT, |
| 417 | (uint32_t *) &assoc_req->assocFailureTimeout) |
| 418 | != eSIR_SUCCESS) { |
| 419 | /* Could not get AssocFailureTimeout value from CFG.*/ |
| 420 | lim_log(mac_ctx, LOGP, |
| 421 | FL("could not retrieve AssocFailureTimeout value")); |
| 422 | } |
| 423 | |
| 424 | if (cfg_get_capability_info(mac_ctx, &caps, session_entry) |
| 425 | != eSIR_SUCCESS) |
| 426 | /* Could not get Capabilities value from CFG.*/ |
| 427 | lim_log(mac_ctx, LOGP, |
| 428 | FL("could not retrieve Capabilities value")); |
| 429 | |
| 430 | /* Clear spectrum management bit if AP doesn't support it */ |
| 431 | if (!(session_entry->pLimJoinReq->bssDescription.capabilityInfo & |
| 432 | LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) |
| 433 | /* |
| 434 | * AP doesn't support spectrum management |
| 435 | * clear spectrum management bit |
| 436 | */ |
| 437 | caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK); |
| 438 | |
Krishna Kumaar Natarajan | d26e9e7 | 2015-11-03 11:49:03 -0800 | [diff] [blame] | 439 | /* |
| 440 | * RM capability should be independent of AP's capabilities |
| 441 | * Refer 8.4.1.4 Capability Information field in 802.11-2012 |
| 442 | * Do not modify it. |
| 443 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 444 | |
| 445 | /* Clear short preamble bit if AP does not support it */ |
| 446 | if (!(session_entry->pLimJoinReq->bssDescription.capabilityInfo & |
| 447 | (LIM_SHORT_PREAMBLE_BIT_MASK))) { |
| 448 | caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK); |
| 449 | lim_log(mac_ctx, LOG1, |
| 450 | FL("Clearing short preamble:no AP support")); |
| 451 | } |
| 452 | |
| 453 | /* Clear immediate block ack bit if AP does not support it */ |
| 454 | if (!(session_entry->pLimJoinReq->bssDescription.capabilityInfo & |
| 455 | (LIM_IMMEDIATE_BLOCK_ACK_MASK))) { |
| 456 | caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK); |
| 457 | lim_log(mac_ctx, LOG1, |
| 458 | FL("Clearing Immed Blk Ack:no AP support")); |
| 459 | } |
| 460 | |
| 461 | assoc_req->capabilityInfo = caps; |
| 462 | cap_info = ((tpSirMacCapabilityInfo) &assoc_req->capabilityInfo); |
| 463 | lim_log(mac_ctx, LOG3, FL("Capabilities to be used in AssocReq=0x%X," |
| 464 | "privacy bit=%x shortSlotTime %x"), caps, |
| 465 | cap_info->privacy, |
| 466 | cap_info->shortSlotTime); |
| 467 | |
| 468 | /* |
| 469 | * If telescopic beaconing is enabled, set listen interval to |
| 470 | * WNI_CFG_TELE_BCN_MAX_LI |
| 471 | */ |
| 472 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_TELE_BCN_WAKEUP_EN, &tele_bcn) |
| 473 | != eSIR_SUCCESS) |
| 474 | lim_log(mac_ctx, LOGP, |
| 475 | FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN")); |
| 476 | |
| 477 | val = WNI_CFG_LISTEN_INTERVAL_STADEF; |
| 478 | if (tele_bcn) { |
| 479 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_TELE_BCN_MAX_LI, &val) != |
| 480 | eSIR_SUCCESS) |
| 481 | /* |
| 482 | * Could not get ListenInterval value |
| 483 | * from CFG. Log error. |
| 484 | */ |
| 485 | lim_log(mac_ctx, LOGP, |
| 486 | FL("could not retrieve ListenInterval")); |
| 487 | } else { |
| 488 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_LISTEN_INTERVAL, |
| 489 | &val) != eSIR_SUCCESS) |
| 490 | /* |
| 491 | * Could not get ListenInterval value |
| 492 | * from CFG. Log error. |
| 493 | */ |
| 494 | lim_log(mac_ctx, LOGP, |
| 495 | FL("could not retrieve ListenInterval")); |
| 496 | } |
| 497 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 498 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_REQ_EVENT, |
| 499 | session_entry, eSIR_SUCCESS, eSIR_SUCCESS); |
| 500 | #endif |
| 501 | assoc_req->listenInterval = (uint16_t) val; |
| 502 | /* Update PE session ID */ |
| 503 | assoc_req->sessionId = session_entry->peSessionId; |
| 504 | session_entry->limPrevSmeState = session_entry->limSmeState; |
| 505 | session_entry->limSmeState = eLIM_SME_WT_ASSOC_STATE; |
| 506 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 507 | session_entry->peSessionId, session_entry->limSmeState)); |
| 508 | lim_post_mlm_message(mac_ctx, LIM_MLM_ASSOC_REQ, |
| 509 | (uint32_t *) assoc_req); |
| 510 | } |
| 511 | |
| 512 | #ifdef WLAN_FEATURE_11W |
| 513 | /** |
| 514 | * lim_pmf_comeback_timer_callback() -PMF callback handler |
| 515 | * @context: Timer context |
| 516 | * |
| 517 | * This function is called to processes the PMF comeback |
| 518 | * callback |
| 519 | * |
| 520 | * Return: None |
| 521 | */ |
| 522 | void lim_pmf_comeback_timer_callback(void *context) |
| 523 | { |
| 524 | tComebackTimerInfo *info = (tComebackTimerInfo *) context; |
| 525 | tpAniSirGlobal mac_ctx = info->pMac; |
| 526 | tpPESession psessionEntry = &mac_ctx->lim.gpSession[info->sessionID]; |
| 527 | |
| 528 | lim_log(mac_ctx, LOGE, |
| 529 | FL("comeback later timer expired. sending MLM ASSOC req")); |
| 530 | /* set MLM state such that ASSOC REQ packet will be sent out */ |
| 531 | psessionEntry->limPrevMlmState = info->limPrevMlmState; |
| 532 | psessionEntry->limMlmState = info->limMlmState; |
| 533 | lim_send_mlm_assoc_req(mac_ctx, psessionEntry); |
| 534 | } |
| 535 | #endif /* WLAN_FEATURE_11W */ |
| 536 | |
| 537 | /** |
| 538 | * lim_process_mlm_auth_cnf()-Process Auth confirmation |
| 539 | * @mac_ctx: Pointer to Global MAC structure |
| 540 | * @msg: A pointer to the MLM message buffer |
| 541 | * |
| 542 | * This function is called to processes MLM_AUTH_CNF |
| 543 | * message from MLM State machine. |
| 544 | * |
| 545 | * Return: None |
| 546 | */ |
| 547 | void lim_process_mlm_auth_cnf(tpAniSirGlobal mac_ctx, uint32_t *msg) |
| 548 | { |
| 549 | tAniAuthType auth_type, auth_mode; |
| 550 | tLimMlmAuthReq *auth_req; |
| 551 | tLimMlmAuthCnf *auth_cnf; |
| 552 | tpPESession session_entry; |
| 553 | |
| 554 | if (msg == NULL) { |
| 555 | lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL")); |
| 556 | return; |
| 557 | } |
| 558 | auth_cnf = (tLimMlmAuthCnf *) msg; |
| 559 | session_entry = pe_find_session_by_session_id(mac_ctx, |
| 560 | auth_cnf->sessionId); |
| 561 | if (session_entry == NULL) { |
| 562 | lim_log(mac_ctx, LOGE, FL("SessionId:%d session doesn't exist"), |
| 563 | auth_cnf->sessionId); |
| 564 | return; |
| 565 | } |
| 566 | |
| 567 | if ((session_entry->limSmeState != eLIM_SME_WT_AUTH_STATE && |
| 568 | session_entry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE) || |
| 569 | LIM_IS_AP_ROLE(session_entry) || |
| 570 | LIM_IS_BT_AMP_AP_ROLE(session_entry)) { |
| 571 | /** |
| 572 | * Should not have received AUTH confirm |
| 573 | * from MLM in other states or on AP. |
| 574 | * Log error |
| 575 | */ |
| 576 | lim_log(mac_ctx, LOGE, |
| 577 | FL("SessionId:%d received MLM_AUTH_CNF in state %X"), |
| 578 | session_entry->peSessionId, session_entry->limSmeState); |
| 579 | return; |
| 580 | } |
| 581 | |
| 582 | if (((tLimMlmAuthCnf *) msg)->resultCode == eSIR_SME_SUCCESS) { |
| 583 | if (session_entry->limSmeState == eLIM_SME_WT_AUTH_STATE) { |
| 584 | lim_send_mlm_assoc_req(mac_ctx, session_entry); |
| 585 | } else { |
| 586 | /* |
| 587 | * Successful Pre-authentication. Send |
| 588 | * Pre-auth response to host |
| 589 | */ |
| 590 | session_entry->limSmeState = |
| 591 | session_entry->limPrevSmeState; |
| 592 | MTRACE(mac_trace |
| 593 | (mac_ctx, TRACE_CODE_SME_STATE, |
| 594 | session_entry->peSessionId, |
| 595 | session_entry->limSmeState)); |
| 596 | } |
| 597 | /* Return for success case */ |
| 598 | return; |
| 599 | } |
| 600 | /* |
| 601 | * Failure case handle: |
| 602 | * Process AUTH confirm from MLM |
| 603 | */ |
| 604 | if (session_entry->limSmeState == eLIM_SME_WT_AUTH_STATE) { |
| 605 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_AUTHENTICATION_TYPE, |
| 606 | (uint32_t *) &auth_type) != eSIR_SUCCESS) { |
| 607 | /* |
| 608 | * Could not get AuthType value from CFG. |
| 609 | * Log error. |
| 610 | */ |
| 611 | lim_log(mac_ctx, LOGP, |
| 612 | FL("Fail to retrieve AuthType value")); |
| 613 | } |
| 614 | } else { |
| 615 | auth_type = mac_ctx->lim.gLimPreAuthType; |
| 616 | } |
| 617 | |
| 618 | if ((auth_type == eSIR_AUTO_SWITCH) && |
| 619 | (((tLimMlmAuthCnf *) msg)->authType == eSIR_OPEN_SYSTEM) |
| 620 | && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == |
| 621 | ((tLimMlmAuthCnf *) msg)->protStatusCode)) { |
| 622 | /* |
| 623 | * When Open authentication fails with reason |
| 624 | * code "13" and authType set to 'auto switch', |
| 625 | * Try with Shared Authentication |
| 626 | */ |
| 627 | auth_mode = eSIR_SHARED_KEY; |
| 628 | /* Trigger MAC based Authentication */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 629 | auth_req = qdf_mem_malloc(sizeof(tLimMlmAuthReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 630 | if (NULL == auth_req) { |
| 631 | /* Log error */ |
| 632 | lim_log(mac_ctx, LOGP, |
| 633 | FL("mlmAuthReq :Memory alloc failed ")); |
| 634 | return; |
| 635 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 636 | qdf_mem_set((uint8_t *) auth_req, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 637 | sizeof(tLimMlmAuthReq), 0); |
| 638 | if (session_entry->limSmeState == |
| 639 | eLIM_SME_WT_AUTH_STATE) { |
| 640 | sir_copy_mac_addr(auth_req->peerMacAddr, |
| 641 | session_entry->bssId); |
| 642 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 643 | qdf_mem_copy((uint8_t *)&auth_req->peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 644 | (uint8_t *)&mac_ctx->lim.gLimPreAuthPeerAddr, |
| 645 | sizeof(tSirMacAddr)); |
| 646 | } |
| 647 | auth_req->authType = auth_mode; |
| 648 | /* Update PE session Id */ |
| 649 | auth_req->sessionId = auth_cnf->sessionId; |
| 650 | if (wlan_cfg_get_int(mac_ctx, |
| 651 | WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT, |
| 652 | (uint32_t *) &auth_req->authFailureTimeout) |
| 653 | != eSIR_SUCCESS) { |
| 654 | /* |
| 655 | * Could not get AuthFailureTimeout value from CFG. |
| 656 | * Log error. |
| 657 | */ |
| 658 | lim_log(mac_ctx, LOGP, |
| 659 | FL("Fail:retrieve AuthFailureTimeout ")); |
| 660 | } |
| 661 | lim_post_mlm_message(mac_ctx, LIM_MLM_AUTH_REQ, |
| 662 | (uint32_t *) auth_req); |
| 663 | return; |
| 664 | } else { |
| 665 | /* MAC based authentication failure */ |
| 666 | if (session_entry->limSmeState == |
| 667 | eLIM_SME_WT_AUTH_STATE) { |
| 668 | lim_log(mac_ctx, LOGE, |
| 669 | FL("Auth Failure occurred.")); |
| 670 | session_entry->limSmeState = |
| 671 | eLIM_SME_JOIN_FAILURE_STATE; |
| 672 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 673 | session_entry->peSessionId, |
| 674 | session_entry->limSmeState)); |
| 675 | session_entry->limMlmState = |
| 676 | eLIM_MLM_IDLE_STATE; |
| 677 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 678 | session_entry->peSessionId, |
| 679 | session_entry->limMlmState)); |
| 680 | /* |
| 681 | * Need to send Join response with |
| 682 | * auth failure to Host. |
| 683 | */ |
| 684 | lim_handle_sme_join_result(mac_ctx, |
| 685 | ((tLimMlmAuthCnf *)msg)->resultCode, |
| 686 | ((tLimMlmAuthCnf *)msg)->protStatusCode, |
| 687 | session_entry); |
| 688 | } else { |
| 689 | /* |
| 690 | * Pre-authentication failure. |
| 691 | * Send Pre-auth failure response to host |
| 692 | */ |
| 693 | session_entry->limSmeState = |
| 694 | session_entry->limPrevSmeState; |
| 695 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 696 | session_entry->peSessionId, |
| 697 | session_entry->limSmeState)); |
| 698 | } |
| 699 | } |
| 700 | } |
| 701 | |
| 702 | /** |
| 703 | * lim_process_mlm_assoc_cnf() - Process association confirmation |
| 704 | * @mac_ctx: Pointer to Global MAC structure |
| 705 | * @msg: A pointer to the MLM message buffer |
| 706 | * |
| 707 | * This function is called to processes MLM_ASSOC_CNF |
| 708 | * message from MLM State machine. |
| 709 | * |
| 710 | * Return: None |
| 711 | */ |
| 712 | void lim_process_mlm_assoc_cnf(tpAniSirGlobal mac_ctx, |
| 713 | uint32_t *msg) |
| 714 | { |
| 715 | tpPESession session_entry; |
| 716 | tLimMlmAssocCnf *assoc_cnf; |
| 717 | |
| 718 | if (msg == NULL) { |
| 719 | lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL")); |
| 720 | return; |
| 721 | } |
| 722 | assoc_cnf = (tLimMlmAssocCnf *) msg; |
| 723 | session_entry = pe_find_session_by_session_id(mac_ctx, |
| 724 | assoc_cnf->sessionId); |
| 725 | if (session_entry == NULL) { |
| 726 | lim_log(mac_ctx, LOGE, |
| 727 | FL("SessionId:%d Session does not exist"), |
| 728 | assoc_cnf->sessionId); |
| 729 | return; |
| 730 | } |
| 731 | if (session_entry->limSmeState != eLIM_SME_WT_ASSOC_STATE || |
| 732 | LIM_IS_AP_ROLE(session_entry) || |
| 733 | LIM_IS_BT_AMP_AP_ROLE(session_entry)) { |
| 734 | /* |
| 735 | * Should not have received Assocication confirm |
| 736 | * from MLM in other states OR on AP. |
| 737 | * Log error |
| 738 | */ |
| 739 | lim_log(mac_ctx, LOGE, |
| 740 | FL("SessionId:%d Received MLM_ASSOC_CNF in state %X"), |
| 741 | session_entry->peSessionId, session_entry->limSmeState); |
| 742 | return; |
| 743 | } |
| 744 | if (((tLimMlmAssocCnf *) msg)->resultCode != eSIR_SME_SUCCESS) { |
| 745 | /* Association failure */ |
| 746 | lim_log(mac_ctx, LOG1, FL("SessionId:%d Association failure"), |
| 747 | session_entry->peSessionId); |
| 748 | session_entry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE; |
| 749 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 750 | session_entry->peSessionId, mac_ctx->lim.gLimSmeState)); |
| 751 | /* |
| 752 | * Need to send Join response with |
| 753 | * Association failure to Host. |
| 754 | */ |
| 755 | lim_handle_sme_join_result(mac_ctx, |
| 756 | ((tLimMlmAssocCnf *) msg)->resultCode, |
| 757 | ((tLimMlmAssocCnf *) msg)->protStatusCode, |
| 758 | session_entry); |
| 759 | } else { |
| 760 | /* Successful Association */ |
| 761 | lim_log(mac_ctx, LOG1, FL("SessionId:%d Associated with BSS"), |
| 762 | session_entry->peSessionId); |
| 763 | session_entry->limSmeState = eLIM_SME_LINK_EST_STATE; |
| 764 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 765 | session_entry->peSessionId, |
| 766 | session_entry->limSmeState)); |
| 767 | /** |
| 768 | * Need to send Join response with |
| 769 | * Association success to Host. |
| 770 | */ |
| 771 | lim_handle_sme_join_result(mac_ctx, |
| 772 | ((tLimMlmAssocCnf *) msg)->resultCode, |
| 773 | ((tLimMlmAssocCnf *) msg)->protStatusCode, |
| 774 | session_entry); |
| 775 | } |
| 776 | } |
| 777 | |
| 778 | /** |
| 779 | * lim_process_mlm_reassoc_cnf() - process mlm reassoc cnf msg |
| 780 | * |
| 781 | * @mac_ctx: Pointer to Global MAC structure |
| 782 | * @msg_buf: A pointer to the MLM message buffer |
| 783 | * |
| 784 | * This function is called to process MLM_REASSOC_CNF message from MLM State |
| 785 | * machine. |
| 786 | * |
| 787 | * @Return: void |
| 788 | */ |
| 789 | void lim_process_mlm_reassoc_cnf(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) |
| 790 | { |
| 791 | tpPESession session; |
| 792 | tLimMlmReassocCnf *lim_mlm_reassoc_cnf; |
| 793 | |
| 794 | if (msg_buf == NULL) { |
| 795 | lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL")); |
| 796 | return; |
| 797 | } |
| 798 | lim_mlm_reassoc_cnf = (tLimMlmReassocCnf *) msg_buf; |
| 799 | session = pe_find_session_by_session_id(mac_ctx, |
| 800 | lim_mlm_reassoc_cnf->sessionId); |
| 801 | if (session == NULL) { |
| 802 | lim_log(mac_ctx, LOGE, |
| 803 | FL("session Does not exist for given session Id")); |
| 804 | return; |
| 805 | } |
| 806 | if ((session->limSmeState != eLIM_SME_WT_REASSOC_STATE) || |
| 807 | LIM_IS_AP_ROLE(session) || LIM_IS_BT_AMP_AP_ROLE(session)) { |
| 808 | /* |
| 809 | * Should not have received Reassocication confirm |
| 810 | * from MLM in other states OR on AP. |
| 811 | */ |
| 812 | lim_log(mac_ctx, LOGE, |
| 813 | FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state 0x%X"), |
| 814 | GET_LIM_SYSTEM_ROLE(session), session->limSmeState); |
| 815 | return; |
| 816 | } |
| 817 | if (session->pLimReAssocReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 818 | qdf_mem_free(session->pLimReAssocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 819 | session->pLimReAssocReq = NULL; |
| 820 | } |
| 821 | |
| 822 | /* |
| 823 | * Upon Reassoc success or failure, freeup the cached preauth request, |
| 824 | * to ensure that channel switch is now allowed following any change in |
| 825 | * HT params. |
| 826 | */ |
| 827 | if (session->ftPEContext.pFTPreAuthReq) { |
| 828 | lim_log(mac_ctx, LOG1, FL("Freeing pFTPreAuthReq= %p"), |
| 829 | session->ftPEContext.pFTPreAuthReq); |
| 830 | if (session->ftPEContext.pFTPreAuthReq->pbssDescription) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 831 | qdf_mem_free( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 832 | session->ftPEContext.pFTPreAuthReq->pbssDescription); |
| 833 | session->ftPEContext.pFTPreAuthReq->pbssDescription = |
| 834 | NULL; |
| 835 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 836 | qdf_mem_free(session->ftPEContext.pFTPreAuthReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 837 | session->ftPEContext.pFTPreAuthReq = NULL; |
| 838 | session->ftPEContext.ftPreAuthSession = false; |
| 839 | } |
| 840 | |
| 841 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 842 | if (session->bRoamSynchInProgress) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 843 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 844 | FL("LFR3:Re-set the LIM Ctxt Roam Synch In Progress")); |
| 845 | session->bRoamSynchInProgress = false; |
| 846 | } |
| 847 | #endif |
| 848 | |
| 849 | lim_log(mac_ctx, LOG1, FL("Rcv MLM_REASSOC_CNF with result code %d"), |
| 850 | lim_mlm_reassoc_cnf->resultCode); |
| 851 | if (lim_mlm_reassoc_cnf->resultCode == eSIR_SME_SUCCESS) { |
| 852 | /* Successful Reassociation */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 853 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 854 | FL("*** Reassociated with new BSS ***")); |
| 855 | |
| 856 | session->limSmeState = eLIM_SME_LINK_EST_STATE; |
| 857 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 858 | session->peSessionId, session->limSmeState)); |
| 859 | |
| 860 | /* Need to send Reassoc rsp with Reassoc success to Host. */ |
| 861 | lim_send_sme_join_reassoc_rsp(mac_ctx, eWNI_SME_REASSOC_RSP, |
| 862 | lim_mlm_reassoc_cnf->resultCode, |
| 863 | lim_mlm_reassoc_cnf->protStatusCode, |
| 864 | session, session->smeSessionId, |
| 865 | session->transactionId); |
| 866 | } else if (lim_mlm_reassoc_cnf->resultCode |
| 867 | == eSIR_SME_REASSOC_REFUSED) { |
| 868 | /* |
| 869 | * Reassociation failure With the New AP but we still have the |
| 870 | * link with the Older AP |
| 871 | */ |
| 872 | session->limSmeState = eLIM_SME_LINK_EST_STATE; |
| 873 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 874 | session->peSessionId, session->limSmeState)); |
| 875 | |
| 876 | /* Need to send Reassoc rsp with Assoc failure to Host. */ |
| 877 | lim_send_sme_join_reassoc_rsp(mac_ctx, eWNI_SME_REASSOC_RSP, |
| 878 | lim_mlm_reassoc_cnf->resultCode, |
| 879 | lim_mlm_reassoc_cnf->protStatusCode, |
| 880 | session, session->smeSessionId, |
| 881 | session->transactionId); |
| 882 | } else { |
| 883 | /* Reassociation failure */ |
| 884 | session->limSmeState = eLIM_SME_JOIN_FAILURE_STATE; |
| 885 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 886 | session->peSessionId, session->limSmeState)); |
| 887 | /* Need to send Reassoc rsp with Assoc failure to Host. */ |
| 888 | lim_handle_sme_reaasoc_result(mac_ctx, |
| 889 | lim_mlm_reassoc_cnf->resultCode, |
| 890 | lim_mlm_reassoc_cnf->protStatusCode, |
| 891 | session); |
| 892 | } |
| 893 | } |
| 894 | |
| 895 | /** |
| 896 | * lim_fill_assoc_ind_params() - Initialize association indication |
| 897 | * mac_ctx: Pointer to Global MAC structure |
| 898 | * assoc_ind: PE association indication structure |
| 899 | * sme_assoc_ind: SME association indication |
| 900 | * session_entry: PE session entry |
| 901 | * |
| 902 | * This function is called to initialzie the association |
| 903 | * indication strucutre to process association indication. |
| 904 | * |
| 905 | * Return: None |
| 906 | */ |
| 907 | |
| 908 | void |
| 909 | lim_fill_assoc_ind_params(tpAniSirGlobal mac_ctx, |
| 910 | tpLimMlmAssocInd assoc_ind, tSirSmeAssocInd *sme_assoc_ind, |
| 911 | tpPESession session_entry) |
| 912 | { |
| 913 | sme_assoc_ind->length = sizeof(tSirSmeAssocInd); |
| 914 | sme_assoc_ind->sessionId = session_entry->smeSessionId; |
| 915 | |
| 916 | /* Required for indicating the frames to upper layer */ |
| 917 | sme_assoc_ind->assocReqLength = assoc_ind->assocReqLength; |
| 918 | sme_assoc_ind->assocReqPtr = assoc_ind->assocReqPtr; |
| 919 | |
| 920 | sme_assoc_ind->beaconPtr = session_entry->beacon; |
| 921 | sme_assoc_ind->beaconLength = session_entry->bcnLen; |
| 922 | |
| 923 | /* Fill in peerMacAddr */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 924 | qdf_mem_copy(sme_assoc_ind->peerMacAddr, assoc_ind->peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 925 | sizeof(tSirMacAddr)); |
| 926 | |
| 927 | /* Fill in aid */ |
| 928 | sme_assoc_ind->aid = assoc_ind->aid; |
| 929 | /* Fill in bssId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 930 | qdf_mem_copy(sme_assoc_ind->bssId, session_entry->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 931 | sizeof(tSirMacAddr)); |
| 932 | /* Fill in authType */ |
| 933 | sme_assoc_ind->authType = assoc_ind->authType; |
| 934 | /* Fill in ssId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 935 | qdf_mem_copy((uint8_t *) &sme_assoc_ind->ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 936 | (uint8_t *) &(assoc_ind->ssId), assoc_ind->ssId.length + 1); |
| 937 | sme_assoc_ind->rsnIE.length = assoc_ind->rsnIE.length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 938 | qdf_mem_copy((uint8_t *) &sme_assoc_ind->rsnIE.rsnIEdata, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 939 | (uint8_t *) &(assoc_ind->rsnIE.rsnIEdata), |
| 940 | assoc_ind->rsnIE.length); |
| 941 | |
| 942 | #ifdef FEATURE_WLAN_WAPI |
| 943 | sme_assoc_ind->wapiIE.length = assoc_ind->wapiIE.length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 944 | qdf_mem_copy((uint8_t *) &sme_assoc_ind->wapiIE.wapiIEdata, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 945 | (uint8_t *) &(assoc_ind->wapiIE.wapiIEdata), |
| 946 | assoc_ind->wapiIE.length); |
| 947 | #endif |
| 948 | sme_assoc_ind->addIE.length = assoc_ind->addIE.length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 949 | qdf_mem_copy((uint8_t *) &sme_assoc_ind->addIE.addIEdata, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 950 | (uint8_t *) &(assoc_ind->addIE.addIEdata), |
| 951 | assoc_ind->addIE.length); |
| 952 | |
| 953 | /* Copy the new TITAN capabilities */ |
| 954 | sme_assoc_ind->spectrumMgtIndicator = assoc_ind->spectrumMgtIndicator; |
| 955 | if (assoc_ind->spectrumMgtIndicator == eSIR_TRUE) { |
| 956 | sme_assoc_ind->powerCap.minTxPower = |
| 957 | assoc_ind->powerCap.minTxPower; |
| 958 | sme_assoc_ind->powerCap.maxTxPower = |
| 959 | assoc_ind->powerCap.maxTxPower; |
| 960 | sme_assoc_ind->supportedChannels.numChnl = |
| 961 | assoc_ind->supportedChannels.numChnl; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 962 | qdf_mem_copy((uint8_t *) &sme_assoc_ind->supportedChannels. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 963 | channelList, |
| 964 | (uint8_t *) &(assoc_ind->supportedChannels.channelList), |
| 965 | assoc_ind->supportedChannels.numChnl); |
| 966 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 967 | qdf_mem_copy(&sme_assoc_ind->chan_info, &assoc_ind->chan_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 968 | sizeof(tSirSmeChanInfo)); |
| 969 | /* Fill in WmmInfo */ |
| 970 | sme_assoc_ind->wmmEnabledSta = assoc_ind->WmmStaInfoPresent; |
| 971 | } |
| 972 | |
| 973 | /** |
| 974 | * lim_process_mlm_assoc_ind() |
| 975 | * |
| 976 | ***FUNCTION: |
| 977 | * This function is called to processes MLM_ASSOC_IND |
| 978 | * message from MLM State machine. |
| 979 | * |
| 980 | ***LOGIC: |
| 981 | * |
| 982 | ***ASSUMPTIONS: |
| 983 | * |
| 984 | ***NOTE: |
| 985 | * |
| 986 | * @param pMac Pointer to Global MAC structure |
| 987 | * @param pMsgBuf A pointer to the MLM message buffer |
| 988 | * |
| 989 | * @return None |
| 990 | */ |
| 991 | void lim_process_mlm_assoc_ind(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 992 | { |
| 993 | uint32_t len; |
| 994 | tSirMsgQ msgQ; |
| 995 | tSirSmeAssocInd *pSirSmeAssocInd; |
| 996 | tpDphHashNode pStaDs = 0; |
| 997 | tpPESession psessionEntry; |
| 998 | if (pMsgBuf == NULL) { |
| 999 | PELOGE(lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL"));) |
| 1000 | return; |
| 1001 | } |
| 1002 | psessionEntry = pe_find_session_by_session_id(pMac, |
| 1003 | ((tpLimMlmAssocInd) pMsgBuf)-> |
| 1004 | sessionId); |
| 1005 | if (psessionEntry == NULL) { |
| 1006 | lim_log(pMac, LOGE, |
| 1007 | FL("Session Does not exist for given sessionId")); |
| 1008 | return; |
| 1009 | } |
| 1010 | /* / Inform Host of STA association */ |
| 1011 | len = sizeof(tSirSmeAssocInd); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 1012 | pSirSmeAssocInd = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1013 | if (NULL == pSirSmeAssocInd) { |
| 1014 | /* Log error */ |
| 1015 | lim_log(pMac, LOGP, |
| 1016 | FL |
| 1017 | ("call to AllocateMemory failed for eWNI_SME_ASSOC_IND")); |
| 1018 | return; |
| 1019 | } |
| 1020 | |
| 1021 | pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND; |
| 1022 | lim_fill_assoc_ind_params(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, |
| 1023 | psessionEntry); |
| 1024 | msgQ.type = eWNI_SME_ASSOC_IND; |
| 1025 | msgQ.bodyptr = pSirSmeAssocInd; |
| 1026 | msgQ.bodyval = 0; |
| 1027 | pStaDs = dph_get_hash_entry(pMac, |
| 1028 | ((tpLimMlmAssocInd) pMsgBuf)->aid, |
| 1029 | &psessionEntry->dph.dphHashTable); |
| 1030 | if (!pStaDs) { /* good time to panic... */ |
| 1031 | lim_log(pMac, LOGE, |
| 1032 | FL |
| 1033 | ("MLM AssocInd: Station context no longer valid (aid %d)"), |
| 1034 | ((tpLimMlmAssocInd) pMsgBuf)->aid); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 1035 | qdf_mem_free(pSirSmeAssocInd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1036 | |
| 1037 | return; |
| 1038 | } |
| 1039 | pSirSmeAssocInd->staId = pStaDs->staIndex; |
| 1040 | pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType; |
| 1041 | pSirSmeAssocInd->timingMeasCap = pStaDs->timingMeasCap; |
| 1042 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 1043 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1044 | lim_diag_event_report(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, |
| 1045 | 0); |
| 1046 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1047 | lim_sys_process_mmh_msg_api(pMac, &msgQ, ePROT); |
| 1048 | |
| 1049 | PELOG1(lim_log(pMac, LOG1, |
| 1050 | FL |
| 1051 | ("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND")); |
| 1052 | ) |
| 1053 | /* |
| 1054 | ** turn on a timer to detect the loss of ASSOC CNF |
| 1055 | **/ |
| 1056 | lim_activate_cnf_timer(pMac, |
| 1057 | (uint16_t) ((tpLimMlmAssocInd) pMsgBuf)->aid, |
| 1058 | psessionEntry); |
| 1059 | |
| 1060 | } /*** end lim_process_mlm_assoc_ind() ***/ |
| 1061 | |
| 1062 | /** |
| 1063 | * lim_process_mlm_disassoc_ind() |
| 1064 | * |
| 1065 | ***FUNCTION: |
| 1066 | * This function is called to processes MLM_DISASSOC_IND |
| 1067 | * message from MLM State machine. |
| 1068 | * |
| 1069 | ***LOGIC: |
| 1070 | * |
| 1071 | ***ASSUMPTIONS: |
| 1072 | * |
| 1073 | ***NOTE: |
| 1074 | * |
| 1075 | * @param pMac Pointer to Global MAC structure |
| 1076 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1077 | * |
| 1078 | * @return None |
| 1079 | */ |
| 1080 | void lim_process_mlm_disassoc_ind(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 1081 | { |
| 1082 | tLimMlmDisassocInd *pMlmDisassocInd; |
| 1083 | tpPESession psessionEntry; |
| 1084 | pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf; |
| 1085 | psessionEntry = pe_find_session_by_session_id(pMac, |
| 1086 | pMlmDisassocInd->sessionId); |
| 1087 | if (psessionEntry == NULL) { |
| 1088 | lim_log(pMac, LOGP, |
| 1089 | FL("Session Does not exist for given sessionID")); |
| 1090 | return; |
| 1091 | } |
| 1092 | switch (GET_LIM_SYSTEM_ROLE(psessionEntry)) { |
| 1093 | case eLIM_STA_IN_IBSS_ROLE: |
| 1094 | break; |
| 1095 | case eLIM_STA_ROLE: |
| 1096 | case eLIM_BT_AMP_STA_ROLE: |
| 1097 | psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE; |
| 1098 | MTRACE(mac_trace |
| 1099 | (pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, |
| 1100 | psessionEntry->limSmeState)); |
| 1101 | break; |
| 1102 | default: /* eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE */ |
| 1103 | PELOG1(lim_log(pMac, LOG1, |
| 1104 | FL("*** Peer staId=%d Disassociated ***"), |
| 1105 | pMlmDisassocInd->aid); |
| 1106 | ) |
| 1107 | /* Send SME_DISASOC_IND after Polaris cleanup */ |
| 1108 | /* (after receiving LIM_MLM_PURGE_STA_IND) */ |
| 1109 | break; |
| 1110 | } /* end switch (GET_LIM_SYSTEM_ROLE(psessionEntry)) */ |
| 1111 | } /*** end lim_process_mlm_disassoc_ind() ***/ |
| 1112 | |
| 1113 | /** |
| 1114 | * lim_process_mlm_disassoc_cnf() - Processes disassociation |
| 1115 | * @mac_ctx: Pointer to Global MAC structure |
| 1116 | * @msg: A pointer to the MLM message buffer |
| 1117 | * |
| 1118 | * This function is called to processes MLM_DISASSOC_CNF |
| 1119 | * message from MLM State machine. |
| 1120 | * |
| 1121 | * Return: None |
| 1122 | */ |
| 1123 | void lim_process_mlm_disassoc_cnf(tpAniSirGlobal mac_ctx, |
| 1124 | uint32_t *msg) |
| 1125 | { |
| 1126 | tSirResultCodes result_code; |
| 1127 | tLimMlmDisassocCnf *disassoc_cnf; |
| 1128 | tpPESession session_entry; |
| 1129 | disassoc_cnf = (tLimMlmDisassocCnf *) msg; |
| 1130 | |
| 1131 | session_entry = |
| 1132 | pe_find_session_by_session_id(mac_ctx, disassoc_cnf->sessionId); |
| 1133 | if (session_entry == NULL) { |
| 1134 | lim_log(mac_ctx, LOGE, |
| 1135 | FL("session Does not exist for given session Id")); |
| 1136 | return; |
| 1137 | } |
| 1138 | result_code = (tSirResultCodes)(disassoc_cnf->disassocTrigger == |
| 1139 | eLIM_LINK_MONITORING_DISASSOC) ? |
| 1140 | eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE : |
| 1141 | disassoc_cnf->resultCode; |
| 1142 | if (LIM_IS_STA_ROLE(session_entry) || |
| 1143 | LIM_IS_BT_AMP_STA_ROLE(session_entry)) { |
| 1144 | /* Disassociate Confirm from MLM */ |
| 1145 | if ((session_entry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) |
| 1146 | && (session_entry->limSmeState != |
| 1147 | eLIM_SME_WT_DEAUTH_STATE)) { |
| 1148 | /* |
| 1149 | * Should not have received |
| 1150 | * Disassocate confirm |
| 1151 | * from MLM in other states.Log error |
| 1152 | */ |
| 1153 | lim_log(mac_ctx, LOGE, |
| 1154 | FL("received MLM_DISASSOC_CNF in state %X"), |
| 1155 | session_entry->limSmeState); |
| 1156 | return; |
| 1157 | } |
| 1158 | if (mac_ctx->lim.gLimRspReqd) |
| 1159 | mac_ctx->lim.gLimRspReqd = false; |
| 1160 | if (disassoc_cnf->disassocTrigger == |
| 1161 | eLIM_PROMISCUOUS_MODE_DISASSOC) { |
| 1162 | if (disassoc_cnf->resultCode != eSIR_SME_SUCCESS) |
| 1163 | session_entry->limSmeState = |
| 1164 | session_entry->limPrevSmeState; |
| 1165 | else |
| 1166 | session_entry->limSmeState = |
| 1167 | eLIM_SME_OFFLINE_STATE; |
| 1168 | MTRACE(mac_trace |
| 1169 | (mac_ctx, TRACE_CODE_SME_STATE, |
| 1170 | session_entry->peSessionId, |
| 1171 | session_entry->limSmeState)); |
| 1172 | } else { |
| 1173 | if (disassoc_cnf->resultCode != eSIR_SME_SUCCESS) |
| 1174 | session_entry->limSmeState = |
| 1175 | session_entry->limPrevSmeState; |
| 1176 | else |
| 1177 | session_entry->limSmeState = |
| 1178 | eLIM_SME_IDLE_STATE; |
| 1179 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 1180 | session_entry->peSessionId, |
| 1181 | session_entry->limSmeState)); |
| 1182 | lim_send_sme_disassoc_ntf(mac_ctx, |
| 1183 | disassoc_cnf->peerMacAddr, result_code, |
| 1184 | disassoc_cnf->disassocTrigger, |
| 1185 | disassoc_cnf->aid, session_entry->smeSessionId, |
| 1186 | session_entry->transactionId, session_entry); |
| 1187 | } |
| 1188 | } else if (LIM_IS_AP_ROLE(session_entry) || |
| 1189 | LIM_IS_BT_AMP_AP_ROLE(session_entry)) { |
| 1190 | lim_send_sme_disassoc_ntf(mac_ctx, disassoc_cnf->peerMacAddr, |
| 1191 | result_code, disassoc_cnf->disassocTrigger, |
| 1192 | disassoc_cnf->aid, session_entry->smeSessionId, |
| 1193 | session_entry->transactionId, session_entry); |
| 1194 | } |
| 1195 | } |
| 1196 | |
| 1197 | /** |
| 1198 | * lim_process_mlm_deauth_ind() |
| 1199 | * |
| 1200 | ***FUNCTION: |
| 1201 | * This function is called to processes MLM_DEAUTH_IND |
| 1202 | * message from MLM State machine. |
| 1203 | * |
| 1204 | ***LOGIC: |
| 1205 | * |
| 1206 | ***ASSUMPTIONS: |
| 1207 | * |
| 1208 | ***NOTE: |
| 1209 | * |
| 1210 | * @param pMac Pointer to Global MAC structure |
| 1211 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1212 | * |
| 1213 | * @return None |
| 1214 | */ |
| 1215 | void lim_process_mlm_deauth_ind(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 1216 | { |
| 1217 | tLimMlmDeauthInd *pMlmDeauthInd; |
| 1218 | tpPESession psessionEntry; |
| 1219 | uint8_t sessionId; |
| 1220 | pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf; |
| 1221 | psessionEntry = pe_find_session_by_bssid(pMac, |
| 1222 | pMlmDeauthInd->peerMacAddr, &sessionId); |
| 1223 | if (psessionEntry == NULL) { |
| 1224 | lim_log(pMac, LOGE, |
| 1225 | FL("session does not exist for Addr:" MAC_ADDRESS_STR), |
| 1226 | MAC_ADDR_ARRAY(pMlmDeauthInd->peerMacAddr)); |
| 1227 | return; |
| 1228 | } |
| 1229 | switch (GET_LIM_SYSTEM_ROLE(psessionEntry)) { |
| 1230 | case eLIM_STA_IN_IBSS_ROLE: |
| 1231 | break; |
| 1232 | case eLIM_STA_ROLE: |
| 1233 | case eLIM_BT_AMP_STA_ROLE: |
| 1234 | psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE; |
| 1235 | MTRACE(mac_trace |
| 1236 | (pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, |
| 1237 | psessionEntry->limSmeState)); |
| 1238 | |
| 1239 | default: /* eLIM_AP_ROLE */ |
| 1240 | { |
| 1241 | PELOG1(lim_log(pMac, LOG1, |
| 1242 | FL |
| 1243 | ("*** Received Deauthentication from staId=%d ***"), |
| 1244 | pMlmDeauthInd->aid); |
| 1245 | ) |
| 1246 | } |
| 1247 | /* Send SME_DEAUTH_IND after Polaris cleanup */ |
| 1248 | /* (after receiving LIM_MLM_PURGE_STA_IND) */ |
| 1249 | break; |
| 1250 | } /* end switch (GET_LIM_SYSTEM_ROLE(psessionEntry)) */ |
| 1251 | } /*** end lim_process_mlm_deauth_ind() ***/ |
| 1252 | |
| 1253 | /** |
| 1254 | * lim_process_mlm_deauth_cnf() |
| 1255 | * |
| 1256 | ***FUNCTION: |
| 1257 | * This function is called to processes MLM_DEAUTH_CNF |
| 1258 | * message from MLM State machine. |
| 1259 | * |
| 1260 | ***LOGIC: |
| 1261 | * |
| 1262 | ***ASSUMPTIONS: |
| 1263 | * |
| 1264 | ***NOTE: |
| 1265 | * |
| 1266 | * @param pMac Pointer to Global MAC structure |
| 1267 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1268 | * |
| 1269 | * @return None |
| 1270 | */ |
| 1271 | void lim_process_mlm_deauth_cnf(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 1272 | { |
| 1273 | uint16_t aid; |
| 1274 | tSirResultCodes resultCode; |
| 1275 | tLimMlmDeauthCnf *pMlmDeauthCnf; |
| 1276 | tpPESession psessionEntry; |
| 1277 | |
| 1278 | if (pMsgBuf == NULL) { |
| 1279 | PELOGE(lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL"));) |
| 1280 | return; |
| 1281 | } |
| 1282 | pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf; |
| 1283 | psessionEntry = pe_find_session_by_session_id(pMac, |
| 1284 | pMlmDeauthCnf->sessionId); |
| 1285 | if (psessionEntry == NULL) { |
| 1286 | PELOGE(lim_log |
| 1287 | (pMac, LOGE, |
| 1288 | FL("session does not exist for given session Id ")); |
| 1289 | ) |
| 1290 | return; |
| 1291 | } |
| 1292 | |
| 1293 | resultCode = (tSirResultCodes) |
| 1294 | (pMlmDeauthCnf->deauthTrigger == |
| 1295 | eLIM_LINK_MONITORING_DEAUTH) ? |
| 1296 | eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE : |
| 1297 | pMlmDeauthCnf->resultCode; |
| 1298 | aid = LIM_IS_AP_ROLE(psessionEntry) ? pMlmDeauthCnf->aid : 1; |
| 1299 | if (LIM_IS_STA_ROLE(psessionEntry) || |
| 1300 | LIM_IS_BT_AMP_STA_ROLE(psessionEntry)) { |
| 1301 | /* Deauth Confirm from MLM */ |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1302 | if ((psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) |
| 1303 | && psessionEntry->limSmeState != |
| 1304 | eLIM_SME_WT_DEAUTH_STATE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1305 | /** |
| 1306 | * Should not have received Deauth confirm |
| 1307 | * from MLM in other states. |
| 1308 | * Log error |
| 1309 | */ |
| 1310 | PELOGE(lim_log(pMac, LOGE, |
| 1311 | FL |
| 1312 | ("received unexpected MLM_DEAUTH_CNF in state %X"), |
| 1313 | psessionEntry->limSmeState);) |
| 1314 | return; |
| 1315 | } |
| 1316 | if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS) { |
| 1317 | psessionEntry->limSmeState = eLIM_SME_IDLE_STATE; |
| 1318 | PELOG1(lim_log(pMac, LOG1, |
| 1319 | FL("*** Deauthenticated with BSS ***"));) |
| 1320 | } else |
| 1321 | psessionEntry->limSmeState = |
| 1322 | psessionEntry->limPrevSmeState; |
| 1323 | MTRACE(mac_trace |
| 1324 | (pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, |
| 1325 | psessionEntry->limSmeState)); |
| 1326 | |
| 1327 | if (pMac->lim.gLimRspReqd) |
| 1328 | pMac->lim.gLimRspReqd = false; |
| 1329 | } |
| 1330 | /* On STA or on BASIC AP, send SME_DEAUTH_RSP to host */ |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1331 | lim_send_sme_deauth_ntf(pMac, pMlmDeauthCnf->peer_macaddr.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1332 | resultCode, |
| 1333 | pMlmDeauthCnf->deauthTrigger, |
| 1334 | aid, psessionEntry->smeSessionId, |
| 1335 | psessionEntry->transactionId); |
| 1336 | } /*** end lim_process_mlm_deauth_cnf() ***/ |
| 1337 | |
| 1338 | /** |
| 1339 | * lim_process_mlm_purge_sta_ind() |
| 1340 | * |
| 1341 | ***FUNCTION: |
| 1342 | * This function is called to processes MLM_PURGE_STA_IND |
| 1343 | * message from MLM State machine. |
| 1344 | * |
| 1345 | ***LOGIC: |
| 1346 | * |
| 1347 | ***ASSUMPTIONS: |
| 1348 | * |
| 1349 | ***NOTE: |
| 1350 | * |
| 1351 | * @param pMac Pointer to Global MAC structure |
| 1352 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1353 | * |
| 1354 | * @return None |
| 1355 | */ |
| 1356 | void lim_process_mlm_purge_sta_ind(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 1357 | { |
| 1358 | tSirResultCodes resultCode; |
| 1359 | tpLimMlmPurgeStaInd pMlmPurgeStaInd; |
| 1360 | tpPESession psessionEntry; |
| 1361 | if (pMsgBuf == NULL) { |
| 1362 | PELOGE(lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL"));) |
| 1363 | return; |
| 1364 | } |
| 1365 | pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf; |
| 1366 | psessionEntry = pe_find_session_by_session_id(pMac, |
| 1367 | pMlmPurgeStaInd->sessionId); |
| 1368 | if (psessionEntry == NULL) { |
| 1369 | PELOGE(lim_log |
| 1370 | (pMac, LOGE, |
| 1371 | FL("session does not exist for given bssId")); |
| 1372 | ) |
| 1373 | return; |
| 1374 | } |
| 1375 | /* Purge STA indication from MLM */ |
| 1376 | resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode; |
| 1377 | switch (GET_LIM_SYSTEM_ROLE(psessionEntry)) { |
| 1378 | case eLIM_STA_IN_IBSS_ROLE: |
| 1379 | break; |
| 1380 | case eLIM_STA_ROLE: |
| 1381 | case eLIM_BT_AMP_STA_ROLE: |
| 1382 | default: /* eLIM_AP_ROLE */ |
| 1383 | if (LIM_IS_STA_ROLE(psessionEntry) && |
| 1384 | (psessionEntry->limSmeState != |
| 1385 | eLIM_SME_WT_DISASSOC_STATE) && |
| 1386 | (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)) { |
| 1387 | /** |
| 1388 | * Should not have received |
| 1389 | * Purge STA indication |
| 1390 | * from MLM in other states. |
| 1391 | * Log error |
| 1392 | */ |
| 1393 | PELOGE(lim_log(pMac, LOGE, |
| 1394 | FL |
| 1395 | ("received unexpected MLM_PURGE_STA_IND in state %X"), |
| 1396 | psessionEntry->limSmeState); |
| 1397 | ) |
| 1398 | break; |
| 1399 | } |
| 1400 | PELOG1(lim_log(pMac, LOG1, |
| 1401 | FL("*** Cleanup completed for staId=%d ***"), |
| 1402 | pMlmPurgeStaInd->aid); |
| 1403 | ) |
| 1404 | if (LIM_IS_STA_ROLE(psessionEntry) || |
| 1405 | LIM_IS_BT_AMP_STA_ROLE(psessionEntry)) { |
| 1406 | psessionEntry->limSmeState = eLIM_SME_IDLE_STATE; |
| 1407 | MTRACE(mac_trace |
| 1408 | (pMac, TRACE_CODE_SME_STATE, |
| 1409 | psessionEntry->peSessionId, |
| 1410 | psessionEntry->limSmeState)); |
| 1411 | |
| 1412 | } |
| 1413 | if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH) { |
| 1414 | lim_send_sme_deauth_ntf(pMac, |
| 1415 | pMlmPurgeStaInd->peerMacAddr, |
| 1416 | resultCode, |
| 1417 | pMlmPurgeStaInd->purgeTrigger, |
| 1418 | pMlmPurgeStaInd->aid, |
| 1419 | psessionEntry->smeSessionId, |
| 1420 | psessionEntry->transactionId); |
| 1421 | } else |
| 1422 | lim_send_sme_disassoc_ntf(pMac, |
| 1423 | pMlmPurgeStaInd->peerMacAddr, |
| 1424 | resultCode, |
| 1425 | pMlmPurgeStaInd->purgeTrigger, |
| 1426 | pMlmPurgeStaInd->aid, |
| 1427 | psessionEntry->smeSessionId, |
| 1428 | psessionEntry->transactionId, |
| 1429 | psessionEntry); |
| 1430 | } /* end switch (GET_LIM_SYSTEM_ROLE(psessionEntry)) */ |
| 1431 | } /*** end lim_process_mlm_purge_sta_ind() ***/ |
| 1432 | |
| 1433 | /** |
| 1434 | * lim_process_mlm_set_keys_cnf() |
| 1435 | * |
| 1436 | ***FUNCTION: |
| 1437 | * This function is called to processes MLM_SETKEYS_CNF |
| 1438 | * message from MLM State machine. |
| 1439 | * |
| 1440 | ***LOGIC: |
| 1441 | * |
| 1442 | ***ASSUMPTIONS: |
| 1443 | * |
| 1444 | ***NOTE: |
| 1445 | * |
| 1446 | * @param pMac Pointer to Global MAC structure |
| 1447 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1448 | * |
| 1449 | * @return None |
| 1450 | */ |
| 1451 | void lim_process_mlm_set_keys_cnf(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 1452 | { |
| 1453 | /* Prepare and send SME_SETCONTEXT_RSP message */ |
| 1454 | tLimMlmSetKeysCnf *pMlmSetKeysCnf; |
| 1455 | tpPESession psessionEntry; |
| 1456 | uint16_t aid; |
| 1457 | tpDphHashNode sta_ds; |
| 1458 | |
| 1459 | if (pMsgBuf == NULL) { |
| 1460 | PELOGE(lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL"));) |
| 1461 | return; |
| 1462 | } |
| 1463 | pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf; |
| 1464 | psessionEntry = pe_find_session_by_session_id(pMac, |
| 1465 | pMlmSetKeysCnf->sessionId); |
| 1466 | if (psessionEntry == NULL) { |
| 1467 | PELOGE(lim_log |
| 1468 | (pMac, LOGE, |
| 1469 | FL("session does not exist for given sessionId ")); |
| 1470 | ) |
| 1471 | return; |
| 1472 | } |
| 1473 | psessionEntry->is_key_installed = 0; |
| 1474 | lim_log(pMac, LOG1, |
| 1475 | FL("Received MLM_SETKEYS_CNF with resultCode = %d"), |
| 1476 | pMlmSetKeysCnf->resultCode); |
| 1477 | /* if the status is success keys are installed in the |
| 1478 | * Firmware so we can set the protection bit |
| 1479 | */ |
| 1480 | if (eSIR_SME_SUCCESS == pMlmSetKeysCnf->resultCode) { |
| 1481 | psessionEntry->is_key_installed = 1; |
| 1482 | if (LIM_IS_AP_ROLE(psessionEntry) || |
| 1483 | LIM_IS_BT_AMP_AP_ROLE(psessionEntry)) { |
| 1484 | sta_ds = dph_lookup_hash_entry(pMac, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 1485 | pMlmSetKeysCnf->peer_macaddr.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1486 | &aid, &psessionEntry->dph.dphHashTable); |
| 1487 | if (sta_ds != NULL) |
| 1488 | sta_ds->is_key_installed = 1; |
| 1489 | } |
| 1490 | } |
| 1491 | lim_send_sme_set_context_rsp(pMac, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 1492 | pMlmSetKeysCnf->peer_macaddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1493 | 1, |
| 1494 | (tSirResultCodes) pMlmSetKeysCnf->resultCode, |
| 1495 | psessionEntry, psessionEntry->smeSessionId, |
| 1496 | psessionEntry->transactionId); |
| 1497 | } /*** end lim_process_mlm_set_keys_cnf() ***/ |
| 1498 | |
| 1499 | /** |
| 1500 | * lim_handle_sme_join_result() - Handles sme join result |
| 1501 | * @mac_ctx: Pointer to Global MAC structure |
| 1502 | * @result_code: Failure code to be sent |
| 1503 | * @prot_status_code : Protocol status code |
| 1504 | * @session_entry: PE session handle |
| 1505 | * |
| 1506 | * This function is called to process join/auth/assoc failures |
| 1507 | * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or |
| 1508 | * MLM_ASSOC_CNF with a success code in case of STA role and |
| 1509 | * MLM_JOIN_CNF with success in case of STA in IBSS role. |
| 1510 | * |
| 1511 | * Return: None |
| 1512 | */ |
| 1513 | static void |
| 1514 | lim_handle_sme_join_result(tpAniSirGlobal mac_ctx, |
| 1515 | tSirResultCodes result_code, uint16_t prot_status_code, |
| 1516 | tpPESession session_entry) |
| 1517 | { |
| 1518 | tpDphHashNode sta_ds = NULL; |
| 1519 | uint8_t sme_session_id; |
| 1520 | uint16_t sme_trans_id; |
| 1521 | |
| 1522 | if (session_entry == NULL) { |
| 1523 | lim_log(mac_ctx, LOGE, FL("psessionEntry is NULL ")); |
| 1524 | return; |
| 1525 | } |
| 1526 | sme_session_id = session_entry->smeSessionId; |
| 1527 | sme_trans_id = session_entry->transactionId; |
| 1528 | /* |
| 1529 | * When associations is failed , delete the session created |
| 1530 | * and pass NULL to limsendsmeJoinReassocRsp() |
| 1531 | */ |
| 1532 | if (result_code != eSIR_SME_SUCCESS) { |
| 1533 | sta_ds = |
| 1534 | dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, |
| 1535 | &session_entry->dph.dphHashTable); |
| 1536 | if (sta_ds != NULL) { |
| 1537 | sta_ds->mlmStaContext.disassocReason = |
| 1538 | eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 1539 | sta_ds->mlmStaContext.cleanupTrigger = |
| 1540 | eLIM_JOIN_FAILURE; |
| 1541 | sta_ds->mlmStaContext.resultCode = result_code; |
| 1542 | sta_ds->mlmStaContext.protStatusCode = prot_status_code; |
| 1543 | /* |
| 1544 | * FIX_ME: at the end of lim_cleanup_rx_path, |
| 1545 | * make sure PE is sending eWNI_SME_JOIN_RSP |
| 1546 | * to SME |
| 1547 | */ |
| 1548 | lim_cleanup_rx_path(mac_ctx, sta_ds, session_entry); |
Abhishek Singh | 96bda8e | 2015-12-03 16:45:35 +0530 | [diff] [blame] | 1549 | /* Cleanup if add bss failed */ |
| 1550 | if (session_entry->add_bss_failed) { |
| 1551 | dph_delete_hash_entry(mac_ctx, |
| 1552 | sta_ds->staAddr, sta_ds->assocId, |
| 1553 | &session_entry->dph.dphHashTable); |
| 1554 | goto error; |
| 1555 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 1556 | qdf_mem_free(session_entry->pLimJoinReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1557 | session_entry->pLimJoinReq = NULL; |
| 1558 | return; |
| 1559 | } |
| 1560 | } |
Abhishek Singh | 96bda8e | 2015-12-03 16:45:35 +0530 | [diff] [blame] | 1561 | error: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 1562 | qdf_mem_free(session_entry->pLimJoinReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1563 | session_entry->pLimJoinReq = NULL; |
| 1564 | /* Delete teh session if JOIN failure occurred. */ |
| 1565 | if (result_code != eSIR_SME_SUCCESS) { |
| 1566 | if (lim_set_link_state(mac_ctx, eSIR_LINK_DOWN_STATE, |
| 1567 | session_entry->bssId, |
| 1568 | session_entry->selfMacAddr, NULL, NULL) |
| 1569 | != eSIR_SUCCESS) |
| 1570 | lim_log(mac_ctx, LOGE, |
| 1571 | FL("Failed to set the DownState.")); |
| 1572 | if (lim_set_link_state |
| 1573 | (mac_ctx, eSIR_LINK_IDLE_STATE, |
| 1574 | session_entry->bssId, |
| 1575 | session_entry->selfMacAddr, NULL, |
| 1576 | NULL) != eSIR_SUCCESS) |
| 1577 | lim_log(mac_ctx, LOGE, |
| 1578 | FL("Failed to set the LinkState.")); |
| 1579 | pe_delete_session(mac_ctx, session_entry); |
| 1580 | session_entry = NULL; |
| 1581 | } |
| 1582 | |
| 1583 | lim_send_sme_join_reassoc_rsp(mac_ctx, eWNI_SME_JOIN_RSP, result_code, |
| 1584 | prot_status_code, session_entry, sme_session_id, sme_trans_id); |
| 1585 | } |
| 1586 | |
| 1587 | /** |
| 1588 | * lim_handle_sme_reaasoc_result() |
| 1589 | * |
| 1590 | ***FUNCTION: |
| 1591 | * This function is called to process reassoc failures |
| 1592 | * upon receiving REASSOC_CNF with a failure code or |
| 1593 | * MLM_REASSOC_CNF with a success code in case of STA role |
| 1594 | * |
| 1595 | ***LOGIC: |
| 1596 | * |
| 1597 | ***ASSUMPTIONS: |
| 1598 | * |
| 1599 | ***NOTE: |
| 1600 | * |
| 1601 | * @param pMac Pointer to Global MAC structure |
| 1602 | * @param resultCode Failure code to be sent |
| 1603 | * |
| 1604 | * |
| 1605 | * @return None |
| 1606 | */ |
| 1607 | static void |
| 1608 | lim_handle_sme_reaasoc_result(tpAniSirGlobal pMac, tSirResultCodes resultCode, |
| 1609 | uint16_t protStatusCode, tpPESession psessionEntry) |
| 1610 | { |
| 1611 | tpDphHashNode pStaDs = NULL; |
| 1612 | uint8_t smesessionId; |
| 1613 | uint16_t smetransactionId; |
| 1614 | |
| 1615 | if (psessionEntry == NULL) { |
| 1616 | PELOGE(lim_log(pMac, LOGE, FL("psessionEntry is NULL "));) |
| 1617 | return; |
| 1618 | } |
| 1619 | smesessionId = psessionEntry->smeSessionId; |
| 1620 | smetransactionId = psessionEntry->transactionId; |
| 1621 | /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */ |
| 1622 | if (resultCode != eSIR_SME_SUCCESS) { |
| 1623 | pStaDs = |
| 1624 | dph_get_hash_entry(pMac, DPH_STA_HASH_INDEX_PEER, |
| 1625 | &psessionEntry->dph.dphHashTable); |
| 1626 | if (pStaDs != NULL) { |
| 1627 | pStaDs->mlmStaContext.disassocReason = |
| 1628 | eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 1629 | pStaDs->mlmStaContext.cleanupTrigger = |
| 1630 | eLIM_JOIN_FAILURE; |
| 1631 | pStaDs->mlmStaContext.resultCode = resultCode; |
| 1632 | pStaDs->mlmStaContext.protStatusCode = protStatusCode; |
| 1633 | lim_cleanup_rx_path(pMac, pStaDs, psessionEntry); |
Abhishek Singh | 96bda8e | 2015-12-03 16:45:35 +0530 | [diff] [blame] | 1634 | /* Cleanup if add bss failed */ |
| 1635 | if (psessionEntry->add_bss_failed) { |
| 1636 | dph_delete_hash_entry(pMac, |
| 1637 | pStaDs->staAddr, pStaDs->assocId, |
| 1638 | &psessionEntry->dph.dphHashTable); |
| 1639 | goto error; |
| 1640 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1641 | return; |
| 1642 | } |
| 1643 | } |
Abhishek Singh | 96bda8e | 2015-12-03 16:45:35 +0530 | [diff] [blame] | 1644 | error: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1645 | /* Delete teh session if REASSOC failure occurred. */ |
| 1646 | if (resultCode != eSIR_SME_SUCCESS) { |
| 1647 | if (NULL != psessionEntry) { |
| 1648 | pe_delete_session(pMac, psessionEntry); |
| 1649 | psessionEntry = NULL; |
| 1650 | } |
| 1651 | } |
| 1652 | lim_send_sme_join_reassoc_rsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, |
| 1653 | protStatusCode, psessionEntry, smesessionId, |
| 1654 | smetransactionId); |
| 1655 | } /*** end limHandleSmeReassocResult() ***/ |
| 1656 | |
| 1657 | /** |
| 1658 | * lim_process_mlm_add_sta_rsp() |
| 1659 | * |
| 1660 | ***FUNCTION: |
| 1661 | * This function is called to process a WMA_ADD_STA_RSP from HAL. |
| 1662 | * Upon receipt of this message from HAL, MLME - |
| 1663 | * > Determines the "state" in which this message was received |
| 1664 | * > Forwards it to the appropriate callback |
| 1665 | * |
| 1666 | ***ASSUMPTIONS: |
| 1667 | * |
| 1668 | ***NOTE: |
| 1669 | * |
| 1670 | * @param pMac Pointer to Global MAC structure |
| 1671 | * @param tSirMsgQ The MsgQ header, which contains the response buffer |
| 1672 | * |
| 1673 | * @return None |
| 1674 | */ |
| 1675 | void lim_process_mlm_add_sta_rsp(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, |
| 1676 | tpPESession psessionEntry) |
| 1677 | { |
| 1678 | /* we need to process the deferred message since the initiating req. there might be nested request. */ |
| 1679 | /* in the case of nested request the new request initiated from the response will take care of resetting */ |
| 1680 | /* the deffered flag. */ |
| 1681 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 1682 | if (LIM_IS_BT_AMP_AP_ROLE(psessionEntry) || |
| 1683 | LIM_IS_AP_ROLE(psessionEntry)) { |
| 1684 | lim_process_ap_mlm_add_sta_rsp(pMac, limMsgQ, psessionEntry); |
| 1685 | return; |
| 1686 | } |
| 1687 | lim_process_sta_mlm_add_sta_rsp(pMac, limMsgQ, psessionEntry); |
| 1688 | } |
| 1689 | |
| 1690 | /** |
| 1691 | * lim_process_sta_mlm_add_sta_rsp () - Process add sta response |
| 1692 | * @mac_ctx: Pointer to mac context |
| 1693 | * @msg: tpSirMsgQan Message structure |
| 1694 | * @session_entry: PE session entry |
| 1695 | * |
| 1696 | * Process ADD STA response sent from WMA and posts results |
| 1697 | * to SME. |
| 1698 | * |
| 1699 | * Return: Null |
| 1700 | */ |
| 1701 | |
| 1702 | void lim_process_sta_mlm_add_sta_rsp(tpAniSirGlobal mac_ctx, |
| 1703 | tpSirMsgQ msg, tpPESession session_entry) |
| 1704 | { |
| 1705 | tLimMlmAssocCnf mlm_assoc_cnf; |
| 1706 | tpDphHashNode sta_ds; |
| 1707 | uint32_t msg_type = LIM_MLM_ASSOC_CNF; |
| 1708 | tpAddStaParams add_sta_params = (tpAddStaParams) msg->bodyptr; |
| 1709 | tpPESession ft_session = NULL; |
| 1710 | uint8_t ft_session_id; |
| 1711 | |
| 1712 | if (NULL == add_sta_params) { |
| 1713 | lim_log(mac_ctx, LOGE, FL("Encountered NULL Pointer")); |
| 1714 | return; |
| 1715 | } |
| 1716 | |
| 1717 | if (session_entry->limSmeState == eLIM_SME_WT_REASSOC_STATE) |
| 1718 | msg_type = LIM_MLM_REASSOC_CNF; |
| 1719 | |
| 1720 | if (true == session_entry->fDeauthReceived) { |
| 1721 | lim_log(mac_ctx, LOGE, |
| 1722 | FL("Received Deauth frame in ADD_STA_RESP state")); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1723 | if (QDF_STATUS_SUCCESS == add_sta_params->status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1724 | lim_log(mac_ctx, LOGE, |
| 1725 | FL("ADD_STA success, send update result code with eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA staIdx: %d limMlmState: %d"), |
| 1726 | add_sta_params->staIdx, |
| 1727 | session_entry->limMlmState); |
| 1728 | |
| 1729 | if (session_entry->limSmeState == |
| 1730 | eLIM_SME_WT_REASSOC_STATE) |
| 1731 | msg_type = LIM_MLM_REASSOC_CNF; |
| 1732 | /* |
| 1733 | * We are sending result code |
| 1734 | * eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA which |
| 1735 | * will trigger proper cleanup (DEL_STA/DEL_BSS both |
| 1736 | * required) in either assoc cnf or reassoc cnf handler. |
| 1737 | */ |
| 1738 | mlm_assoc_cnf.resultCode = |
| 1739 | eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA; |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 1740 | mlm_assoc_cnf.protStatusCode = |
| 1741 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1742 | session_entry->staId = add_sta_params->staIdx; |
| 1743 | goto end; |
| 1744 | } |
| 1745 | } |
| 1746 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1747 | if (QDF_STATUS_SUCCESS == add_sta_params->status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1748 | if (eLIM_MLM_WT_ADD_STA_RSP_STATE != |
| 1749 | session_entry->limMlmState) { |
| 1750 | lim_log(mac_ctx, LOGE, |
| 1751 | FL("Received WMA_ADD_STA_RSP in state %X"), |
| 1752 | session_entry->limMlmState); |
| 1753 | mlm_assoc_cnf.resultCode = |
| 1754 | (tSirResultCodes) eSIR_SME_REFUSED; |
| 1755 | goto end; |
| 1756 | } |
| 1757 | if (session_entry->limSmeState == eLIM_SME_WT_REASSOC_STATE) { |
| 1758 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1759 | /* check if we have keys(PTK)to install in case of 11r */ |
| 1760 | tpftPEContext ft_ctx = &session_entry->ftPEContext; |
| 1761 | ft_session = pe_find_session_by_bssid(mac_ctx, |
| 1762 | session_entry->limReAssocbssId, &ft_session_id); |
| 1763 | if (ft_session != NULL && |
| 1764 | ft_ctx->PreAuthKeyInfo.extSetStaKeyParamValid |
| 1765 | == true) { |
| 1766 | tpLimMlmSetKeysReq pMlmStaKeys = |
| 1767 | &ft_ctx->PreAuthKeyInfo.extSetStaKeyParam; |
| 1768 | lim_send_set_sta_key_req(mac_ctx, pMlmStaKeys, |
| 1769 | 0, 0, ft_session, false); |
| 1770 | ft_ctx->PreAuthKeyInfo.extSetStaKeyParamValid = |
| 1771 | false; |
| 1772 | } |
| 1773 | #endif |
| 1774 | } |
| 1775 | /* |
| 1776 | * Update the DPH Hash Entry for this STA |
| 1777 | * with proper state info |
| 1778 | */ |
| 1779 | sta_ds = |
| 1780 | dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, |
| 1781 | &session_entry->dph.dphHashTable); |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 1782 | if (NULL != sta_ds) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1783 | sta_ds->mlmStaContext.mlmState = |
| 1784 | eLIM_MLM_LINK_ESTABLISHED_STATE; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 1785 | sta_ds->nss = add_sta_params->nss; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1786 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1787 | lim_log(mac_ctx, LOGW, |
| 1788 | FL("Fail to get DPH Hash Entry for AID - %d"), |
| 1789 | DPH_STA_HASH_INDEX_PEER); |
| 1790 | session_entry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
| 1791 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 1792 | session_entry->peSessionId, |
| 1793 | session_entry->limMlmState)); |
| 1794 | /* |
| 1795 | * Storing the self StaIndex(Generated by HAL) in |
| 1796 | * session context, instead of storing it in DPH Hash |
| 1797 | * entry for Self STA. |
| 1798 | * DPH entry for the self STA stores the sta index for |
| 1799 | * the BSS entry to which the STA is associated |
| 1800 | */ |
| 1801 | session_entry->staId = add_sta_params->staIdx; |
| 1802 | |
| 1803 | #ifdef WLAN_DEBUG |
| 1804 | mac_ctx->lim.gLimNumLinkEsts++; |
| 1805 | #endif |
| 1806 | #ifdef FEATURE_WLAN_TDLS |
| 1807 | /* initialize TDLS peer related data */ |
| 1808 | lim_init_tdls_data(mac_ctx, session_entry); |
| 1809 | #endif |
| 1810 | /* |
| 1811 | * Return Assoc confirm to SME with success |
| 1812 | * FIXME - Need the correct ASSOC RSP code to |
| 1813 | * be passed in here |
| 1814 | */ |
| 1815 | mlm_assoc_cnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS; |
| 1816 | } else { |
| 1817 | lim_log(mac_ctx, LOGE, FL("ADD_STA failed!")); |
| 1818 | if (session_entry->limSmeState == eLIM_SME_WT_REASSOC_STATE) |
| 1819 | mlm_assoc_cnf.resultCode = |
| 1820 | (tSirResultCodes) eSIR_SME_FT_REASSOC_FAILURE; |
| 1821 | else |
| 1822 | mlm_assoc_cnf.resultCode = |
| 1823 | (tSirResultCodes) eSIR_SME_REFUSED; |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 1824 | mlm_assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1825 | } |
| 1826 | end: |
| 1827 | if (NULL != msg->bodyptr) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 1828 | qdf_mem_free(add_sta_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1829 | msg->bodyptr = NULL; |
| 1830 | } |
| 1831 | /* Updating PE session Id */ |
| 1832 | mlm_assoc_cnf.sessionId = session_entry->peSessionId; |
| 1833 | lim_post_sme_message(mac_ctx, msg_type, (uint32_t *) &mlm_assoc_cnf); |
| 1834 | if (true == session_entry->fDeauthReceived) |
| 1835 | session_entry->fDeauthReceived = false; |
| 1836 | return; |
| 1837 | } |
| 1838 | |
| 1839 | void lim_process_mlm_del_bss_rsp(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, |
| 1840 | tpPESession psessionEntry) |
| 1841 | { |
| 1842 | /* we need to process the deferred message since the initiating req. there might be nested request. */ |
| 1843 | /* in the case of nested request the new request initiated from the response will take care of resetting */ |
| 1844 | /* the deffered flag. */ |
| 1845 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 1846 | pMac->sys.gSysFrameCount[SIR_MAC_MGMT_FRAME][SIR_MAC_MGMT_DEAUTH] = 0; |
| 1847 | |
| 1848 | if ((LIM_IS_BT_AMP_AP_ROLE(psessionEntry) || |
| 1849 | LIM_IS_BT_AMP_STA_ROLE(psessionEntry) || |
| 1850 | LIM_IS_AP_ROLE(psessionEntry)) && |
| 1851 | (psessionEntry->statypeForBss == STA_ENTRY_SELF)) { |
| 1852 | lim_process_bt_amp_ap_mlm_del_bss_rsp(pMac, limMsgQ, psessionEntry); |
| 1853 | return; |
| 1854 | } |
| 1855 | lim_process_sta_mlm_del_bss_rsp(pMac, limMsgQ, psessionEntry); |
| 1856 | |
| 1857 | #ifdef WLAN_FEATURE_11W |
| 1858 | if (psessionEntry->limRmfEnabled) { |
| 1859 | if (eSIR_SUCCESS != |
| 1860 | lim_send_exclude_unencrypt_ind(pMac, true, psessionEntry)) { |
| 1861 | lim_log(pMac, LOGE, |
| 1862 | FL |
| 1863 | ("Could not send down Exclude Unencrypted Indication!")); |
| 1864 | } |
| 1865 | } |
| 1866 | #endif |
| 1867 | } |
| 1868 | |
| 1869 | void lim_process_sta_mlm_del_bss_rsp(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, |
| 1870 | tpPESession psessionEntry) |
| 1871 | { |
| 1872 | tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr; |
| 1873 | tpDphHashNode pStaDs = |
| 1874 | dph_get_hash_entry(pMac, DPH_STA_HASH_INDEX_PEER, |
| 1875 | &psessionEntry->dph.dphHashTable); |
| 1876 | tSirResultCodes statusCode = eSIR_SME_SUCCESS; |
| 1877 | |
| 1878 | if (NULL == pDelBssParams) { |
| 1879 | lim_log(pMac, LOGE, FL("Invalid body pointer in message")); |
| 1880 | goto end; |
| 1881 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1882 | if (QDF_STATUS_SUCCESS == pDelBssParams->status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1883 | PELOGW(lim_log(pMac, LOGW, |
| 1884 | FL("STA received the DEL_BSS_RSP for BSSID: %X."), |
| 1885 | pDelBssParams->bssIdx); |
| 1886 | ) |
| 1887 | if (lim_set_link_state |
| 1888 | (pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId, |
| 1889 | psessionEntry->selfMacAddr, NULL, |
| 1890 | NULL) != eSIR_SUCCESS) { |
| 1891 | PELOGE(lim_log |
| 1892 | (pMac, LOGE, |
| 1893 | FL("Failure in setting link state to IDLE")); |
| 1894 | ) |
| 1895 | statusCode = eSIR_SME_REFUSED; |
| 1896 | goto end; |
| 1897 | } |
| 1898 | if (pStaDs == NULL) { |
| 1899 | lim_log(pMac, LOGE, FL("DPH Entry for STA 1 missing.")); |
| 1900 | statusCode = eSIR_SME_REFUSED; |
| 1901 | goto end; |
| 1902 | } |
| 1903 | if (eLIM_MLM_WT_DEL_BSS_RSP_STATE != |
| 1904 | pStaDs->mlmStaContext.mlmState) { |
| 1905 | PELOGE(lim_log |
| 1906 | (pMac, LOGE, |
| 1907 | FL |
| 1908 | ("Received unexpected WMA_DEL_BSS_RSP in state %X"), |
| 1909 | pStaDs->mlmStaContext.mlmState); |
| 1910 | ) |
| 1911 | statusCode = eSIR_SME_REFUSED; |
| 1912 | goto end; |
| 1913 | } |
| 1914 | PELOG1(lim_log |
| 1915 | (pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId); |
| 1916 | lim_print_mac_addr(pMac, pStaDs->staAddr, LOG1); |
| 1917 | ) |
| 1918 | } else { |
| 1919 | lim_log(pMac, LOGE, FL("DEL BSS failed!")); |
| 1920 | statusCode = eSIR_SME_STOP_BSS_FAILURE; |
| 1921 | } |
| 1922 | end: |
| 1923 | if (0 != limMsgQ->bodyptr) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 1924 | qdf_mem_free(pDelBssParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1925 | limMsgQ->bodyptr = NULL; |
| 1926 | } |
| 1927 | if (pStaDs == NULL) |
| 1928 | return; |
| 1929 | if ((LIM_IS_STA_ROLE(psessionEntry) || |
| 1930 | LIM_IS_BT_AMP_STA_ROLE(psessionEntry)) && |
| 1931 | (psessionEntry->limSmeState != |
| 1932 | eLIM_SME_WT_DISASSOC_STATE && |
| 1933 | psessionEntry->limSmeState != |
| 1934 | eLIM_SME_WT_DEAUTH_STATE) && |
| 1935 | pStaDs->mlmStaContext.cleanupTrigger != |
| 1936 | eLIM_JOIN_FAILURE) { |
| 1937 | /** The Case where the DelBss is invoked from |
| 1938 | * context of other than normal DisAssoc / Deauth OR |
| 1939 | * as part of Join Failure. |
| 1940 | */ |
| 1941 | lim_handle_del_bss_in_re_assoc_context(pMac, pStaDs, psessionEntry); |
| 1942 | return; |
| 1943 | } |
| 1944 | lim_prepare_and_send_del_sta_cnf(pMac, pStaDs, statusCode, psessionEntry); |
| 1945 | return; |
| 1946 | } |
| 1947 | |
| 1948 | void lim_process_bt_amp_ap_mlm_del_bss_rsp(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, |
| 1949 | tpPESession psessionEntry) |
| 1950 | { |
| 1951 | tSirResultCodes rc = eSIR_SME_SUCCESS; |
| 1952 | tSirRetStatus status; |
| 1953 | tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr; |
| 1954 | tSirMacAddr nullBssid = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
| 1955 | |
| 1956 | if (psessionEntry == NULL) { |
| 1957 | lim_log(pMac, LOGE, FL("Session entry passed is NULL")); |
| 1958 | if (pDelBss != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 1959 | qdf_mem_free(pDelBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1960 | limMsgQ->bodyptr = NULL; |
| 1961 | } |
| 1962 | return; |
| 1963 | } |
| 1964 | |
| 1965 | if (pDelBss == NULL) { |
| 1966 | PELOGE(lim_log(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));) |
| 1967 | rc = eSIR_SME_REFUSED; |
| 1968 | goto end; |
| 1969 | } |
| 1970 | pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE; |
| 1971 | MTRACE(mac_trace |
| 1972 | (pMac, TRACE_CODE_MLM_STATE, NO_SESSION, |
| 1973 | pMac->lim.gLimMlmState)); |
| 1974 | |
| 1975 | if (eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState) { |
| 1976 | lim_log(pMac, LOGE, |
| 1977 | FL("Received unexpected WMA_DEL_BSS_RSP in state %X"), |
| 1978 | psessionEntry->limMlmState); |
| 1979 | rc = eSIR_SME_REFUSED; |
| 1980 | goto end; |
| 1981 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1982 | if (pDelBss->status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1983 | lim_log(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "), |
| 1984 | pDelBss->status, pDelBss->bssIdx); |
| 1985 | rc = eSIR_SME_STOP_BSS_FAILURE; |
| 1986 | goto end; |
| 1987 | } |
| 1988 | status = lim_set_link_state(pMac, eSIR_LINK_IDLE_STATE, nullBssid, |
| 1989 | psessionEntry->selfMacAddr, NULL, NULL); |
| 1990 | if (status != eSIR_SUCCESS) { |
| 1991 | rc = eSIR_SME_REFUSED; |
| 1992 | goto end; |
| 1993 | } |
| 1994 | /** Softmac may send all the buffered packets right after resuming the transmission hence |
| 1995 | * to occupy the medium during non channel occupancy period. So resume the transmission after |
| 1996 | * HAL gives back the response. |
| 1997 | */ |
| 1998 | dph_hash_table_class_init(pMac, &psessionEntry->dph.dphHashTable); |
| 1999 | lim_delete_pre_auth_list(pMac); |
| 2000 | /* Initialize number of associated stations during cleanup */ |
| 2001 | psessionEntry->gLimNumOfCurrentSTAs = 0; |
| 2002 | end: |
| 2003 | lim_send_sme_rsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, |
| 2004 | psessionEntry->smeSessionId, |
| 2005 | psessionEntry->transactionId); |
| 2006 | pe_delete_session(pMac, psessionEntry); |
| 2007 | |
| 2008 | if (pDelBss != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2009 | qdf_mem_free(pDelBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2010 | limMsgQ->bodyptr = NULL; |
| 2011 | } |
| 2012 | } |
| 2013 | |
| 2014 | /** |
| 2015 | * lim_process_mlm_del_sta_rsp() - Process DEL STA response |
| 2016 | * @mac_ctx: Pointer to Global MAC structure |
| 2017 | * @msg: The MsgQ header, which contains the response buffer |
| 2018 | * |
| 2019 | * This function is called to process a WMA_DEL_STA_RSP from |
| 2020 | * WMA Upon receipt of this message from FW. |
| 2021 | * |
| 2022 | * Return: None |
| 2023 | */ |
| 2024 | void lim_process_mlm_del_sta_rsp(tpAniSirGlobal mac_ctx, |
| 2025 | tpSirMsgQ msg) |
| 2026 | { |
| 2027 | /* |
| 2028 | * we need to process the deferred message since the |
| 2029 | * initiating req. there might be nested request |
| 2030 | * in the case of nested request the new request |
| 2031 | * initiated from the response will take care of resetting |
| 2032 | * the deffered flag. |
| 2033 | */ |
| 2034 | tpPESession session_entry; |
| 2035 | tpDeleteStaParams del_sta_params; |
| 2036 | del_sta_params = (tpDeleteStaParams) msg->bodyptr; |
| 2037 | if (NULL == del_sta_params) { |
| 2038 | lim_log(mac_ctx, LOGE, |
| 2039 | FL("null pointer del_sta_params msg")); |
| 2040 | return; |
| 2041 | } |
| 2042 | SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true); |
| 2043 | |
| 2044 | session_entry = pe_find_session_by_session_id(mac_ctx, |
| 2045 | del_sta_params->sessionId); |
| 2046 | if (NULL == session_entry) { |
| 2047 | lim_log(mac_ctx, LOGP, |
| 2048 | FL("Session Doesn't exist")); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2049 | qdf_mem_free(del_sta_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2050 | msg->bodyptr = NULL; |
| 2051 | return; |
| 2052 | } |
| 2053 | |
| 2054 | if (LIM_IS_BT_AMP_AP_ROLE(session_entry) || |
| 2055 | LIM_IS_AP_ROLE(session_entry)) { |
| 2056 | lim_process_bt_amp_ap_mlm_del_sta_rsp(mac_ctx, msg, |
| 2057 | session_entry); |
| 2058 | return; |
| 2059 | } |
| 2060 | lim_process_sta_mlm_del_sta_rsp(mac_ctx, msg, session_entry); |
| 2061 | } |
| 2062 | |
| 2063 | void lim_process_bt_amp_ap_mlm_del_sta_rsp(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, |
| 2064 | tpPESession psessionEntry) |
| 2065 | { |
| 2066 | tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr; |
| 2067 | tpDphHashNode pStaDs; |
| 2068 | tSirResultCodes statusCode = eSIR_SME_SUCCESS; |
| 2069 | if (limMsgQ->bodyptr == NULL) { |
| 2070 | lim_log(pMac, LOGE, FL("limMsgQ->bodyptry NULL")); |
| 2071 | return; |
| 2072 | } |
| 2073 | |
| 2074 | pStaDs = |
| 2075 | dph_get_hash_entry(pMac, pDelStaParams->assocId, |
| 2076 | &psessionEntry->dph.dphHashTable); |
| 2077 | if (pStaDs == NULL) { |
| 2078 | lim_log(pMac, LOGE, |
| 2079 | FL("DPH Entry for STA %X missing."), |
| 2080 | pDelStaParams->assocId); |
| 2081 | statusCode = eSIR_SME_REFUSED; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2082 | qdf_mem_free(pDelStaParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2083 | limMsgQ->bodyptr = NULL; |
| 2084 | |
| 2085 | return; |
| 2086 | } |
| 2087 | lim_log(pMac, LOG1, FL("Received del Sta Rsp in StaD MlmState : %d"), |
| 2088 | pStaDs->mlmStaContext.mlmState); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2089 | if (QDF_STATUS_SUCCESS == pDelStaParams->status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2090 | lim_log(pMac, LOGW, |
| 2091 | FL("AP received the DEL_STA_RSP for assocID: %X."), |
| 2092 | pDelStaParams->assocId); |
| 2093 | |
| 2094 | if ((eLIM_MLM_WT_DEL_STA_RSP_STATE != |
| 2095 | pStaDs->mlmStaContext.mlmState) |
| 2096 | && (eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != |
| 2097 | pStaDs->mlmStaContext.mlmState)) { |
| 2098 | lim_log(pMac, LOGE, |
| 2099 | FL |
| 2100 | ("Received unexpected WMA_DEL_STA_RSP in state %s for staId %d assocId %d "), |
| 2101 | lim_mlm_state_str(pStaDs->mlmStaContext.mlmState), |
| 2102 | pStaDs->staIndex, pStaDs->assocId); |
| 2103 | statusCode = eSIR_SME_REFUSED; |
| 2104 | goto end; |
| 2105 | } |
| 2106 | |
| 2107 | lim_log(pMac, LOG1, |
| 2108 | FL("Deleted STA AssocID %d staId %d MAC "), |
| 2109 | pStaDs->assocId, pStaDs->staIndex); |
| 2110 | lim_print_mac_addr(pMac, pStaDs->staAddr, LOG1); |
| 2111 | if (eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == |
| 2112 | pStaDs->mlmStaContext.mlmState) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2113 | qdf_mem_free(pDelStaParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2114 | limMsgQ->bodyptr = NULL; |
| 2115 | if (lim_add_sta(pMac, pStaDs, false, psessionEntry) != |
| 2116 | eSIR_SUCCESS) { |
| 2117 | PELOGE(lim_log |
| 2118 | (pMac, LOGE, |
| 2119 | FL("could not Add STA with assocId=%d"), |
| 2120 | pStaDs->assocId); |
| 2121 | ) |
| 2122 | /* delete the TS if it has already been added. */ |
| 2123 | /* send the response with error status. */ |
| 2124 | if (pStaDs->qos.addtsPresent) { |
| 2125 | tpLimTspecInfo pTspecInfo; |
| 2126 | if (eSIR_SUCCESS == |
| 2127 | lim_tspec_find_by_assoc_id(pMac, |
| 2128 | pStaDs->assocId, |
| 2129 | &pStaDs->qos.addts.tspec, |
| 2130 | &pMac->lim.tspecInfo[0], |
| 2131 | &pTspecInfo)) { |
| 2132 | lim_admit_control_delete_ts(pMac, |
| 2133 | pStaDs-> |
| 2134 | assocId, |
| 2135 | &pStaDs-> |
| 2136 | qos. |
| 2137 | addts. |
| 2138 | tspec. |
| 2139 | tsinfo, |
| 2140 | NULL, |
| 2141 | &pTspecInfo-> |
| 2142 | idx); |
| 2143 | } |
| 2144 | } |
| 2145 | lim_reject_association(pMac, |
| 2146 | pStaDs->staAddr, |
| 2147 | pStaDs->mlmStaContext. |
| 2148 | subType, true, |
| 2149 | pStaDs->mlmStaContext. |
| 2150 | authType, pStaDs->assocId, |
| 2151 | true, |
| 2152 | (tSirResultCodes) |
| 2153 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2154 | psessionEntry); |
| 2155 | } |
| 2156 | return; |
| 2157 | } |
| 2158 | } else { |
| 2159 | lim_log(pMac, LOGW, FL("DEL STA failed!")); |
| 2160 | statusCode = eSIR_SME_REFUSED; |
| 2161 | } |
| 2162 | end: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2163 | qdf_mem_free(pDelStaParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2164 | limMsgQ->bodyptr = NULL; |
| 2165 | if (eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != |
| 2166 | pStaDs->mlmStaContext.mlmState) { |
| 2167 | lim_prepare_and_send_del_sta_cnf(pMac, pStaDs, statusCode, |
| 2168 | psessionEntry); |
| 2169 | } |
| 2170 | return; |
| 2171 | } |
| 2172 | |
| 2173 | void lim_process_sta_mlm_del_sta_rsp(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, |
| 2174 | tpPESession psessionEntry) |
| 2175 | { |
| 2176 | tSirResultCodes statusCode = eSIR_SME_SUCCESS; |
| 2177 | tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr; |
| 2178 | tpDphHashNode pStaDs = NULL; |
| 2179 | if (NULL == pDelStaParams) { |
| 2180 | lim_log(pMac, LOGE, FL("Encountered NULL Pointer")); |
| 2181 | goto end; |
| 2182 | } |
Vidyullatha Kanchanapally | dcd3b5a | 2015-08-14 16:54:08 -0700 | [diff] [blame] | 2183 | lim_log(pMac, LOG1, FL("Del STA RSP received. Status:%d AssocID:%d"), |
| 2184 | pDelStaParams->status, pDelStaParams->assocId); |
| 2185 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2186 | if (QDF_STATUS_SUCCESS != pDelStaParams->status) |
Vidyullatha Kanchanapally | dcd3b5a | 2015-08-14 16:54:08 -0700 | [diff] [blame] | 2187 | lim_log(pMac, LOGE, FL( |
| 2188 | "Del STA failed! Status:%d, proceeding with Del BSS"), |
| 2189 | pDelStaParams->status); |
| 2190 | |
| 2191 | pStaDs = dph_get_hash_entry(pMac, DPH_STA_HASH_INDEX_PEER, |
| 2192 | &psessionEntry->dph.dphHashTable); |
| 2193 | if (pStaDs == NULL) { |
| 2194 | lim_log(pMac, LOGE, FL("DPH Entry for STA %X missing."), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2195 | pDelStaParams->assocId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2196 | statusCode = eSIR_SME_REFUSED; |
Vidyullatha Kanchanapally | dcd3b5a | 2015-08-14 16:54:08 -0700 | [diff] [blame] | 2197 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2198 | } |
Vidyullatha Kanchanapally | dcd3b5a | 2015-08-14 16:54:08 -0700 | [diff] [blame] | 2199 | if (eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState) { |
| 2200 | lim_log(pMac, LOGE, FL( |
| 2201 | "Received unexpected WDA_DELETE_STA_RSP in state %s"), |
| 2202 | lim_mlm_state_str(psessionEntry->limMlmState)); |
| 2203 | statusCode = eSIR_SME_REFUSED; |
| 2204 | goto end; |
| 2205 | } |
| 2206 | lim_log(pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId); |
| 2207 | lim_print_mac_addr(pMac, pStaDs->staAddr, LOG1); |
| 2208 | /* |
| 2209 | * we must complete all cleanup related to delSta before |
| 2210 | * calling limDelBSS. |
| 2211 | */ |
| 2212 | if (0 != limMsgQ->bodyptr) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2213 | qdf_mem_free(pDelStaParams); |
Vidyullatha Kanchanapally | dcd3b5a | 2015-08-14 16:54:08 -0700 | [diff] [blame] | 2214 | limMsgQ->bodyptr = NULL; |
| 2215 | } |
| 2216 | /* Proceed to do DelBSS even if DelSta resulted in failure */ |
| 2217 | statusCode = (tSirResultCodes)lim_del_bss(pMac, pStaDs, 0, |
| 2218 | psessionEntry); |
| 2219 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2220 | end: |
| 2221 | if (0 != limMsgQ->bodyptr) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2222 | qdf_mem_free(pDelStaParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2223 | limMsgQ->bodyptr = NULL; |
| 2224 | } |
| 2225 | return; |
| 2226 | } |
| 2227 | |
| 2228 | void lim_process_ap_mlm_add_sta_rsp(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, |
| 2229 | tpPESession psessionEntry) |
| 2230 | { |
| 2231 | tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr; |
| 2232 | tpDphHashNode pStaDs = NULL; |
| 2233 | |
| 2234 | if (NULL == pAddStaParams) { |
| 2235 | lim_log(pMac, LOGE, FL("Invalid body pointer in message")); |
| 2236 | goto end; |
| 2237 | } |
| 2238 | |
| 2239 | pStaDs = |
| 2240 | dph_get_hash_entry(pMac, pAddStaParams->assocId, |
| 2241 | &psessionEntry->dph.dphHashTable); |
| 2242 | if (pStaDs == NULL) { |
| 2243 | /* TODO: any response to be sent out here ? */ |
| 2244 | lim_log(pMac, LOGE, FL("DPH Entry for STA %X missing."), |
| 2245 | pAddStaParams->assocId); |
| 2246 | goto end; |
| 2247 | } |
| 2248 | /* */ |
| 2249 | /* TODO & FIXME_GEN4 */ |
| 2250 | /* Need to inspect tSirMsgQ.reserved for a valid Dialog token! */ |
| 2251 | /* */ |
| 2252 | /* TODO: any check for pMac->lim.gLimMlmState ? */ |
| 2253 | if (eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) { |
| 2254 | /* TODO: any response to be sent out here ? */ |
| 2255 | lim_log(pMac, LOGE, |
| 2256 | FL("Received unexpected WMA_ADD_STA_RSP in state %X"), |
| 2257 | pStaDs->mlmStaContext.mlmState); |
| 2258 | goto end; |
| 2259 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2260 | if (QDF_STATUS_SUCCESS != pAddStaParams->status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2261 | PELOGE(lim_log |
| 2262 | (pMac, LOGE, |
| 2263 | FL("Error! rcvd delSta rsp from HAL with status %d"), |
| 2264 | pAddStaParams->status); |
| 2265 | ) |
| 2266 | lim_reject_association(pMac, pStaDs->staAddr, |
| 2267 | pStaDs->mlmStaContext.subType, |
| 2268 | true, pStaDs->mlmStaContext.authType, |
| 2269 | pStaDs->assocId, true, |
| 2270 | (tSirResultCodes) |
| 2271 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2272 | psessionEntry); |
| 2273 | goto end; |
| 2274 | } |
| 2275 | pStaDs->bssId = pAddStaParams->bssIdx; |
| 2276 | pStaDs->staIndex = pAddStaParams->staIdx; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 2277 | pStaDs->nss = pAddStaParams->nss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2278 | /* if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state */ |
| 2279 | pStaDs->valid = 1; |
| 2280 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE; |
| 2281 | lim_log(pMac, LOG1, |
| 2282 | FL("AddStaRsp Success.STA AssocID %d staId %d MAC "), |
| 2283 | pStaDs->assocId, pStaDs->staIndex); |
| 2284 | lim_print_mac_addr(pMac, pStaDs->staAddr, LOG1); |
| 2285 | |
| 2286 | /* For BTAMP-AP, the flow sequence shall be: |
| 2287 | * 1) PE sends eWNI_SME_ASSOC_IND to SME |
| 2288 | * 2) PE receives eWNI_SME_ASSOC_CNF from SME |
| 2289 | * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA |
| 2290 | */ |
| 2291 | lim_send_mlm_assoc_ind(pMac, pStaDs, psessionEntry); |
| 2292 | /* fall though to reclaim the original Add STA Response message */ |
| 2293 | end: |
| 2294 | if (0 != limMsgQ->bodyptr) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2295 | qdf_mem_free(pAddStaParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2296 | limMsgQ->bodyptr = NULL; |
| 2297 | } |
| 2298 | return; |
| 2299 | } |
| 2300 | |
| 2301 | /** |
| 2302 | * lim_process_ap_mlm_add_bss_rsp() |
| 2303 | * |
| 2304 | ***FUNCTION: |
| 2305 | * This function is called to process a WMA_ADD_BSS_RSP from HAL. |
| 2306 | * Upon receipt of this message from HAL, MLME - |
| 2307 | * > Validates the result of WMA_ADD_BSS_REQ |
| 2308 | * > Init other remaining LIM variables |
| 2309 | * > Init the AID pool, for that BSSID |
| 2310 | * > Init the Pre-AUTH list, for that BSSID |
| 2311 | * > Create LIM timers, specific to that BSSID |
| 2312 | * > Init DPH related parameters that are specific to that BSSID |
| 2313 | * > TODO - When do we do the actual change channel? |
| 2314 | * |
| 2315 | ***LOGIC: |
| 2316 | * SME sends eWNI_SME_START_BSS_REQ to LIM |
| 2317 | * LIM sends LIM_MLM_START_REQ to MLME |
| 2318 | * MLME sends WMA_ADD_BSS_REQ to HAL |
| 2319 | * HAL responds with WMA_ADD_BSS_RSP to MLME |
| 2320 | * MLME responds with LIM_MLM_START_CNF to LIM |
| 2321 | * LIM responds with eWNI_SME_START_BSS_RSP to SME |
| 2322 | * |
| 2323 | ***ASSUMPTIONS: |
| 2324 | * tSirMsgQ.body is allocated by MLME during lim_process_mlm_start_req |
| 2325 | * tSirMsgQ.body will now be freed by this routine |
| 2326 | * |
| 2327 | ***NOTE: |
| 2328 | * |
| 2329 | * @param pMac Pointer to Global MAC structure |
| 2330 | * @param tSirMsgQ The MsgQ header, which contains the response buffer |
| 2331 | * |
| 2332 | * @return None |
| 2333 | */ |
| 2334 | static void lim_process_ap_mlm_add_bss_rsp(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ) |
| 2335 | { |
| 2336 | tLimMlmStartCnf mlmStartCnf; |
| 2337 | tpPESession psessionEntry; |
| 2338 | uint8_t isWepEnabled = false; |
| 2339 | tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr; |
| 2340 | if (NULL == pAddBssParams) { |
| 2341 | lim_log(pMac, LOGE, FL("Encountered NULL Pointer")); |
| 2342 | goto end; |
| 2343 | } |
| 2344 | /* TBD: free the memory before returning, do it for all places where lookup fails. */ |
| 2345 | psessionEntry = pe_find_session_by_session_id(pMac, |
| 2346 | pAddBssParams->sessionId); |
| 2347 | if (psessionEntry == NULL) { |
| 2348 | PELOGE(lim_log |
| 2349 | (pMac, LOGE, |
| 2350 | FL("session does not exist for given sessionId")); |
| 2351 | ) |
| 2352 | if (NULL != pAddBssParams) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2353 | qdf_mem_free(pAddBssParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2354 | limMsgQ->bodyptr = NULL; |
| 2355 | } |
| 2356 | return; |
| 2357 | } |
| 2358 | /* Update PE session Id */ |
| 2359 | mlmStartCnf.sessionId = pAddBssParams->sessionId; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2360 | if (QDF_STATUS_SUCCESS == pAddBssParams->status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2361 | PELOG2(lim_log |
| 2362 | (pMac, LOG2, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2363 | FL("WMA_ADD_BSS_RSP returned with QDF_STATUS_SUCCESS")); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2364 | ) |
| 2365 | if (lim_set_link_state |
| 2366 | (pMac, eSIR_LINK_AP_STATE, psessionEntry->bssId, |
| 2367 | psessionEntry->selfMacAddr, NULL, |
| 2368 | NULL) != eSIR_SUCCESS) |
| 2369 | goto end; |
| 2370 | /* Set MLME state */ |
| 2371 | psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE; |
| 2372 | psessionEntry->chainMask = pAddBssParams->chainMask; |
| 2373 | psessionEntry->smpsMode = pAddBssParams->smpsMode; |
| 2374 | MTRACE(mac_trace |
| 2375 | (pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, |
| 2376 | psessionEntry->limMlmState)); |
| 2377 | if (eSIR_IBSS_MODE == pAddBssParams->bssType) { |
| 2378 | /** IBSS is 'active' when we receive |
| 2379 | * Beacon frames from other STAs that are part of same IBSS. |
| 2380 | * Mark internal state as inactive until then. |
| 2381 | */ |
| 2382 | psessionEntry->limIbssActive = false; |
| 2383 | psessionEntry->statypeForBss = STA_ENTRY_PEER; /* to know session created for self/peer */ |
| 2384 | limResetHBPktCount(psessionEntry); |
| 2385 | } |
| 2386 | psessionEntry->bssIdx = (uint8_t) pAddBssParams->bssIdx; |
| 2387 | |
| 2388 | psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE; |
| 2389 | |
| 2390 | if (eSIR_INFRA_AP_MODE == pAddBssParams->bssType) |
| 2391 | psessionEntry->limSystemRole = eLIM_AP_ROLE; |
| 2392 | else |
| 2393 | psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE; |
| 2394 | sch_edca_profile_update(pMac, psessionEntry); |
| 2395 | lim_init_pre_auth_list(pMac); |
| 2396 | /* Check the SAP security configuration.If configured to |
| 2397 | * WEP then max clients supported is 16 |
| 2398 | */ |
| 2399 | if (psessionEntry->privacy) { |
| 2400 | if ((psessionEntry->gStartBssRSNIe.present) |
| 2401 | || (psessionEntry->gStartBssWPAIe.present)) |
| 2402 | lim_log(pMac, LOG1, |
| 2403 | FL("WPA/WPA2 SAP configuration\n")); |
| 2404 | else { |
| 2405 | if (pMac->lim.gLimAssocStaLimit > |
| 2406 | MAX_SUPPORTED_PEERS_WEP) { |
| 2407 | lim_log(pMac, LOG1, |
| 2408 | FL("WEP SAP Configuration\n")); |
| 2409 | pMac->lim.gLimAssocStaLimit = |
| 2410 | MAX_SUPPORTED_PEERS_WEP; |
| 2411 | isWepEnabled = true; |
| 2412 | } |
| 2413 | } |
| 2414 | } |
| 2415 | lim_init_peer_idxpool(pMac, psessionEntry); |
| 2416 | |
| 2417 | /* Start OLBC timer */ |
| 2418 | if (tx_timer_activate |
| 2419 | (&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != |
| 2420 | TX_SUCCESS) { |
| 2421 | lim_log(pMac, LOGE, FL("tx_timer_activate failed")); |
| 2422 | } |
| 2423 | |
| 2424 | /* Apply previously set configuration at HW */ |
| 2425 | lim_apply_configuration(pMac, psessionEntry); |
| 2426 | |
| 2427 | /* In lim_apply_configuration gLimAssocStaLimit is assigned from cfg. |
| 2428 | * So update the value to 16 in case SoftAP is configured in WEP. |
| 2429 | */ |
| 2430 | if ((pMac->lim.gLimAssocStaLimit > MAX_SUPPORTED_PEERS_WEP) |
| 2431 | && (isWepEnabled)) |
| 2432 | pMac->lim.gLimAssocStaLimit = MAX_SUPPORTED_PEERS_WEP; |
| 2433 | psessionEntry->staId = pAddBssParams->staContext.staIdx; |
| 2434 | mlmStartCnf.resultCode = eSIR_SME_SUCCESS; |
| 2435 | } else { |
| 2436 | lim_log(pMac, LOGE, FL("WMA_ADD_BSS_REQ failed with status %d"), |
| 2437 | pAddBssParams->status); |
| 2438 | mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 2439 | } |
| 2440 | lim_post_sme_message(pMac, LIM_MLM_START_CNF, (uint32_t *) &mlmStartCnf); |
| 2441 | end: |
| 2442 | if (0 != limMsgQ->bodyptr) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2443 | qdf_mem_free(pAddBssParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2444 | limMsgQ->bodyptr = NULL; |
| 2445 | } |
| 2446 | } |
| 2447 | |
| 2448 | /** |
| 2449 | * lim_process_ibss_mlm_add_bss_rsp() |
| 2450 | * |
| 2451 | ***FUNCTION: |
| 2452 | * This function is called to process a WMA_ADD_BSS_RSP from HAL. |
| 2453 | * Upon receipt of this message from HAL, MLME - |
| 2454 | * > Validates the result of WMA_ADD_BSS_REQ |
| 2455 | * > Init other remaining LIM variables |
| 2456 | * > Init the AID pool, for that BSSID |
| 2457 | * > Init the Pre-AUTH list, for that BSSID |
| 2458 | * > Create LIM timers, specific to that BSSID |
| 2459 | * > Init DPH related parameters that are specific to that BSSID |
| 2460 | * > TODO - When do we do the actual change channel? |
| 2461 | * |
| 2462 | ***LOGIC: |
| 2463 | * SME sends eWNI_SME_START_BSS_REQ to LIM |
| 2464 | * LIM sends LIM_MLM_START_REQ to MLME |
| 2465 | * MLME sends WMA_ADD_BSS_REQ to HAL |
| 2466 | * HAL responds with WMA_ADD_BSS_RSP to MLME |
| 2467 | * MLME responds with LIM_MLM_START_CNF to LIM |
| 2468 | * LIM responds with eWNI_SME_START_BSS_RSP to SME |
| 2469 | * |
| 2470 | ***ASSUMPTIONS: |
| 2471 | * tSirMsgQ.body is allocated by MLME during lim_process_mlm_start_req |
| 2472 | * tSirMsgQ.body will now be freed by this routine |
| 2473 | * |
| 2474 | ***NOTE: |
| 2475 | * |
| 2476 | * @param pMac Pointer to Global MAC structure |
| 2477 | * @param tSirMsgQ The MsgQ header, which contains the response buffer |
| 2478 | * |
| 2479 | * @return None |
| 2480 | */ |
| 2481 | static void |
| 2482 | lim_process_ibss_mlm_add_bss_rsp(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, |
| 2483 | tpPESession psessionEntry) |
| 2484 | { |
| 2485 | tLimMlmStartCnf mlmStartCnf; |
| 2486 | tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr; |
| 2487 | |
| 2488 | if (NULL == pAddBssParams) { |
| 2489 | lim_log(pMac, LOGE, FL("Invalid body pointer in message")); |
| 2490 | goto end; |
| 2491 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2492 | if (QDF_STATUS_SUCCESS == pAddBssParams->status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2493 | PELOG1(lim_log |
| 2494 | (pMac, LOG1, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2495 | FL("WMA_ADD_BSS_RSP returned with QDF_STATUS_SUCCESS")); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2496 | ) |
| 2497 | if (lim_set_link_state |
| 2498 | (pMac, eSIR_LINK_IBSS_STATE, psessionEntry->bssId, |
| 2499 | psessionEntry->selfMacAddr, NULL, |
| 2500 | NULL) != eSIR_SUCCESS) |
| 2501 | goto end; |
| 2502 | /* Set MLME state */ |
| 2503 | psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE; |
| 2504 | MTRACE(mac_trace |
| 2505 | (pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, |
| 2506 | psessionEntry->limMlmState)); |
| 2507 | /** IBSS is 'active' when we receive |
| 2508 | * Beacon frames from other STAs that are part of same IBSS. |
| 2509 | * Mark internal state as inactive until then. |
| 2510 | */ |
| 2511 | psessionEntry->limIbssActive = false; |
| 2512 | limResetHBPktCount(psessionEntry); |
| 2513 | psessionEntry->bssIdx = (uint8_t) pAddBssParams->bssIdx; |
| 2514 | psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE; |
| 2515 | psessionEntry->statypeForBss = STA_ENTRY_SELF; |
| 2516 | sch_edca_profile_update(pMac, psessionEntry); |
| 2517 | if (0 == psessionEntry->freePeerIdxHead) |
| 2518 | lim_init_peer_idxpool(pMac, psessionEntry); |
| 2519 | |
| 2520 | /* Apply previously set configuration at HW */ |
| 2521 | lim_apply_configuration(pMac, psessionEntry); |
| 2522 | psessionEntry->staId = pAddBssParams->staContext.staIdx; |
| 2523 | mlmStartCnf.resultCode = eSIR_SME_SUCCESS; |
| 2524 | /* If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM */ |
| 2525 | if (true == pMac->lim.gLimIbssCoalescingHappened) { |
| 2526 | lim_ibss_add_bss_rsp_when_coalescing(pMac, limMsgQ->bodyptr, |
| 2527 | psessionEntry); |
| 2528 | goto end; |
| 2529 | } |
| 2530 | } else { |
| 2531 | lim_log(pMac, LOGE, FL("WMA_ADD_BSS_REQ failed with status %d"), |
| 2532 | pAddBssParams->status); |
| 2533 | mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 2534 | } |
| 2535 | /* Send this message to SME, when ADD_BSS is initiated by SME */ |
| 2536 | /* If ADD_BSS is done as part of coalescing, this won't happen. */ |
| 2537 | /* Update PE session Id */ |
| 2538 | mlmStartCnf.sessionId = psessionEntry->peSessionId; |
| 2539 | lim_post_sme_message(pMac, LIM_MLM_START_CNF, (uint32_t *) &mlmStartCnf); |
| 2540 | end: |
| 2541 | if (0 != limMsgQ->bodyptr) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2542 | qdf_mem_free(pAddBssParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2543 | limMsgQ->bodyptr = NULL; |
| 2544 | } |
| 2545 | } |
| 2546 | |
| 2547 | /** |
| 2548 | * csr_neighbor_roam_handoff_req_hdlr - Processes handoff request |
| 2549 | * @mac_ctx: Pointer to mac context |
| 2550 | * @msg: message sent to HDD |
| 2551 | * @session_entry: PE session handle |
| 2552 | * |
| 2553 | * This function is called to process a WMA_ADD_BSS_RSP from HAL. |
| 2554 | * Upon receipt of this message from HAL if the state is pre assoc. |
| 2555 | * |
| 2556 | * Return: Null |
| 2557 | */ |
| 2558 | static void |
| 2559 | lim_process_sta_add_bss_rsp_pre_assoc(tpAniSirGlobal mac_ctx, |
| 2560 | tpSirMsgQ msg, tpPESession session_entry) |
| 2561 | { |
| 2562 | tpAddBssParams pAddBssParams = (tpAddBssParams) msg->bodyptr; |
| 2563 | tAniAuthType cfgAuthType, authMode; |
| 2564 | tLimMlmAuthReq *pMlmAuthReq; |
| 2565 | tpDphHashNode pStaDs = NULL; |
| 2566 | |
| 2567 | if (NULL == pAddBssParams) { |
| 2568 | lim_log(mac_ctx, LOGE, FL("Invalid body pointer in message")); |
| 2569 | goto joinFailure; |
| 2570 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2571 | if (QDF_STATUS_SUCCESS == pAddBssParams->status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2572 | pStaDs = dph_add_hash_entry(mac_ctx, |
| 2573 | pAddBssParams->staContext.staMac, |
| 2574 | DPH_STA_HASH_INDEX_PEER, |
| 2575 | &session_entry->dph.dphHashTable); |
| 2576 | if (pStaDs == NULL) { |
| 2577 | /* Could not add hash table entry */ |
| 2578 | lim_log(mac_ctx, LOGE, |
| 2579 | FL("could not add hash entry at DPH for ")); |
| 2580 | lim_print_mac_addr(mac_ctx, |
| 2581 | pAddBssParams->staContext.staMac, LOGE); |
| 2582 | goto joinFailure; |
| 2583 | } |
| 2584 | session_entry->bssIdx = (uint8_t) pAddBssParams->bssIdx; |
| 2585 | /* Success, handle below */ |
| 2586 | pStaDs->bssId = pAddBssParams->bssIdx; |
| 2587 | /* STA Index(genr by HAL) for the BSS entry is stored here */ |
| 2588 | pStaDs->staIndex = pAddBssParams->staContext.staIdx; |
| 2589 | /* Trigger Authentication with AP */ |
| 2590 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_AUTHENTICATION_TYPE, |
| 2591 | (uint32_t *) &cfgAuthType) != eSIR_SUCCESS) { |
| 2592 | /* |
| 2593 | * Could not get AuthType from CFG. |
| 2594 | * Log error. |
| 2595 | */ |
| 2596 | lim_log(mac_ctx, LOGP, |
| 2597 | FL("could not retrieve AuthType")); |
| 2598 | } |
| 2599 | /* Try Open Authentication first */ |
| 2600 | if (cfgAuthType == eSIR_AUTO_SWITCH) |
| 2601 | authMode = eSIR_OPEN_SYSTEM; |
| 2602 | else |
| 2603 | authMode = cfgAuthType; |
| 2604 | |
| 2605 | /* Trigger MAC based Authentication */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2606 | pMlmAuthReq = qdf_mem_malloc(sizeof(tLimMlmAuthReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2607 | if (NULL == pMlmAuthReq) { |
| 2608 | lim_log(mac_ctx, LOGP, |
| 2609 | FL("Allocate Memory failed for mlmAuthReq")); |
| 2610 | return; |
| 2611 | } |
| 2612 | sir_copy_mac_addr(pMlmAuthReq->peerMacAddr, |
| 2613 | session_entry->bssId); |
| 2614 | |
| 2615 | pMlmAuthReq->authType = authMode; |
| 2616 | if (wlan_cfg_get_int(mac_ctx, |
| 2617 | WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT, |
| 2618 | (uint32_t *) &pMlmAuthReq->authFailureTimeout) |
| 2619 | != eSIR_SUCCESS) { |
| 2620 | /* |
| 2621 | * Could not get AuthFailureTimeout |
| 2622 | * value from CFG. Log error. |
| 2623 | */ |
| 2624 | lim_log(mac_ctx, LOGP, |
| 2625 | FL("Fail: retrieve AuthFailureTimeout value")); |
| 2626 | } |
| 2627 | session_entry->limMlmState = eLIM_MLM_JOINED_STATE; |
| 2628 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 2629 | session_entry->peSessionId, eLIM_MLM_JOINED_STATE)); |
| 2630 | pMlmAuthReq->sessionId = session_entry->peSessionId; |
| 2631 | session_entry->limPrevSmeState = session_entry->limSmeState; |
| 2632 | session_entry->limSmeState = eLIM_SME_WT_AUTH_STATE; |
| 2633 | /* remember staId in case of assoc timeout/failure handling */ |
| 2634 | session_entry->staId = pAddBssParams->staContext.staIdx; |
| 2635 | |
| 2636 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 2637 | session_entry->peSessionId, |
| 2638 | session_entry->limSmeState)); |
| 2639 | lim_log(mac_ctx, LOG1, |
| 2640 | FL("SessionId:%d lim_post_mlm_message " |
| 2641 | "LIM_MLM_AUTH_REQ with limSmeState:%d"), |
| 2642 | session_entry->peSessionId, session_entry->limSmeState); |
| 2643 | lim_post_mlm_message(mac_ctx, LIM_MLM_AUTH_REQ, |
| 2644 | (uint32_t *) pMlmAuthReq); |
| 2645 | return; |
| 2646 | } |
| 2647 | |
| 2648 | joinFailure: |
| 2649 | { |
| 2650 | session_entry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE; |
| 2651 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 2652 | session_entry->peSessionId, |
| 2653 | session_entry->limSmeState)); |
| 2654 | |
| 2655 | /* Send Join response to Host */ |
| 2656 | lim_handle_sme_join_result(mac_ctx, eSIR_SME_REFUSED, |
| 2657 | eSIR_MAC_UNSPEC_FAILURE_STATUS, session_entry); |
| 2658 | } |
| 2659 | |
| 2660 | } |
| 2661 | |
| 2662 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2663 | /*------------------------------------------------------------------------------------------ |
| 2664 | * |
| 2665 | * Function to handle WMA_ADD_BSS_RSP, in FT reassoc state. |
| 2666 | * Function to Send ReAssociation Request. |
| 2667 | * |
| 2668 | * |
| 2669 | ***------------------------------------------------------------------------------------------ |
| 2670 | */ |
| 2671 | static inline void |
| 2672 | lim_process_sta_mlm_add_bss_rsp_ft(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, |
| 2673 | tpPESession psessionEntry) |
| 2674 | { |
| 2675 | tLimMlmReassocCnf mlmReassocCnf; /* keep sme */ |
| 2676 | tpDphHashNode pStaDs = NULL; |
| 2677 | tpAddStaParams pAddStaParams = NULL; |
| 2678 | uint32_t listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF; |
| 2679 | tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr; |
| 2680 | uint32_t selfStaDot11Mode = 0; |
| 2681 | |
| 2682 | /* Sanity Checks */ |
| 2683 | |
| 2684 | if (pAddBssParams == NULL) { |
| 2685 | PELOGE(lim_log(pMac, LOGE, FL("Invalid parameters"));) |
| 2686 | goto end; |
| 2687 | } |
| 2688 | if (eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != |
| 2689 | psessionEntry->limMlmState) { |
| 2690 | goto end; |
| 2691 | } |
| 2692 | |
| 2693 | pStaDs = dph_add_hash_entry(pMac, pAddBssParams->bssId, |
| 2694 | DPH_STA_HASH_INDEX_PEER, |
| 2695 | &psessionEntry->dph.dphHashTable); |
| 2696 | if (pStaDs == NULL) { |
| 2697 | /* Could not add hash table entry */ |
| 2698 | PELOGE(lim_log |
| 2699 | (pMac, LOGE, FL("could not add hash entry at DPH for ")); |
| 2700 | ) |
| 2701 | lim_print_mac_addr(pMac, pAddBssParams->staContext.staMac, |
| 2702 | LOGE); |
| 2703 | goto end; |
| 2704 | } |
| 2705 | /* Prepare and send Reassociation request frame */ |
| 2706 | /* start reassoc timer. */ |
| 2707 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2708 | if (psessionEntry->bRoamSynchInProgress != true) { |
| 2709 | #endif |
| 2710 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = |
| 2711 | psessionEntry->peSessionId; |
| 2712 | /* / Start reassociation failure timer */ |
| 2713 | MTRACE(mac_trace |
| 2714 | (pMac, TRACE_CODE_TIMER_ACTIVATE, |
| 2715 | psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER)); |
| 2716 | if (tx_timer_activate |
| 2717 | (&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 2718 | != TX_SUCCESS) { |
| 2719 | /* / Could not start reassoc failure timer. */ |
| 2720 | /* Log error */ |
| 2721 | lim_log(pMac, LOGP, |
| 2722 | FL |
| 2723 | ("could not start Reassociation failure timer")); |
| 2724 | /* Return Reassoc confirm with */ |
| 2725 | /* Resources Unavailable */ |
| 2726 | mlmReassocCnf.resultCode = |
| 2727 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2728 | mlmReassocCnf.protStatusCode = |
| 2729 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2730 | goto end; |
| 2731 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2732 | pMac->lim.pSessionEntry = psessionEntry; |
| 2733 | if (NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq) { |
| 2734 | /* Take a copy of reassoc request for retrying */ |
| 2735 | pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2736 | qdf_mem_malloc(sizeof(tLimMlmReassocReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2737 | if (NULL == |
| 2738 | pMac->lim.pSessionEntry->pLimMlmReassocRetryReq) |
| 2739 | goto end; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2740 | qdf_mem_set(pMac->lim.pSessionEntry-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2741 | pLimMlmReassocRetryReq, |
| 2742 | sizeof(tLimMlmReassocReq), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2743 | qdf_mem_copy(pMac->lim.pSessionEntry-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2744 | pLimMlmReassocRetryReq, |
| 2745 | psessionEntry->pLimMlmReassocReq, |
| 2746 | sizeof(tLimMlmReassocReq)); |
| 2747 | } |
| 2748 | pMac->lim.reAssocRetryAttempt = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2749 | lim_send_reassoc_req_with_ft_ies_mgmt_frame(pMac, |
| 2750 | psessionEntry-> |
| 2751 | pLimMlmReassocReq, |
| 2752 | psessionEntry); |
| 2753 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2754 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2755 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2756 | "LFR3:Do not activate timer and dont send the reassoc req"); |
| 2757 | } |
| 2758 | #endif |
| 2759 | psessionEntry->limPrevMlmState = psessionEntry->limMlmState; |
| 2760 | psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE; |
| 2761 | MTRACE(mac_trace |
| 2762 | (pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, |
| 2763 | eLIM_MLM_WT_FT_REASSOC_RSP_STATE)); |
| 2764 | PELOGE(lim_log |
| 2765 | (pMac, LOG1, FL("Set the mlm state to %d session=%d"), |
| 2766 | psessionEntry->limMlmState, psessionEntry->peSessionId); |
| 2767 | ) |
| 2768 | |
| 2769 | psessionEntry->bssIdx = (uint8_t) pAddBssParams->bssIdx; |
| 2770 | |
| 2771 | /* Success, handle below */ |
| 2772 | pStaDs->bssId = pAddBssParams->bssIdx; |
| 2773 | /* STA Index(genr by HAL) for the BSS entry is stored here */ |
| 2774 | pStaDs->staIndex = pAddBssParams->staContext.staIdx; |
| 2775 | pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig; |
| 2776 | pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig; |
| 2777 | |
| 2778 | #if defined WLAN_FEATURE_VOWIFI |
| 2779 | rrm_cache_mgmt_tx_power(pMac, pAddBssParams->txMgmtPower, psessionEntry); |
| 2780 | #endif |
| 2781 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2782 | pAddStaParams = qdf_mem_malloc(sizeof(tAddStaParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2783 | if (NULL == pAddStaParams) { |
| 2784 | lim_log(pMac, LOGP, |
| 2785 | FL("Unable to allocate memory during ADD_STA")); |
| 2786 | goto end; |
| 2787 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2788 | qdf_mem_set((uint8_t *) pAddStaParams, sizeof(tAddStaParams), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2789 | |
| 2790 | /* / Add STA context at MAC HW (BMU, RHP & TFP) */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2791 | qdf_mem_copy((uint8_t *) pAddStaParams->staMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2792 | (uint8_t *) psessionEntry->selfMacAddr, |
| 2793 | sizeof(tSirMacAddr)); |
| 2794 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2795 | qdf_mem_copy((uint8_t *) pAddStaParams->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2796 | psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 2797 | |
| 2798 | pAddStaParams->staType = STA_ENTRY_SELF; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2799 | pAddStaParams->status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2800 | pAddStaParams->respReqd = 1; |
| 2801 | |
| 2802 | /* Update PE session ID */ |
| 2803 | pAddStaParams->sessionId = psessionEntry->peSessionId; |
| 2804 | pAddStaParams->smesessionId = psessionEntry->smeSessionId; |
| 2805 | |
| 2806 | /* This will indicate HAL to "allocate" a new STA index */ |
| 2807 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2808 | if (psessionEntry->bRoamSynchInProgress != true) |
| 2809 | #endif |
| 2810 | pAddStaParams->staIdx = STA_INVALID_IDX; |
| 2811 | pAddStaParams->updateSta = false; |
| 2812 | |
| 2813 | pAddStaParams->shortPreambleSupported = |
| 2814 | (uint8_t) psessionEntry->beaconParams.fShortPreamble; |
| 2815 | #ifdef WLAN_FEATURE_11AC |
| 2816 | lim_populate_peer_rate_set(pMac, &pAddStaParams->supportedRates, NULL, |
| 2817 | false, psessionEntry, NULL); |
| 2818 | #else |
| 2819 | lim_populate_peer_rate_set(pMac, &pAddStaParams->supportedRates, NULL, |
| 2820 | false, psessionEntry); |
| 2821 | #endif |
| 2822 | |
| 2823 | if (psessionEntry->htCapability) { |
| 2824 | pAddStaParams->htCapable = psessionEntry->htCapability; |
| 2825 | #ifdef WLAN_FEATURE_11AC |
| 2826 | pAddStaParams->vhtCapable = psessionEntry->vhtCapability; |
| 2827 | pAddStaParams->ch_width = psessionEntry->ch_width; |
| 2828 | #endif |
| 2829 | |
| 2830 | pAddStaParams->greenFieldCapable = |
| 2831 | lim_get_ht_capability(pMac, eHT_GREENFIELD, |
| 2832 | psessionEntry); |
| 2833 | pAddStaParams->mimoPS = |
| 2834 | lim_get_ht_capability(pMac, eHT_MIMO_POWER_SAVE, |
| 2835 | psessionEntry); |
| 2836 | pAddStaParams->rifsMode = |
| 2837 | lim_get_ht_capability(pMac, eHT_RIFS_MODE, psessionEntry); |
| 2838 | pAddStaParams->lsigTxopProtection = |
| 2839 | lim_get_ht_capability(pMac, eHT_LSIG_TXOP_PROTECTION, |
| 2840 | psessionEntry); |
| 2841 | pAddStaParams->maxAmpduDensity = |
| 2842 | lim_get_ht_capability(pMac, eHT_MPDU_DENSITY, psessionEntry); |
| 2843 | pAddStaParams->maxAmpduSize = |
| 2844 | lim_get_ht_capability(pMac, eHT_MAX_RX_AMPDU_FACTOR, |
| 2845 | psessionEntry); |
| 2846 | pAddStaParams->maxAmsduSize = |
| 2847 | lim_get_ht_capability(pMac, eHT_MAX_AMSDU_LENGTH, |
| 2848 | psessionEntry); |
| 2849 | pAddStaParams->fDsssCckMode40Mhz = |
| 2850 | lim_get_ht_capability(pMac, eHT_DSSS_CCK_MODE_40MHZ, |
| 2851 | psessionEntry); |
| 2852 | pAddStaParams->fShortGI20Mhz = |
| 2853 | lim_get_ht_capability(pMac, eHT_SHORT_GI_20MHZ, psessionEntry); |
| 2854 | pAddStaParams->fShortGI40Mhz = |
| 2855 | lim_get_ht_capability(pMac, eHT_SHORT_GI_40MHZ, psessionEntry); |
| 2856 | } |
| 2857 | |
| 2858 | if (wlan_cfg_get_int(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != |
| 2859 | eSIR_SUCCESS) |
| 2860 | lim_log(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL")); |
| 2861 | pAddStaParams->listenInterval = (uint16_t) listenInterval; |
| 2862 | |
| 2863 | wlan_cfg_get_int(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode); |
| 2864 | pAddStaParams->supportedRates.opRateMode = |
| 2865 | lim_get_sta_rate_mode((uint8_t) selfStaDot11Mode); |
| 2866 | pAddStaParams->encryptType = psessionEntry->encryptType; |
| 2867 | pAddStaParams->maxTxPower = psessionEntry->maxTxPower; |
| 2868 | |
| 2869 | /* Lets save this for when we receive the Reassoc Rsp */ |
| 2870 | psessionEntry->ftPEContext.pAddStaReq = pAddStaParams; |
| 2871 | |
| 2872 | if (pAddBssParams != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2873 | qdf_mem_free(pAddBssParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2874 | pAddBssParams = NULL; |
| 2875 | limMsgQ->bodyptr = NULL; |
| 2876 | } |
| 2877 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2878 | if (psessionEntry->bRoamSynchInProgress) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2879 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2880 | "LFR3:Prepare and save pAddStaReq in pMac for post-assoc-rsp"); |
| 2881 | lim_process_assoc_rsp_frame(pMac, pMac->roam.pReassocResp, |
| 2882 | LIM_REASSOC, psessionEntry); |
| 2883 | } |
| 2884 | #endif |
| 2885 | return; |
| 2886 | |
| 2887 | end: |
| 2888 | /* Free up buffer allocated for reassocReq */ |
| 2889 | if (psessionEntry != NULL) |
| 2890 | if (psessionEntry->pLimMlmReassocReq != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2891 | qdf_mem_free(psessionEntry->pLimMlmReassocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2892 | psessionEntry->pLimMlmReassocReq = NULL; |
| 2893 | } |
| 2894 | |
| 2895 | if (pAddBssParams != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 2896 | qdf_mem_free(pAddBssParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2897 | pAddBssParams = NULL; |
| 2898 | limMsgQ->bodyptr = NULL; |
| 2899 | } |
| 2900 | |
| 2901 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 2902 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2903 | /* Update PE session Id */ |
| 2904 | if (psessionEntry != NULL) |
| 2905 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 2906 | else |
| 2907 | mlmReassocCnf.sessionId = 0; |
| 2908 | |
| 2909 | lim_post_sme_message(pMac, LIM_MLM_REASSOC_CNF, |
| 2910 | (uint32_t *) &mlmReassocCnf); |
| 2911 | } |
| 2912 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 2913 | /** |
| 2914 | * lim_process_sta_mlm_add_bss_rsp() - Process ADD BSS response |
| 2915 | * @mac_ctx: Pointer to Global MAC structure |
| 2916 | * @msg: The MsgQ header, which contains the response buffer |
| 2917 | * |
| 2918 | * This function is called to process a WMA_ADD_BSS_RSP from HAL. |
| 2919 | * Upon receipt of this message from HAL, MLME - |
| 2920 | * > Validates the result of WMA_ADD_BSS_REQ |
| 2921 | * > Now, send an ADD_STA to HAL and ADD the "local" STA itself |
| 2922 | * |
| 2923 | * MLME had sent WMA_ADD_BSS_REQ to HAL |
| 2924 | * HAL responded with WMA_ADD_BSS_RSP to MLME |
| 2925 | * MLME now sends WMA_ADD_STA_REQ to HAL |
| 2926 | * ASSUMPTIONS: |
| 2927 | * tSirMsgQ.body is allocated by MLME during lim_process_mlm_join_req |
| 2928 | * tSirMsgQ.body will now be freed by this routine |
| 2929 | * |
| 2930 | * Return: None |
| 2931 | */ |
| 2932 | static void |
| 2933 | lim_process_sta_mlm_add_bss_rsp(tpAniSirGlobal mac_ctx, |
| 2934 | tpSirMsgQ msg, tpPESession session_entry) |
| 2935 | { |
| 2936 | tpAddBssParams add_bss_params = (tpAddBssParams) msg->bodyptr; |
| 2937 | tLimMlmAssocCnf mlm_assoc_cnf; |
| 2938 | uint32_t msg_type = LIM_MLM_ASSOC_CNF; |
| 2939 | uint32_t sub_type = LIM_ASSOC; |
| 2940 | tpDphHashNode sta_ds = NULL; |
| 2941 | uint16_t sta_idx = STA_INVALID_IDX; |
| 2942 | uint8_t update_sta = false; |
| 2943 | mlm_assoc_cnf.resultCode = eSIR_SME_SUCCESS; |
| 2944 | |
| 2945 | if (eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == |
| 2946 | session_entry->limMlmState) { |
| 2947 | lim_log(mac_ctx, LOG1, |
| 2948 | "SessionId:%d lim_process_sta_add_bss_rsp_pre_assoc", |
| 2949 | session_entry->peSessionId); |
| 2950 | lim_process_sta_add_bss_rsp_pre_assoc(mac_ctx, msg, |
| 2951 | session_entry); |
| 2952 | goto end; |
| 2953 | } |
| 2954 | if (eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == session_entry->limMlmState |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2955 | || (eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == |
Deepak Dhamdhere | 9a7110c | 2015-11-08 19:44:07 -0800 | [diff] [blame] | 2956 | session_entry->limMlmState)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2957 | msg_type = LIM_MLM_REASSOC_CNF; |
| 2958 | sub_type = LIM_REASSOC; |
| 2959 | /* |
| 2960 | * If Reassoc is happening for the same BSS, then |
| 2961 | * use the existing StaId and indicate to HAL to update |
| 2962 | * the existing STA entry. |
| 2963 | * If Reassoc is happening for the new BSS, then |
| 2964 | * old BSS and STA entry would have been already deleted |
| 2965 | * before PE tries to add BSS for the new BSS, so set the |
| 2966 | * updateSta to false and pass INVALID STA Index. |
| 2967 | */ |
| 2968 | if (sir_compare_mac_addr(session_entry->bssId, |
| 2969 | session_entry->limReAssocbssId)) { |
| 2970 | sta_idx = session_entry->staId; |
| 2971 | update_sta = true; |
| 2972 | } |
| 2973 | } |
| 2974 | |
| 2975 | if (add_bss_params == 0) |
| 2976 | goto end; |
| 2977 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2978 | if (session_entry->bRoamSynchInProgress) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2979 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2980 | "LFR3:lim_process_sta_mlm_add_bss_rsp"); |
| 2981 | #endif |
| 2982 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2983 | if (QDF_STATUS_SUCCESS == add_bss_params->status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2984 | if (eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == |
| 2985 | session_entry->limMlmState) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2986 | lim_log(mac_ctx, LOG1, FL("Mlm=%d %d"), |
| 2987 | session_entry->limMlmState, |
| 2988 | eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2989 | lim_process_sta_mlm_add_bss_rsp_ft(mac_ctx, msg, |
| 2990 | session_entry); |
| 2991 | goto end; |
| 2992 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2993 | |
| 2994 | /* Set MLME state */ |
| 2995 | session_entry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE; |
| 2996 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 2997 | session_entry->peSessionId, |
| 2998 | session_entry->limMlmState)); |
| 2999 | /* to know the session started for self or for peer */ |
| 3000 | session_entry->statypeForBss = STA_ENTRY_PEER; |
| 3001 | /* Now, send WMA_ADD_STA_REQ */ |
| 3002 | lim_log(mac_ctx, LOGW, |
| 3003 | FL("SessionId:%d On STA: ADD_BSS was successful"), |
| 3004 | session_entry->peSessionId); |
| 3005 | sta_ds = |
| 3006 | dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, |
| 3007 | &session_entry->dph.dphHashTable); |
| 3008 | if (sta_ds == NULL) { |
| 3009 | lim_log(mac_ctx, LOGE, |
| 3010 | FL("Session:%d Fail to add Self Entry for STA"), |
| 3011 | session_entry->peSessionId); |
| 3012 | mlm_assoc_cnf.resultCode = |
| 3013 | (tSirResultCodes) eSIR_SME_REFUSED; |
| 3014 | } else { |
| 3015 | session_entry->bssIdx = |
| 3016 | (uint8_t) add_bss_params->bssIdx; |
| 3017 | /* Success, handle below */ |
| 3018 | sta_ds->bssId = add_bss_params->bssIdx; |
| 3019 | /* |
| 3020 | * STA Index(genr by HAL) for the BSS |
| 3021 | * entry is stored here |
| 3022 | */ |
| 3023 | sta_ds->staIndex = add_bss_params->staContext.staIdx; |
| 3024 | sta_ds->ucUcastSig = |
| 3025 | add_bss_params->staContext.ucUcastSig; |
| 3026 | sta_ds->ucBcastSig = |
| 3027 | add_bss_params->staContext.ucBcastSig; |
| 3028 | /* Downgrade the EDCA parameters if needed */ |
| 3029 | lim_set_active_edca_params(mac_ctx, |
| 3030 | session_entry->gLimEdcaParams, session_entry); |
| 3031 | lim_send_edca_params(mac_ctx, |
| 3032 | session_entry->gLimEdcaParamsActive, |
| 3033 | sta_ds->bssId); |
| 3034 | #if defined WLAN_FEATURE_VOWIFI |
| 3035 | rrm_cache_mgmt_tx_power(mac_ctx, |
| 3036 | add_bss_params->txMgmtPower, session_entry); |
| 3037 | #endif |
| 3038 | if (lim_add_sta_self(mac_ctx, sta_idx, update_sta, |
| 3039 | session_entry) != eSIR_SUCCESS) { |
| 3040 | /* Add STA context at HW */ |
| 3041 | lim_log(mac_ctx, LOGE, |
| 3042 | FL("Session:%d could not Add Self" |
| 3043 | "Entry for the station"), |
| 3044 | session_entry->peSessionId); |
| 3045 | mlm_assoc_cnf.resultCode = |
| 3046 | (tSirResultCodes) eSIR_SME_REFUSED; |
| 3047 | } |
| 3048 | } |
| 3049 | } else { |
| 3050 | lim_log(mac_ctx, LOGP, FL("SessionId:%d ADD_BSS failed!"), |
| 3051 | session_entry->peSessionId); |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3052 | mlm_assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3053 | /* Return Assoc confirm to SME with failure */ |
| 3054 | if (eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == |
| 3055 | session_entry->limMlmState) |
| 3056 | mlm_assoc_cnf.resultCode = |
| 3057 | (tSirResultCodes) eSIR_SME_FT_REASSOC_FAILURE; |
| 3058 | else |
| 3059 | mlm_assoc_cnf.resultCode = |
| 3060 | (tSirResultCodes) eSIR_SME_REFUSED; |
Abhishek Singh | 96bda8e | 2015-12-03 16:45:35 +0530 | [diff] [blame] | 3061 | session_entry->add_bss_failed = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3062 | } |
| 3063 | |
| 3064 | if (mlm_assoc_cnf.resultCode != eSIR_SME_SUCCESS) { |
| 3065 | session_entry->limMlmState = eLIM_MLM_IDLE_STATE; |
| 3066 | if (lim_set_link_state(mac_ctx, eSIR_LINK_IDLE_STATE, |
| 3067 | session_entry->bssId, |
| 3068 | session_entry->selfMacAddr, |
| 3069 | NULL, NULL) != eSIR_SUCCESS) |
| 3070 | lim_log(mac_ctx, LOGE, FL("Failed to set the LinkState")); |
| 3071 | /* Update PE session Id */ |
| 3072 | mlm_assoc_cnf.sessionId = session_entry->peSessionId; |
| 3073 | lim_post_sme_message(mac_ctx, msg_type, |
| 3074 | (uint32_t *) &mlm_assoc_cnf); |
| 3075 | } |
| 3076 | end: |
| 3077 | if (0 != msg->bodyptr) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3078 | qdf_mem_free(add_bss_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3079 | msg->bodyptr = NULL; |
| 3080 | } |
| 3081 | } |
| 3082 | |
| 3083 | /** |
| 3084 | * lim_process_mlm_add_bss_rsp() - Processes ADD BSS Response |
| 3085 | * |
| 3086 | * @mac_ctx - Pointer to Global MAC structure |
| 3087 | * @msg - The MsgQ header, which contains the response buffer |
| 3088 | * |
| 3089 | * This function is called to process a WMA_ADD_BSS_RSP from HAL. |
| 3090 | * Upon receipt of this message from HAL, MLME - |
| 3091 | * Determines the "state" in which this message was received |
| 3092 | * Forwards it to the appropriate callback |
| 3093 | * |
| 3094 | *LOGIC: |
| 3095 | * WMA_ADD_BSS_RSP can be received by MLME while the LIM is |
| 3096 | * in the following two states: |
| 3097 | * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE |
| 3098 | * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE |
| 3099 | * Based on these two states, this API will determine where to |
| 3100 | * route the message to |
| 3101 | * |
| 3102 | * Return None |
| 3103 | */ |
| 3104 | void lim_process_mlm_add_bss_rsp(tpAniSirGlobal mac_ctx, |
| 3105 | tpSirMsgQ msg) |
| 3106 | { |
| 3107 | tLimMlmStartCnf mlm_start_cnf; |
| 3108 | tpPESession session_entry; |
| 3109 | tpAddBssParams add_bss_param = (tpAddBssParams) (msg->bodyptr); |
| 3110 | tSirBssType bss_type; |
| 3111 | |
| 3112 | if (NULL == add_bss_param) { |
| 3113 | lim_log(mac_ctx, LOGE, FL("Encountered NULL Pointer")); |
| 3114 | return; |
| 3115 | } |
| 3116 | |
| 3117 | /* |
| 3118 | * we need to process the deferred message since the |
| 3119 | * initiating req.there might be nested request. |
| 3120 | * in the case of nested request the new request initiated |
| 3121 | * from the response will take care of resetting the deffered |
| 3122 | * flag. |
| 3123 | */ |
| 3124 | SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true); |
| 3125 | /* Validate SME/LIM/MLME state */ |
| 3126 | session_entry = pe_find_session_by_session_id(mac_ctx, |
| 3127 | add_bss_param->sessionId); |
| 3128 | if (session_entry == NULL) { |
| 3129 | lim_log(mac_ctx, LOGE, FL("SessionId:%d Session Doesn't exist"), |
| 3130 | add_bss_param->sessionId); |
| 3131 | if (NULL != add_bss_param) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3132 | qdf_mem_free(add_bss_param); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3133 | msg->bodyptr = NULL; |
| 3134 | } |
| 3135 | return; |
| 3136 | } |
| 3137 | |
| 3138 | session_entry->nss = add_bss_param->nss; |
| 3139 | bss_type = session_entry->bssType; |
| 3140 | /* update PE session Id */ |
| 3141 | mlm_start_cnf.sessionId = session_entry->peSessionId; |
| 3142 | if (eSIR_IBSS_MODE == bss_type) { |
| 3143 | lim_process_ibss_mlm_add_bss_rsp(mac_ctx, msg, session_entry); |
| 3144 | } else { |
| 3145 | if (eLIM_SME_WT_START_BSS_STATE == session_entry->limSmeState) { |
| 3146 | if (eLIM_MLM_WT_ADD_BSS_RSP_STATE != |
| 3147 | session_entry->limMlmState) { |
| 3148 | /* Mesg received from HAL in Invalid state! */ |
| 3149 | lim_log(mac_ctx, LOGE, |
| 3150 | FL("SessionId:%d Received " |
| 3151 | " WMA_ADD_BSS_RSP in state %X"), |
| 3152 | session_entry->peSessionId, |
| 3153 | session_entry->limMlmState); |
| 3154 | mlm_start_cnf.resultCode = |
| 3155 | eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED; |
| 3156 | if (0 != msg->bodyptr) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3157 | qdf_mem_free(add_bss_param); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3158 | msg->bodyptr = NULL; |
| 3159 | } |
| 3160 | lim_post_sme_message(mac_ctx, LIM_MLM_START_CNF, |
| 3161 | (uint32_t *) &mlm_start_cnf); |
| 3162 | } else if ((bss_type == eSIR_BTAMP_AP_MODE) || |
| 3163 | (bss_type == eSIR_BTAMP_STA_MODE)) { |
| 3164 | lim_process_btamp_add_bss_rsp(mac_ctx, msg, |
| 3165 | session_entry); |
| 3166 | } else |
| 3167 | lim_process_ap_mlm_add_bss_rsp(mac_ctx, msg); |
| 3168 | } else { |
| 3169 | /* Called while processing assoc response */ |
| 3170 | lim_process_sta_mlm_add_bss_rsp(mac_ctx, msg, |
| 3171 | session_entry); |
| 3172 | } |
| 3173 | } |
| 3174 | |
| 3175 | #ifdef WLAN_FEATURE_11W |
| 3176 | if (session_entry->limRmfEnabled) { |
| 3177 | if (eSIR_SUCCESS != |
| 3178 | lim_send_exclude_unencrypt_ind(mac_ctx, false, |
| 3179 | session_entry)) { |
| 3180 | lim_log(mac_ctx, LOGE, |
| 3181 | FL("Failed to send Exclude Unencrypted Ind.")); |
| 3182 | } |
| 3183 | } |
| 3184 | #endif |
| 3185 | } |
| 3186 | |
| 3187 | /** |
| 3188 | * lim_process_mlm_set_sta_key_rsp() - Process STA key response |
| 3189 | * |
| 3190 | * @mac_ctx: Pointer to Global MAC structure |
| 3191 | * @msg: The MsgQ header, which contains the response buffer |
| 3192 | * |
| 3193 | * This function is called to process the following two |
| 3194 | * messages from HAL: |
| 3195 | * 1) WMA_SET_BSSKEY_RSP |
| 3196 | * 2) WMA_SET_STAKEY_RSP |
| 3197 | * 3) WMA_SET_STA_BCASTKEY_RSP |
| 3198 | * Upon receipt of this message from HAL, |
| 3199 | * MLME - |
| 3200 | * > Determines the "state" in which this message was received |
| 3201 | * > Forwards it to the appropriate callback |
| 3202 | * LOGIC: |
| 3203 | * WMA_SET_BSSKEY_RSP/WMA_SET_STAKEY_RSP can be |
| 3204 | * received by MLME while in the following state: |
| 3205 | * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR-- |
| 3206 | * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR-- |
| 3207 | * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE |
| 3208 | * Based on this state, this API will determine where to |
| 3209 | * route the message to |
| 3210 | * Assumption: |
| 3211 | * ONLY the MLME state is being taken into account for now. |
| 3212 | * This is because, it appears that the handling of the |
| 3213 | * SETKEYS REQ is handled symmetrically on both the AP & STA |
| 3214 | * |
| 3215 | * Return: None |
| 3216 | */ |
| 3217 | void lim_process_mlm_set_sta_key_rsp(tpAniSirGlobal mac_ctx, |
| 3218 | tpSirMsgQ msg) |
| 3219 | { |
| 3220 | uint8_t resp_reqd = 1; |
| 3221 | tLimMlmSetKeysCnf mlm_set_key_cnf; |
| 3222 | uint8_t session_id = 0; |
| 3223 | tpPESession session_entry; |
| 3224 | |
| 3225 | SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3226 | qdf_mem_set((void *)&mlm_set_key_cnf, sizeof(tLimMlmSetKeysCnf), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3227 | if (NULL == msg->bodyptr) { |
| 3228 | PELOGE(lim_log(mac_ctx, LOGE, FL("msg bodyptr is NULL"));) |
| 3229 | return; |
| 3230 | } |
| 3231 | session_id = ((tpSetStaKeyParams) msg->bodyptr)->sessionId; |
| 3232 | session_entry = pe_find_session_by_session_id(mac_ctx, session_id); |
| 3233 | if (session_entry == NULL) { |
| 3234 | PELOGE(lim_log(mac_ctx, LOGE, |
| 3235 | FL("session does not exist for given session_id"));) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3236 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3237 | msg->bodyptr = NULL; |
| 3238 | return; |
| 3239 | } |
| 3240 | if (eLIM_MLM_WT_SET_STA_KEY_STATE != session_entry->limMlmState) { |
| 3241 | /* Mesg received from HAL in Invalid state! */ |
| 3242 | lim_log(mac_ctx, LOGE, |
| 3243 | FL("Received unexpected [Mesg Id - %d] in state %X"), |
| 3244 | msg->type, session_entry->limMlmState); |
| 3245 | /* There's not much that MLME can do at this stage... */ |
| 3246 | resp_reqd = 0; |
| 3247 | } else { |
| 3248 | mlm_set_key_cnf.resultCode = |
| 3249 | (uint16_t)(((tpSetStaKeyParams) msg->bodyptr)->status); |
| 3250 | } |
| 3251 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3252 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3253 | msg->bodyptr = NULL; |
| 3254 | /* Restore MLME state */ |
| 3255 | session_entry->limMlmState = session_entry->limPrevMlmState; |
| 3256 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 3257 | session_entry->peSessionId, session_entry->limMlmState)); |
| 3258 | if (resp_reqd) { |
| 3259 | tpLimMlmSetKeysReq lpLimMlmSetKeysReq = |
| 3260 | (tpLimMlmSetKeysReq) mac_ctx->lim.gpLimMlmSetKeysReq; |
| 3261 | /* Prepare and Send LIM_MLM_SETKEYS_CNF */ |
| 3262 | if (NULL != lpLimMlmSetKeysReq) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3263 | qdf_copy_macaddr(&mlm_set_key_cnf.peer_macaddr, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 3264 | &lpLimMlmSetKeysReq->peer_macaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3265 | /* |
| 3266 | * Free the buffer cached for the global |
| 3267 | * mac_ctx->lim.gpLimMlmSetKeysReq |
| 3268 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3269 | qdf_mem_free(mac_ctx->lim.gpLimMlmSetKeysReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3270 | mac_ctx->lim.gpLimMlmSetKeysReq = NULL; |
| 3271 | } |
| 3272 | mlm_set_key_cnf.sessionId = session_id; |
| 3273 | lim_post_sme_message(mac_ctx, LIM_MLM_SETKEYS_CNF, |
| 3274 | (uint32_t *) &mlm_set_key_cnf); |
| 3275 | } |
| 3276 | } |
| 3277 | |
| 3278 | /** |
| 3279 | * lim_process_mlm_set_bss_key_rsp() - handles BSS key |
| 3280 | * |
| 3281 | * @mac_ctx: A pointer to Global MAC structure |
| 3282 | * @msg: Message from SME |
| 3283 | * |
| 3284 | * This function processes BSS key response and updates |
| 3285 | * PE status accordingly. |
| 3286 | * |
| 3287 | * Return: NULL |
| 3288 | */ |
| 3289 | void lim_process_mlm_set_bss_key_rsp(tpAniSirGlobal mac_ctx, |
| 3290 | tpSirMsgQ msg) |
| 3291 | { |
| 3292 | tLimMlmSetKeysCnf set_key_cnf; |
| 3293 | uint16_t result_status; |
| 3294 | uint8_t session_id = 0; |
| 3295 | tpPESession session_entry; |
| 3296 | tpLimMlmSetKeysReq set_key_req; |
| 3297 | |
| 3298 | SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3299 | qdf_mem_set((void *)&set_key_cnf, sizeof(tLimMlmSetKeysCnf), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3300 | if (NULL == msg->bodyptr) { |
| 3301 | PELOGE(lim_log(mac_ctx, LOGE, FL("msg bodyptr is null"));) |
| 3302 | return; |
| 3303 | } |
| 3304 | session_id = ((tpSetBssKeyParams) msg->bodyptr)->sessionId; |
| 3305 | session_entry = pe_find_session_by_session_id(mac_ctx, session_id); |
| 3306 | if (session_entry == NULL) { |
| 3307 | PELOGE(lim_log(mac_ctx, LOGE, |
| 3308 | FL("session does not exist for given sessionId [%d]"), |
| 3309 | session_id);) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3310 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3311 | msg->bodyptr = NULL; |
| 3312 | return; |
| 3313 | } |
| 3314 | if (eLIM_MLM_WT_SET_BSS_KEY_STATE == session_entry->limMlmState) |
| 3315 | result_status = |
| 3316 | (uint16_t)(((tpSetBssKeyParams)msg->bodyptr)->status); |
| 3317 | else |
| 3318 | /* |
| 3319 | * BCAST key also uses tpSetStaKeyParams. |
| 3320 | * Done this way for readabilty. |
| 3321 | */ |
| 3322 | result_status = |
| 3323 | (uint16_t)(((tpSetStaKeyParams)msg->bodyptr)->status); |
| 3324 | |
| 3325 | /* Validate MLME state */ |
| 3326 | if (eLIM_MLM_WT_SET_BSS_KEY_STATE != session_entry->limMlmState && |
| 3327 | eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != |
| 3328 | session_entry->limMlmState) { |
| 3329 | /* Msg received from HAL in Invalid state! */ |
| 3330 | lim_log(mac_ctx, LOGE, |
| 3331 | FL("Received unexpected [Mesg Id - %d] in state %X"), |
| 3332 | msg->type, session_entry->limMlmState); |
| 3333 | } else { |
| 3334 | set_key_cnf.resultCode = result_status; |
| 3335 | } |
| 3336 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3337 | qdf_mem_free(msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3338 | msg->bodyptr = NULL; |
| 3339 | /* Restore MLME state */ |
| 3340 | session_entry->limMlmState = session_entry->limPrevMlmState; |
| 3341 | |
| 3342 | MTRACE(mac_trace |
| 3343 | (mac_ctx, TRACE_CODE_MLM_STATE, session_entry->peSessionId, |
| 3344 | session_entry->limMlmState)); |
| 3345 | set_key_req = |
| 3346 | (tpLimMlmSetKeysReq) mac_ctx->lim.gpLimMlmSetKeysReq; |
| 3347 | set_key_cnf.sessionId = session_id; |
| 3348 | |
| 3349 | /* Prepare and Send LIM_MLM_SETKEYS_CNF */ |
| 3350 | if (NULL != set_key_req) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3351 | qdf_copy_macaddr(&set_key_cnf.peer_macaddr, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 3352 | &set_key_req->peer_macaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3353 | /* |
| 3354 | * Free the buffer cached for the |
| 3355 | * global mac_ctx->lim.gpLimMlmSetKeysReq |
| 3356 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3357 | qdf_mem_free(mac_ctx->lim.gpLimMlmSetKeysReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3358 | mac_ctx->lim.gpLimMlmSetKeysReq = NULL; |
| 3359 | } |
| 3360 | lim_post_sme_message(mac_ctx, LIM_MLM_SETKEYS_CNF, |
| 3361 | (uint32_t *) &set_key_cnf); |
| 3362 | } |
| 3363 | |
| 3364 | /** |
| 3365 | * lim_process_switch_channel_re_assoc_req() |
| 3366 | * |
| 3367 | ***FUNCTION: |
| 3368 | * This function is called to send the reassoc req mgmt frame after the |
| 3369 | * switchChannelRsp message is received from HAL. |
| 3370 | * |
| 3371 | ***LOGIC: |
| 3372 | * |
| 3373 | ***ASSUMPTIONS: |
| 3374 | * NA |
| 3375 | * |
| 3376 | ***NOTE: |
| 3377 | * NA |
| 3378 | * |
| 3379 | * @param pMac - Pointer to Global MAC structure. |
| 3380 | * @param psessionEntry - session related information. |
| 3381 | * @param status - channel switch success/failure. |
| 3382 | * |
| 3383 | * @return None |
| 3384 | */ |
| 3385 | static void lim_process_switch_channel_re_assoc_req(tpAniSirGlobal pMac, |
| 3386 | tpPESession psessionEntry, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3387 | QDF_STATUS status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3388 | { |
| 3389 | tLimMlmReassocCnf mlmReassocCnf; |
| 3390 | tLimMlmReassocReq *pMlmReassocReq; |
| 3391 | pMlmReassocReq = |
| 3392 | (tLimMlmReassocReq *) (psessionEntry->pLimMlmReassocReq); |
| 3393 | if (pMlmReassocReq == NULL) { |
| 3394 | lim_log(pMac, LOGP, |
| 3395 | FL |
| 3396 | ("pLimMlmReassocReq does not exist for given switchChanSession")); |
| 3397 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3398 | goto end; |
| 3399 | } |
| 3400 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3401 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3402 | PELOGE(lim_log(pMac, LOGE, FL("Change channel failed!!"));) |
| 3403 | mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL; |
| 3404 | goto end; |
| 3405 | } |
| 3406 | /* / Start reassociation failure timer */ |
| 3407 | MTRACE(mac_trace |
| 3408 | (pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, |
| 3409 | eLIM_REASSOC_FAIL_TIMER)); |
| 3410 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 3411 | != TX_SUCCESS) { |
| 3412 | /* / Could not start reassoc failure timer. */ |
| 3413 | /* Log error */ |
| 3414 | lim_log(pMac, LOGP, |
| 3415 | FL("could not start Reassociation failure timer")); |
| 3416 | /* Return Reassoc confirm with */ |
| 3417 | /* Resources Unavailable */ |
| 3418 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3419 | goto end; |
| 3420 | } |
| 3421 | /* / Prepare and send Reassociation request frame */ |
| 3422 | lim_send_reassoc_req_mgmt_frame(pMac, pMlmReassocReq, psessionEntry); |
| 3423 | return; |
| 3424 | end: |
| 3425 | /* Free up buffer allocated for reassocReq */ |
| 3426 | if (pMlmReassocReq != NULL) { |
| 3427 | /* Update PE session Id */ |
| 3428 | mlmReassocCnf.sessionId = pMlmReassocReq->sessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3429 | qdf_mem_free(pMlmReassocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3430 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3431 | } else { |
| 3432 | mlmReassocCnf.sessionId = 0; |
| 3433 | } |
| 3434 | |
| 3435 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3436 | /* Update PE sessio Id */ |
| 3437 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 3438 | |
| 3439 | lim_post_sme_message(pMac, LIM_MLM_REASSOC_CNF, |
| 3440 | (uint32_t *) &mlmReassocCnf); |
| 3441 | } |
| 3442 | |
| 3443 | |
| 3444 | /** |
| 3445 | * lim_process_switch_channel_join_req() -Initiates probe request |
| 3446 | * |
| 3447 | * @mac_ctx - A pointer to Global MAC structure |
| 3448 | * @sessionEntry - session related information. |
| 3449 | * @status - channel switch success/failure |
| 3450 | * |
| 3451 | * This function is called to send the probe req mgmt frame |
| 3452 | * after the switchChannelRsp message is received from HAL. |
| 3453 | * |
| 3454 | * Return None |
| 3455 | */ |
| 3456 | static void lim_process_switch_channel_join_req( |
| 3457 | tpAniSirGlobal mac_ctx, tpPESession session_entry, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3458 | QDF_STATUS status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3459 | { |
| 3460 | tSirMacSSid ssId; |
| 3461 | tLimMlmJoinCnf join_cnf; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3462 | if (status != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3463 | PELOGE(lim_log(mac_ctx, LOGE, FL("Change channel failed!!"));) |
| 3464 | goto error; |
| 3465 | } |
| 3466 | |
| 3467 | if ((NULL == session_entry) || (NULL == session_entry->pLimMlmJoinReq) |
| 3468 | || (NULL == session_entry->pLimJoinReq)) { |
| 3469 | PELOGE(lim_log(mac_ctx, LOGE, FL("invalid pointer!!"));) |
| 3470 | goto error; |
| 3471 | } |
| 3472 | |
| 3473 | /* |
| 3474 | * eSIR_BTAMP_AP_MODE stroed as bss type in session |
| 3475 | * Table when join req is received, is to be veified |
| 3476 | */ |
| 3477 | if (session_entry->bssType == eSIR_BTAMP_AP_MODE) { |
| 3478 | if (lim_set_link_state |
| 3479 | (mac_ctx, eSIR_LINK_BTAMP_PREASSOC_STATE, |
| 3480 | session_entry->bssId, session_entry->selfMacAddr, |
| 3481 | NULL, NULL) != eSIR_SUCCESS) { |
| 3482 | PELOGE(lim_log |
| 3483 | (mac_ctx, LOGE, |
| 3484 | FL("Sessionid: %d Set link state " |
| 3485 | "failed!! BSSID:" MAC_ADDRESS_STR), |
| 3486 | session_entry->peSessionId, |
| 3487 | MAC_ADDR_ARRAY(session_entry->bssId));) |
| 3488 | goto error; |
| 3489 | } |
| 3490 | } |
| 3491 | |
| 3492 | session_entry->limPrevMlmState = session_entry->limMlmState; |
| 3493 | session_entry->limMlmState = eLIM_MLM_WT_JOIN_BEACON_STATE; |
| 3494 | lim_log(mac_ctx, LOG1, |
| 3495 | FL("Sessionid %d prev lim state %d new lim state %d " |
| 3496 | "systemrole = %d"), session_entry->peSessionId, |
| 3497 | session_entry->limPrevMlmState, |
| 3498 | session_entry->limMlmState, GET_LIM_SYSTEM_ROLE(session_entry)); |
| 3499 | |
| 3500 | /* Apply previously set configuration at HW */ |
| 3501 | lim_apply_configuration(mac_ctx, session_entry); |
| 3502 | |
| 3503 | /* |
| 3504 | * If sendDeauthBeforeCon is enabled, Send Deauth first to AP if last |
| 3505 | * disconnection was caused by HB failure. |
| 3506 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3507 | if (mac_ctx->roam.configParam.sendDeauthBeforeCon) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3508 | int apCount; |
| 3509 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3510 | for (apCount = 0; apCount < 2; apCount++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3511 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3512 | if (!qdf_mem_cmp(session_entry->pLimMlmJoinReq->bssDescription.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3513 | mac_ctx->lim.gLimHeartBeatApMac[apCount], sizeof(tSirMacAddr))) { |
| 3514 | |
| 3515 | lim_log(mac_ctx, LOGE, FL("Index %d Sessionid: %d Send deauth on " |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3516 | "channel %d to BSSID: "MAC_ADDRESS_STR), apCount, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3517 | session_entry->peSessionId, session_entry->currentOperChannel, |
| 3518 | MAC_ADDR_ARRAY(session_entry->pLimMlmJoinReq->bssDescription. |
| 3519 | bssId)); |
| 3520 | |
| 3521 | lim_send_deauth_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_REASON, |
| 3522 | session_entry->pLimMlmJoinReq->bssDescription.bssId, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3523 | session_entry, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3524 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3525 | qdf_mem_zero(mac_ctx->lim.gLimHeartBeatApMac[apCount], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3526 | sizeof(tSirMacAddr)); |
| 3527 | break; |
| 3528 | } |
| 3529 | } |
| 3530 | } |
| 3531 | |
| 3532 | /* Wait for Beacon to announce join success */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3533 | qdf_mem_copy(ssId.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3534 | session_entry->ssId.ssId, session_entry->ssId.length); |
| 3535 | ssId.length = session_entry->ssId.length; |
| 3536 | |
| 3537 | lim_deactivate_and_change_timer(mac_ctx, |
| 3538 | eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER); |
| 3539 | |
| 3540 | /* assign appropriate sessionId to the timer object */ |
| 3541 | mac_ctx->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = |
| 3542 | session_entry->peSessionId; |
| 3543 | lim_log(mac_ctx, LOG1, |
| 3544 | FL("Sessionid: %d Send Probe req on channel %d ssid:%.*s " |
| 3545 | "BSSID: " MAC_ADDRESS_STR), session_entry->peSessionId, |
| 3546 | session_entry->currentOperChannel, ssId.length, ssId.ssId, |
| 3547 | MAC_ADDR_ARRAY( |
| 3548 | session_entry->pLimMlmJoinReq->bssDescription.bssId)); |
| 3549 | |
| 3550 | /* |
| 3551 | * We need to wait for probe response, so start join |
| 3552 | * timeout timer.This timer will be deactivated once |
| 3553 | * we receive probe response. |
| 3554 | */ |
| 3555 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_TIMER_ACTIVATE, |
| 3556 | session_entry->peSessionId, eLIM_JOIN_FAIL_TIMER)); |
| 3557 | if (tx_timer_activate(&mac_ctx->lim.limTimers.gLimJoinFailureTimer) != |
| 3558 | TX_SUCCESS) { |
| 3559 | lim_log(mac_ctx, LOGP, |
| 3560 | FL("couldn't activate Join failure timer")); |
| 3561 | session_entry->limMlmState = session_entry->limPrevMlmState; |
| 3562 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 3563 | session_entry->peSessionId, |
| 3564 | mac_ctx->lim.gLimMlmState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3565 | goto error; |
| 3566 | } |
| 3567 | /* include additional IE if there is */ |
| 3568 | lim_send_probe_req_mgmt_frame(mac_ctx, &ssId, |
| 3569 | session_entry->pLimMlmJoinReq->bssDescription.bssId, |
| 3570 | session_entry->currentOperChannel, session_entry->selfMacAddr, |
| 3571 | session_entry->dot11mode, |
| 3572 | session_entry->pLimJoinReq->addIEScan.length, |
| 3573 | session_entry->pLimJoinReq->addIEScan.addIEdata); |
| 3574 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3575 | if (session_entry->pePersona == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3576 | /* Activate Join Periodic Probe Req timer */ |
| 3577 | if (tx_timer_activate |
| 3578 | (&mac_ctx->lim.limTimers.gLimPeriodicJoinProbeReqTimer) |
| 3579 | != TX_SUCCESS) { |
| 3580 | lim_log(mac_ctx, LOGP, |
| 3581 | FL("Periodic JoinReq timer activate failed")); |
| 3582 | goto error; |
| 3583 | } |
| 3584 | } |
| 3585 | return; |
| 3586 | error: |
| 3587 | if (NULL != session_entry) { |
| 3588 | if (session_entry->pLimMlmJoinReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3589 | qdf_mem_free(session_entry->pLimMlmJoinReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3590 | session_entry->pLimMlmJoinReq = NULL; |
| 3591 | } |
| 3592 | if (session_entry->pLimJoinReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3593 | qdf_mem_free(session_entry->pLimJoinReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3594 | session_entry->pLimJoinReq = NULL; |
| 3595 | } |
| 3596 | join_cnf.sessionId = session_entry->peSessionId; |
| 3597 | } else { |
| 3598 | join_cnf.sessionId = 0; |
| 3599 | } |
| 3600 | join_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3601 | join_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3602 | lim_post_sme_message(mac_ctx, LIM_MLM_JOIN_CNF, (uint32_t *)&join_cnf); |
| 3603 | } |
| 3604 | |
| 3605 | /** |
| 3606 | * lim_process_switch_channel_rsp() |
| 3607 | * |
| 3608 | ***FUNCTION: |
| 3609 | * This function is called to process switchChannelRsp message from HAL. |
| 3610 | * |
| 3611 | ***LOGIC: |
| 3612 | * |
| 3613 | ***ASSUMPTIONS: |
| 3614 | * NA |
| 3615 | * |
| 3616 | ***NOTE: |
| 3617 | * NA |
| 3618 | * |
| 3619 | * @param pMac - Pointer to Global MAC structure |
| 3620 | * @param body - message body. |
| 3621 | * |
| 3622 | * @return None |
| 3623 | */ |
| 3624 | void lim_process_switch_channel_rsp(tpAniSirGlobal pMac, void *body) |
| 3625 | { |
| 3626 | tpSwitchChannelParams pChnlParams = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3627 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3628 | uint16_t channelChangeReasonCode; |
| 3629 | uint8_t peSessionId; |
| 3630 | tpPESession psessionEntry; |
| 3631 | /* we need to process the deferred message since the initiating req. there might be nested request. */ |
| 3632 | /* in the case of nested request the new request initiated from the response will take care of resetting */ |
| 3633 | /* the deffered flag. */ |
| 3634 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 3635 | pChnlParams = (tpSwitchChannelParams) body; |
| 3636 | status = pChnlParams->status; |
| 3637 | peSessionId = pChnlParams->peSessionId; |
| 3638 | |
| 3639 | psessionEntry = pe_find_session_by_session_id(pMac, peSessionId); |
| 3640 | if (psessionEntry == NULL) { |
| 3641 | lim_log(pMac, LOGP, |
| 3642 | FL("session does not exist for given sessionId")); |
| 3643 | return; |
| 3644 | } |
| 3645 | #if defined WLAN_FEATURE_VOWIFI |
| 3646 | /* HAL fills in the tx power used for mgmt frames in this field. */ |
| 3647 | /* Store this value to use in TPC report IE. */ |
| 3648 | rrm_cache_mgmt_tx_power(pMac, pChnlParams->txMgmtPower, psessionEntry); |
| 3649 | #endif |
| 3650 | channelChangeReasonCode = psessionEntry->channelChangeReasonCode; |
| 3651 | /* initialize it back to invalid id */ |
| 3652 | psessionEntry->chainMask = pChnlParams->chainMask; |
| 3653 | psessionEntry->nss = pChnlParams->nss; |
| 3654 | psessionEntry->smpsMode = pChnlParams->smpsMode; |
| 3655 | psessionEntry->channelChangeReasonCode = 0xBAD; |
| 3656 | lim_log(pMac, LOG1, FL("channelChangeReasonCode %d"), |
| 3657 | channelChangeReasonCode); |
| 3658 | switch (channelChangeReasonCode) { |
| 3659 | case LIM_SWITCH_CHANNEL_REASSOC: |
| 3660 | lim_process_switch_channel_re_assoc_req(pMac, psessionEntry, status); |
| 3661 | break; |
| 3662 | case LIM_SWITCH_CHANNEL_JOIN: |
| 3663 | lim_process_switch_channel_join_req(pMac, psessionEntry, status); |
| 3664 | break; |
| 3665 | |
| 3666 | case LIM_SWITCH_CHANNEL_OPERATION: |
| 3667 | /* |
| 3668 | * The above code should also use the callback. |
| 3669 | * mechanism below, there is scope for cleanup here. |
| 3670 | * THat way all this response handler does is call the call back |
| 3671 | * We can get rid of the reason code here. |
| 3672 | */ |
| 3673 | if (pMac->lim.gpchangeChannelCallback) { |
| 3674 | PELOG1(lim_log |
| 3675 | (pMac, LOG1, |
| 3676 | "Channel changed hence invoke registered call back"); |
| 3677 | ) |
| 3678 | pMac->lim.gpchangeChannelCallback(pMac, status, |
| 3679 | pMac->lim. |
| 3680 | gpchangeChannelData, |
| 3681 | psessionEntry); |
| 3682 | } |
| 3683 | break; |
| 3684 | case LIM_SWITCH_CHANNEL_SAP_DFS: |
| 3685 | { |
| 3686 | /* Note: This event code specific to SAP mode |
| 3687 | * When SAP session issues channel change as performing |
| 3688 | * DFS, we will come here. Other sessions, for e.g. P2P |
| 3689 | * will have to define their own event code and channel |
| 3690 | * switch handler. This is required since the SME may |
| 3691 | * require completely different information for P2P unlike |
| 3692 | * SAP. |
| 3693 | */ |
| 3694 | lim_send_sme_ap_channel_switch_resp(pMac, psessionEntry, |
| 3695 | pChnlParams); |
| 3696 | } |
| 3697 | break; |
| 3698 | default: |
| 3699 | break; |
| 3700 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3701 | qdf_mem_free(body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3702 | } |
| 3703 | |
| 3704 | /** |
| 3705 | * @function : lim_handle_del_bss_in_re_assoc_context |
| 3706 | * @brief : While Processing the ReAssociation Response Frame in STA, |
| 3707 | * a. immediately after receiving the Reassoc Response the RxCleanUp is |
| 3708 | * being issued and the end of DelBSS the new BSS is being added. |
| 3709 | * |
| 3710 | * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context |
| 3711 | * change, We need to update CSR with ReAssocCNF Response with the |
| 3712 | * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS |
| 3713 | * context only |
| 3714 | * |
| 3715 | * @param : pMac - tpAniSirGlobal |
| 3716 | * pStaDs - Station Descriptor |
| 3717 | * |
| 3718 | * @return : none |
| 3719 | */ |
| 3720 | static void |
| 3721 | lim_handle_del_bss_in_re_assoc_context(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 3722 | tpPESession psessionEntry) |
| 3723 | { |
| 3724 | tLimMlmReassocCnf mlmReassocCnf; |
| 3725 | /* |
| 3726 | * Skipped the DeleteDPH Hash Entry as we need it for the new BSS |
| 3727 | * Set the MlmState to IDLE |
| 3728 | */ |
| 3729 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
| 3730 | /* Update PE session Id */ |
| 3731 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 3732 | switch (psessionEntry->limSmeState) { |
| 3733 | case eLIM_SME_WT_REASSOC_STATE: |
| 3734 | { |
| 3735 | tpSirAssocRsp assocRsp; |
| 3736 | tpDphHashNode pStaDs; |
| 3737 | tSirRetStatus retStatus = eSIR_SUCCESS; |
| 3738 | tpSchBeaconStruct beacon_struct; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3739 | beacon_struct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3740 | if (NULL == beacon_struct) { |
| 3741 | lim_log(pMac, LOGE, FL("beaconStruct alloc failed")); |
| 3742 | mlmReassocCnf.resultCode = |
| 3743 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3744 | mlmReassocCnf.protStatusCode = |
| 3745 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3746 | lim_delete_dph_hash_entry(pMac, psessionEntry->bssId, |
| 3747 | DPH_STA_HASH_INDEX_PEER, psessionEntry); |
| 3748 | goto error; |
| 3749 | } |
| 3750 | /* Delete the older STA Table entry */ |
| 3751 | lim_delete_dph_hash_entry(pMac, psessionEntry->bssId, |
| 3752 | DPH_STA_HASH_INDEX_PEER, psessionEntry); |
| 3753 | /* |
| 3754 | * Add an entry for AP to hash table |
| 3755 | * maintained by DPH module |
| 3756 | */ |
| 3757 | pStaDs = dph_add_hash_entry(pMac, |
| 3758 | psessionEntry->limReAssocbssId, |
| 3759 | DPH_STA_HASH_INDEX_PEER, |
| 3760 | &psessionEntry->dph.dphHashTable); |
| 3761 | if (pStaDs == NULL) { |
| 3762 | /* Could not add hash table entry */ |
| 3763 | lim_log(pMac, LOGE, |
| 3764 | FL("could not add hash entry at DPH for ")); |
| 3765 | lim_print_mac_addr(pMac, |
| 3766 | psessionEntry->limReAssocbssId, LOGE); |
| 3767 | mlmReassocCnf.resultCode = |
| 3768 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3769 | mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3770 | qdf_mem_free(beacon_struct); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3771 | goto error; |
| 3772 | } |
| 3773 | /* |
| 3774 | * While Processing the ReAssoc Response Frame the ReAssocRsp Frame |
| 3775 | * is being stored to be used here for sending ADDBSS |
| 3776 | */ |
| 3777 | assocRsp = |
| 3778 | (tpSirAssocRsp) psessionEntry->limAssocResponseData; |
| 3779 | lim_update_assoc_sta_datas(pMac, pStaDs, assocRsp, |
| 3780 | psessionEntry); |
| 3781 | lim_update_re_assoc_globals(pMac, assocRsp, psessionEntry); |
| 3782 | lim_extract_ap_capabilities(pMac, |
| 3783 | (uint8_t *) psessionEntry->pLimReAssocReq->bssDescription.ieFields, |
| 3784 | lim_get_ielen_from_bss_description( |
| 3785 | &psessionEntry->pLimReAssocReq->bssDescription), |
| 3786 | beacon_struct); |
| 3787 | if (pMac->lim.gLimProtectionControl != |
| 3788 | WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 3789 | lim_decide_sta_protection_on_assoc(pMac, |
| 3790 | beacon_struct, |
| 3791 | psessionEntry); |
| 3792 | if (beacon_struct->erpPresent) { |
| 3793 | if (beacon_struct->erpIEInfo.barkerPreambleMode) |
| 3794 | psessionEntry->beaconParams.fShortPreamble = 0; |
| 3795 | else |
| 3796 | psessionEntry->beaconParams.fShortPreamble = 1; |
| 3797 | } |
| 3798 | /* |
| 3799 | * updateBss flag is false, as in this case, PE is first |
| 3800 | * deleting the existing BSS and then adding a new one |
| 3801 | */ |
| 3802 | if (eSIR_SUCCESS != |
| 3803 | lim_sta_send_add_bss(pMac, assocRsp, beacon_struct, |
| 3804 | &psessionEntry->pLimReAssocReq->bssDescription, |
| 3805 | false, psessionEntry)) { |
| 3806 | lim_log(pMac, LOGE, |
| 3807 | FL("Posting ADDBSS in the ReAssocCtx has Failed ")); |
| 3808 | retStatus = eSIR_FAILURE; |
| 3809 | } |
| 3810 | if (retStatus != eSIR_SUCCESS) { |
| 3811 | mlmReassocCnf.resultCode = |
| 3812 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3813 | mlmReassocCnf.protStatusCode = |
| 3814 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3815 | qdf_mem_free(assocRsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3816 | pMac->lim.gLimAssocResponseData = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3817 | qdf_mem_free(beacon_struct); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3818 | goto error; |
| 3819 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3820 | qdf_mem_free(assocRsp); |
| 3821 | qdf_mem_free(beacon_struct); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3822 | psessionEntry->limAssocResponseData = NULL; |
| 3823 | } |
| 3824 | break; |
| 3825 | case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: |
| 3826 | { |
| 3827 | /** Case wherein the DisAssoc / Deauth |
| 3828 | * being sent as response to ReAssoc Req*/ |
| 3829 | /** Send the Reason code as the same received in Disassoc / Deauth Frame*/ |
| 3830 | mlmReassocCnf.resultCode = |
| 3831 | pStaDs->mlmStaContext.disassocReason; |
| 3832 | mlmReassocCnf.protStatusCode = |
| 3833 | pStaDs->mlmStaContext.cleanupTrigger; |
| 3834 | /** Set the SME State back to WT_Reassoc State*/ |
| 3835 | psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE; |
| 3836 | lim_delete_dph_hash_entry(pMac, pStaDs->staAddr, |
| 3837 | pStaDs->assocId, psessionEntry); |
| 3838 | if (LIM_IS_STA_ROLE(psessionEntry) || |
| 3839 | LIM_IS_BT_AMP_STA_ROLE(psessionEntry)) { |
| 3840 | psessionEntry->limMlmState = |
| 3841 | eLIM_MLM_IDLE_STATE; |
| 3842 | } |
| 3843 | lim_post_sme_message(pMac, LIM_MLM_REASSOC_CNF, |
| 3844 | (uint32_t *) &mlmReassocCnf); |
| 3845 | } |
| 3846 | break; |
| 3847 | default: |
| 3848 | lim_log(pMac, LOGE, |
| 3849 | FL("DelBss is being invoked in the wrong system Role /unhandled SME State")); |
| 3850 | |
| 3851 | mlmReassocCnf.resultCode = eSIR_SME_REFUSED; |
| 3852 | mlmReassocCnf.protStatusCode = |
| 3853 | eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 3854 | goto error; |
| 3855 | } |
| 3856 | return; |
| 3857 | error: |
| 3858 | lim_post_sme_message(pMac, LIM_MLM_REASSOC_CNF, |
| 3859 | (uint32_t *) &mlmReassocCnf); |
| 3860 | } |
| 3861 | |
| 3862 | /* Added For BT -AMP Support */ |
| 3863 | static void |
| 3864 | lim_process_btamp_add_bss_rsp(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, |
| 3865 | tpPESession psessionEntry) |
| 3866 | { |
| 3867 | tLimMlmStartCnf mlmStartCnf; |
| 3868 | tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr; |
| 3869 | |
| 3870 | if (NULL == pAddBssParams) { |
| 3871 | lim_log(pMac, LOGE, FL("Invalid body pointer in message")); |
| 3872 | goto end; |
| 3873 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3874 | if (QDF_STATUS_SUCCESS == pAddBssParams->status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3875 | lim_log(pMac, LOG2, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3876 | FL("WMA_ADD_BSS_RSP returned with QDF_STATUS_SUCCESS")); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3877 | if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE) { |
| 3878 | if (lim_set_link_state |
| 3879 | (pMac, eSIR_LINK_BTAMP_AP_STATE, |
| 3880 | psessionEntry->bssId, psessionEntry->selfMacAddr, |
| 3881 | NULL, NULL) != eSIR_SUCCESS) |
| 3882 | goto end; |
| 3883 | } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) { |
| 3884 | if (lim_set_link_state |
| 3885 | (pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId, |
| 3886 | psessionEntry->selfMacAddr, NULL, |
| 3887 | NULL) != eSIR_SUCCESS) |
| 3888 | goto end; |
| 3889 | } |
| 3890 | /* Set MLME state */ |
| 3891 | psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE; |
| 3892 | psessionEntry->statypeForBss = STA_ENTRY_SELF; /* to know session started for peer or for self */ |
| 3893 | psessionEntry->bssIdx = (uint8_t) pAddBssParams->bssIdx; |
| 3894 | sch_edca_profile_update(pMac, psessionEntry); |
| 3895 | lim_init_peer_idxpool(pMac, psessionEntry); |
| 3896 | |
| 3897 | /* Apply previously set configuration at HW */ |
| 3898 | lim_apply_configuration(pMac, psessionEntry); |
| 3899 | psessionEntry->staId = pAddBssParams->staContext.staIdx; |
| 3900 | mlmStartCnf.resultCode = eSIR_SME_SUCCESS; |
| 3901 | } else { |
| 3902 | lim_log(pMac, LOGE, FL("WMA_ADD_BSS_REQ failed with status %d"), |
| 3903 | pAddBssParams->status); |
| 3904 | mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 3905 | } |
| 3906 | mlmStartCnf.sessionId = psessionEntry->peSessionId; |
| 3907 | lim_post_sme_message(pMac, LIM_MLM_START_CNF, (uint32_t *) &mlmStartCnf); |
| 3908 | end: |
| 3909 | if (0 != limMsgQ->bodyptr) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3910 | qdf_mem_free(pAddBssParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3911 | limMsgQ->bodyptr = NULL; |
| 3912 | } |
| 3913 | } |
| 3914 | |
| 3915 | /** |
| 3916 | * @function : lim_handle_add_bss_in_re_assoc_context |
| 3917 | * @brief : While Processing the ReAssociation Response Frame in STA, |
| 3918 | * a. immediately after receiving the Reassoc Response the RxCleanUp is |
| 3919 | * being issued and the end of DelBSS the new BSS is being added. |
| 3920 | * |
| 3921 | * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context |
| 3922 | * change, We need to update CSR with ReAssocCNF Response with the |
| 3923 | * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS |
| 3924 | * context only |
| 3925 | * |
| 3926 | * @param : pMac - tpAniSirGlobal |
| 3927 | * pStaDs - Station Descriptor |
| 3928 | * |
| 3929 | * @return : none |
| 3930 | */ |
| 3931 | void |
| 3932 | lim_handle_add_bss_in_re_assoc_context(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 3933 | tpPESession psessionEntry) |
| 3934 | { |
| 3935 | tLimMlmReassocCnf mlmReassocCnf; |
| 3936 | /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/ |
| 3937 | /** Set the MlmState to IDLE*/ |
| 3938 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
| 3939 | MTRACE(mac_trace |
| 3940 | (pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, |
| 3941 | psessionEntry->limMlmState)); |
| 3942 | switch (psessionEntry->limSmeState) { |
| 3943 | case eLIM_SME_WT_REASSOC_STATE: { |
| 3944 | tpSirAssocRsp assocRsp; |
| 3945 | tpDphHashNode pStaDs; |
| 3946 | tSirRetStatus retStatus = eSIR_SUCCESS; |
| 3947 | tSchBeaconStruct *pBeaconStruct; |
| 3948 | pBeaconStruct = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3949 | qdf_mem_malloc(sizeof(tSchBeaconStruct)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3950 | if (NULL == pBeaconStruct) { |
| 3951 | lim_log(pMac, LOGE, |
| 3952 | FL |
| 3953 | ("Unable to allocate memory in lim_handle_add_bss_in_re_assoc_context")); |
| 3954 | mlmReassocCnf.resultCode = |
| 3955 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3956 | mlmReassocCnf.protStatusCode = |
| 3957 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3958 | goto Error; |
| 3959 | } |
| 3960 | /* Get the AP entry from DPH hash table */ |
| 3961 | pStaDs = |
| 3962 | dph_get_hash_entry(pMac, DPH_STA_HASH_INDEX_PEER, |
| 3963 | &psessionEntry->dph.dphHashTable); |
| 3964 | if (pStaDs == NULL) { |
| 3965 | PELOGE(lim_log |
| 3966 | (pMac, LOGE, |
| 3967 | FL |
| 3968 | ("Fail to get STA PEER entry from hash")); |
| 3969 | ) |
| 3970 | mlmReassocCnf.resultCode = |
| 3971 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3972 | mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 3973 | qdf_mem_free(pBeaconStruct); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3974 | goto Error; |
| 3975 | } |
| 3976 | /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame |
| 3977 | * is being stored to be used here for sending ADDBSS |
| 3978 | */ |
| 3979 | assocRsp = |
| 3980 | (tpSirAssocRsp) psessionEntry->limAssocResponseData; |
| 3981 | lim_update_assoc_sta_datas(pMac, pStaDs, assocRsp, |
| 3982 | psessionEntry); |
| 3983 | lim_update_re_assoc_globals(pMac, assocRsp, psessionEntry); |
| 3984 | lim_extract_ap_capabilities(pMac, |
| 3985 | (uint8_t *) psessionEntry-> |
| 3986 | pLimReAssocReq->bssDescription. |
| 3987 | ieFields, |
| 3988 | lim_get_ielen_from_bss_description |
| 3989 | (&psessionEntry-> |
| 3990 | pLimReAssocReq-> |
| 3991 | bssDescription), |
| 3992 | pBeaconStruct); |
| 3993 | if (pMac->lim.gLimProtectionControl != |
| 3994 | WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 3995 | lim_decide_sta_protection_on_assoc(pMac, |
| 3996 | pBeaconStruct, |
| 3997 | psessionEntry); |
| 3998 | |
| 3999 | if (pBeaconStruct->erpPresent) { |
| 4000 | if (pBeaconStruct->erpIEInfo.barkerPreambleMode) |
| 4001 | psessionEntry->beaconParams. |
| 4002 | fShortPreamble = 0; |
| 4003 | else |
| 4004 | psessionEntry->beaconParams. |
| 4005 | fShortPreamble = 1; |
| 4006 | } |
| 4007 | |
| 4008 | psessionEntry->isNonRoamReassoc = 1; |
| 4009 | if (eSIR_SUCCESS != |
| 4010 | lim_sta_send_add_bss(pMac, assocRsp, pBeaconStruct, |
| 4011 | &psessionEntry->pLimReAssocReq-> |
| 4012 | bssDescription, true, |
| 4013 | psessionEntry)) { |
| 4014 | lim_log(pMac, LOGE, |
| 4015 | FL |
| 4016 | ("Posting ADDBSS in the ReAssocContext has Failed ")); |
| 4017 | retStatus = eSIR_FAILURE; |
| 4018 | } |
| 4019 | if (retStatus != eSIR_SUCCESS) { |
| 4020 | mlmReassocCnf.resultCode = |
| 4021 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 4022 | mlmReassocCnf.protStatusCode = |
| 4023 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 4024 | qdf_mem_free(assocRsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4025 | pMac->lim.gLimAssocResponseData = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 4026 | qdf_mem_free(pBeaconStruct); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4027 | goto Error; |
| 4028 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 4029 | qdf_mem_free(assocRsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4030 | psessionEntry->limAssocResponseData = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 4031 | qdf_mem_free(pBeaconStruct); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4032 | } |
| 4033 | break; |
| 4034 | case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { |
| 4035 | /* Case wherein the DisAssoc / Deauth |
| 4036 | * being sent as response to ReAssoc Req |
| 4037 | * Send the Reason code as the same received |
| 4038 | * in Disassoc / Deauth Frame |
| 4039 | */ |
| 4040 | mlmReassocCnf.resultCode = |
| 4041 | pStaDs->mlmStaContext.disassocReason; |
| 4042 | mlmReassocCnf.protStatusCode = |
| 4043 | pStaDs->mlmStaContext.cleanupTrigger; |
| 4044 | /** Set the SME State back to WT_Reassoc State*/ |
| 4045 | psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE; |
| 4046 | lim_delete_dph_hash_entry(pMac, pStaDs->staAddr, |
| 4047 | pStaDs->assocId, psessionEntry); |
| 4048 | if (LIM_IS_STA_ROLE(psessionEntry)) { |
| 4049 | psessionEntry->limMlmState = |
| 4050 | eLIM_MLM_IDLE_STATE; |
| 4051 | MTRACE(mac_trace |
| 4052 | (pMac, TRACE_CODE_MLM_STATE, |
| 4053 | psessionEntry->peSessionId, |
| 4054 | psessionEntry->limMlmState)); |
| 4055 | } |
| 4056 | |
| 4057 | lim_post_sme_message(pMac, LIM_MLM_REASSOC_CNF, |
| 4058 | (uint32_t *) &mlmReassocCnf); |
| 4059 | } |
| 4060 | break; |
| 4061 | default: |
| 4062 | PELOGE(lim_log |
| 4063 | (pMac, LOGE, |
| 4064 | FL |
| 4065 | ("DelBss is being invoked in the wrong system Role /unhandled SME State")); |
| 4066 | ) |
| 4067 | mlmReassocCnf.resultCode = eSIR_SME_REFUSED; |
| 4068 | mlmReassocCnf.protStatusCode = |
| 4069 | eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 4070 | goto Error; |
| 4071 | } |
| 4072 | return; |
| 4073 | Error: |
| 4074 | lim_post_sme_message(pMac, LIM_MLM_REASSOC_CNF, |
| 4075 | (uint32_t *) &mlmReassocCnf); |
| 4076 | } |
| 4077 | |
| 4078 | void lim_send_beacon_ind(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 4079 | { |
| 4080 | tBeaconGenParams *pBeaconGenParams = NULL; |
| 4081 | tSirMsgQ limMsg; |
| 4082 | /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/ |
| 4083 | if (psessionEntry == NULL) { |
| 4084 | PELOGE(lim_log(pMac, LOGE, |
| 4085 | FL("Error:Unable to get the PESessionEntry")); |
| 4086 | ) |
| 4087 | return; |
| 4088 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 4089 | pBeaconGenParams = qdf_mem_malloc(sizeof(*pBeaconGenParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4090 | if (NULL == pBeaconGenParams) { |
| 4091 | PELOGE(lim_log(pMac, LOGP, |
| 4092 | FL |
| 4093 | ("Unable to allocate memory during sending beaconPreMessage")); |
| 4094 | ) |
| 4095 | return; |
| 4096 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 4097 | qdf_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0); |
| 4098 | qdf_mem_copy((void *)pBeaconGenParams->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4099 | (void *)psessionEntry->bssId, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4100 | limMsg.bodyptr = pBeaconGenParams; |
| 4101 | sch_process_pre_beacon_ind(pMac, &limMsg); |
| 4102 | return; |
| 4103 | } |
| 4104 | |
| 4105 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 4106 | /** |
| 4107 | * lim_send_sme_scan_cache_updated_ind() |
| 4108 | * |
| 4109 | ***FUNCTION: |
| 4110 | * This function is used to post WMA_SME_SCAN_CACHE_UPDATED message to WMA. |
| 4111 | * This message is the indication to WMA that all scan cache results |
| 4112 | * are updated from LIM to SME. Mainly used only in PNO offload case. |
| 4113 | * |
| 4114 | ***LOGIC: |
| 4115 | * |
| 4116 | ***ASSUMPTIONS: |
| 4117 | * This function should be called after posting scan cache results to SME. |
| 4118 | * |
| 4119 | ***NOTE: |
| 4120 | * NA |
| 4121 | * |
| 4122 | * @return None |
| 4123 | */ |
| 4124 | void lim_send_sme_scan_cache_updated_ind(uint8_t sessionId) |
| 4125 | { |
| 4126 | cds_msg_t msg; |
| 4127 | |
| 4128 | msg.type = WMA_SME_SCAN_CACHE_UPDATED; |
| 4129 | msg.reserved = 0; |
| 4130 | msg.bodyptr = NULL; |
| 4131 | msg.bodyval = sessionId; |
| 4132 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4133 | if (!QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4134 | (cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4135 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4136 | "%s: Not able to post WMA_SME_SCAN_CACHE_UPDATED message to WMA", |
| 4137 | __func__); |
| 4138 | } |
| 4139 | #endif |
| 4140 | |
| 4141 | void lim_send_scan_offload_complete(tpAniSirGlobal pMac, |
| 4142 | tSirScanOffloadEvent *pScanEvent) |
| 4143 | { |
| 4144 | |
| 4145 | pMac->lim.gLimRspReqd = false; |
| 4146 | lim_send_sme_scan_rsp(pMac, pScanEvent->reasonCode, |
| 4147 | pScanEvent->sessionId, 0, pScanEvent->scanId); |
| 4148 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 4149 | lim_send_sme_scan_cache_updated_ind(pScanEvent->sessionId); |
| 4150 | #endif |
| 4151 | } |
| 4152 | |
| 4153 | void lim_process_rx_scan_event(tpAniSirGlobal pMac, void *buf) |
| 4154 | { |
| 4155 | tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf; |
| 4156 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4157 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO, |
Deepak Dhamdhere | d97bfb3 | 2015-10-11 15:16:18 -0700 | [diff] [blame] | 4158 | "scan_id = %u, scan_requestor_id 0x%x", pScanEvent->scanId, |
| 4159 | pScanEvent->requestor); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4160 | switch (pScanEvent->event) { |
| 4161 | case SCAN_EVENT_STARTED: |
| 4162 | break; |
| 4163 | case SCAN_EVENT_START_FAILED: |
| 4164 | case SCAN_EVENT_COMPLETED: |
Deepak Dhamdhere | d97bfb3 | 2015-10-11 15:16:18 -0700 | [diff] [blame] | 4165 | if (ROC_SCAN_REQUESTOR_ID == pScanEvent->requestor) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4166 | lim_send_sme_roc_rsp(pMac, eWNI_SME_REMAIN_ON_CHN_RSP, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4167 | QDF_STATUS_SUCCESS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4168 | pScanEvent->sessionId, |
| 4169 | pScanEvent->scanId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 4170 | qdf_mem_free(pMac->lim.gpLimRemainOnChanReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4171 | pMac->lim.gpLimRemainOnChanReq = NULL; |
| 4172 | /* |
| 4173 | * If remain on channel timer expired and action frame |
| 4174 | * is pending then indicate confirmation with status |
| 4175 | * failure. |
| 4176 | */ |
| 4177 | if (pMac->lim.mgmtFrameSessionId != 0xff) { |
| 4178 | lim_send_sme_rsp(pMac, |
| 4179 | eWNI_SME_ACTION_FRAME_SEND_CNF, |
| 4180 | eSIR_SME_SEND_ACTION_FAIL, |
| 4181 | pMac->lim.mgmtFrameSessionId, 0); |
| 4182 | pMac->lim.mgmtFrameSessionId = 0xff; |
| 4183 | } |
Deepak Dhamdhere | d97bfb3 | 2015-10-11 15:16:18 -0700 | [diff] [blame] | 4184 | } else if (PREAUTH_REQUESTOR_ID == pScanEvent->requestor) { |
| 4185 | lim_preauth_scan_event_handler(pMac, pScanEvent->event, |
| 4186 | pScanEvent->sessionId, |
| 4187 | pScanEvent->scanId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4188 | } else { |
| 4189 | lim_send_scan_offload_complete(pMac, pScanEvent); |
| 4190 | } |
| 4191 | break; |
| 4192 | case SCAN_EVENT_FOREIGN_CHANNEL: |
Deepak Dhamdhere | d97bfb3 | 2015-10-11 15:16:18 -0700 | [diff] [blame] | 4193 | if (ROC_SCAN_REQUESTOR_ID == pScanEvent->requestor) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4194 | /*Send Ready on channel indication to SME */ |
| 4195 | if (pMac->lim.gpLimRemainOnChanReq) { |
| 4196 | lim_send_sme_roc_rsp(pMac, |
| 4197 | eWNI_SME_REMAIN_ON_CHN_RDY_IND, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4198 | QDF_STATUS_SUCCESS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4199 | pScanEvent->sessionId, |
| 4200 | pScanEvent->scanId); |
| 4201 | } else { |
| 4202 | lim_log(pMac, LOGE, |
| 4203 | FL("gpLimRemainOnChanReq is NULL")); |
| 4204 | } |
Deepak Dhamdhere | d97bfb3 | 2015-10-11 15:16:18 -0700 | [diff] [blame] | 4205 | } else if (PREAUTH_REQUESTOR_ID == pScanEvent->requestor) { |
| 4206 | lim_preauth_scan_event_handler(pMac, pScanEvent->event, |
| 4207 | pScanEvent->sessionId, |
| 4208 | pScanEvent->scanId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4209 | } |
| 4210 | break; |
| 4211 | case SCAN_EVENT_BSS_CHANNEL: |
| 4212 | case SCAN_EVENT_DEQUEUED: |
| 4213 | case SCAN_EVENT_PREEMPTED: |
| 4214 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4215 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4216 | "Received unhandled scan event %u", |
| 4217 | pScanEvent->event); |
| 4218 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 4219 | qdf_mem_free(buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4220 | } |