Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [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 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 24 | * This file limProcessMlmRspMessages.cc contains the code |
| 25 | * for processing response messages from MLM state machine. |
| 26 | * Author: Chandra Modumudi |
| 27 | * Date: 02/11/02 |
| 28 | * History:- |
| 29 | * Date Modified by Modification Information |
| 30 | * -------------------------------------------------------------------- |
| 31 | * |
| 32 | */ |
| 33 | #include "wniApi.h" |
| 34 | #ifdef ANI_PRODUCT_TYPE_AP |
| 35 | #include "wniCfgAp.h" |
| 36 | #else |
| 37 | #include "wniCfgSta.h" |
| 38 | #endif |
| 39 | #include "cfgApi.h" |
| 40 | #include "sirApi.h" |
| 41 | #include "schApi.h" |
| 42 | #include "utilsApi.h" |
| 43 | #include "limUtils.h" |
| 44 | #include "limAssocUtils.h" |
| 45 | #include "limSecurityUtils.h" |
| 46 | #include "limSerDesUtils.h" |
| 47 | #include "limTimerUtils.h" |
| 48 | #include "limSendMessages.h" |
| 49 | #include "limAdmitControl.h" |
| 50 | #include "limSendMessages.h" |
| 51 | #include "limIbssPeerMgmt.h" |
| 52 | #include "limSession.h" |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 53 | #include "limSessionUtils.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 54 | #if defined WLAN_FEATURE_VOWIFI |
| 55 | #include "rrmApi.h" |
| 56 | #endif |
| 57 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 58 | #include <limFT.h> |
| 59 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 60 | #include "wlan_qct_wda.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 61 | |
| 62 | static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 63 | static void limHandleSmeReaasocResult(tpAniSirGlobal, tSirResultCodes, tANI_U16, tpPESession); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 64 | void limProcessMlmScanCnf(tpAniSirGlobal, tANI_U32 *); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 65 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 66 | void limProcessMlmOemDataReqCnf(tpAniSirGlobal, tANI_U32 *); |
| 67 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 68 | void limProcessMlmJoinCnf(tpAniSirGlobal, tANI_U32 *); |
| 69 | void limProcessMlmAuthCnf(tpAniSirGlobal, tANI_U32 *); |
| 70 | void limProcessMlmStartCnf(tpAniSirGlobal, tANI_U32 *); |
| 71 | void limProcessMlmAuthInd(tpAniSirGlobal, tANI_U32 *); |
| 72 | void limProcessMlmAssocInd(tpAniSirGlobal, tANI_U32 *); |
| 73 | void limProcessMlmAssocCnf(tpAniSirGlobal, tANI_U32 *); |
| 74 | void limProcessMlmReassocCnf(tpAniSirGlobal, tANI_U32 *); |
| 75 | void limProcessMlmReassocInd(tpAniSirGlobal, tANI_U32 *); |
| 76 | void limProcessMlmSetKeysCnf(tpAniSirGlobal, tANI_U32 *); |
| 77 | void limProcessMlmDisassocInd(tpAniSirGlobal, tANI_U32 *); |
| 78 | void limProcessMlmDisassocCnf(tpAniSirGlobal, tANI_U32 *); |
| 79 | void limProcessMlmDeauthInd(tpAniSirGlobal, tANI_U32 *); |
| 80 | void limProcessMlmDeauthCnf(tpAniSirGlobal, tANI_U32 *); |
| 81 | void limProcessMlmPurgeStaInd(tpAniSirGlobal, tANI_U32 *); |
| 82 | void limProcessMlmAddBACnf(tpAniSirGlobal, tANI_U32 *); |
| 83 | void limProcessMlmDelBACnf(tpAniSirGlobal, tANI_U32 *); |
| 84 | void limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf); |
| 85 | static void limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry); |
| 86 | void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *); |
| 87 | static void |
| 88 | limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry); |
| 89 | /** |
| 90 | * limProcessMlmRspMessages() |
| 91 | * |
| 92 | *FUNCTION: |
| 93 | * This function is called to processes various MLM response (CNF/IND |
| 94 | * messages from MLM State machine. |
| 95 | * |
| 96 | *LOGIC: |
| 97 | * |
| 98 | *ASSUMPTIONS: |
| 99 | * |
| 100 | *NOTE: |
| 101 | * |
| 102 | * @param pMac Pointer to Global MAC structure |
| 103 | * @param msgType Indicates the MLM message type |
| 104 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 105 | * |
| 106 | * @return None |
| 107 | */ |
| 108 | void |
| 109 | limProcessMlmRspMessages(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf) |
| 110 | { |
| 111 | |
| 112 | if(pMsgBuf == NULL) |
| 113 | { |
| 114 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 115 | return; |
| 116 | } |
| 117 | switch (msgType) |
| 118 | { |
| 119 | case LIM_MLM_SCAN_CNF: |
| 120 | limProcessMlmScanCnf(pMac, pMsgBuf); |
| 121 | break; |
| 122 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 123 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 124 | case LIM_MLM_OEM_DATA_CNF: |
| 125 | limProcessMlmOemDataReqCnf(pMac, pMsgBuf); |
| 126 | break; |
| 127 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 128 | |
| 129 | case LIM_MLM_AUTH_CNF: |
| 130 | limProcessMlmAuthCnf(pMac, pMsgBuf); |
| 131 | break; |
| 132 | case LIM_MLM_AUTH_IND: |
| 133 | limProcessMlmAuthInd(pMac, pMsgBuf); |
| 134 | break; |
| 135 | case LIM_MLM_ASSOC_CNF: |
| 136 | limProcessMlmAssocCnf(pMac, pMsgBuf); |
| 137 | break; |
| 138 | case LIM_MLM_START_CNF: |
| 139 | limProcessMlmStartCnf(pMac, pMsgBuf); |
| 140 | break; |
| 141 | case LIM_MLM_JOIN_CNF: |
| 142 | limProcessMlmJoinCnf(pMac, pMsgBuf); |
| 143 | break; |
| 144 | case LIM_MLM_ASSOC_IND: |
| 145 | limProcessMlmAssocInd(pMac, pMsgBuf); |
| 146 | break; |
| 147 | case LIM_MLM_REASSOC_CNF: |
| 148 | limProcessMlmReassocCnf(pMac, pMsgBuf); |
| 149 | break; |
| 150 | case LIM_MLM_REASSOC_IND: |
| 151 | limProcessMlmReassocInd(pMac, pMsgBuf); |
| 152 | break; |
| 153 | case LIM_MLM_DISASSOC_CNF: |
| 154 | limProcessMlmDisassocCnf(pMac, pMsgBuf); |
| 155 | break; |
| 156 | case LIM_MLM_DISASSOC_IND: |
| 157 | limProcessMlmDisassocInd(pMac, pMsgBuf); |
| 158 | break; |
| 159 | case LIM_MLM_PURGE_STA_IND: |
| 160 | limProcessMlmPurgeStaInd(pMac, pMsgBuf); |
| 161 | break; |
| 162 | case LIM_MLM_DEAUTH_CNF: |
| 163 | limProcessMlmDeauthCnf(pMac, pMsgBuf); |
| 164 | break; |
| 165 | case LIM_MLM_DEAUTH_IND: |
| 166 | limProcessMlmDeauthInd(pMac, pMsgBuf); |
| 167 | break; |
| 168 | case LIM_MLM_SETKEYS_CNF: |
| 169 | limProcessMlmSetKeysCnf(pMac, pMsgBuf); |
| 170 | break; |
| 171 | case LIM_MLM_REMOVEKEY_CNF: |
| 172 | limProcessMlmRemoveKeyCnf(pMac, pMsgBuf); |
| 173 | break; |
| 174 | case LIM_MLM_TSPEC_CNF: |
| 175 | break; |
| 176 | case LIM_MLM_ADDBA_CNF: |
| 177 | limProcessMlmAddBACnf( pMac, pMsgBuf ); |
| 178 | break; |
| 179 | case LIM_MLM_DELBA_CNF: |
| 180 | limProcessMlmDelBACnf( pMac, pMsgBuf ); |
| 181 | break; |
| 182 | default: |
| 183 | break; |
| 184 | } // switch (msgType) |
| 185 | return; |
| 186 | } /*** end limProcessMlmRspMessages() ***/ |
| 187 | |
| 188 | /** |
| 189 | * limProcessMlmScanCnf() |
| 190 | * |
| 191 | *FUNCTION: |
| 192 | * This function is called to processes MLM_SCAN_CNF |
| 193 | * message from MLM State machine. |
| 194 | * |
| 195 | *LOGIC: |
| 196 | * |
| 197 | *ASSUMPTIONS: |
| 198 | * |
| 199 | *NOTE: |
| 200 | * |
| 201 | * @param pMac Pointer to Global MAC structure |
| 202 | * @param pMsgBuf A pointer to the MLM message buffer |
| 203 | * |
| 204 | * @return None |
| 205 | */ |
| 206 | void |
| 207 | limProcessMlmScanCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 208 | { |
| 209 | switch(pMac->lim.gLimSmeState) |
| 210 | { |
| 211 | case eLIM_SME_WT_SCAN_STATE: |
| 212 | //case eLIM_SME_LINK_EST_WT_SCAN_STATE: //TO SUPPORT BT-AMP |
| 213 | //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: //TO SUPPORT BT-AMP |
| 214 | pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 215 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 216 | pMac->lim.gLimSystemInScanLearnMode = 0; |
| 217 | break; |
| 218 | default: |
| 219 | /** |
| 220 | * Should not have received scan confirm |
| 221 | * from MLM in other states. |
| 222 | * Log error |
| 223 | */ |
| 224 | PELOGE(limLog(pMac, LOGE, |
| 225 | FL("received unexpected MLM_SCAN_CNF in state %X\n"), |
| 226 | pMac->lim.gLimSmeState);) |
| 227 | return; |
| 228 | } |
| 229 | |
| 230 | /// Process received scan confirm |
| 231 | /// Increment length of cached scan results |
| 232 | pMac->lim.gLimSmeScanResultLength += |
| 233 | ((tLimMlmScanCnf *) pMsgBuf)->scanResultLength; |
| 234 | if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults) |
| 235 | { |
| 236 | tANI_U16 scanRspLen = 0; |
| 237 | /// Need to send response to Host |
| 238 | pMac->lim.gLimRspReqd = false; |
| 239 | if ((((tLimMlmScanCnf *) pMsgBuf)->resultCode == |
| 240 | eSIR_SME_SUCCESS) || |
| 241 | pMac->lim.gLimSmeScanResultLength) |
| 242 | { |
| 243 | scanRspLen = sizeof(tSirSmeScanRsp) + |
| 244 | pMac->lim.gLimSmeScanResultLength - |
| 245 | sizeof(tSirBssDescription); |
| 246 | } |
| 247 | else |
| 248 | { |
| 249 | scanRspLen = sizeof(tSirSmeScanRsp); |
| 250 | } |
| 251 | if(pMac->lim.gLimReportBackgroundScanResults) |
| 252 | { |
| 253 | pMac->lim.gLimBackgroundScanTerminate = TRUE; |
| 254 | } |
| 255 | if (pMac->lim.gLimSmeScanResultLength == 0) |
| 256 | { |
| 257 | limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId); |
| 258 | } |
| 259 | else |
| 260 | { |
| 261 | limSendSmeScanRsp(pMac, scanRspLen, |
| 262 | eSIR_SME_SUCCESS,pMac->lim.gSmeSessionId, pMac->lim.gTransactionId); |
| 263 | } |
| 264 | } // if (pMac->lim.gLimRspReqd) |
| 265 | //check to see whether we need to run bgScan timer |
| 266 | if(pMac->lim.gLimBackgroundScanTerminate == FALSE) |
| 267 | { |
| 268 | if (tx_timer_activate( |
| 269 | &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS) |
| 270 | { |
| 271 | /// Could not activate background scan timer. |
| 272 | // Log error |
| 273 | limLog(pMac, LOGP, |
| 274 | FL("could not activate background scan timer\n")); |
| 275 | pMac->lim.gLimBackgroundScanStarted = FALSE; |
| 276 | } |
| 277 | else |
| 278 | { |
| 279 | pMac->lim.gLimBackgroundScanStarted = TRUE; |
| 280 | } |
| 281 | } |
| 282 | } /*** end limProcessMlmScanCnf() ***/ |
| 283 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 284 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 285 | |
| 286 | /** |
| 287 | * limProcessMlmOemDataReqCnf() |
| 288 | * |
| 289 | *FUNCTION: |
| 290 | * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF |
| 291 | * message from MLM State machine. |
| 292 | * |
| 293 | *LOGIC: |
| 294 | * |
| 295 | *ASSUMPTIONS: |
| 296 | * |
| 297 | *NOTE: |
| 298 | * |
| 299 | * @param pMac Pointer to Global MAC structure |
| 300 | * @param pMsgBuf A pointer to the MLM message buffer |
| 301 | * |
| 302 | * @return None |
| 303 | */ |
| 304 | |
| 305 | void limProcessMlmOemDataReqCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 306 | { |
| 307 | tLimMlmOemDataRsp* measRsp; |
| 308 | |
| 309 | tSirResultCodes resultCode = eSIR_SME_SUCCESS; |
| 310 | |
| 311 | measRsp = (tLimMlmOemDataRsp*)(pMsgBuf); |
| 312 | |
| 313 | //Now send the meas confirm message to the sme |
| 314 | limSendSmeOemDataRsp(pMac, (tANI_U32*)measRsp, resultCode); |
| 315 | |
| 316 | //Dont free the memory here. It will be freed up by the callee |
| 317 | |
| 318 | return; |
| 319 | } |
| 320 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 321 | |
| 322 | /** |
| 323 | * limProcessMlmStartCnf() |
| 324 | * |
| 325 | *FUNCTION: |
| 326 | * This function is called to processes MLM_START_CNF |
| 327 | * message from MLM State machine. |
| 328 | * |
| 329 | *LOGIC: |
| 330 | * |
| 331 | *ASSUMPTIONS: |
| 332 | * |
| 333 | *NOTE: |
| 334 | * |
| 335 | * @param pMac Pointer to Global MAC structure |
| 336 | * @param pMsgBuf A pointer to the MLM message buffer |
| 337 | * |
| 338 | * @return None |
| 339 | */ |
| 340 | void |
| 341 | limProcessMlmStartCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 342 | { |
| 343 | tpPESession psessionEntry = NULL; |
| 344 | tLimMlmStartCnf *pLimMlmStartCnf; |
| 345 | tANI_U8 smesessionId; |
| 346 | tANI_U16 smetransactionId; |
| 347 | |
| 348 | if(pMsgBuf == NULL) |
| 349 | { |
| 350 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 351 | return; |
| 352 | } |
| 353 | pLimMlmStartCnf = (tLimMlmStartCnf*)pMsgBuf; |
| 354 | if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmStartCnf->sessionId))==NULL) |
| 355 | { |
| 356 | PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId \n"));) |
| 357 | return; |
| 358 | } |
| 359 | smesessionId = psessionEntry->smeSessionId; |
| 360 | smetransactionId = psessionEntry->transactionId; |
| 361 | |
| 362 | if (psessionEntry->limSmeState != eLIM_SME_WT_START_BSS_STATE) |
| 363 | { |
| 364 | /** |
| 365 | * Should not have received Start confirm from MLM |
| 366 | * in other states. |
| 367 | * Log error |
| 368 | */ |
| 369 | PELOGE(limLog(pMac, LOGE, |
| 370 | FL("received unexpected MLM_START_CNF in state %X\n"), |
| 371 | psessionEntry->limSmeState);) |
| 372 | return; |
| 373 | } |
| 374 | if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == |
| 375 | eSIR_SME_SUCCESS) |
| 376 | { |
| 377 | |
| 378 | /** |
| 379 | * Update global SME state so that Beacon Generation |
| 380 | * module starts writing Beacon frames into TFP's |
| 381 | * Beacon file register. |
| 382 | */ |
| 383 | psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 384 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 385 | if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE) |
| 386 | { |
| 387 | limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***\n")); |
| 388 | } |
| 389 | else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE) |
| 390 | { |
| 391 | limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP AP SIDE***\n")); |
| 392 | } |
| 393 | #ifdef WLAN_SOFTAP_FEATURE |
| 394 | else if(psessionEntry->bssType == eSIR_INFRA_AP_MODE) |
| 395 | { |
| 396 | limLog(pMac, LOG1, FL("*** Started BSS in INFRA AP SIDE***\n")); |
| 397 | } |
| 398 | #endif |
| 399 | else |
| 400 | PELOG1(limLog(pMac, LOG1, FL("*** Started BSS ***\n"));) |
| 401 | } |
| 402 | else |
| 403 | { |
| 404 | /// Start BSS is a failure |
| 405 | peDeleteSession(pMac,psessionEntry); |
| 406 | psessionEntry = NULL; |
| 407 | } |
| 408 | /// Send response to Host |
| 409 | limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, |
| 410 | ((tLimMlmStartCnf *) pMsgBuf)->resultCode,psessionEntry, |
| 411 | smesessionId,smetransactionId); |
| 412 | #ifdef WLAN_SOFTAP_FEATURE |
| 413 | if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS) |
| 414 | { |
| 415 | //Configure beacon and send beacons to HAL |
| 416 | limSendBeaconInd(pMac, psessionEntry); |
| 417 | } |
| 418 | #endif |
| 419 | } |
| 420 | |
| 421 | /*** end limProcessMlmStartCnf() ***/ |
| 422 | |
| 423 | /** |
| 424 | * limProcessMlmJoinCnf() |
| 425 | * |
| 426 | *FUNCTION: |
| 427 | * This function is called to processes MLM_JOIN_CNF |
| 428 | * message from MLM State machine. |
| 429 | * |
| 430 | *LOGIC: |
| 431 | * |
| 432 | *ASSUMPTIONS: |
| 433 | * |
| 434 | *NOTE: |
| 435 | * |
| 436 | * @param pMac Pointer to Global MAC structure |
| 437 | * @param pMsgBuf A pointer to the MLM message buffer |
| 438 | * |
| 439 | * @return None |
| 440 | */ |
| 441 | void |
| 442 | limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 443 | { |
| 444 | tSirResultCodes resultCode; |
| 445 | tLimMlmJoinCnf *pLimMlmJoinCnf; |
| 446 | tpPESession psessionEntry; |
| 447 | pLimMlmJoinCnf = (tLimMlmJoinCnf*)pMsgBuf; |
| 448 | if( (psessionEntry = peFindSessionBySessionId(pMac,pLimMlmJoinCnf->sessionId))== NULL) |
| 449 | { |
| 450 | PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId\n"));) |
| 451 | return; |
| 452 | } |
| 453 | |
| 454 | if (psessionEntry->limSmeState!= eLIM_SME_WT_JOIN_STATE) |
| 455 | { |
| 456 | PELOGE(limLog(pMac, LOGE, |
| 457 | FL("received unexpected MLM_JOIN_CNF in state %X\n"), |
| 458 | psessionEntry->limSmeState);) |
| 459 | return; |
| 460 | } |
| 461 | |
| 462 | resultCode = ((tLimMlmJoinCnf *) pMsgBuf)->resultCode ; |
| 463 | /// Process Join confirm from MLM |
| 464 | if (resultCode == eSIR_SME_SUCCESS) |
| 465 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 466 | PELOG1(limLog(pMac, LOG1, FL("*** Joined ESS ***"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 467 | //Setup hardware upfront |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 468 | //Done: 7-27-2009. JIM_FIX_ME sessionize the following function |
| 469 | if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS) |
| 470 | return; |
| 471 | else |
| 472 | resultCode = eSIR_SME_REFUSED; |
| 473 | } |
| 474 | { |
| 475 | /// Join failure |
| 476 | psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 477 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 478 | /// Send Join response to Host |
| 479 | limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry ); |
| 480 | } |
| 481 | } /*** end limProcessMlmJoinCnf() ***/ |
| 482 | |
| 483 | /** |
| 484 | * limProcessMlmAuthCnf() |
| 485 | * |
| 486 | *FUNCTION: |
| 487 | * This function is called to processes MLM_AUTH_CNF |
| 488 | * message from MLM State machine. |
| 489 | * |
| 490 | *LOGIC: |
| 491 | * |
| 492 | *ASSUMPTIONS: |
| 493 | * |
| 494 | *NOTE: |
| 495 | * |
| 496 | * @param pMac Pointer to Global MAC structure |
| 497 | * @param pMsgBuf A pointer to the MLM message buffer |
| 498 | * |
| 499 | * @return None |
| 500 | */ |
| 501 | void |
| 502 | limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 503 | { |
| 504 | tANI_U16 caps; |
| 505 | tANI_U32 val; |
| 506 | tAniAuthType cfgAuthType, authMode; |
| 507 | tLimMlmAuthReq *pMlmAuthReq; |
| 508 | tLimMlmAssocReq *pMlmAssocReq; |
| 509 | tLimMlmAuthCnf *pMlmAuthCnf; |
| 510 | tpPESession psessionEntry; |
| 511 | tANI_U32 teleBcnEn = 0; |
| 512 | // tANI_U8 sessionId; |
| 513 | |
| 514 | if(pMsgBuf == NULL) |
| 515 | { |
| 516 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 517 | return; |
| 518 | } |
| 519 | pMlmAuthCnf = (tLimMlmAuthCnf*)pMsgBuf; |
| 520 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAuthCnf->sessionId))== NULL) |
| 521 | { |
| 522 | PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId\n"));) |
| 523 | return; |
| 524 | } |
| 525 | |
| 526 | if (((psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) && |
| 527 | (psessionEntry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE)) || |
| 528 | (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) |
| 529 | { |
| 530 | /** |
| 531 | * Should not have received AUTH confirm |
| 532 | * from MLM in other states or on AP. |
| 533 | * Log error |
| 534 | */ |
| 535 | PELOGE(limLog(pMac, LOGE, |
| 536 | FL("received unexpected MLM_AUTH_CNF in state %X\n"), |
| 537 | psessionEntry->limSmeState);) |
| 538 | return; |
| 539 | } |
| 540 | /// Process AUTH confirm from MLM |
| 541 | if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS) |
| 542 | { |
| 543 | if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE) |
| 544 | { |
| 545 | if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE, |
| 546 | (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS) |
| 547 | { |
| 548 | /** |
| 549 | * Could not get AuthType value from CFG. |
| 550 | * Log error. |
| 551 | */ |
| 552 | limLog(pMac, LOGP, |
| 553 | FL("could not retrieve AuthType value\n")); |
| 554 | } |
| 555 | } |
| 556 | else |
| 557 | cfgAuthType = pMac->lim.gLimPreAuthType; |
| 558 | |
| 559 | if ((cfgAuthType == eSIR_AUTO_SWITCH) && |
| 560 | (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM) |
| 561 | && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode)) |
| 562 | { |
| 563 | /** |
| 564 | * When Open authentication fails with reason code "13" and |
| 565 | * authType set to 'auto switch', Try with Shared Authentication |
| 566 | */ |
| 567 | authMode = eSIR_SHARED_KEY; |
| 568 | // Trigger MAC based Authentication |
| 569 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAuthReq, sizeof(tLimMlmAuthReq))) |
| 570 | { |
| 571 | // Log error |
| 572 | limLog(pMac, LOGP, |
| 573 | FL("call to palAllocateMemory failed for mlmAuthReq\n")); |
| 574 | return; |
| 575 | } |
| 576 | palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq)); |
| 577 | val = sizeof(tSirMacAddr); |
| 578 | if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE) |
| 579 | { |
| 580 | sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId); |
| 581 | } |
| 582 | else |
| 583 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmAuthReq->peerMacAddr, |
| 584 | (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr, |
| 585 | sizeof(tSirMacAddr)); |
| 586 | pMlmAuthReq->authType = authMode; |
| 587 | /* Update PE session Id*/ |
| 588 | pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId; |
| 589 | if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT, |
| 590 | (tANI_U32 *) &pMlmAuthReq->authFailureTimeout) |
| 591 | != eSIR_SUCCESS) |
| 592 | { |
| 593 | /** |
| 594 | * Could not get AuthFailureTimeout value from CFG. |
| 595 | * Log error. |
| 596 | */ |
| 597 | limLog(pMac, LOGP, |
| 598 | FL("could not retrieve AuthFailureTimeout value\n")); |
| 599 | } |
| 600 | limPostMlmMessage(pMac, |
| 601 | LIM_MLM_AUTH_REQ, |
| 602 | (tANI_U32 *) pMlmAuthReq); |
| 603 | return; |
| 604 | } |
| 605 | else |
| 606 | { |
| 607 | // MAC based authentication failure |
| 608 | if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE) |
| 609 | { |
| 610 | PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred.\n"));) |
| 611 | psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 612 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 613 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 614 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
| 615 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 616 | #if defined(ANI_AP_CLIENT_SDK) |
| 617 | if (psessionEntry->limSystemRole == eLIM_STA_ROLE) |
| 618 | { |
| 619 | tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0}; |
| 620 | PELOGE(limLog(pMac, LOGE, FL("Setting current BSSID as NULL in cfg\n"));) |
| 621 | palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr)); |
| 622 | if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS) |
| 623 | { |
| 624 | limLog(pMac, LOGP, FL("Could not update BSSID on CFG")); |
| 625 | } |
| 626 | } |
| 627 | #endif |
| 628 | /** |
| 629 | * Need to send Join response with |
| 630 | * auth failure to Host. |
| 631 | */ |
| 632 | limHandleSmeJoinResult(pMac, |
| 633 | ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry); |
| 634 | } |
| 635 | else |
| 636 | { |
| 637 | /** |
| 638 | * Pre-authentication failure. |
| 639 | * Send Pre-auth failure response to host |
| 640 | */ |
| 641 | psessionEntry->limSmeState = psessionEntry->limPrevSmeState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 642 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 643 | limSendSmeAuthRsp( |
| 644 | pMac, |
| 645 | ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, |
| 646 | ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr, |
| 647 | ((tLimMlmAuthCnf *) pMsgBuf)->authType, |
| 648 | ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId); |
| 649 | } |
| 650 | } // end if (cfgAuthType == eAUTO_SWITCH) |
| 651 | } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ... |
| 652 | else |
| 653 | { |
| 654 | if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE) |
| 655 | { |
| 656 | /** |
| 657 | * Successful MAC based authentication |
| 658 | * Trigger Association with BSS |
| 659 | */ |
| 660 | PELOG1(limLog(pMac, LOG1, |
| 661 | FL("*** Authenticated with BSS ***\n"));) |
| 662 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAssocReq, sizeof(tLimMlmAssocReq))) |
| 663 | { |
| 664 | // Log error |
| 665 | limLog(pMac, LOGP, |
| 666 | FL("call to palAllocateMemory failed for mlmAssocReq\n")); |
| 667 | return; |
| 668 | } |
| 669 | val = sizeof(tSirMacAddr); |
| 670 | #if 0 |
| 671 | if (cfgGetStr(pMac, WNI_CFG_BSSID, |
| 672 | pMlmAssocReq->peerMacAddr, |
| 673 | &val) != eSIR_SUCCESS) |
| 674 | { |
| 675 | /// Could not get BSSID from CFG. Log error. |
| 676 | limLog(pMac, LOGP, FL("could not retrieve BSSID\n")); |
| 677 | } |
| 678 | #endif //SUPPORT BT-AMP |
| 679 | sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId); |
| 680 | if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT, |
| 681 | (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout) |
| 682 | != eSIR_SUCCESS) |
| 683 | { |
| 684 | /** |
| 685 | * Could not get AssocFailureTimeout value |
| 686 | * from CFG. Log error. |
| 687 | */ |
| 688 | limLog(pMac, LOGP, |
| 689 | FL("could not retrieve AssocFailureTimeout value\n")); |
| 690 | } |
| 691 | if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS) |
| 692 | { |
| 693 | /** |
| 694 | * Could not get Capabilities value |
| 695 | * from CFG. Log error. |
| 696 | */ |
| 697 | limLog(pMac, LOGP, |
| 698 | FL("could not retrieve Capabilities value\n")); |
| 699 | } |
| 700 | /*Clear spectrum management bit if AP doesn't support it*/ |
| 701 | if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) |
| 702 | { |
| 703 | /*AP doesn't support spectrum management clear spectrum management bit*/ |
| 704 | caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK); |
| 705 | } |
| 706 | |
| 707 | pMlmAssocReq->capabilityInfo = caps; |
| 708 | PELOG3(limLog(pMac, LOG3, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 709 | FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x\n"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 710 | caps, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 711 | ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy, |
| 712 | ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 713 | |
| 714 | /* If telescopic beaconing is enabled, set listen interval to |
| 715 | WNI_CFG_TELE_BCN_MAX_LI */ |
| 716 | if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) != |
| 717 | eSIR_SUCCESS) |
| 718 | limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN\n")); |
| 719 | |
| 720 | val = WNI_CFG_LISTEN_INTERVAL_STADEF; |
| 721 | |
| 722 | if(teleBcnEn) |
| 723 | { |
| 724 | if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != |
| 725 | eSIR_SUCCESS) |
| 726 | { |
| 727 | /** |
| 728 | * Could not get ListenInterval value |
| 729 | * from CFG. Log error. |
| 730 | */ |
| 731 | limLog(pMac, LOGP, FL("could not retrieve ListenInterval\n")); |
| 732 | } |
| 733 | } |
| 734 | else |
| 735 | { |
| 736 | if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS) |
| 737 | { |
| 738 | /** |
| 739 | * Could not get ListenInterval value |
| 740 | * from CFG. Log error. |
| 741 | */ |
| 742 | limLog(pMac, LOGP, FL("could not retrieve ListenInterval\n")); |
| 743 | } |
| 744 | } |
| 745 | |
| 746 | pMlmAssocReq->listenInterval = (tANI_U16)val; |
| 747 | /* Update PE session ID*/ |
| 748 | pMlmAssocReq->sessionId = psessionEntry->peSessionId; |
| 749 | psessionEntry->limPrevSmeState = psessionEntry->limSmeState; |
| 750 | psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 751 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 752 | limPostMlmMessage(pMac, |
| 753 | LIM_MLM_ASSOC_REQ, |
| 754 | (tANI_U32 *) pMlmAssocReq); |
| 755 | } |
| 756 | else |
| 757 | { |
| 758 | /** |
| 759 | * Successful Pre-authentication. |
| 760 | * Send Pre-auth response to host |
| 761 | */ |
| 762 | psessionEntry->limSmeState = psessionEntry->limPrevSmeState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 763 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 764 | limSendSmeAuthRsp( |
| 765 | pMac, |
| 766 | ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, |
| 767 | ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr, |
| 768 | ((tLimMlmAuthCnf *) pMsgBuf)->authType, |
| 769 | ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId); |
| 770 | } |
| 771 | } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ... |
| 772 | } /*** end limProcessMlmAuthCnf() ***/ |
| 773 | |
| 774 | /** |
| 775 | * limProcessMlmAssocCnf() |
| 776 | * |
| 777 | *FUNCTION: |
| 778 | * This function is called to processes MLM_ASSOC_CNF |
| 779 | * message from MLM State machine. |
| 780 | * |
| 781 | *LOGIC: |
| 782 | * |
| 783 | *ASSUMPTIONS: |
| 784 | * |
| 785 | *NOTE: |
| 786 | * |
| 787 | * @param pMac Pointer to Global MAC structure |
| 788 | * @param pMsgBuf A pointer to the MLM message buffer |
| 789 | * |
| 790 | * @return None |
| 791 | */ |
| 792 | void |
| 793 | limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 794 | { |
| 795 | tpPESession psessionEntry; |
| 796 | tLimMlmAssocCnf *pLimMlmAssocCnf; |
| 797 | |
| 798 | if(pMsgBuf == NULL) |
| 799 | { |
| 800 | limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n")); |
| 801 | return; |
| 802 | } |
| 803 | pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf; |
| 804 | if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL) |
| 805 | { |
| 806 | PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId\n"));) |
| 807 | return; |
| 808 | } |
| 809 | if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE || |
| 810 | psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE) |
| 811 | { |
| 812 | /** |
| 813 | * Should not have received Assocication confirm |
| 814 | * from MLM in other states OR on AP. |
| 815 | * Log error |
| 816 | */ |
| 817 | PELOGE(limLog(pMac, LOGE, |
| 818 | FL("received unexpected MLM_ASSOC_CNF in state %X\n"), |
| 819 | psessionEntry->limSmeState);) |
| 820 | return; |
| 821 | } |
| 822 | if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS) |
| 823 | { |
| 824 | // Association failure |
| 825 | PELOG1(limLog(pMac, LOG1, FL("*** Association failure ***\n"));) |
| 826 | psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 827 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 828 | #if defined(ANI_AP_CLIENT_SDK) |
| 829 | if (psessionEntry->limSystemRole == eLIM_STA_ROLE) |
| 830 | { |
| 831 | tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0}; |
| 832 | palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr)); |
| 833 | if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS) |
| 834 | { |
| 835 | limLog(pMac, LOGP, FL("Could not update BSSID on CFG")); |
| 836 | } |
| 837 | } |
| 838 | #endif |
| 839 | /** |
| 840 | * Need to send Join response with |
| 841 | * Association failure to Host. |
| 842 | */ |
| 843 | limHandleSmeJoinResult(pMac, |
| 844 | ((tLimMlmAssocCnf *) pMsgBuf)->resultCode, |
| 845 | ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry); |
| 846 | } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ... |
| 847 | else |
| 848 | { |
| 849 | // Successful Association |
| 850 | PELOG1(limLog(pMac, LOG1, FL("*** Associated with BSS ***\n"));) |
| 851 | psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 852 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 853 | /** |
| 854 | * Need to send Join response with |
| 855 | * Association success to Host. |
| 856 | */ |
| 857 | limHandleSmeJoinResult(pMac, |
| 858 | ((tLimMlmAssocCnf *) pMsgBuf)->resultCode, |
| 859 | ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry); |
| 860 | } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != .... |
| 861 | } /*** end limProcessMlmAssocCnf() ***/ |
| 862 | |
| 863 | /** |
| 864 | * limProcessMlmReassocCnf() |
| 865 | * |
| 866 | *FUNCTION: |
| 867 | * This function is called to processes MLM_REASSOC_CNF |
| 868 | * message from MLM State machine. |
| 869 | * |
| 870 | *LOGIC: |
| 871 | * |
| 872 | *ASSUMPTIONS: |
| 873 | * |
| 874 | *NOTE: |
| 875 | * |
| 876 | * @param pMac Pointer to Global MAC structure |
| 877 | * @param pMsgBuf A pointer to the MLM message buffer |
| 878 | * |
| 879 | * @return None |
| 880 | */ |
| 881 | void |
| 882 | limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 883 | { |
| 884 | tpPESession psessionEntry; |
| 885 | tLimMlmReassocCnf *pLimMlmReassocCnf; |
| 886 | |
| 887 | if(pMsgBuf == NULL) |
| 888 | { |
| 889 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 890 | return; |
| 891 | } |
| 892 | pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf; |
| 893 | if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL) |
| 894 | { |
| 895 | PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id\n"));) |
| 896 | return; |
| 897 | } |
| 898 | if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) || |
| 899 | (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) |
| 900 | { |
| 901 | /** |
| 902 | * Should not have received Reassocication confirm |
| 903 | * from MLM in other states OR on AP. |
| 904 | * Log error |
| 905 | */ |
| 906 | PELOGE(limLog(pMac, LOGE, |
| 907 | FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state 0x%X\n"), |
| 908 | psessionEntry->limSystemRole, psessionEntry->limSmeState);) |
| 909 | return; |
| 910 | } |
| 911 | if (psessionEntry->pLimReAssocReq) { |
| 912 | palFreeMemory( pMac->hHdd, psessionEntry->pLimReAssocReq); |
| 913 | psessionEntry->pLimReAssocReq = NULL; |
| 914 | } |
| 915 | |
| 916 | PELOGE(limLog(pMac, LOGE, FL("Rcv MLM_REASSOC_CNF with result code %d\n"), pLimMlmReassocCnf->resultCode);) |
| 917 | if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) { |
| 918 | // Successful Reassociation |
| 919 | PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***\n"));) |
| 920 | |
| 921 | psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 922 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 923 | |
| 924 | /** |
| 925 | * Need to send Reassoc response with |
| 926 | * Reassociation success to Host. |
| 927 | */ |
| 928 | limSendSmeJoinReassocRsp( |
| 929 | pMac, eWNI_SME_REASSOC_RSP, |
| 930 | pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry, |
| 931 | psessionEntry->smeSessionId,psessionEntry->transactionId); |
| 932 | }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) { |
| 933 | /** Reassociation failure With the New AP |
| 934 | * but we still have the link with the Older AP |
| 935 | */ |
| 936 | psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 937 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 938 | |
| 939 | /** |
| 940 | * Need to send Reassoc response with |
| 941 | * Association failure to Host. |
| 942 | */ |
| 943 | limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, |
| 944 | pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry, |
| 945 | psessionEntry->smeSessionId,psessionEntry->transactionId); |
| 946 | }else { |
| 947 | // Reassociation failure |
| 948 | psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 949 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 950 | /** |
| 951 | * Need to send Reassoc response with |
| 952 | * Association failure to Host. |
| 953 | */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 954 | limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 955 | } |
| 956 | } /*** end limProcessMlmReassocCnf() ***/ |
| 957 | |
| 958 | /** |
| 959 | * limProcessMlmReassocInd() |
| 960 | * |
| 961 | *FUNCTION: |
| 962 | * This function is called to processes MLM_REASSOC_IND |
| 963 | * message from MLM State machine. |
| 964 | * |
| 965 | *LOGIC: |
| 966 | * |
| 967 | *ASSUMPTIONS: |
| 968 | * |
| 969 | *NOTE: |
| 970 | * |
| 971 | * @param pMac Pointer to Global MAC structure |
| 972 | * @param pMsgBuf A pointer to the MLM message buffer |
| 973 | * |
| 974 | * @return None |
| 975 | */ |
| 976 | void |
| 977 | limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 978 | { |
| 979 | tANI_U32 len; |
| 980 | tSirMsgQ msgQ; |
| 981 | tSirSmeReassocInd *pSirSmeReassocInd; |
| 982 | tpDphHashNode pStaDs=0; |
| 983 | tpPESession psessionEntry; |
| 984 | tANI_U8 sessionId; |
| 985 | if(pMsgBuf == NULL) |
| 986 | { |
| 987 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 988 | return; |
| 989 | } |
| 990 | if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL) |
| 991 | { |
| 992 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));) |
| 993 | return; |
| 994 | } |
| 995 | /// Inform Host of STA reassociation |
| 996 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 997 | len = sizeof(tSirSmeReassocInd) - |
| 998 | sizeof(tSirNeighborBssInfo) + |
| 999 | (((tpLimMlmReassocInd) pMsgBuf)->numBss * |
| 1000 | sizeof(tSirNeighborBssInfo)) - |
| 1001 | SIR_MAC_MAX_SSID_LENGTH + |
| 1002 | ((tpLimMlmReassocInd) pMsgBuf)->ssId.length; |
| 1003 | #else |
| 1004 | len = sizeof(tSirSmeReassocInd); |
| 1005 | #endif |
| 1006 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeReassocInd, len)) |
| 1007 | { |
| 1008 | // Log error |
| 1009 | limLog(pMac, LOGP, |
| 1010 | FL("call to palAllocateMemory failed for eWNI_SME_REASSOC_IND\n")); |
| 1011 | return; |
| 1012 | |
| 1013 | } |
| 1014 | sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType, |
| 1015 | eWNI_SME_REASSOC_IND); |
| 1016 | limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf, |
| 1017 | (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry); |
| 1018 | |
| 1019 | // Required for indicating the frames to upper layer |
| 1020 | pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength; |
| 1021 | pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr; |
| 1022 | pSirSmeReassocInd->beaconPtr = psessionEntry->beacon; |
| 1023 | pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen; |
| 1024 | |
| 1025 | msgQ.type = eWNI_SME_REASSOC_IND; |
| 1026 | msgQ.bodyptr = pSirSmeReassocInd; |
| 1027 | msgQ.bodyval = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1028 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1029 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 1030 | limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0); |
| 1031 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 1032 | pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable); |
| 1033 | if (! pStaDs) |
| 1034 | { |
| 1035 | limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)\n"), |
| 1036 | ((tpLimMlmReassocInd) pMsgBuf)->aid); |
| 1037 | palFreeMemory(pMac->hHdd, pSirSmeReassocInd); |
| 1038 | return; |
| 1039 | } |
| 1040 | |
| 1041 | limSysProcessMmhMsgApi(pMac, &msgQ, ePROT); |
| 1042 | PELOG1(limLog(pMac, LOG1, |
| 1043 | FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND\n"));) |
| 1044 | /* |
| 1045 | ** turn on a timer to detect the loss of REASSOC CNF |
| 1046 | **/ |
| 1047 | limActivateCnfTimer(pMac, |
| 1048 | (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry); |
| 1049 | } /*** end limProcessMlmReassocInd() ***/ |
| 1050 | |
| 1051 | /** |
| 1052 | * limProcessMlmAuthInd() |
| 1053 | * |
| 1054 | *FUNCTION: |
| 1055 | * This function is called to processes MLM_AUTH_IND |
| 1056 | * message from MLM State machine. |
| 1057 | * |
| 1058 | *LOGIC: |
| 1059 | * |
| 1060 | *ASSUMPTIONS: |
| 1061 | * |
| 1062 | *NOTE: |
| 1063 | * |
| 1064 | * @param pMac Pointer to Global MAC structure |
| 1065 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1066 | * |
| 1067 | * @return None |
| 1068 | */ |
| 1069 | void |
| 1070 | limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1071 | { |
| 1072 | tSirMsgQ msgQ; |
| 1073 | tSirSmeAuthInd *pSirSmeAuthInd; |
| 1074 | |
| 1075 | if(pMsgBuf == NULL) |
| 1076 | { |
| 1077 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 1078 | return; |
| 1079 | } |
| 1080 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeAuthInd, sizeof(tSirSmeAuthInd))) |
| 1081 | { |
| 1082 | // Log error |
| 1083 | limLog(pMac, LOGP, |
| 1084 | FL("call to palAllocateMemory failed for eWNI_SME_AUTH_IND\n")); |
| 1085 | } |
| 1086 | limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND); |
| 1087 | limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf, |
| 1088 | (tANI_U8 *) &(pSirSmeAuthInd->length)); |
| 1089 | msgQ.type = eWNI_SME_AUTH_IND; |
| 1090 | msgQ.bodyptr = pSirSmeAuthInd; |
| 1091 | msgQ.bodyval = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1092 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1093 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 1094 | limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0); |
| 1095 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 1096 | limSysProcessMmhMsgApi(pMac, &msgQ, ePROT); |
| 1097 | } /*** end limProcessMlmAuthInd() ***/ |
| 1098 | |
| 1099 | |
| 1100 | |
| 1101 | |
| 1102 | void |
| 1103 | limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, |
| 1104 | tSirSmeAssocInd *pSirSmeAssocInd, |
| 1105 | tpPESession psessionEntry) |
| 1106 | { |
| 1107 | pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd); |
| 1108 | pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId; |
| 1109 | |
| 1110 | // Required for indicating the frames to upper layer |
| 1111 | pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength; |
| 1112 | pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr; |
| 1113 | |
| 1114 | pSirSmeAssocInd->beaconPtr = psessionEntry->beacon; |
| 1115 | pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen; |
| 1116 | |
| 1117 | // Fill in peerMacAddr |
| 1118 | palCopyMemory( pMac->hHdd, pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 1119 | // Fill in aid |
| 1120 | pSirSmeAssocInd->aid = pAssocInd->aid; |
| 1121 | // Fill in bssId |
| 1122 | palCopyMemory( pMac->hHdd, pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 1123 | // Fill in staId |
| 1124 | //pSirSmeAssocInd->staId = psessionEntry->staId; |
| 1125 | // Fill in authType |
| 1126 | pSirSmeAssocInd->authType = pAssocInd->authType; |
| 1127 | // Fill in ssId |
| 1128 | palCopyMemory( pMac->hHdd, (tANI_U8*)&pSirSmeAssocInd->ssId, |
| 1129 | (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1); |
| 1130 | pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length; |
| 1131 | palCopyMemory( pMac->hHdd, (tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata, |
| 1132 | (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata), |
| 1133 | pAssocInd->rsnIE.length); |
| 1134 | |
| 1135 | pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length; |
| 1136 | palCopyMemory( pMac->hHdd, (tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata, |
| 1137 | (tANI_U8 *) &(pAssocInd->addIE.addIEdata), |
| 1138 | pAssocInd->addIE.length); |
| 1139 | |
| 1140 | // Copy the new TITAN capabilities |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1141 | pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator; |
| 1142 | if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE) |
| 1143 | { |
| 1144 | pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower; |
| 1145 | pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower; |
| 1146 | pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl; |
| 1147 | palCopyMemory( pMac->hHdd, (tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList, |
| 1148 | (tANI_U8 *) &(pAssocInd->supportedChannels.channelList), |
| 1149 | pAssocInd->supportedChannels.numChnl); |
| 1150 | } |
| 1151 | #ifdef WLAN_SOFTAP_FEATURE |
| 1152 | // Fill in WmmInfo |
| 1153 | pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent; |
| 1154 | #endif |
| 1155 | } /*** end limAssocIndSerDes() ***/ |
| 1156 | |
| 1157 | |
| 1158 | |
| 1159 | /** |
| 1160 | * limProcessMlmAssocInd() |
| 1161 | * |
| 1162 | *FUNCTION: |
| 1163 | * This function is called to processes MLM_ASSOC_IND |
| 1164 | * message from MLM State machine. |
| 1165 | * |
| 1166 | *LOGIC: |
| 1167 | * |
| 1168 | *ASSUMPTIONS: |
| 1169 | * |
| 1170 | *NOTE: |
| 1171 | * |
| 1172 | * @param pMac Pointer to Global MAC structure |
| 1173 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1174 | * |
| 1175 | * @return None |
| 1176 | */ |
| 1177 | void |
| 1178 | limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1179 | { |
| 1180 | tANI_U32 len; |
| 1181 | tSirMsgQ msgQ; |
| 1182 | tSirSmeAssocInd *pSirSmeAssocInd; |
| 1183 | tpDphHashNode pStaDs=0; |
| 1184 | tpPESession psessionEntry; |
| 1185 | if(pMsgBuf == NULL) |
| 1186 | { |
| 1187 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 1188 | return; |
| 1189 | } |
| 1190 | if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL) |
| 1191 | { |
| 1192 | limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId\n" )); |
| 1193 | return; |
| 1194 | } |
| 1195 | /// Inform Host of STA association |
| 1196 | #if defined (ANI_PRODUCT_TYPE_AP) |
| 1197 | len = sizeof(tSirSmeAssocInd) - |
| 1198 | sizeof(tSirNeighborBssInfo) + |
| 1199 | (((tpLimMlmAssocInd) pMsgBuf)->numBss * |
| 1200 | sizeof(tSirNeighborBssInfo)) - |
| 1201 | SIR_MAC_MAX_SSID_LENGTH + |
| 1202 | ((tpLimMlmAssocInd) pMsgBuf)->ssId.length; |
| 1203 | #else |
| 1204 | len = sizeof(tSirSmeAssocInd); |
| 1205 | #endif |
| 1206 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeAssocInd, len)) |
| 1207 | { |
| 1208 | // Log error |
| 1209 | limLog(pMac, LOGP, |
| 1210 | FL("call to palAllocateMemory failed for eWNI_SME_ASSOC_IND\n")); |
| 1211 | return; |
| 1212 | } |
| 1213 | |
| 1214 | #if defined (ANI_PRODUCT_TYPE_AP) |
| 1215 | sirStoreU16N((tANI_U8 *) &pSirSmeAssocInd->messageType, |
| 1216 | eWNI_SME_ASSOC_IND); |
| 1217 | limAssocIndSerDes(pMac, (tpLimMlmAssocInd) pMsgBuf, |
| 1218 | (tANI_U8 *) &(pSirSmeAssocInd->length), psessionEntry); |
| 1219 | #else |
| 1220 | pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND; |
| 1221 | limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry); |
| 1222 | #endif |
| 1223 | msgQ.type = eWNI_SME_ASSOC_IND; |
| 1224 | msgQ.bodyptr = pSirSmeAssocInd; |
| 1225 | msgQ.bodyval = 0; |
| 1226 | pStaDs = dphGetHashEntry(pMac, |
| 1227 | ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable); |
| 1228 | if (! pStaDs) |
| 1229 | { // good time to panic... |
| 1230 | limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)\n"), |
| 1231 | ((tpLimMlmAssocInd) pMsgBuf)->aid); |
| 1232 | palFreeMemory(pMac->hHdd, pSirSmeAssocInd); |
| 1233 | |
| 1234 | return; |
| 1235 | } |
| 1236 | pSirSmeAssocInd->staId = pStaDs->staIndex; |
| 1237 | #ifdef WLAN_SOFTAP_FEATURE |
| 1238 | pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType; |
| 1239 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1240 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1241 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 1242 | limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0); |
| 1243 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 1244 | limSysProcessMmhMsgApi(pMac, &msgQ, ePROT); |
| 1245 | |
| 1246 | PELOG1(limLog(pMac, LOG1, |
| 1247 | FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND\n"));) |
| 1248 | /* |
| 1249 | ** turn on a timer to detect the loss of ASSOC CNF |
| 1250 | **/ |
| 1251 | limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry); |
| 1252 | |
| 1253 | // Enable this Compile flag to test the BT-AMP -AP assoc sequence |
| 1254 | #ifdef TEST_BTAMP_AP |
| 1255 | //tANI_U32 *pMsgBuf; |
| 1256 | { |
| 1257 | tpSirSmeAssocCnf pSmeAssoccnf; |
| 1258 | if(!palAllocateMemory(pMac->hHdd,(void **)&pSmeAssoccnf,sizeof(tSirSmeAssocCnf))) |
| 1259 | PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed for pSmeAssoccnf \n"));) |
| 1260 | pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF; |
| 1261 | pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf); |
| 1262 | palCopyMemory( pMac->hHdd,pSmeAssoccnf->peerMacAddr,((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr,6); |
| 1263 | pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS; |
| 1264 | pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid; |
| 1265 | palCopyMemory( pMac->hHdd, pSmeAssoccnf->alternateBssId,pSmeAssoccnf->peerMacAddr,sizeof(tSirMacAddr)); |
| 1266 | pSmeAssoccnf->alternateChannelId = 6; |
| 1267 | palCopyMemory( pMac->hHdd,pSmeAssoccnf->bssId,psessionEntry->selfMacAddr,6); |
| 1268 | pMsgBuf = (tANI_U32)pSmeAssoccnf; |
| 1269 | __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf); |
| 1270 | palFreeMemory(pMac->hHdd,pSmeAssoccnf); |
| 1271 | } |
| 1272 | #endif |
| 1273 | |
| 1274 | |
| 1275 | } /*** end limProcessMlmAssocInd() ***/ |
| 1276 | |
| 1277 | |
| 1278 | |
| 1279 | |
| 1280 | /** |
| 1281 | * limProcessMlmDisassocInd() |
| 1282 | * |
| 1283 | *FUNCTION: |
| 1284 | * This function is called to processes MLM_DISASSOC_IND |
| 1285 | * message from MLM State machine. |
| 1286 | * |
| 1287 | *LOGIC: |
| 1288 | * |
| 1289 | *ASSUMPTIONS: |
| 1290 | * |
| 1291 | *NOTE: |
| 1292 | * |
| 1293 | * @param pMac Pointer to Global MAC structure |
| 1294 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1295 | * |
| 1296 | * @return None |
| 1297 | */ |
| 1298 | void |
| 1299 | limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1300 | { |
| 1301 | tLimMlmDisassocInd *pMlmDisassocInd; |
| 1302 | tpPESession psessionEntry; |
| 1303 | pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf; |
| 1304 | if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL) |
| 1305 | { |
| 1306 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n")); |
| 1307 | return; |
| 1308 | } |
| 1309 | switch (psessionEntry->limSystemRole) |
| 1310 | { |
| 1311 | case eLIM_STA_IN_IBSS_ROLE: |
| 1312 | break; |
| 1313 | case eLIM_STA_ROLE: |
| 1314 | case eLIM_BT_AMP_STA_ROLE: |
| 1315 | psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1316 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1317 | break; |
| 1318 | default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE |
| 1319 | PELOG1(limLog(pMac, LOG1, |
| 1320 | FL("*** Peer staId=%d Disassociated ***\n"), |
| 1321 | pMlmDisassocInd->aid);) |
| 1322 | // Send SME_DISASOC_IND after Polaris cleanup |
| 1323 | // (after receiving LIM_MLM_PURGE_STA_IND) |
| 1324 | break; |
| 1325 | } // end switch (psessionEntry->limSystemRole) |
| 1326 | } /*** end limProcessMlmDisassocInd() ***/ |
| 1327 | |
| 1328 | /** |
| 1329 | * limProcessMlmDisassocCnf() |
| 1330 | * |
| 1331 | *FUNCTION: |
| 1332 | * This function is called to processes MLM_DISASSOC_CNF |
| 1333 | * message from MLM State machine. |
| 1334 | * |
| 1335 | *LOGIC: |
| 1336 | * |
| 1337 | *ASSUMPTIONS: |
| 1338 | * |
| 1339 | *NOTE: |
| 1340 | * |
| 1341 | * @param pMac Pointer to Global MAC structure |
| 1342 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1343 | * |
| 1344 | * @return None |
| 1345 | */ |
| 1346 | void |
| 1347 | limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1348 | { |
| 1349 | tSirResultCodes resultCode; |
| 1350 | tLimMlmDisassocCnf *pMlmDisassocCnf; |
| 1351 | tpPESession psessionEntry; |
| 1352 | pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf; |
| 1353 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL) |
| 1354 | { |
| 1355 | PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id\n"));) |
| 1356 | return; |
| 1357 | } |
| 1358 | resultCode = (tSirResultCodes) |
| 1359 | (pMlmDisassocCnf->disassocTrigger == |
| 1360 | eLIM_LINK_MONITORING_DISASSOC) ? |
| 1361 | eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE : |
| 1362 | pMlmDisassocCnf->resultCode; |
| 1363 | if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) |
| 1364 | { |
| 1365 | #if defined(ANI_AP_CLIENT_SDK) |
| 1366 | tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0}; |
| 1367 | #endif |
| 1368 | // Disassociate Confirm from MLM |
| 1369 | if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) && |
| 1370 | (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) ) |
| 1371 | { |
| 1372 | /** |
| 1373 | * Should not have received |
| 1374 | * Disassocate confirm |
| 1375 | * from MLM in other states. |
| 1376 | * Log error |
| 1377 | */ |
| 1378 | PELOGE(limLog(pMac, LOGE, |
| 1379 | FL("received unexpected MLM_DISASSOC_CNF in state %X\n"),psessionEntry->limSmeState);) |
| 1380 | return; |
| 1381 | } |
| 1382 | #if defined(ANI_AP_CLIENT_SDK) |
| 1383 | // Whenever there is a disassoc notification, make sure the bssId is cleared so that |
| 1384 | // if the station finds the same AP to which it was associated, it can try to associate |
| 1385 | // with it again. If this is not done, the beacons/probe rsp from this AP will not be given |
| 1386 | // up to WSM and it never see this is AP unless a cga/reboot is done. |
| 1387 | palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr)); |
| 1388 | if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS) |
| 1389 | { |
| 1390 | limLog(pMac, LOGP, FL("Could not update BSSID on CFG")); |
| 1391 | } |
| 1392 | #endif |
| 1393 | if (pMac->lim.gLimRspReqd) |
| 1394 | pMac->lim.gLimRspReqd = false; |
| 1395 | if (pMlmDisassocCnf->disassocTrigger == |
| 1396 | eLIM_PROMISCUOUS_MODE_DISASSOC) |
| 1397 | { |
| 1398 | if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS) |
| 1399 | psessionEntry->limSmeState = psessionEntry->limPrevSmeState; |
| 1400 | else |
| 1401 | psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1402 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1403 | // Send Promiscuous mode response to host |
| 1404 | limSendSmePromiscuousModeRsp(pMac); |
| 1405 | } |
| 1406 | else |
| 1407 | { |
| 1408 | if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS) |
| 1409 | psessionEntry->limSmeState = psessionEntry->limPrevSmeState; |
| 1410 | else |
| 1411 | psessionEntry->limSmeState = eLIM_SME_IDLE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1412 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1413 | limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr, |
| 1414 | resultCode, |
| 1415 | pMlmDisassocCnf->disassocTrigger, |
| 1416 | pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry); |
| 1417 | } |
| 1418 | } |
| 1419 | else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 1420 | { |
| 1421 | limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr, |
| 1422 | resultCode, |
| 1423 | pMlmDisassocCnf->disassocTrigger, |
| 1424 | pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry); |
| 1425 | } |
| 1426 | } /*** end limProcessMlmDisassocCnf() ***/ |
| 1427 | |
| 1428 | /** |
| 1429 | * limProcessMlmDeauthInd() |
| 1430 | * |
| 1431 | *FUNCTION: |
| 1432 | * This function is called to processes MLM_DEAUTH_IND |
| 1433 | * message from MLM State machine. |
| 1434 | * |
| 1435 | *LOGIC: |
| 1436 | * |
| 1437 | *ASSUMPTIONS: |
| 1438 | * |
| 1439 | *NOTE: |
| 1440 | * |
| 1441 | * @param pMac Pointer to Global MAC structure |
| 1442 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1443 | * |
| 1444 | * @return None |
| 1445 | */ |
| 1446 | void |
| 1447 | limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1448 | { |
| 1449 | tLimMlmDeauthInd *pMlmDeauthInd; |
| 1450 | tpPESession psessionEntry; |
| 1451 | tANI_U8 sessionId; |
| 1452 | pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf; |
| 1453 | if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL) |
| 1454 | { |
| 1455 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));) |
| 1456 | return; |
| 1457 | } |
| 1458 | switch (psessionEntry->limSystemRole) |
| 1459 | { |
| 1460 | case eLIM_STA_IN_IBSS_ROLE: |
| 1461 | break; |
| 1462 | case eLIM_STA_ROLE: |
| 1463 | case eLIM_BT_AMP_STA_ROLE: |
| 1464 | psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1465 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1466 | |
| 1467 | default: // eLIM_AP_ROLE |
| 1468 | { |
| 1469 | PELOG1(limLog(pMac, LOG1, |
| 1470 | FL("*** Received Deauthentication from staId=%d ***\n"), |
| 1471 | pMlmDeauthInd->aid);) |
| 1472 | } |
| 1473 | // Send SME_DEAUTH_IND after Polaris cleanup |
| 1474 | // (after receiving LIM_MLM_PURGE_STA_IND) |
| 1475 | break; |
| 1476 | } // end switch (psessionEntry->limSystemRole) |
| 1477 | } /*** end limProcessMlmDeauthInd() ***/ |
| 1478 | |
| 1479 | /** |
| 1480 | * limProcessMlmDeauthCnf() |
| 1481 | * |
| 1482 | *FUNCTION: |
| 1483 | * This function is called to processes MLM_DEAUTH_CNF |
| 1484 | * message from MLM State machine. |
| 1485 | * |
| 1486 | *LOGIC: |
| 1487 | * |
| 1488 | *ASSUMPTIONS: |
| 1489 | * |
| 1490 | *NOTE: |
| 1491 | * |
| 1492 | * @param pMac Pointer to Global MAC structure |
| 1493 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1494 | * |
| 1495 | * @return None |
| 1496 | */ |
| 1497 | void |
| 1498 | limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1499 | { |
| 1500 | tANI_U16 aid; |
| 1501 | tSirResultCodes resultCode; |
| 1502 | tLimMlmDeauthCnf *pMlmDeauthCnf; |
| 1503 | tpPESession psessionEntry; |
| 1504 | |
| 1505 | if(pMsgBuf == NULL) |
| 1506 | { |
| 1507 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 1508 | return; |
| 1509 | } |
| 1510 | pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf; |
| 1511 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL) |
| 1512 | { |
| 1513 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id \n"));) |
| 1514 | return; |
| 1515 | } |
| 1516 | |
| 1517 | resultCode = (tSirResultCodes) |
| 1518 | (pMlmDeauthCnf->deauthTrigger == |
| 1519 | eLIM_LINK_MONITORING_DEAUTH) ? |
| 1520 | eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE : |
| 1521 | pMlmDeauthCnf->resultCode; |
| 1522 | aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ? |
| 1523 | pMlmDeauthCnf->aid : 1; |
| 1524 | if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) |
| 1525 | { |
| 1526 | #if defined(ANI_AP_CLIENT_SDK) |
| 1527 | tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0}; |
| 1528 | #endif |
| 1529 | // Deauth Confirm from MLM |
| 1530 | if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) |
| 1531 | { |
| 1532 | /** |
| 1533 | * Should not have received Deauth confirm |
| 1534 | * from MLM in other states. |
| 1535 | * Log error |
| 1536 | */ |
| 1537 | PELOGE(limLog(pMac, LOGE, |
| 1538 | FL("received unexpected MLM_DEAUTH_CNF in state %X\n"), |
| 1539 | psessionEntry->limSmeState);) |
| 1540 | return; |
| 1541 | } |
| 1542 | #if defined(ANI_AP_CLIENT_SDK) |
| 1543 | // Whenever there is a disassoc notification, make sure the bssId is cleared so that |
| 1544 | // if the station finds the same AP to which it was associated, it can try to associate |
| 1545 | // with it again. If this is not done, the beacons/probe rsp from this AP will not be given |
| 1546 | // up to WSM and it never see this is AP unless a cga/reboot is done. |
| 1547 | palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr)); |
| 1548 | if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS) |
| 1549 | { |
| 1550 | limLog(pMac, LOGP, FL("Could not update BSSID on CFG")); |
| 1551 | } |
| 1552 | #endif |
| 1553 | if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS) |
| 1554 | { |
| 1555 | psessionEntry->limSmeState = eLIM_SME_IDLE_STATE; |
| 1556 | PELOG1(limLog(pMac, LOG1, |
| 1557 | FL("*** Deauthenticated with BSS ***\n"));) |
| 1558 | } |
| 1559 | else |
| 1560 | psessionEntry->limSmeState = psessionEntry->limPrevSmeState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1561 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1562 | |
| 1563 | if (pMac->lim.gLimRspReqd) |
| 1564 | pMac->lim.gLimRspReqd = false; |
| 1565 | } |
| 1566 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP) |
| 1567 | // BP deauthenticated by AP or vice versa |
| 1568 | // Send SME_DISASSOC_RSP to host. |
| 1569 | limSendSmeDisassocNtf(pMac, pMlmDeauthCnf->peerMacAddr, |
| 1570 | resultCode, |
| 1571 | pMlmDeauthCnf->deauthTrigger, |
| 1572 | aid); |
| 1573 | #else |
| 1574 | // On STA or on BASIC AP, send SME_DEAUTH_RSP to host |
| 1575 | limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr, |
| 1576 | resultCode, |
| 1577 | pMlmDeauthCnf->deauthTrigger, |
| 1578 | aid,psessionEntry->smeSessionId,psessionEntry->transactionId); |
| 1579 | #endif |
| 1580 | } /*** end limProcessMlmDeauthCnf() ***/ |
| 1581 | |
| 1582 | /** |
| 1583 | * limProcessMlmPurgeStaInd() |
| 1584 | * |
| 1585 | *FUNCTION: |
| 1586 | * This function is called to processes MLM_PURGE_STA_IND |
| 1587 | * message from MLM State machine. |
| 1588 | * |
| 1589 | *LOGIC: |
| 1590 | * |
| 1591 | *ASSUMPTIONS: |
| 1592 | * |
| 1593 | *NOTE: |
| 1594 | * |
| 1595 | * @param pMac Pointer to Global MAC structure |
| 1596 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1597 | * |
| 1598 | * @return None |
| 1599 | */ |
| 1600 | void |
| 1601 | limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1602 | { |
| 1603 | tSirResultCodes resultCode; |
| 1604 | tpLimMlmPurgeStaInd pMlmPurgeStaInd; |
| 1605 | tpPESession psessionEntry; |
| 1606 | #if defined(ANI_AP_CLIENT_SDK) |
| 1607 | tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0}; |
| 1608 | #endif |
| 1609 | if(pMsgBuf == NULL) |
| 1610 | { |
| 1611 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 1612 | return; |
| 1613 | } |
| 1614 | pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf; |
| 1615 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL) |
| 1616 | { |
| 1617 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));) |
| 1618 | return; |
| 1619 | } |
| 1620 | // Purge STA indication from MLM |
| 1621 | resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode; |
| 1622 | switch (psessionEntry->limSystemRole) |
| 1623 | { |
| 1624 | case eLIM_STA_IN_IBSS_ROLE: |
| 1625 | break; |
| 1626 | case eLIM_STA_ROLE: |
| 1627 | case eLIM_BT_AMP_STA_ROLE: |
| 1628 | default: // eLIM_AP_ROLE |
| 1629 | if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) && |
| 1630 | (psessionEntry->limSmeState != |
| 1631 | eLIM_SME_WT_DISASSOC_STATE) && |
| 1632 | (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)) |
| 1633 | { |
| 1634 | /** |
| 1635 | * Should not have received |
| 1636 | * Purge STA indication |
| 1637 | * from MLM in other states. |
| 1638 | * Log error |
| 1639 | */ |
| 1640 | PELOGE(limLog(pMac, LOGE, |
| 1641 | FL("received unexpected MLM_PURGE_STA_IND in state %X\n"), |
| 1642 | psessionEntry->limSmeState);) |
| 1643 | break; |
| 1644 | } |
| 1645 | PELOG1(limLog(pMac, LOG1, |
| 1646 | FL("*** Polaris cleanup completed for staId=%d ***\n"), |
| 1647 | pMlmPurgeStaInd->aid);) |
| 1648 | if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) |
| 1649 | { |
| 1650 | psessionEntry->limSmeState = eLIM_SME_IDLE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1651 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1652 | |
| 1653 | #if defined(ANI_AP_CLIENT_SDK) |
| 1654 | // Whenever there is a disassoc notification, make sure the bssId is cleared so that |
| 1655 | // if the station finds the same AP to which it was associated, it can try to associate |
| 1656 | // with it again. If this is not done, the beacons/probe rsp from this AP will not be given |
| 1657 | // up to WSM and it never see this is AP unless a cga/reboot is done. |
| 1658 | palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr)); |
| 1659 | if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS) |
| 1660 | { |
| 1661 | limLog(pMac, LOGP, FL("Could not update BSSID on CFG")); |
| 1662 | } |
| 1663 | #endif |
| 1664 | } |
| 1665 | if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH) |
| 1666 | { |
| 1667 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP) |
| 1668 | // BP deauthenticated by AP or vice versa |
| 1669 | // Send SME_DISASSOC_IND to host. |
| 1670 | limSendSmeDisassocNtf(pMac, |
| 1671 | pMlmPurgeStaInd->peerMacAddr, |
| 1672 | resultCode, |
| 1673 | pMlmPurgeStaInd->purgeTrigger, |
| 1674 | pMlmPurgeStaInd->aid,psessionEntry); |
| 1675 | #else |
| 1676 | limSendSmeDeauthNtf(pMac, |
| 1677 | pMlmPurgeStaInd->peerMacAddr, |
| 1678 | resultCode, |
| 1679 | pMlmPurgeStaInd->purgeTrigger, |
| 1680 | pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId); |
| 1681 | #endif |
| 1682 | } |
| 1683 | else |
| 1684 | limSendSmeDisassocNtf(pMac, |
| 1685 | pMlmPurgeStaInd->peerMacAddr, |
| 1686 | resultCode, |
| 1687 | pMlmPurgeStaInd->purgeTrigger, |
| 1688 | pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry); |
| 1689 | } // end switch (psessionEntry->limSystemRole) |
| 1690 | } /*** end limProcessMlmPurgeStaInd() ***/ |
| 1691 | |
| 1692 | /** |
| 1693 | * limProcessMlmSetKeysCnf() |
| 1694 | * |
| 1695 | *FUNCTION: |
| 1696 | * This function is called to processes MLM_SETKEYS_CNF |
| 1697 | * message from MLM State machine. |
| 1698 | * |
| 1699 | *LOGIC: |
| 1700 | * |
| 1701 | *ASSUMPTIONS: |
| 1702 | * |
| 1703 | *NOTE: |
| 1704 | * |
| 1705 | * @param pMac Pointer to Global MAC structure |
| 1706 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1707 | * |
| 1708 | * @return None |
| 1709 | */ |
| 1710 | void |
| 1711 | limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1712 | { |
| 1713 | // Prepare and send SME_SETCONTEXT_RSP message |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1714 | tLimMlmSetKeysCnf *pMlmSetKeysCnf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1715 | tpPESession psessionEntry; |
| 1716 | |
| 1717 | if(pMsgBuf == NULL) |
| 1718 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1719 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 1720 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1721 | } |
| 1722 | pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf; |
| 1723 | if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL) |
| 1724 | { |
| 1725 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId \n"));) |
| 1726 | return; |
| 1727 | } |
| 1728 | limLog( pMac, LOG1, |
| 1729 | FL("Received MLM_SETKEYS_CNF with resultCode = %d\n"), |
| 1730 | pMlmSetKeysCnf->resultCode ); |
| 1731 | limSendSmeSetContextRsp(pMac, |
| 1732 | pMlmSetKeysCnf->peerMacAddr, |
| 1733 | #ifdef ANI_PRODUCT_TYPE_AP |
| 1734 | pMlmSetKeysCnf->aid, |
| 1735 | #else |
| 1736 | 1, |
| 1737 | #endif |
| 1738 | (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId, |
| 1739 | psessionEntry->transactionId); |
| 1740 | } /*** end limProcessMlmSetKeysCnf() ***/ |
| 1741 | /** |
| 1742 | * limProcessMlmRemoveKeyCnf() |
| 1743 | * |
| 1744 | *FUNCTION: |
| 1745 | * This function is called to processes MLM_REMOVEKEY_CNF |
| 1746 | * message from MLM State machine. |
| 1747 | * |
| 1748 | *LOGIC: |
| 1749 | * |
| 1750 | *ASSUMPTIONS: |
| 1751 | * |
| 1752 | *NOTE: |
| 1753 | * |
| 1754 | * @param pMac Pointer to Global MAC structure |
| 1755 | * @param pMsgBuf A pointer to the MLM message buffer |
| 1756 | * |
| 1757 | * @return None |
| 1758 | */ |
| 1759 | void |
| 1760 | limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1761 | { |
| 1762 | // Prepare and send SME_REMOVECONTEXT_RSP message |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1763 | tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1764 | tpPESession psessionEntry; |
| 1765 | |
| 1766 | if(pMsgBuf == NULL) |
| 1767 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1768 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 1769 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1770 | } |
| 1771 | pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf; |
| 1772 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL) |
| 1773 | { |
| 1774 | PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id\n"));) |
| 1775 | return; |
| 1776 | } |
| 1777 | limLog( pMac, LOG1, |
| 1778 | FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d\n"), |
| 1779 | pMlmRemoveKeyCnf->resultCode ); |
| 1780 | limSendSmeRemoveKeyRsp(pMac, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1781 | pMlmRemoveKeyCnf->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1782 | (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry, |
| 1783 | psessionEntry->smeSessionId,psessionEntry->transactionId); |
| 1784 | } /*** end limProcessMlmRemoveKeyCnf() ***/ |
| 1785 | |
| 1786 | |
| 1787 | /** |
| 1788 | * limHandleSmeJoinResult() |
| 1789 | * |
| 1790 | *FUNCTION: |
| 1791 | * This function is called to process join/auth/assoc failures |
| 1792 | * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or |
| 1793 | * MLM_ASSOC_CNF with a success code in case of STA role and |
| 1794 | * MLM_JOIN_CNF with success in case of STA in IBSS role. |
| 1795 | * |
| 1796 | *LOGIC: |
| 1797 | * |
| 1798 | *ASSUMPTIONS: |
| 1799 | * |
| 1800 | *NOTE: |
| 1801 | * |
| 1802 | * @param pMac Pointer to Global MAC structure |
| 1803 | * @param resultCode Failure code to be sent |
| 1804 | * |
| 1805 | * |
| 1806 | * @return None |
| 1807 | */ |
| 1808 | static void |
| 1809 | limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry) |
| 1810 | { |
| 1811 | tpDphHashNode pStaDs = NULL; |
| 1812 | tANI_U8 smesessionId; |
| 1813 | tANI_U16 smetransactionId; |
| 1814 | |
| 1815 | /* Newly Added on oct 11 th*/ |
| 1816 | if(psessionEntry == NULL) |
| 1817 | { |
| 1818 | PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL \n"));) |
| 1819 | return; |
| 1820 | } |
| 1821 | smesessionId = psessionEntry->smeSessionId; |
| 1822 | smetransactionId = psessionEntry->transactionId; |
| 1823 | /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */ |
| 1824 | if(resultCode != eSIR_SME_SUCCESS) |
| 1825 | { |
| 1826 | pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 1827 | if (pStaDs != NULL) |
| 1828 | { |
| 1829 | pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 1830 | pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE; |
| 1831 | pStaDs->mlmStaContext.resultCode = resultCode; |
| 1832 | pStaDs->mlmStaContext.protStatusCode = protStatusCode; |
| 1833 | //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME |
| 1834 | limCleanupRxPath(pMac, pStaDs, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1835 | palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq); |
| 1836 | psessionEntry->pLimJoinReq = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1837 | return; |
| 1838 | } |
| 1839 | } |
| 1840 | |
| 1841 | palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq); |
| 1842 | psessionEntry->pLimJoinReq = NULL; |
| 1843 | //Delete teh session if JOIN failure occurred. |
| 1844 | if(resultCode != eSIR_SME_SUCCESS) |
| 1845 | { |
| 1846 | if(NULL != psessionEntry) |
| 1847 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1848 | if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId, |
| 1849 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS) |
| 1850 | PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState.\n"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1851 | peDeleteSession(pMac,psessionEntry); |
| 1852 | psessionEntry = NULL; |
| 1853 | } |
| 1854 | } |
| 1855 | limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry, |
| 1856 | smesessionId, smetransactionId); |
| 1857 | } /*** end limHandleSmeJoinResult() ***/ |
| 1858 | |
| 1859 | /** |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1860 | * limHandleSmeReaasocResult() |
| 1861 | * |
| 1862 | *FUNCTION: |
| 1863 | * This function is called to process reassoc failures |
| 1864 | * upon receiving REASSOC_CNF with a failure code or |
| 1865 | * MLM_REASSOC_CNF with a success code in case of STA role |
| 1866 | * |
| 1867 | *LOGIC: |
| 1868 | * |
| 1869 | *ASSUMPTIONS: |
| 1870 | * |
| 1871 | *NOTE: |
| 1872 | * |
| 1873 | * @param pMac Pointer to Global MAC structure |
| 1874 | * @param resultCode Failure code to be sent |
| 1875 | * |
| 1876 | * |
| 1877 | * @return None |
| 1878 | */ |
| 1879 | static void |
| 1880 | limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry) |
| 1881 | { |
| 1882 | tpDphHashNode pStaDs = NULL; |
| 1883 | tANI_U8 smesessionId; |
| 1884 | tANI_U16 smetransactionId; |
| 1885 | |
| 1886 | if(psessionEntry == NULL) |
| 1887 | { |
| 1888 | PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL \n"));) |
| 1889 | return; |
| 1890 | } |
| 1891 | smesessionId = psessionEntry->smeSessionId; |
| 1892 | smetransactionId = psessionEntry->transactionId; |
| 1893 | /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */ |
| 1894 | if(resultCode != eSIR_SME_SUCCESS) |
| 1895 | { |
| 1896 | pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 1897 | if (pStaDs != NULL) |
| 1898 | { |
| 1899 | pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 1900 | pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE; |
| 1901 | pStaDs->mlmStaContext.resultCode = resultCode; |
| 1902 | pStaDs->mlmStaContext.protStatusCode = protStatusCode; |
| 1903 | limCleanupRxPath(pMac, pStaDs, psessionEntry); |
| 1904 | return; |
| 1905 | } |
| 1906 | } |
| 1907 | |
| 1908 | //Delete teh session if REASSOC failure occurred. |
| 1909 | if(resultCode != eSIR_SME_SUCCESS) |
| 1910 | { |
| 1911 | if(NULL != psessionEntry) |
| 1912 | { |
| 1913 | peDeleteSession(pMac,psessionEntry); |
| 1914 | psessionEntry = NULL; |
| 1915 | } |
| 1916 | } |
| 1917 | limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry, |
| 1918 | smesessionId, smetransactionId); |
| 1919 | } /*** end limHandleSmeReassocResult() ***/ |
| 1920 | |
| 1921 | /** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1922 | * limProcessMlmAddStaRsp() |
| 1923 | * |
| 1924 | *FUNCTION: |
| 1925 | * This function is called to process a WDA_ADD_STA_RSP from HAL. |
| 1926 | * Upon receipt of this message from HAL, MLME - |
| 1927 | * > Determines the "state" in which this message was received |
| 1928 | * > Forwards it to the appropriate callback |
| 1929 | * |
| 1930 | *ASSUMPTIONS: |
| 1931 | * |
| 1932 | *NOTE: |
| 1933 | * |
| 1934 | * @param pMac Pointer to Global MAC structure |
| 1935 | * @param tSirMsgQ The MsgQ header, which contains the response buffer |
| 1936 | * |
| 1937 | * @return None |
| 1938 | */ |
| 1939 | void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry ) |
| 1940 | { |
| 1941 | //we need to process the deferred message since the initiating req. there might be nested request. |
| 1942 | //in the case of nested request the new request initiated from the response will take care of resetting |
| 1943 | //the deffered flag. |
| 1944 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1945 | if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) |
| 1946 | #ifdef WLAN_SOFTAP_FEATURE |
| 1947 | || (psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1948 | #endif |
| 1949 | ) |
| 1950 | { |
| 1951 | limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry); |
| 1952 | return; |
| 1953 | } |
| 1954 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 1955 | limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry); |
| 1956 | #endif |
| 1957 | } |
| 1958 | void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry) |
| 1959 | { |
| 1960 | tLimMlmAssocCnf mlmAssocCnf; |
| 1961 | tpDphHashNode pStaDs; |
| 1962 | tANI_U32 mesgType = LIM_MLM_ASSOC_CNF; |
| 1963 | tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr; |
| 1964 | |
| 1965 | if(NULL == pAddStaParams ) |
| 1966 | { |
| 1967 | limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" )); |
| 1968 | return; |
| 1969 | } |
| 1970 | if( eHAL_STATUS_SUCCESS == pAddStaParams->status ) |
| 1971 | { |
| 1972 | if( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState) |
| 1973 | { |
| 1974 | //TODO: any response to be sent out here ? |
| 1975 | limLog( pMac, LOGE, |
| 1976 | FL( "Received unexpected WDA_ADD_STA_RSP in state %X\n" ), |
| 1977 | psessionEntry->limMlmState); |
| 1978 | mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED; |
| 1979 | goto end; |
| 1980 | } |
| 1981 | if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE) |
| 1982 | mesgType = LIM_MLM_REASSOC_CNF; |
| 1983 | // |
| 1984 | // Update the DPH Hash Entry for this STA |
| 1985 | // with proper state info |
| 1986 | // |
| 1987 | pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 1988 | if( NULL != pStaDs) |
| 1989 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
| 1990 | else |
| 1991 | limLog( pMac, LOGW, |
| 1992 | FL( "Unable to get the DPH Hash Entry for AID - %d\n" ), |
| 1993 | DPH_STA_HASH_INDEX_PEER); |
| 1994 | psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1995 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1996 | /* |
| 1997 | * Storing the self StaIndex(Generated by HAL) in session context, |
| 1998 | * instead of storing it in DPH Hash entry for Self STA. |
| 1999 | * DPH entry for the self STA stores the sta index for the BSS entry |
| 2000 | * to which the STA is associated. |
| 2001 | */ |
| 2002 | psessionEntry->staId = pAddStaParams->staIdx; |
| 2003 | //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state |
| 2004 | limReactivateHeartBeatTimer(pMac, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2005 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2006 | |
| 2007 | //assign the sessionId to the timer Object |
| 2008 | pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId; |
| 2009 | if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS) |
| 2010 | limLog(pMac, LOGP, FL("Cannot activate keepalive timer.\n")); |
| 2011 | #ifdef WLAN_DEBUG |
| 2012 | pMac->lim.gLimNumLinkEsts++; |
| 2013 | #endif |
| 2014 | // Return Assoc confirm to SME with success |
| 2015 | // FIXME_GEN4 - Need the correct ASSOC RSP code to |
| 2016 | // be passed in here.... |
| 2017 | //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode; |
| 2018 | mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS; |
| 2019 | } |
| 2020 | else |
| 2021 | { |
| 2022 | limLog( pMac, LOGW, FL( "ADD_STA failed!\n")); |
| 2023 | mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED; |
| 2024 | } |
| 2025 | end: |
| 2026 | if( 0 != limMsgQ->bodyptr ) |
| 2027 | { |
| 2028 | palFreeMemory( pMac->hHdd, (void *) pAddStaParams ); |
| 2029 | } |
| 2030 | /* Updating PE session Id*/ |
| 2031 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 2032 | limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf ); |
| 2033 | return; |
| 2034 | } |
| 2035 | void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry) |
| 2036 | { |
| 2037 | //we need to process the deferred message since the initiating req. there might be nested request. |
| 2038 | //in the case of nested request the new request initiated from the response will take care of resetting |
| 2039 | //the deffered flag. |
| 2040 | // tpPESession psessionEntry; |
| 2041 | // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr; |
| 2042 | // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL) |
| 2043 | // { |
| 2044 | // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId\n" )); |
| 2045 | // return; |
| 2046 | // } |
| 2047 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2048 | |
| 2049 | if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) || |
| 2050 | (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) |
| 2051 | #ifdef WLAN_SOFTAP_FEATURE |
| 2052 | || (psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 2053 | #endif |
| 2054 | ) && |
| 2055 | (psessionEntry->statypeForBss == STA_ENTRY_SELF)) |
| 2056 | { |
| 2057 | limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry); |
| 2058 | return; |
| 2059 | } |
| 2060 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 2061 | limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry); |
| 2062 | #endif |
| 2063 | } |
| 2064 | |
| 2065 | void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry) |
| 2066 | { |
| 2067 | tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr; |
| 2068 | tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 2069 | tSirResultCodes statusCode = eSIR_SME_SUCCESS; |
| 2070 | if( eHAL_STATUS_SUCCESS == pDelBssParams->status ) |
| 2071 | { |
| 2072 | PELOGW(limLog( pMac, LOGW, |
| 2073 | FL( "STA received the DEL_BSS_RSP for BSSID: %X.\n"),pDelBssParams->bssIdx);) |
| 2074 | if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId, |
| 2075 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS) |
| 2076 | |
| 2077 | { |
| 2078 | PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE\n"));) |
| 2079 | statusCode = eSIR_SME_REFUSED; |
| 2080 | goto end; |
| 2081 | } |
| 2082 | if(pStaDs == NULL) |
| 2083 | { |
| 2084 | limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing.\n")); |
| 2085 | statusCode = eSIR_SME_REFUSED; |
| 2086 | goto end; |
| 2087 | } |
| 2088 | if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState) |
| 2089 | { |
| 2090 | PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %X\n" ), |
| 2091 | pStaDs->mlmStaContext.mlmState);) |
| 2092 | statusCode = eSIR_SME_REFUSED; |
| 2093 | goto end; |
| 2094 | } |
| 2095 | PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId ); |
| 2096 | limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);) |
| 2097 | } |
| 2098 | else |
| 2099 | { |
| 2100 | limLog( pMac, LOGP, FL( "DEL BSS failed!\n" ) ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2101 | if( NULL != pDelBssParams ) |
| 2102 | { |
| 2103 | palFreeMemory( pMac->hHdd, (void *) pDelBssParams ); |
| 2104 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2105 | return; |
| 2106 | } |
| 2107 | end: |
| 2108 | if( 0 != limMsgQ->bodyptr ) |
| 2109 | { |
| 2110 | palFreeMemory( pMac->hHdd, (void *) pDelBssParams ); |
| 2111 | } |
| 2112 | if(pStaDs == NULL) |
| 2113 | return; |
| 2114 | if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) && |
| 2115 | (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE && |
| 2116 | psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) && |
| 2117 | pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE) |
| 2118 | { |
| 2119 | /** The Case where the DelBss is invoked from |
| 2120 | * context of other than normal DisAssoc / Deauth OR |
| 2121 | * as part of Join Failure. |
| 2122 | */ |
| 2123 | limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry); |
| 2124 | return; |
| 2125 | } |
| 2126 | limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry); |
| 2127 | return; |
| 2128 | } |
| 2129 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2130 | void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry) |
| 2131 | { |
| 2132 | tSirResultCodes rc = eSIR_SME_SUCCESS; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2133 | tSirRetStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2134 | tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr; |
| 2135 | tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
| 2136 | |
| 2137 | if(psessionEntry == NULL) |
| 2138 | { |
| 2139 | limLog(pMac, LOGE,FL("Session entry passed is NULL\n")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2140 | if(pDelBss != NULL) |
| 2141 | palFreeMemory( pMac->hHdd, (void *) pDelBss ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2142 | return; |
| 2143 | } |
| 2144 | |
| 2145 | if (pDelBss == NULL) |
| 2146 | { |
| 2147 | PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!\n"));) |
| 2148 | rc = eSIR_SME_REFUSED; |
| 2149 | goto end; |
| 2150 | } |
| 2151 | pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE; |
| 2152 | if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState) |
| 2153 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2154 | limLog( pMac, LOGE, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2155 | FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ), |
| 2156 | psessionEntry->limMlmState); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2157 | rc = eSIR_SME_REFUSED; |
| 2158 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2159 | } |
| 2160 | if (pDelBss->status != eHAL_STATUS_SUCCESS) |
| 2161 | { |
| 2162 | limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "), |
| 2163 | pDelBss->status, pDelBss->bssIdx); |
| 2164 | rc = eSIR_SME_STOP_BSS_FAILURE; |
| 2165 | goto end; |
| 2166 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2167 | status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2168 | psessionEntry->selfMacAddr, NULL, NULL); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2169 | if (status != eSIR_SUCCESS) |
| 2170 | { |
| 2171 | rc = eSIR_SME_REFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2172 | goto end; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2173 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2174 | /** Softmac may send all the buffered packets right after resuming the transmission hence |
| 2175 | * to occupy the medium during non channel occupancy period. So resume the transmission after |
| 2176 | * HAL gives back the response. |
| 2177 | */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2178 | #if 0 //TODO: How to handle this per session |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2179 | if (LIM_IS_RADAR_DETECTED(pMac)) |
| 2180 | { |
| 2181 | limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX); |
| 2182 | LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE); |
| 2183 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2184 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2185 | dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ? |
| 2186 | limDeletePreAuthList(pMac); |
| 2187 | #ifdef WLAN_SOFTAP_FEATURE |
| 2188 | //Initialize number of associated stations during cleanup |
| 2189 | pMac->lim.gLimNumOfCurrentSTAs = 0; |
| 2190 | #endif |
| 2191 | end: |
| 2192 | limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId); |
| 2193 | peDeleteSession(pMac, psessionEntry); |
| 2194 | |
| 2195 | if(pDelBss != NULL) |
| 2196 | palFreeMemory( pMac->hHdd, (void *) pDelBss ); |
| 2197 | } |
| 2198 | |
| 2199 | void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ) |
| 2200 | { |
| 2201 | //we need to process the deferred message since the initiating req. there might be nested request. |
| 2202 | //in the case of nested request the new request initiated from the response will take care of resetting |
| 2203 | //the deffered flag. |
| 2204 | |
| 2205 | tpPESession psessionEntry; |
| 2206 | tpDeleteStaParams pDeleteStaParams; |
| 2207 | pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr; |
| 2208 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 2209 | if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteStaParams->sessionId))==NULL) |
| 2210 | { |
| 2211 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2212 | if(pDeleteStaParams != NULL) |
| 2213 | palFreeMemory( pMac->hHdd, (void *) pDeleteStaParams ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2214 | return; |
| 2215 | } |
| 2216 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2217 | if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) |
| 2218 | #ifdef WLAN_SOFTAP_FEATURE |
| 2219 | || (psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 2220 | #endif |
| 2221 | ) |
| 2222 | { |
| 2223 | limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry); |
| 2224 | return; |
| 2225 | } |
| 2226 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 2227 | limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry); |
| 2228 | #endif |
| 2229 | } |
| 2230 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2231 | void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry) |
| 2232 | { |
| 2233 | tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr; |
| 2234 | tpDphHashNode pStaDs; |
| 2235 | tSirResultCodes statusCode = eSIR_SME_SUCCESS; |
| 2236 | if(limMsgQ->bodyptr == NULL) |
| 2237 | { |
| 2238 | return; |
| 2239 | } |
| 2240 | |
| 2241 | pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable); |
| 2242 | if(pStaDs == NULL) |
| 2243 | { |
| 2244 | limLog( pMac, LOGE, |
| 2245 | FL( "DPH Entry for STA %X missing.\n"), pDelStaParams->assocId); |
| 2246 | statusCode = eSIR_SME_REFUSED; |
| 2247 | palFreeMemory( pMac->hHdd, (void *) pDelStaParams ); |
| 2248 | |
| 2249 | return; |
| 2250 | } |
| 2251 | if( eHAL_STATUS_SUCCESS == pDelStaParams->status ) |
| 2252 | { |
| 2253 | limLog( pMac, LOGW, |
| 2254 | FL( "AP received the DEL_STA_RSP for assocID: %X.\n"), pDelStaParams->assocId); |
| 2255 | |
| 2256 | if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) && |
| 2257 | ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)) |
| 2258 | { |
| 2259 | limLog( pMac, LOGE, |
| 2260 | FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d \n" ), |
| 2261 | limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId); |
| 2262 | statusCode = eSIR_SME_REFUSED; |
| 2263 | goto end; |
| 2264 | } |
| 2265 | |
| 2266 | limLog( pMac, LOG1, |
| 2267 | FL("Deleted STA AssocID %d staId %d MAC "), |
| 2268 | pStaDs->assocId, pStaDs->staIndex); |
| 2269 | limPrintMacAddr(pMac, pStaDs->staAddr, LOG1); |
| 2270 | if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState) |
| 2271 | { |
| 2272 | palFreeMemory( pMac->hHdd, (void *) pDelStaParams ); |
| 2273 | if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS) |
| 2274 | { |
| 2275 | PELOGE(limLog(pMac, LOGE, |
| 2276 | FL("could not Add STA with assocId=%d\n"), |
| 2277 | pStaDs->assocId);) |
| 2278 | // delete the TS if it has already been added. |
| 2279 | // send the response with error status. |
| 2280 | if(pStaDs->qos.addtsPresent) |
| 2281 | { |
| 2282 | tpLimTspecInfo pTspecInfo; |
| 2283 | if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId, |
| 2284 | &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo)) |
| 2285 | { |
| 2286 | limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo, |
| 2287 | NULL, &pTspecInfo->idx); |
| 2288 | } |
| 2289 | } |
| 2290 | limRejectAssociation(pMac, |
| 2291 | pStaDs->staAddr, |
| 2292 | pStaDs->mlmStaContext.subType, |
| 2293 | true, pStaDs->mlmStaContext.authType, |
| 2294 | pStaDs->assocId, true, |
| 2295 | (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2296 | psessionEntry); |
| 2297 | } |
| 2298 | return; |
| 2299 | } |
| 2300 | } |
| 2301 | else |
| 2302 | { |
| 2303 | limLog( pMac, LOGW, |
| 2304 | FL( "DEL STA failed!\n" )); |
| 2305 | statusCode = eSIR_SME_REFUSED; |
| 2306 | } |
| 2307 | end: |
| 2308 | palFreeMemory( pMac->hHdd, (void *) pDelStaParams ); |
| 2309 | if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) |
| 2310 | { |
| 2311 | limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry); |
| 2312 | } |
| 2313 | return; |
| 2314 | } |
| 2315 | |
| 2316 | void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry) |
| 2317 | { |
| 2318 | tSirResultCodes statusCode = eSIR_SME_SUCCESS; |
| 2319 | tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr; |
| 2320 | tpDphHashNode pStaDs = NULL; |
| 2321 | if(NULL == pDelStaParams ) |
| 2322 | { |
| 2323 | limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" )); |
| 2324 | goto end; |
| 2325 | } |
| 2326 | if( eHAL_STATUS_SUCCESS == pDelStaParams->status ) |
| 2327 | { |
| 2328 | pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 2329 | if (pStaDs == NULL) |
| 2330 | { |
| 2331 | //TODO: any response to be sent out here ? |
| 2332 | limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing.\n"), |
| 2333 | pDelStaParams->assocId); |
| 2334 | statusCode = eSIR_SME_REFUSED; |
| 2335 | goto end; |
| 2336 | } |
| 2337 | if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState) |
| 2338 | { |
| 2339 | //TODO: any response to be sent out here ? |
| 2340 | limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s\n" ), |
| 2341 | limMlmStateStr(psessionEntry->limMlmState)); |
| 2342 | statusCode = eSIR_SME_REFUSED; |
| 2343 | goto end; |
| 2344 | } |
| 2345 | PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId ); |
| 2346 | limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);) |
| 2347 | limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X\n"), pDelStaParams->assocId); |
| 2348 | //we must complete all cleanup related to delSta before calling limDelBSS. |
| 2349 | if( 0 != limMsgQ->bodyptr ) |
| 2350 | { |
| 2351 | palFreeMemory( pMac->hHdd, (void *) pDelStaParams ); |
| 2352 | } |
| 2353 | statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry); |
| 2354 | return; |
| 2355 | } |
| 2356 | else |
| 2357 | { |
| 2358 | limLog( pMac, LOGW, FL( "DEL_STA failed!\n" )); |
| 2359 | statusCode = eSIR_SME_REFUSED; |
| 2360 | } |
| 2361 | end: |
| 2362 | if( 0 != limMsgQ->bodyptr ) |
| 2363 | { |
| 2364 | palFreeMemory( pMac->hHdd, (void *) pDelStaParams ); |
| 2365 | } |
| 2366 | return; |
| 2367 | } |
| 2368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2369 | void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry) |
| 2370 | { |
| 2371 | tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr; |
| 2372 | tpDphHashNode pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable); |
| 2373 | if(pStaDs == NULL) |
| 2374 | { |
| 2375 | //TODO: any response to be sent out here ? |
| 2376 | limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing.\n"), pAddStaParams->assocId); |
| 2377 | goto end; |
| 2378 | } |
| 2379 | // |
| 2380 | // TODO & FIXME_GEN4 |
| 2381 | // Need to inspect tSirMsgQ.reserved for a valid Dialog token! |
| 2382 | // |
| 2383 | //TODO: any check for pMac->lim.gLimMlmState ? |
| 2384 | if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) |
| 2385 | { |
| 2386 | //TODO: any response to be sent out here ? |
| 2387 | limLog( pMac, LOGE, |
| 2388 | FL( "Received unexpected WDA_ADD_STA_RSP in state %X\n" ), |
| 2389 | pStaDs->mlmStaContext.mlmState); |
| 2390 | goto end; |
| 2391 | } |
| 2392 | if(eHAL_STATUS_SUCCESS != pAddStaParams->status) |
| 2393 | { |
| 2394 | PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d\n"),pAddStaParams->status);) |
| 2395 | limRejectAssociation(pMac, pStaDs->staAddr, |
| 2396 | pStaDs->mlmStaContext.subType, |
| 2397 | true, pStaDs->mlmStaContext.authType, |
| 2398 | pStaDs->assocId, true, |
| 2399 | (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2400 | psessionEntry); |
| 2401 | goto end; |
| 2402 | } |
| 2403 | pStaDs->bssId = pAddStaParams->bssIdx; |
| 2404 | pStaDs->staIndex = pAddStaParams->staIdx; |
| 2405 | //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state |
| 2406 | pStaDs->valid = 1; |
| 2407 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE; |
| 2408 | limLog( pMac, LOG1, |
| 2409 | FL("STA AssocID %d staId %d MAC "), |
| 2410 | pStaDs->assocId, |
| 2411 | pStaDs->staIndex); |
| 2412 | limPrintMacAddr(pMac, pStaDs->staAddr, LOG1); |
| 2413 | |
| 2414 | /* For BTAMP-AP, the flow sequence shall be: |
| 2415 | * 1) PE sends eWNI_SME_ASSOC_IND to SME |
| 2416 | * 2) PE receives eWNI_SME_ASSOC_CNF from SME |
| 2417 | * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA |
| 2418 | */ |
| 2419 | limSendMlmAssocInd(pMac, pStaDs, psessionEntry); |
| 2420 | // fall though to reclaim the original Add STA Response message |
| 2421 | end: |
| 2422 | if( 0 != limMsgQ->bodyptr ) |
| 2423 | { |
| 2424 | palFreeMemory( pMac->hHdd, (void *) pAddStaParams ); |
| 2425 | } |
| 2426 | return; |
| 2427 | } |
| 2428 | |
| 2429 | /** |
| 2430 | * limProcessApMlmAddBssRsp() |
| 2431 | * |
| 2432 | *FUNCTION: |
| 2433 | * This function is called to process a WDA_ADD_BSS_RSP from HAL. |
| 2434 | * Upon receipt of this message from HAL, MLME - |
| 2435 | * > Validates the result of WDA_ADD_BSS_REQ |
| 2436 | * > Init other remaining LIM variables |
| 2437 | * > Init the AID pool, for that BSSID |
| 2438 | * > Init the Pre-AUTH list, for that BSSID |
| 2439 | * > Create LIM timers, specific to that BSSID |
| 2440 | * > Init DPH related parameters that are specific to that BSSID |
| 2441 | * > TODO - When do we do the actual change channel? |
| 2442 | * |
| 2443 | *LOGIC: |
| 2444 | * SME sends eWNI_SME_START_BSS_REQ to LIM |
| 2445 | * LIM sends LIM_MLM_START_REQ to MLME |
| 2446 | * MLME sends WDA_ADD_BSS_REQ to HAL |
| 2447 | * HAL responds with WDA_ADD_BSS_RSP to MLME |
| 2448 | * MLME responds with LIM_MLM_START_CNF to LIM |
| 2449 | * LIM responds with eWNI_SME_START_BSS_RSP to SME |
| 2450 | * |
| 2451 | *ASSUMPTIONS: |
| 2452 | * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq |
| 2453 | * tSirMsgQ.body will now be freed by this routine |
| 2454 | * |
| 2455 | *NOTE: |
| 2456 | * |
| 2457 | * @param pMac Pointer to Global MAC structure |
| 2458 | * @param tSirMsgQ The MsgQ header, which contains the response buffer |
| 2459 | * |
| 2460 | * @return None |
| 2461 | */ |
| 2462 | static void |
| 2463 | limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ) |
| 2464 | { |
| 2465 | tLimMlmStartCnf mlmStartCnf; |
| 2466 | tANI_U32 val; |
| 2467 | tpPESession psessionEntry; |
| 2468 | // tANI_U8 sessionId; |
| 2469 | tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr; |
| 2470 | if(NULL == pAddBssParams ) |
| 2471 | { |
| 2472 | limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" )); |
| 2473 | goto end; |
| 2474 | } |
| 2475 | //TBD: free the memory before returning, do it for all places where lookup fails. |
| 2476 | if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL) |
| 2477 | { |
| 2478 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2479 | if( NULL != pAddBssParams ) |
| 2480 | palFreeMemory( pMac->hHdd, (void *) pAddBssParams ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2481 | return; |
| 2482 | } |
| 2483 | /* Update PE session Id*/ |
| 2484 | mlmStartCnf.sessionId = pAddBssParams->sessionId; |
| 2485 | if( eHAL_STATUS_SUCCESS == pAddBssParams->status ) |
| 2486 | { |
| 2487 | PELOG2(limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n"));) |
| 2488 | if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId, |
| 2489 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS ) |
| 2490 | goto end; |
| 2491 | // Set MLME state |
| 2492 | psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2493 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2494 | if( eSIR_IBSS_MODE == pAddBssParams->bssType ) |
| 2495 | { |
| 2496 | /** IBSS is 'active' when we receive |
| 2497 | * Beacon frames from other STAs that are part of same IBSS. |
| 2498 | * Mark internal state as inactive until then. |
| 2499 | */ |
| 2500 | psessionEntry->limIbssActive = false; |
| 2501 | psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer |
| 2502 | limResetHBPktCount( psessionEntry ); |
| 2503 | limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2504 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2505 | if (limActivateHearBeatTimer(pMac) != TX_SUCCESS) |
| 2506 | limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n")); |
| 2507 | } |
| 2508 | psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx; |
| 2509 | |
| 2510 | #ifdef ANI_PRODUCT_TYPE_AP |
| 2511 | psessionEntry->limSystemRole = eLIM_AP_ROLE; |
| 2512 | #else |
| 2513 | psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE; |
| 2514 | #endif |
| 2515 | |
| 2516 | #ifdef WLAN_SOFTAP_FEATURE |
| 2517 | if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType ) |
| 2518 | psessionEntry->limSystemRole = eLIM_AP_ROLE; |
| 2519 | else |
| 2520 | psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE; |
| 2521 | #endif |
| 2522 | schEdcaProfileUpdate(pMac, psessionEntry); |
| 2523 | limInitPreAuthList(pMac); |
| 2524 | limInitAIDpool(pMac,psessionEntry); |
| 2525 | // Create timers used by LIM |
| 2526 | if (!pMac->lim.gLimTimersCreated) |
| 2527 | limCreateTimers(pMac); |
Madan Mohan Koyyalamudi | 788b4ee | 2012-09-25 10:42:09 -0700 | [diff] [blame] | 2528 | |
| 2529 | // Start OLBC timer |
| 2530 | if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS) |
| 2531 | { |
| 2532 | limLog(pMac, LOGE, FL("tx_timer_activate failed\n")); |
| 2533 | } |
| 2534 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2535 | /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */ |
| 2536 | if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val )) |
| 2537 | limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n")); |
| 2538 | pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0; |
| 2539 | // Apply previously set configuration at HW |
| 2540 | limApplyConfiguration(pMac,psessionEntry); |
| 2541 | psessionEntry->staId = pAddBssParams->staContext.staIdx; |
| 2542 | mlmStartCnf.resultCode = eSIR_SME_SUCCESS; |
| 2543 | } |
| 2544 | else |
| 2545 | { |
| 2546 | limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ),pAddBssParams->status ); |
| 2547 | mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 2548 | } |
| 2549 | limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf ); |
| 2550 | end: |
| 2551 | if( 0 != limMsgQ->bodyptr ) |
| 2552 | palFreeMemory( pMac->hHdd, (void *) pAddBssParams ); |
| 2553 | } |
| 2554 | |
| 2555 | |
| 2556 | /** |
| 2557 | * limProcessIbssMlmAddBssRsp() |
| 2558 | * |
| 2559 | *FUNCTION: |
| 2560 | * This function is called to process a WDA_ADD_BSS_RSP from HAL. |
| 2561 | * Upon receipt of this message from HAL, MLME - |
| 2562 | * > Validates the result of WDA_ADD_BSS_REQ |
| 2563 | * > Init other remaining LIM variables |
| 2564 | * > Init the AID pool, for that BSSID |
| 2565 | * > Init the Pre-AUTH list, for that BSSID |
| 2566 | * > Create LIM timers, specific to that BSSID |
| 2567 | * > Init DPH related parameters that are specific to that BSSID |
| 2568 | * > TODO - When do we do the actual change channel? |
| 2569 | * |
| 2570 | *LOGIC: |
| 2571 | * SME sends eWNI_SME_START_BSS_REQ to LIM |
| 2572 | * LIM sends LIM_MLM_START_REQ to MLME |
| 2573 | * MLME sends WDA_ADD_BSS_REQ to HAL |
| 2574 | * HAL responds with WDA_ADD_BSS_RSP to MLME |
| 2575 | * MLME responds with LIM_MLM_START_CNF to LIM |
| 2576 | * LIM responds with eWNI_SME_START_BSS_RSP to SME |
| 2577 | * |
| 2578 | *ASSUMPTIONS: |
| 2579 | * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq |
| 2580 | * tSirMsgQ.body will now be freed by this routine |
| 2581 | * |
| 2582 | *NOTE: |
| 2583 | * |
| 2584 | * @param pMac Pointer to Global MAC structure |
| 2585 | * @param tSirMsgQ The MsgQ header, which contains the response buffer |
| 2586 | * |
| 2587 | * @return None |
| 2588 | */ |
| 2589 | static void |
| 2590 | limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry) |
| 2591 | { |
| 2592 | tLimMlmStartCnf mlmStartCnf; |
| 2593 | tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr; |
| 2594 | tANI_U32 val; |
| 2595 | if( eHAL_STATUS_SUCCESS == pAddBssParams->status ) |
| 2596 | { |
| 2597 | PELOG1(limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n"));) |
| 2598 | if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId, |
| 2599 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS ) |
| 2600 | goto end; |
| 2601 | // Set MLME state |
| 2602 | psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2603 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2604 | /** IBSS is 'active' when we receive |
| 2605 | * Beacon frames from other STAs that are part of same IBSS. |
| 2606 | * Mark internal state as inactive until then. |
| 2607 | */ |
| 2608 | psessionEntry->limIbssActive = false; |
| 2609 | limResetHBPktCount( psessionEntry ); |
| 2610 | /* Timer related functions are not modified for BT-AMP : To be Done */ |
| 2611 | limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2612 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2613 | if (limActivateHearBeatTimer(pMac) != TX_SUCCESS) |
| 2614 | limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n")); |
| 2615 | psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx; |
| 2616 | psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE; |
| 2617 | psessionEntry->statypeForBss = STA_ENTRY_SELF; |
| 2618 | schEdcaProfileUpdate(pMac, psessionEntry); |
| 2619 | //TBD-RAJESH limInitPreauthList should re removed for IBSS also ????? |
| 2620 | //limInitPreAuthList(pMac); |
| 2621 | limInitAIDpool(pMac,psessionEntry); |
| 2622 | // Create timers used by LIM |
| 2623 | #ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart) |
| 2624 | if (!pMac->lim.gLimTimersCreated) |
| 2625 | limCreateTimers(pMac); |
| 2626 | #endif |
| 2627 | /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */ |
| 2628 | if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val )) |
| 2629 | limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n")); |
| 2630 | pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0; |
| 2631 | // Apply previously set configuration at HW |
| 2632 | limApplyConfiguration(pMac,psessionEntry); |
| 2633 | psessionEntry->staId = pAddBssParams->staContext.staIdx; |
| 2634 | mlmStartCnf.resultCode = eSIR_SME_SUCCESS; |
| 2635 | //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM |
| 2636 | if(true == pMac->lim.gLimIbssCoalescingHappened) |
| 2637 | { |
| 2638 | limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry); |
| 2639 | goto end; |
| 2640 | } |
| 2641 | } |
| 2642 | else |
| 2643 | { |
| 2644 | limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ), |
| 2645 | pAddBssParams->status ); |
| 2646 | mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 2647 | } |
| 2648 | //Send this message to SME, when ADD_BSS is initiated by SME |
| 2649 | //If ADD_BSS is done as part of coalescing, this won't happen. |
| 2650 | /* Update PE session Id*/ |
| 2651 | mlmStartCnf.sessionId =psessionEntry->peSessionId; |
| 2652 | limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf ); |
| 2653 | end: |
| 2654 | if( 0 != limMsgQ->bodyptr ) |
| 2655 | palFreeMemory( pMac->hHdd, (void *) pAddBssParams ); |
| 2656 | } |
| 2657 | |
| 2658 | static void |
| 2659 | limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry ) |
| 2660 | { |
| 2661 | tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr; |
| 2662 | tAniAuthType cfgAuthType, authMode; |
| 2663 | tLimMlmAuthReq *pMlmAuthReq; |
| 2664 | tpDphHashNode pStaDs = NULL; |
| 2665 | if( eHAL_STATUS_SUCCESS == pAddBssParams->status ) |
| 2666 | { |
| 2667 | if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL) |
| 2668 | { |
| 2669 | // Could not add hash table entry |
| 2670 | PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));) |
| 2671 | limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE); |
| 2672 | goto joinFailure; |
| 2673 | } |
| 2674 | psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx; |
| 2675 | //Success, handle below |
| 2676 | pStaDs->bssId = pAddBssParams->bssIdx; |
| 2677 | //STA Index(genr by HAL) for the BSS entry is stored here |
| 2678 | pStaDs->staIndex = pAddBssParams->staContext.staIdx; |
| 2679 | // Trigger Authentication with AP |
| 2680 | if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE, |
| 2681 | (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS) |
| 2682 | { |
| 2683 | /** |
| 2684 | * Could not get AuthType from CFG. |
| 2685 | * Log error. |
| 2686 | */ |
| 2687 | limLog(pMac, LOGP, |
| 2688 | FL("could not retrieve AuthType\n")); |
| 2689 | } |
| 2690 | if (cfgAuthType == eSIR_AUTO_SWITCH) |
| 2691 | authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first |
| 2692 | else |
| 2693 | authMode = cfgAuthType; |
| 2694 | |
| 2695 | // Trigger MAC based Authentication |
| 2696 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAuthReq, sizeof(tLimMlmAuthReq))) |
| 2697 | { |
| 2698 | // Log error |
| 2699 | limLog(pMac, LOGP, |
| 2700 | FL("call to palAllocateMemory failed for mlmAuthReq\n")); |
| 2701 | return; |
| 2702 | } |
| 2703 | #if 0 |
| 2704 | val = sizeof(tSirMacAddr); |
| 2705 | if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, |
| 2706 | pMlmAuthReq->peerMacAddr, |
| 2707 | &val) != eSIR_SUCCESS) |
| 2708 | { |
| 2709 | /// Could not get BSSID from CFG. Log error. |
| 2710 | limLog(pMac, LOGP, FL("could not retrieve BSSID\n")); |
| 2711 | } |
| 2712 | #endif //TO SUPPORT BT-AMP |
| 2713 | sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId); |
| 2714 | |
| 2715 | pMlmAuthReq->authType = authMode; |
| 2716 | if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT, |
| 2717 | (tANI_U32 *) &pMlmAuthReq->authFailureTimeout) |
| 2718 | != eSIR_SUCCESS) |
| 2719 | { |
| 2720 | /** |
| 2721 | * Could not get AuthFailureTimeout |
| 2722 | * value from CFG. Log error. |
| 2723 | */ |
| 2724 | limLog(pMac, LOGP, |
| 2725 | FL("could not retrieve AuthFailureTimeout value\n")); |
| 2726 | } |
| 2727 | // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below. |
| 2728 | //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE; |
| 2729 | psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2730 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2731 | pMlmAuthReq->sessionId = psessionEntry->peSessionId; |
| 2732 | psessionEntry->limPrevSmeState = psessionEntry->limSmeState; |
| 2733 | psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE; |
| 2734 | // remember staId in case of assoc timeout/failure handling |
| 2735 | psessionEntry->staId = pAddBssParams->staContext.staIdx; |
| 2736 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2737 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2738 | limPostMlmMessage(pMac, |
| 2739 | LIM_MLM_AUTH_REQ, |
| 2740 | (tANI_U32 *) pMlmAuthReq); |
| 2741 | return; |
| 2742 | } |
| 2743 | |
| 2744 | joinFailure: |
| 2745 | { |
| 2746 | psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2747 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2748 | |
| 2749 | /// Send Join response to Host |
| 2750 | limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry); |
| 2751 | |
| 2752 | } |
| 2753 | |
| 2754 | } |
| 2755 | |
| 2756 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2757 | /*------------------------------------------------------------------------------------------ |
| 2758 | * |
| 2759 | * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state. |
| 2760 | * |
| 2761 | * |
| 2762 | *------------------------------------------------------------------------------------------ |
| 2763 | */ |
| 2764 | static inline void |
| 2765 | limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry) |
| 2766 | { |
| 2767 | tpDphHashNode pStaDs = NULL; |
| 2768 | tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr; |
| 2769 | tpAddStaParams pAddStaParams = NULL; |
| 2770 | tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF; |
| 2771 | tLimMlmReassocReq *pMlmReassocReq; |
| 2772 | tLimMlmReassocCnf mlmReassocCnf; // keep sme |
| 2773 | |
| 2774 | pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq); |
| 2775 | |
| 2776 | if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState ) |
| 2777 | { |
| 2778 | goto end; |
| 2779 | } |
| 2780 | |
| 2781 | if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER, |
| 2782 | &psessionEntry->dph.dphHashTable)) == NULL) |
| 2783 | { |
| 2784 | // Could not add hash table entry |
| 2785 | PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));) |
| 2786 | limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE); |
| 2787 | goto end; |
| 2788 | } |
| 2789 | |
| 2790 | // Set the filter state to post assoc |
| 2791 | if (limSetLinkState(pMac, eSIR_LINK_POSTASSOC_STATE, |
| 2792 | pAddBssParams->bssId, psessionEntry->selfMacAddr, |
| 2793 | NULL, NULL) != eSIR_SUCCESS) |
| 2794 | { |
| 2795 | PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));) |
| 2796 | goto end; |
| 2797 | } |
| 2798 | |
| 2799 | // Prepare and send Reassociation request frame |
| 2800 | // start reassoc timer. |
| 2801 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId; |
| 2802 | /// Start reassociation failure timer |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2803 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2804 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 2805 | != TX_SUCCESS) |
| 2806 | { |
| 2807 | /// Could not start reassoc failure timer. |
| 2808 | // Log error |
| 2809 | limLog(pMac, LOGP, |
| 2810 | FL("could not start Reassociation failure timer\n")); |
| 2811 | // Return Reassoc confirm with |
| 2812 | // Resources Unavailable |
| 2813 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2814 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2815 | goto end; |
| 2816 | } |
| 2817 | limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry); |
| 2818 | psessionEntry->limPrevMlmState = psessionEntry->limMlmState; |
| 2819 | psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE; |
| 2820 | PELOGE(limLog(pMac, LOGE, FL("Set the mlm state to %d session=%d\n"), |
| 2821 | psessionEntry->limMlmState, psessionEntry->peSessionId);) |
| 2822 | |
| 2823 | psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx; |
| 2824 | |
| 2825 | //Success, handle below |
| 2826 | pStaDs->bssId = pAddBssParams->bssIdx; |
| 2827 | //STA Index(genr by HAL) for the BSS entry is stored here |
| 2828 | pStaDs->staIndex = pAddBssParams->staContext.staIdx; |
| 2829 | pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig; |
| 2830 | pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig; |
| 2831 | |
| 2832 | // Downgrade the EDCA parameters if needed |
| 2833 | limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry); |
| 2834 | |
| 2835 | // Send the active EDCA parameters to HAL |
| 2836 | if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) |
| 2837 | { |
| 2838 | limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE); |
| 2839 | } |
| 2840 | else |
| 2841 | { |
| 2842 | limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE); |
| 2843 | } |
| 2844 | |
| 2845 | #if defined WLAN_FEATURE_VOWIFI |
| 2846 | rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry ); |
| 2847 | #endif |
| 2848 | |
| 2849 | if( eHAL_STATUS_SUCCESS != |
| 2850 | palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams ))) |
| 2851 | { |
| 2852 | limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" )); |
| 2853 | return; |
| 2854 | } |
| 2855 | palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams)); |
| 2856 | |
| 2857 | /// Add STA context at MAC HW (BMU, RHP & TFP) |
| 2858 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac, |
| 2859 | (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr)); |
| 2860 | |
| 2861 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId, |
| 2862 | psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 2863 | |
| 2864 | // Update this when we get reassoc rsp , with success. |
| 2865 | // pAddStaParams->assocId = psessionEntry->limAID; |
| 2866 | |
| 2867 | pAddStaParams->staType = STA_ENTRY_SELF; |
| 2868 | pAddStaParams->status = eHAL_STATUS_SUCCESS; |
| 2869 | pAddStaParams->respReqd = 1; |
| 2870 | |
| 2871 | /* Update PE session ID */ |
| 2872 | pAddStaParams->sessionId = psessionEntry->peSessionId; |
| 2873 | |
| 2874 | // This will indicate HAL to "allocate" a new STA index |
| 2875 | pAddStaParams->staIdx = HAL_STA_INVALID_IDX; |
| 2876 | pAddStaParams->updateSta = FALSE; |
| 2877 | |
| 2878 | pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2879 | #ifdef WLAN_FEATURE_11AC |
| 2880 | limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL); |
| 2881 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2882 | limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2883 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2884 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2885 | if( psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2886 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2887 | pAddStaParams->htCapable = psessionEntry->htCapability; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2888 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2889 | /* |
| 2890 | * To resolve the interop problem with Broadcom AP, |
| 2891 | * where TQ STA could not pass traffic with GF enabled, |
| 2892 | * TQ STA will do Greenfield only with TQ AP, for |
| 2893 | * everybody else it will be turned off. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2894 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2895 | if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator)) |
| 2896 | { |
| 2897 | limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry")); |
| 2898 | pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
| 2899 | } |
| 2900 | else |
| 2901 | #endif |
| 2902 | |
| 2903 | #ifdef WLAN_SOFTAP_FEATURE |
| 2904 | pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry); |
| 2905 | pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry); |
| 2906 | pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry ); |
| 2907 | pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry ); |
| 2908 | pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry ); |
| 2909 | pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry ); |
| 2910 | pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry ); |
| 2911 | pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry); |
| 2912 | pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry ); |
| 2913 | pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry); |
| 2914 | pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry); |
| 2915 | pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry); |
| 2916 | #else |
| 2917 | pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD ); |
| 2918 | pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET ); |
| 2919 | pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE ); |
| 2920 | pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE ); |
| 2921 | pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION ); |
| 2922 | pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA ); |
| 2923 | pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY ); |
| 2924 | pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR); |
| 2925 | pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH ); |
| 2926 | pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ); |
| 2927 | pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ); |
| 2928 | pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ); |
| 2929 | #endif |
| 2930 | } |
| 2931 | |
| 2932 | if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS) |
| 2933 | limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n")); |
| 2934 | pAddStaParams->listenInterval = (tANI_U16)listenInterval; |
| 2935 | |
| 2936 | limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry); |
| 2937 | |
| 2938 | // Lets save this for when we receive the Reassoc Rsp |
| 2939 | pMac->ft.ftPEContext.pAddStaReq = pAddStaParams; |
| 2940 | return; |
| 2941 | |
| 2942 | end: |
| 2943 | // Free up buffer allocated for reassocReq |
| 2944 | if (pMlmReassocReq != NULL) |
| 2945 | { |
| 2946 | palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq); |
| 2947 | } |
| 2948 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 2949 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2950 | /* Update PE sessio Id*/ |
| 2951 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 2952 | |
| 2953 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 2954 | } |
| 2955 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 2956 | |
| 2957 | |
| 2958 | /** |
| 2959 | * limProcessStaMlmAddBssRsp() |
| 2960 | * |
| 2961 | *FUNCTION: |
| 2962 | * This function is called to process a WDA_ADD_BSS_RSP from HAL. |
| 2963 | * Upon receipt of this message from HAL, MLME - |
| 2964 | * > Validates the result of WDA_ADD_BSS_REQ |
| 2965 | * > Now, send an ADD_STA to HAL and ADD the "local" STA itself |
| 2966 | * |
| 2967 | *LOGIC: |
| 2968 | * MLME had sent WDA_ADD_BSS_REQ to HAL |
| 2969 | * HAL responded with WDA_ADD_BSS_RSP to MLME |
| 2970 | * MLME now sends WDA_ADD_STA_REQ to HAL |
| 2971 | * |
| 2972 | *ASSUMPTIONS: |
| 2973 | * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq |
| 2974 | * tSirMsgQ.body will now be freed by this routine |
| 2975 | * |
| 2976 | *NOTE: |
| 2977 | * |
| 2978 | * @param pMac Pointer to Global MAC structure |
| 2979 | * @param tSirMsgQ The MsgQ header, which contains the response buffer |
| 2980 | * |
| 2981 | * @return None |
| 2982 | */ |
| 2983 | static void |
| 2984 | limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry) |
| 2985 | { |
| 2986 | tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr; |
| 2987 | tLimMlmAssocCnf mlmAssocCnf; |
| 2988 | tANI_U32 mesgType = LIM_MLM_ASSOC_CNF; |
| 2989 | tANI_U32 subType = LIM_ASSOC; |
| 2990 | tpDphHashNode pStaDs = NULL; |
| 2991 | tANI_U16 staIdx = HAL_STA_INVALID_IDX; |
| 2992 | tANI_U8 updateSta = false; |
| 2993 | mlmAssocCnf.resultCode = eSIR_SME_SUCCESS; |
| 2994 | |
| 2995 | if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState) |
| 2996 | { |
| 2997 | //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function |
| 2998 | limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry); |
| 2999 | goto end; |
| 3000 | } |
| 3001 | if( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState ) |
| 3002 | { |
| 3003 | mesgType = LIM_MLM_REASSOC_CNF; |
| 3004 | subType = LIM_REASSOC; |
| 3005 | //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL |
| 3006 | //to update the existing STA entry. |
| 3007 | //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted |
| 3008 | //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index. |
| 3009 | if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId)) |
| 3010 | { |
| 3011 | staIdx = psessionEntry->staId; |
| 3012 | updateSta = true; |
| 3013 | } |
| 3014 | } |
| 3015 | if( eHAL_STATUS_SUCCESS == pAddBssParams->status ) |
| 3016 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3017 | #if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3018 | if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState ) |
| 3019 | { |
| 3020 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
| 3021 | PELOGE(limLog(pMac, LOGE, FL("Mlm=%d %d\n"), |
| 3022 | psessionEntry->limMlmState, |
| 3023 | eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);) |
| 3024 | #endif |
| 3025 | limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry); |
| 3026 | goto end; |
| 3027 | } |
| 3028 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3029 | |
| 3030 | // Set MLME state |
| 3031 | psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3032 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3033 | psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th |
| 3034 | // Now, send WDA_ADD_STA_REQ |
| 3035 | limLog( pMac, LOGW, FL( "On STA: ADD_BSS was successful\n" )); |
| 3036 | pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 3037 | if (pStaDs == NULL) |
| 3038 | { |
| 3039 | PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station\n"));) |
| 3040 | mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED; |
| 3041 | } |
| 3042 | else |
| 3043 | { |
| 3044 | psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx; |
| 3045 | //Success, handle below |
| 3046 | pStaDs->bssId = pAddBssParams->bssIdx; |
| 3047 | //STA Index(genr by HAL) for the BSS entry is stored here |
| 3048 | pStaDs->staIndex = pAddBssParams->staContext.staIdx; |
| 3049 | pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig; |
| 3050 | pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig; |
| 3051 | // Downgrade the EDCA parameters if needed |
| 3052 | limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry); |
| 3053 | // Send the active EDCA parameters to HAL |
| 3054 | if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) { |
| 3055 | limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE); |
| 3056 | } else { |
| 3057 | limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE); |
| 3058 | } |
| 3059 | #if defined WLAN_FEATURE_VOWIFI |
| 3060 | rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry ); |
| 3061 | #endif |
| 3062 | |
| 3063 | if (subType == LIM_REASSOC) |
| 3064 | limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER); |
| 3065 | if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS) |
| 3066 | { |
| 3067 | // Add STA context at HW |
| 3068 | PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station\n"));) |
| 3069 | mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED; |
| 3070 | } |
| 3071 | } |
| 3072 | } |
| 3073 | else |
| 3074 | { |
| 3075 | limLog( pMac, LOGP, FL( "ADD_BSS failed!\n" )); |
| 3076 | // Return Assoc confirm to SME with failure |
| 3077 | mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED; |
| 3078 | } |
| 3079 | |
| 3080 | if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS) |
| 3081 | { |
| 3082 | /* Update PE session Id*/ |
| 3083 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 3084 | limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf ); |
| 3085 | } |
| 3086 | end: |
| 3087 | if( 0 != limMsgQ->bodyptr ) |
| 3088 | palFreeMemory( pMac->hHdd,(void *) pAddBssParams ); |
| 3089 | } |
| 3090 | |
| 3091 | |
| 3092 | |
| 3093 | /** |
| 3094 | * limProcessMlmAddBssRsp() |
| 3095 | * |
| 3096 | *FUNCTION: |
| 3097 | * This function is called to process a WDA_ADD_BSS_RSP from HAL. |
| 3098 | * Upon receipt of this message from HAL, MLME - |
| 3099 | * > Determines the "state" in which this message was received |
| 3100 | * > Forwards it to the appropriate callback |
| 3101 | * |
| 3102 | *LOGIC: |
| 3103 | * WDA_ADD_BSS_RSP can be received by MLME while the LIM is |
| 3104 | * in the following two states: |
| 3105 | * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE |
| 3106 | * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE |
| 3107 | * Based on these two states, this API will determine where to |
| 3108 | * route the message to |
| 3109 | * |
| 3110 | *ASSUMPTIONS: |
| 3111 | * |
| 3112 | *NOTE: |
| 3113 | * |
| 3114 | * @param pMac Pointer to Global MAC structure |
| 3115 | * @param tSirMsgQ The MsgQ header, which contains the response buffer |
| 3116 | * |
| 3117 | * @return None |
| 3118 | */ |
| 3119 | void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ) |
| 3120 | { |
| 3121 | tLimMlmStartCnf mlmStartCnf; |
| 3122 | tpPESession psessionEntry; |
| 3123 | tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr); |
| 3124 | |
| 3125 | if(NULL == pAddBssParams ) |
| 3126 | { |
| 3127 | limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" )); |
| 3128 | return; |
| 3129 | } |
| 3130 | |
| 3131 | // |
| 3132 | // TODO & FIXME_GEN4 |
| 3133 | // Need to inspect tSirMsgQ.reserved for a valid Dialog token! |
| 3134 | // |
| 3135 | //we need to process the deferred message since the initiating req. there might be nested request. |
| 3136 | //in the case of nested request the new request initiated from the response will take care of resetting |
| 3137 | //the deffered flag. |
| 3138 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 3139 | // Validate SME/LIM state |
| 3140 | // Validate MLME state |
| 3141 | if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL) |
| 3142 | { |
| 3143 | limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId\n" )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3144 | if( NULL != pAddBssParams ) |
| 3145 | palFreeMemory( pMac->hHdd, (void *) pAddBssParams ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3146 | return; |
| 3147 | } |
| 3148 | /* update PE session Id*/ |
| 3149 | mlmStartCnf.sessionId = psessionEntry->peSessionId; |
| 3150 | if( eSIR_IBSS_MODE == psessionEntry->bssType ) |
| 3151 | limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry ); |
| 3152 | else |
| 3153 | { |
| 3154 | if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState ) |
| 3155 | { |
| 3156 | if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState ) |
| 3157 | { |
| 3158 | // Mesg received from HAL in Invalid state! |
| 3159 | limLog( pMac, LOGE, |
| 3160 | FL( "Received unexpected WDA_ADD_BSS_RSP in state %X\n" ), |
| 3161 | psessionEntry->limMlmState ); |
| 3162 | mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED; |
| 3163 | if( 0 != limMsgQ->bodyptr ) |
| 3164 | palFreeMemory( pMac->hHdd, (void *) pAddBssParams ); |
| 3165 | limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf ); |
| 3166 | } |
| 3167 | else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)) |
| 3168 | { |
| 3169 | limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry); |
| 3170 | } |
| 3171 | else |
| 3172 | limProcessApMlmAddBssRsp( pMac,limMsgQ); |
| 3173 | } |
| 3174 | else |
| 3175 | /* Called while processing assoc response */ |
| 3176 | limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry); |
| 3177 | } |
| 3178 | } |
| 3179 | /** |
| 3180 | * limProcessMlmSetKeyRsp() |
| 3181 | * |
| 3182 | *FUNCTION: |
| 3183 | * This function is called to process the following two |
| 3184 | * messages from HAL: |
| 3185 | * 1) WDA_SET_BSSKEY_RSP |
| 3186 | * 2) WDA_SET_STAKEY_RSP |
| 3187 | * 3) WDA_SET_STA_BCASTKEY_RSP |
| 3188 | * Upon receipt of this message from HAL, |
| 3189 | * MLME - |
| 3190 | * > Determines the "state" in which this message was received |
| 3191 | * > Forwards it to the appropriate callback |
| 3192 | * |
| 3193 | *LOGIC: |
| 3194 | * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be |
| 3195 | * received by MLME while in the following state: |
| 3196 | * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR-- |
| 3197 | * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR-- |
| 3198 | * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE |
| 3199 | * Based on this state, this API will determine where to |
| 3200 | * route the message to |
| 3201 | * |
| 3202 | *ASSUMPTIONS: |
| 3203 | * ONLY the MLME state is being taken into account for now. |
| 3204 | * This is because, it appears that the handling of the |
| 3205 | * SETKEYS REQ is handled symmetrically on both the AP & STA |
| 3206 | * |
| 3207 | *NOTE: |
| 3208 | * |
| 3209 | * @param pMac Pointer to Global MAC structure |
| 3210 | * @param tSirMsgQ The MsgQ header, which contains the response buffer |
| 3211 | * |
| 3212 | * @return None |
| 3213 | */ |
| 3214 | void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ) |
| 3215 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3216 | tANI_U8 respReqd = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3217 | tLimMlmSetKeysCnf mlmSetKeysCnf; |
| 3218 | tANI_U8 sessionId = 0; |
| 3219 | tpPESession psessionEntry; |
| 3220 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 3221 | palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf )); |
| 3222 | //BTAMP |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3223 | if( NULL == limMsgQ->bodyptr ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3224 | { |
| 3225 | PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));) |
| 3226 | return; |
| 3227 | } |
| 3228 | sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId; |
| 3229 | if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL) |
| 3230 | { |
| 3231 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3232 | palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3233 | return; |
| 3234 | } |
| 3235 | if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState ) |
| 3236 | { |
| 3237 | // Mesg received from HAL in Invalid state! |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3238 | limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, psessionEntry->limMlmState ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3239 | // There's not much that MLME can do at this stage... |
| 3240 | respReqd = 0; |
| 3241 | } |
| 3242 | else |
| 3243 | mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); |
| 3244 | |
| 3245 | palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr ); |
| 3246 | // Restore MLME state |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3247 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3248 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3249 | if( respReqd ) |
| 3250 | { |
| 3251 | tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq; |
| 3252 | // Prepare and Send LIM_MLM_SETKEYS_CNF |
| 3253 | if( NULL != lpLimMlmSetKeysReq ) |
| 3254 | { |
| 3255 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) ); |
| 3256 | #ifdef ANI_PRODUCT_TYPE_AP |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3257 | mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3258 | #endif |
| 3259 | // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3260 | palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3261 | pMac->lim.gpLimMlmSetKeysReq = NULL; |
| 3262 | } |
| 3263 | mlmSetKeysCnf.sessionId = sessionId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3264 | limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3265 | } |
| 3266 | } |
| 3267 | void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ) |
| 3268 | { |
| 3269 | tANI_U8 respReqd = 1; |
| 3270 | tLimMlmSetKeysCnf mlmSetKeysCnf; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3271 | tANI_U16 resultCode; |
| 3272 | tANI_U8 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3273 | tpPESession psessionEntry; |
| 3274 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 3275 | palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf )); |
| 3276 | //BTAMP |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3277 | if( NULL == limMsgQ->bodyptr ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3278 | { |
| 3279 | PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null\n"));) |
| 3280 | return; |
| 3281 | } |
| 3282 | sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId; |
| 3283 | if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL) |
| 3284 | { |
| 3285 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3286 | palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3287 | return; |
| 3288 | } |
| 3289 | if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState ) |
| 3290 | resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status); |
| 3291 | else |
| 3292 | resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty. |
| 3293 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3294 | // |
| 3295 | // TODO & FIXME_GEN4 |
| 3296 | // Need to inspect tSirMsgQ.reserved for a valid Dialog token! |
| 3297 | // |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3298 | // Validate SME/LIM state - Read the above "ASSUMPTIONS" |
| 3299 | //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState ) |
| 3300 | //{ |
| 3301 | // Validate MLME state |
| 3302 | if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState && |
| 3303 | eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState ) |
| 3304 | { |
| 3305 | // Mesg received from HAL in Invalid state! |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3306 | limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, psessionEntry->limMlmState ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3307 | // There's not much that MLME can do at this stage... |
| 3308 | respReqd = 0; |
| 3309 | } |
| 3310 | else |
| 3311 | mlmSetKeysCnf.resultCode = resultCode; |
| 3312 | |
| 3313 | palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr ); |
| 3314 | // Restore MLME state |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3315 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
| 3316 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3317 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3318 | if( respReqd ) |
| 3319 | { |
| 3320 | tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq; |
| 3321 | mlmSetKeysCnf.sessionId = sessionId; |
| 3322 | |
| 3323 | // Prepare and Send LIM_MLM_SETKEYS_CNF |
| 3324 | if( NULL != lpLimMlmSetKeysReq ) |
| 3325 | { |
| 3326 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) ); |
| 3327 | #ifdef ANI_PRODUCT_TYPE_AP |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3328 | mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3329 | #endif |
| 3330 | // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3331 | palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3332 | pMac->lim.gpLimMlmSetKeysReq = NULL; |
| 3333 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3334 | limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3335 | } |
| 3336 | } |
| 3337 | /** |
| 3338 | * limProcessMlmRemoveKeyRsp() |
| 3339 | * |
| 3340 | *FUNCTION: |
| 3341 | * |
| 3342 | *LOGIC: |
| 3343 | * |
| 3344 | *ASSUMPTIONS: |
| 3345 | * |
| 3346 | *NOTE: |
| 3347 | * |
| 3348 | * @param pMac Pointer to Global MAC structure |
| 3349 | * @param tSirMsgQ The MsgQ header, which contains the response buffer |
| 3350 | * |
| 3351 | * @return None |
| 3352 | */ |
| 3353 | void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ) |
| 3354 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3355 | tANI_U8 respReqd = 1; |
| 3356 | tLimMlmRemoveKeyCnf mlmRemoveCnf; |
| 3357 | tANI_U16 resultCode; |
| 3358 | tANI_U8 sessionId = 0; |
| 3359 | tpPESession psessionEntry; |
| 3360 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 3361 | palZeroMemory( pMac->hHdd, (void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf )); |
| 3362 | |
| 3363 | if( NULL == limMsgQ->bodyptr ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3364 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3365 | PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));) |
| 3366 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3367 | } |
| 3368 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3369 | if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP) |
| 3370 | sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId; |
| 3371 | else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP) |
| 3372 | sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3373 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3374 | if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3375 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3376 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));) |
| 3377 | return; |
| 3378 | } |
| 3379 | |
| 3380 | if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState ) |
| 3381 | resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status); |
| 3382 | else |
| 3383 | resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status); |
| 3384 | |
| 3385 | // Validate MLME state |
| 3386 | if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState && |
| 3387 | eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState ) |
| 3388 | { |
| 3389 | // Mesg received from HAL in Invalid state! |
| 3390 | limLog(pMac, LOGW, |
| 3391 | FL("Received unexpected [Mesg Id - %d] in state %X\n"), |
| 3392 | limMsgQ->type, |
| 3393 | psessionEntry->limMlmState ); |
| 3394 | respReqd = 0; |
| 3395 | } |
| 3396 | else |
| 3397 | mlmRemoveCnf.resultCode = resultCode; |
| 3398 | |
| 3399 | // |
| 3400 | // TODO & FIXME_GEN4 |
| 3401 | // Need to inspect tSirMsgQ.reserved for a valid Dialog token! |
| 3402 | // |
| 3403 | |
| 3404 | palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr ); |
| 3405 | |
| 3406 | // Restore MLME state |
| 3407 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
| 3408 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
| 3409 | |
| 3410 | if( respReqd ) |
| 3411 | { |
| 3412 | tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq; |
| 3413 | mlmRemoveCnf.sessionId = sessionId; |
| 3414 | |
| 3415 | // Prepare and Send LIM_MLM_REMOVEKEY_CNF |
| 3416 | if( NULL != lpLimMlmRemoveKeyReq ) |
| 3417 | { |
| 3418 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmRemoveCnf.peerMacAddr, (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr, |
| 3419 | sizeof( tSirMacAddr )); |
| 3420 | // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq |
| 3421 | palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmRemoveKeyReq); |
| 3422 | pMac->lim.gpLimMlmRemoveKeyReq = NULL; |
| 3423 | } |
| 3424 | limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf ); |
| 3425 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3426 | } |
| 3427 | |
| 3428 | #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK)) |
| 3429 | /**---------------------------------------------------- |
| 3430 | \fn __limProcessFinishLearnRsp |
| 3431 | \brief Handle finish learn rsp state, only for AP. |
| 3432 | \param pMac |
| 3433 | \return NONE |
| 3434 | -----------------------------------------------------*/ |
| 3435 | static void __limProcessFinishLearnRsp(tpAniSirGlobal pMac) |
| 3436 | { |
| 3437 | PELOG2(limLog(pMac, LOG2, FL("System Role: %d\n"), pMac->lim.gLimSystemRole);) |
| 3438 | if (pMac->lim.gpLimMeasReq == NULL) |
| 3439 | { |
| 3440 | limRestorePreLearnState(pMac); |
| 3441 | return; |
| 3442 | } |
| 3443 | /** |
| 3444 | * Initial measurement -> periodic measurement should keep enabled, so that |
| 3445 | * if system Role is UNKNOWN LIM can send indication to WSM. Overloading |
| 3446 | * periodic measurement to distinguish initial measurement and radar |
| 3447 | * detect park basically to avoid sending measurement indication after |
| 3448 | * radar detect park. |
| 3449 | * Radar detect park -> periodic measurement should be disabled, so that |
| 3450 | * LIM wont send indication even when role is UNKNOWN. |
| 3451 | * Final measurement -> periodic measurement should be enabled, so that |
| 3452 | * LIM could start measurement indication timer. |
| 3453 | */ |
| 3454 | if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled && |
| 3455 | !pMac->lim.gLimMeasParams.isMeasIndTimerActive) |
| 3456 | { |
| 3457 | #if 0 /* Will we be ever in UNKNOWN ROLE: Veerendra */ |
| 3458 | if (pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE) |
| 3459 | { |
| 3460 | limSendSmeMeasurementInd(pMac); |
| 3461 | limCleanupMeasResources(pMac); |
| 3462 | limRestorePreLearnState(pMac); |
| 3463 | return; |
| 3464 | } |
| 3465 | else |
| 3466 | #endif |
| 3467 | { |
| 3468 | #ifdef GEN6_TODO |
| 3469 | /* revisit this piece of code to assign the appropriate sessionId below |
| 3470 | * priority - MEDIUM |
| 3471 | */ |
| 3472 | pMac->lim.gLimMeasParams.measurementIndTimer.sessionId = sessionId; |
| 3473 | #endif |
| 3474 | // Activate periodic measurement indication timer |
| 3475 | if (tx_timer_activate( |
| 3476 | &pMac->lim.gLimMeasParams.measurementIndTimer) |
| 3477 | != TX_SUCCESS) |
| 3478 | { |
| 3479 | limLog(pMac, LOGP, FL("could not start Meas IND timer\n")); |
| 3480 | return; |
| 3481 | } |
| 3482 | pMac->lim.gLimMeasParams.isMeasIndTimerActive = 1; |
| 3483 | } |
| 3484 | } |
| 3485 | if (pMac->lim.gLimMeasParams.nextLearnChannelId >= |
| 3486 | pMac->lim.gpLimMeasReq->channelList.numChannels - 1) |
| 3487 | { |
| 3488 | // All channels in the channel set are learned. |
| 3489 | pMac->lim.gLimMeasParams.nextLearnChannelId = 0; |
| 3490 | } |
| 3491 | // Go back to previous state. |
| 3492 | limRestorePreLearnState(pMac); |
| 3493 | // Restart the learn interval timer. |
| 3494 | if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled) |
| 3495 | limReEnableLearnMode(pMac); |
| 3496 | return; |
| 3497 | } |
| 3498 | #endif |
| 3499 | |
| 3500 | /** --------------------------------------------------------------------- |
| 3501 | \fn limProcessInitScanRsp |
| 3502 | \brief This function is called when LIM receives WDA_INIT_SCAN_RSP |
| 3503 | \ message from HAL. If status code is failure, then |
| 3504 | \ update the gLimNumOfConsecutiveBkgndScanFailure count. |
| 3505 | \param tpAniSirGlobal pMac |
| 3506 | \param tANI_U32 body |
| 3507 | \return none |
| 3508 | \ ----------------------------------------------------------------------- */ |
| 3509 | void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body) |
| 3510 | { |
| 3511 | tpInitScanParams pInitScanParam; |
| 3512 | eHalStatus status; |
| 3513 | #if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 3514 | tANI_U8 channelNum; |
| 3515 | #endif |
| 3516 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 3517 | pInitScanParam = (tpInitScanParams) body; |
| 3518 | status = pInitScanParam->status; |
| 3519 | palFreeMemory( pMac->hHdd, (char *)body); |
| 3520 | |
| 3521 | //Only abort scan if the we are scanning. |
| 3522 | if( pMac->lim.abortScan && |
| 3523 | (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) ) |
| 3524 | { |
| 3525 | limLog( pMac, LOGW, FL(" finish scan\n") ); |
| 3526 | pMac->lim.abortScan = 0; |
| 3527 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 3528 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 3529 | //Set the resume channel to Any valid channel (invalid). |
| 3530 | //This will instruct HAL to set it to any previous valid channel. |
| 3531 | peSetResumeChannel(pMac, 0, 0); |
| 3532 | limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE); |
| 3533 | } |
| 3534 | switch(pMac->lim.gLimHalScanState) |
| 3535 | { |
| 3536 | case eLIM_HAL_INIT_SCAN_WAIT_STATE: |
| 3537 | if (status != (tANI_U32) eHAL_STATUS_SUCCESS) |
| 3538 | { |
| 3539 | PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d\n"), status);) |
| 3540 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 3541 | pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1; |
| 3542 | /* |
| 3543 | * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger |
| 3544 | * another Scan request in the same context (happens when 11d is enabled |
| 3545 | * and first scan request with 11d channels fails for whatever reason, then CSR issues next init |
| 3546 | * scan in the same context but with bigger channel list), so the state needs to be |
| 3547 | * changed before this response message is sent. |
| 3548 | */ |
| 3549 | limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED); |
| 3550 | #if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 3551 | /* For handling the measurement request from WSM as scan request in LIM*/ |
| 3552 | #if 0 |
| 3553 | if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE && pMac->lim.gpLimMeasReq != NULL) |
| 3554 | { |
| 3555 | limRestorePreLearnState(pMac); |
| 3556 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 3557 | limReEnableLearnMode(pMac); |
| 3558 | } |
| 3559 | #endif |
| 3560 | #endif |
| 3561 | return; |
| 3562 | } |
| 3563 | else if (status == eHAL_STATUS_SUCCESS) |
| 3564 | { |
| 3565 | /* since we have successfully triggered a background scan, |
| 3566 | * reset the "consecutive bkgnd scan failure" count to 0 |
| 3567 | */ |
| 3568 | pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0; |
| 3569 | pMac->lim.gLimNumOfBackgroundScanSuccess += 1; |
| 3570 | } |
| 3571 | limContinueChannelScan(pMac); |
| 3572 | break; |
| 3573 | #if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 3574 | case eLIM_HAL_INIT_LEARN_WAIT_STATE: |
| 3575 | // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE) |
| 3576 | { |
| 3577 | if (status != (tANI_U32) eHAL_STATUS_SUCCESS) |
| 3578 | { |
| 3579 | limRestorePreLearnState(pMac); |
| 3580 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 3581 | limReEnableLearnMode(pMac); |
| 3582 | return; |
| 3583 | } |
| 3584 | channelNum = limGetCurrentLearnChannel(pMac); |
| 3585 | limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_LEARN_WAIT_STATE); |
| 3586 | } |
| 3587 | break; |
| 3588 | #endif |
| 3589 | //WLAN_SUSPEND_LINK Related |
| 3590 | case eLIM_HAL_SUSPEND_LINK_WAIT_STATE: |
| 3591 | if( pMac->lim.gpLimSuspendCallback ) |
| 3592 | { |
| 3593 | if( status == eHAL_STATUS_SUCCESS ) |
| 3594 | pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE; |
| 3595 | else |
| 3596 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 3597 | |
| 3598 | pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData ); |
| 3599 | pMac->lim.gpLimSuspendCallback = NULL; |
| 3600 | pMac->lim.gpLimSuspendData = NULL; |
| 3601 | } |
| 3602 | else |
| 3603 | { |
| 3604 | limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state\n"); |
| 3605 | return; |
| 3606 | } |
| 3607 | break; |
| 3608 | //end WLAN_SUSPEND_LINK Related |
| 3609 | default: |
| 3610 | limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d\n"), |
| 3611 | pMac->lim.gLimHalScanState); |
| 3612 | break; |
| 3613 | } |
| 3614 | return; |
| 3615 | } |
| 3616 | /** |
| 3617 | * limProcessSwitchChannelReAssocReq() |
| 3618 | * |
| 3619 | *FUNCTION: |
| 3620 | * This function is called to send the reassoc req mgmt frame after the |
| 3621 | * switchChannelRsp message is received from HAL. |
| 3622 | * |
| 3623 | *LOGIC: |
| 3624 | * |
| 3625 | *ASSUMPTIONS: |
| 3626 | * NA |
| 3627 | * |
| 3628 | *NOTE: |
| 3629 | * NA |
| 3630 | * |
| 3631 | * @param pMac - Pointer to Global MAC structure. |
| 3632 | * @param psessionEntry - session related information. |
| 3633 | * @param status - channel switch success/failure. |
| 3634 | * |
| 3635 | * @return None |
| 3636 | */ |
| 3637 | static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status) |
| 3638 | { |
| 3639 | tLimMlmReassocCnf mlmReassocCnf; |
| 3640 | tLimMlmReassocReq *pMlmReassocReq; |
| 3641 | pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq); |
| 3642 | if(pMlmReassocReq == NULL) |
| 3643 | { |
| 3644 | limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession\n")); |
| 3645 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3646 | goto end; |
| 3647 | } |
| 3648 | |
| 3649 | if(status != eHAL_STATUS_SUCCESS) |
| 3650 | { |
| 3651 | PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!\n"));) |
| 3652 | mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL; |
| 3653 | goto end; |
| 3654 | } |
| 3655 | /// Start reassociation failure timer |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3656 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3657 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 3658 | != TX_SUCCESS) |
| 3659 | { |
| 3660 | /// Could not start reassoc failure timer. |
| 3661 | // Log error |
| 3662 | limLog(pMac, LOGP, |
| 3663 | FL("could not start Reassociation failure timer\n")); |
| 3664 | // Return Reassoc confirm with |
| 3665 | // Resources Unavailable |
| 3666 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3667 | goto end; |
| 3668 | } |
| 3669 | /// Prepare and send Reassociation request frame |
| 3670 | limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry); |
| 3671 | return; |
| 3672 | end: |
| 3673 | // Free up buffer allocated for reassocReq |
| 3674 | if(pMlmReassocReq != NULL) |
| 3675 | { |
| 3676 | /* Update PE session Id*/ |
| 3677 | mlmReassocCnf.sessionId = pMlmReassocReq->sessionId; |
| 3678 | palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq); |
| 3679 | } |
| 3680 | else |
| 3681 | { |
| 3682 | mlmReassocCnf.sessionId = 0; |
| 3683 | } |
| 3684 | |
| 3685 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3686 | /* Update PE sessio Id*/ |
| 3687 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 3688 | |
| 3689 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 3690 | } |
| 3691 | /** |
| 3692 | * limProcessSwitchChannelJoinReq() |
| 3693 | * |
| 3694 | *FUNCTION: |
| 3695 | * This function is called to send the probe req mgmt frame after the |
| 3696 | * switchChannelRsp message is received from HAL. |
| 3697 | * |
| 3698 | *LOGIC: |
| 3699 | * |
| 3700 | *ASSUMPTIONS: |
| 3701 | * NA |
| 3702 | * |
| 3703 | *NOTE: |
| 3704 | * NA |
| 3705 | * |
| 3706 | * @param pMac - Pointer to Global MAC structure. |
| 3707 | * @param psessionEntry - session related information. |
| 3708 | * @param status - channel switch success/failure. |
| 3709 | * |
| 3710 | * @return None |
| 3711 | */ |
| 3712 | static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status) |
| 3713 | { |
| 3714 | tANI_U32 val; |
| 3715 | tSirMacSSid ssId; |
| 3716 | tLimMlmJoinCnf mlmJoinCnf; |
| 3717 | if(status != eHAL_STATUS_SUCCESS) |
| 3718 | { |
| 3719 | PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!\n"));) |
| 3720 | goto error; |
| 3721 | } |
| 3722 | |
| 3723 | if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) ) |
| 3724 | { |
| 3725 | PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!\n"));) |
| 3726 | goto error; |
| 3727 | } |
| 3728 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3729 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3730 | /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */ |
| 3731 | if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE) |
| 3732 | { |
| 3733 | if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId, |
| 3734 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS ) |
| 3735 | goto error; |
| 3736 | } |
| 3737 | else |
| 3738 | { |
| 3739 | if(limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId, |
| 3740 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS) |
| 3741 | goto error; |
| 3742 | } |
| 3743 | // Update BSSID at CFG database |
| 3744 | #if 0 |
| 3745 | if (cfgSetStr(pMac, WNI_CFG_BSSID, pMac->lim.gpLimMlmJoinReq->bssDescription.bssId, |
| 3746 | sizeof(tSirMacAddr)) |
| 3747 | != eSIR_SUCCESS) |
| 3748 | limLog(pMac, LOGP, FL("could not update BSSID at CFG\n")); |
| 3749 | #endif //TO SUPPORT BT-AMP |
| 3750 | //sirCopyMacAddr(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,psessionEntry->bssId); |
| 3751 | |
| 3752 | /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */ |
| 3753 | if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS) |
| 3754 | limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!\n")); |
| 3755 | pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0; |
| 3756 | // Apply previously set configuration at HW |
| 3757 | limApplyConfiguration(pMac, psessionEntry); |
| 3758 | /// Wait for Beacon to announce join success |
| 3759 | #if 0 |
| 3760 | if (cfgGetStr(pMac, WNI_CFG_SSID, ssId.ssId, &cfgLen) != eSIR_SUCCESS) |
| 3761 | limLog(pMac, LOGP, FL("could not retrive SSID\n")); |
| 3762 | #endif //To SUPPORT BT-AMP |
| 3763 | palCopyMemory( pMac->hHdd, ssId.ssId, |
| 3764 | psessionEntry->ssId.ssId, |
| 3765 | psessionEntry->ssId.length); |
| 3766 | ssId.length = psessionEntry->ssId.length; |
| 3767 | // include additional IE if there is |
| 3768 | limSendProbeReqMgmtFrame( pMac, &ssId, |
| 3769 | psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/, |
| 3770 | psessionEntry->selfMacAddr, psessionEntry->dot11mode, |
| 3771 | psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3772 | |
| 3773 | // Sending mgmt frame is a blocking call activate Join failure timer now |
| 3774 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER)); |
| 3775 | if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS) |
| 3776 | { |
| 3777 | limLog(pMac, LOGP, FL("could not activate Join failure timer\n")); |
| 3778 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
| 3779 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState)); |
| 3780 | //memory is freed up below. |
| 3781 | psessionEntry->pLimMlmJoinReq = NULL; |
| 3782 | goto error; |
| 3783 | } |
| 3784 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3785 | return; |
| 3786 | error: |
| 3787 | if(NULL != psessionEntry) |
| 3788 | { |
| 3789 | palFreeMemory( pMac->hHdd, (tANI_U8 *) (psessionEntry->pLimMlmJoinReq)); |
| 3790 | psessionEntry->pLimMlmJoinReq = NULL; |
| 3791 | mlmJoinCnf.sessionId = psessionEntry->peSessionId; |
| 3792 | } |
| 3793 | else |
| 3794 | { |
| 3795 | mlmJoinCnf.sessionId = 0; |
| 3796 | } |
| 3797 | mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3798 | mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3799 | limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf); |
| 3800 | } |
| 3801 | |
| 3802 | /** |
| 3803 | * limProcessSwitchChannelRsp() |
| 3804 | * |
| 3805 | *FUNCTION: |
| 3806 | * This function is called to process switchChannelRsp message from HAL. |
| 3807 | * |
| 3808 | *LOGIC: |
| 3809 | * |
| 3810 | *ASSUMPTIONS: |
| 3811 | * NA |
| 3812 | * |
| 3813 | *NOTE: |
| 3814 | * NA |
| 3815 | * |
| 3816 | * @param pMac - Pointer to Global MAC structure |
| 3817 | * @param body - message body. |
| 3818 | * |
| 3819 | * @return None |
| 3820 | */ |
| 3821 | void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body) |
| 3822 | { |
| 3823 | tpSwitchChannelParams pChnlParams = NULL; |
| 3824 | eHalStatus status; |
| 3825 | tANI_U16 channelChangeReasonCode; |
| 3826 | tANI_U8 peSessionId; |
| 3827 | tpPESession psessionEntry; |
| 3828 | //we need to process the deferred message since the initiating req. there might be nested request. |
| 3829 | //in the case of nested request the new request initiated from the response will take care of resetting |
| 3830 | //the deffered flag. |
| 3831 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 3832 | pChnlParams = (tpSwitchChannelParams) body; |
| 3833 | status = pChnlParams->status; |
| 3834 | peSessionId = pChnlParams->peSessionId; |
| 3835 | if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL) |
| 3836 | { |
| 3837 | palFreeMemory( pMac->hHdd, (tANI_U8 *)body); |
| 3838 | limLog(pMac, LOGP, FL("session does not exist for given sessionId\n")); |
| 3839 | return; |
| 3840 | } |
| 3841 | #if defined WLAN_FEATURE_VOWIFI |
| 3842 | //HAL fills in the tx power used for mgmt frames in this field. |
| 3843 | //Store this value to use in TPC report IE. |
| 3844 | rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry ); |
| 3845 | #endif |
| 3846 | palFreeMemory( pMac->hHdd, (tANI_U8 *)body); |
| 3847 | channelChangeReasonCode = psessionEntry->channelChangeReasonCode; |
| 3848 | // initialize it back to invalid id |
| 3849 | psessionEntry->channelChangeReasonCode = 0xBAD; |
| 3850 | switch(channelChangeReasonCode) |
| 3851 | { |
| 3852 | case LIM_SWITCH_CHANNEL_REASSOC: |
| 3853 | limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status); |
| 3854 | break; |
| 3855 | case LIM_SWITCH_CHANNEL_JOIN: |
| 3856 | limProcessSwitchChannelJoinReq(pMac, psessionEntry, status); |
| 3857 | break; |
| 3858 | |
| 3859 | case LIM_SWITCH_CHANNEL_OPERATION: |
| 3860 | /* |
| 3861 | * The above code should also use the callback. |
| 3862 | * mechanism below, there is scope for cleanup here. |
| 3863 | * THat way all this response handler does is call the call back |
| 3864 | * We can get rid of the reason code here. |
| 3865 | */ |
| 3866 | if (pMac->lim.gpchangeChannelCallback) |
| 3867 | { |
| 3868 | PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back\n");) |
| 3869 | pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry); |
| 3870 | } |
| 3871 | break; |
| 3872 | default: |
| 3873 | break; |
| 3874 | } |
| 3875 | } |
| 3876 | /** |
| 3877 | * limProcessStartScanRsp() |
| 3878 | * |
| 3879 | *FUNCTION: |
| 3880 | * This function is called to process startScanRsp message from HAL. If scan/learn was successful |
| 3881 | * then it will start scan/learn on the next channel. |
| 3882 | * |
| 3883 | *LOGIC: |
| 3884 | * |
| 3885 | *ASSUMPTIONS: |
| 3886 | * NA |
| 3887 | * |
| 3888 | *NOTE: |
| 3889 | * NA |
| 3890 | * |
| 3891 | * @param pMac - Pointer to Global MAC structure |
| 3892 | * @param body - message body. |
| 3893 | * |
| 3894 | * @return None |
| 3895 | */ |
| 3896 | |
| 3897 | void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body) |
| 3898 | { |
| 3899 | tpStartScanParams pStartScanParam; |
| 3900 | eHalStatus status; |
| 3901 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 3902 | pStartScanParam = (tpStartScanParams) body; |
| 3903 | status = pStartScanParam->status; |
| 3904 | #if defined WLAN_FEATURE_VOWIFI |
| 3905 | //HAL fills in the tx power used for mgmt frames in this field. |
| 3906 | //Store this value to use in TPC report IE. |
| 3907 | rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL ); |
| 3908 | //Store start TSF of scan start. This will be stored in BSS params. |
| 3909 | rrmUpdateStartTSF( pMac, pStartScanParam->startTSF ); |
| 3910 | #endif |
| 3911 | palFreeMemory( pMac->hHdd, (tANI_U8 *)body); |
| 3912 | if( pMac->lim.abortScan ) |
| 3913 | { |
| 3914 | limLog( pMac, LOGW, FL(" finish scan\n") ); |
| 3915 | pMac->lim.abortScan = 0; |
| 3916 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 3917 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 3918 | //Set the resume channel to Any valid channel (invalid). |
| 3919 | //This will instruct HAL to set it to any previous valid channel. |
| 3920 | peSetResumeChannel(pMac, 0, 0); |
| 3921 | limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE); |
| 3922 | } |
| 3923 | switch(pMac->lim.gLimHalScanState) |
| 3924 | { |
| 3925 | case eLIM_HAL_START_SCAN_WAIT_STATE: |
| 3926 | if (status != (tANI_U32) eHAL_STATUS_SUCCESS) |
| 3927 | { |
| 3928 | PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d\n"), status);) |
| 3929 | // |
| 3930 | // FIXME - With this, LIM will try and recover state, but |
| 3931 | // eWNI_SME_SCAN_CNF maybe reporting an incorrect |
| 3932 | // status back to the SME |
| 3933 | // |
| 3934 | //Set the resume channel to Any valid channel (invalid). |
| 3935 | //This will instruct HAL to set it to any previous valid channel. |
| 3936 | peSetResumeChannel(pMac, 0, 0); |
| 3937 | limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE ); |
| 3938 | //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED); |
| 3939 | } |
| 3940 | else |
| 3941 | { |
| 3942 | pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE; |
| 3943 | limContinuePostChannelScan(pMac); |
| 3944 | } |
| 3945 | break; |
| 3946 | #if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 3947 | case eLIM_HAL_START_LEARN_WAIT_STATE: |
| 3948 | // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE) |
| 3949 | { |
| 3950 | if (status != (tANI_U32) eHAL_STATUS_SUCCESS) |
| 3951 | { |
| 3952 | //Set the resume channel to Any valid channel (invalid). |
| 3953 | //This will instruct HAL to set it to any previous valid channel. |
| 3954 | peSetResumeChannel(pMac, 0, 0); |
| 3955 | limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE); |
| 3956 | } |
| 3957 | else |
| 3958 | { |
| 3959 | limContinueChannelLearn(pMac); |
| 3960 | } |
| 3961 | } |
| 3962 | break; |
| 3963 | #endif |
| 3964 | default: |
| 3965 | limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d\n"), |
| 3966 | pMac->lim.gLimHalScanState); |
| 3967 | break; |
| 3968 | } |
| 3969 | return; |
| 3970 | } |
| 3971 | void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body) |
| 3972 | { |
| 3973 | tpEndScanParams pEndScanParam; |
| 3974 | eHalStatus status; |
| 3975 | #if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 3976 | tANI_U8 channelNum; |
| 3977 | #endif |
| 3978 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 3979 | pEndScanParam = (tpEndScanParams) body; |
| 3980 | status = pEndScanParam->status; |
| 3981 | palFreeMemory( pMac->hHdd, (char *)body); |
| 3982 | switch(pMac->lim.gLimHalScanState) |
| 3983 | { |
| 3984 | case eLIM_HAL_END_SCAN_WAIT_STATE: |
| 3985 | if (status != (tANI_U32) eHAL_STATUS_SUCCESS) |
| 3986 | { |
| 3987 | PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d\n"), status);) |
| 3988 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 3989 | limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED); |
| 3990 | } |
| 3991 | else |
| 3992 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3993 | //Skip Dfs Channel in case of P2P Search |
| 3994 | //If skipDfsChnlInP2pSearch is set in ini |
| 3995 | if( ( pMac->lim.gpLimMlmScanReq != NULL ) && |
| 3996 | pMac->lim.gpLimMlmScanReq->p2pSearch && |
| 3997 | pMac->lim.gpLimMlmScanReq->skipDfsChnlInP2pSearch ) |
| 3998 | { |
| 3999 | int flag = 0; |
| 4000 | while(!flag) |
| 4001 | { |
| 4002 | pMac->lim.gLimCurrentScanChannelId++; |
| 4003 | if( (pMac->lim.gLimCurrentScanChannelId > |
| 4004 | (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))|| |
| 4005 | (limActiveScanAllowed(pMac, limGetCurrentScanChannel(pMac)))) |
| 4006 | { |
| 4007 | flag=1; //Bail out from here |
| 4008 | } |
| 4009 | } |
| 4010 | } |
| 4011 | else |
| 4012 | { |
| 4013 | pMac->lim.gLimCurrentScanChannelId++; |
| 4014 | } |
| 4015 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4016 | limContinueChannelScan(pMac); |
| 4017 | } |
| 4018 | break; |
| 4019 | #if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 4020 | case eLIM_HAL_END_LEARN_WAIT_STATE: |
| 4021 | if (status != (tANI_U32) eHAL_STATUS_SUCCESS) |
| 4022 | { |
| 4023 | //Set the resume channel to Any valid channel (invalid). |
| 4024 | //This will instruct HAL to set it to any previous valid channel. |
| 4025 | peSetResumeChannel(pMac, 0, 0); |
| 4026 | limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE); |
| 4027 | } |
| 4028 | #if 0 /* Will we be in UNKNOWN ROLE ever in this context: Veerendra */ |
| 4029 | else if (pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE) |
| 4030 | { |
| 4031 | /** Before starting BSS, we do complete set of measurement before putting |
| 4032 | * softmac back into normal mode. |
| 4033 | */ |
| 4034 | channelNum = limGetCurrentLearnChannel(pMac); |
| 4035 | limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_LEARN_WAIT_STATE); |
| 4036 | } |
| 4037 | else |
| 4038 | #endif |
| 4039 | { |
| 4040 | limLog(pMac, LOGW, FL("ERROR! This state is set only when AP in UNKNOWN_ROLE\n"), |
| 4041 | pMac->lim.gLimHalScanState); |
| 4042 | limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE); |
| 4043 | } |
| 4044 | break; |
| 4045 | #endif |
| 4046 | default: |
| 4047 | limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d\n"), |
| 4048 | pMac->lim.gLimHalScanState); |
| 4049 | break; |
| 4050 | } |
| 4051 | return; |
| 4052 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4053 | /** |
| 4054 | * limStopTxAndSwitch() |
| 4055 | * |
| 4056 | *FUNCTION: |
| 4057 | * Start channel switch on all sessions that is in channel switch state. |
| 4058 | * |
| 4059 | * @param pMac - pointer to global adapter context |
| 4060 | * |
| 4061 | * @return None |
| 4062 | * |
| 4063 | */ |
| 4064 | static void |
| 4065 | limStopTxAndSwitch (tpAniSirGlobal pMac) |
| 4066 | { |
| 4067 | tANI_U8 i; |
| 4068 | |
| 4069 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 4070 | { |
| 4071 | if(pMac->lim.gpSession[i].valid && |
| 4072 | pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) |
| 4073 | { |
| 4074 | limStopTxAndSwitchChannel(pMac, i); |
| 4075 | } |
| 4076 | } |
| 4077 | return; |
| 4078 | } |
| 4079 | /** |
| 4080 | * limStartQuietOnSession() |
| 4081 | * |
| 4082 | *FUNCTION: |
| 4083 | * This function is called to start quiet timer after finish scan if there is |
| 4084 | * qeuieting on any session. |
| 4085 | * |
| 4086 | *LOGIC: |
| 4087 | * |
| 4088 | *ASSUMPTIONS: |
| 4089 | * NA |
| 4090 | * |
| 4091 | *NOTE: |
| 4092 | * NA |
| 4093 | * |
| 4094 | * @param pMac - Pointer to Global MAC structure |
| 4095 | * |
| 4096 | * @return None |
| 4097 | */ |
| 4098 | static void |
| 4099 | limStartQuietOnSession (tpAniSirGlobal pMac) |
| 4100 | { |
| 4101 | tANI_U8 i; |
| 4102 | |
| 4103 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 4104 | { |
| 4105 | if(pMac->lim.gpSession[i].valid && |
| 4106 | pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) |
| 4107 | { |
| 4108 | limStartQuietTimer(pMac, i); |
| 4109 | } |
| 4110 | } |
| 4111 | return; |
| 4112 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4113 | void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body) |
| 4114 | { |
| 4115 | tpFinishScanParams pFinishScanParam; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4116 | eHalStatus status; |
| 4117 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 4118 | pFinishScanParam = (tpFinishScanParams) body; |
| 4119 | status = pFinishScanParam->status; |
| 4120 | palFreeMemory( pMac->hHdd, (char *)body); |
| 4121 | switch(pMac->lim.gLimHalScanState) |
| 4122 | { |
| 4123 | case eLIM_HAL_FINISH_SCAN_WAIT_STATE: |
| 4124 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 4125 | limCompleteMlmScan(pMac, eSIR_SME_SUCCESS); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4126 | if (limIsChanSwitchRunning(pMac)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4127 | { |
| 4128 | /** Right time to stop tx and start the timer for channel switch */ |
| 4129 | /* Sending Session ID 0, may not be correct, since SCAN is global there should not |
| 4130 | * be any associated session id |
| 4131 | */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4132 | limStopTxAndSwitch(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4133 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4134 | else if (limIsQuietBegin(pMac)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4135 | { |
| 4136 | /** Start the quieting */ |
| 4137 | /* Sending Session ID 0, may not be correct, since SCAN is global there should not |
| 4138 | * be any associated session id |
| 4139 | */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4140 | limStartQuietOnSession(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4141 | } |
| 4142 | #ifdef ANI_PRODUCT_TYPE_AP |
| 4143 | /* For handling the measurement request from WSM as scan request in LIM*/ |
| 4144 | #if 0 |
| 4145 | if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE && pMac->lim.gpLimMeasReq != NULL) |
| 4146 | { |
| 4147 | limSendSmeMeasurementInd(pMac); |
| 4148 | limCleanupMeasResources(pMac); |
| 4149 | limRestorePreLearnState(pMac); |
| 4150 | } |
| 4151 | #endif |
| 4152 | #endif |
| 4153 | if (status != (tANI_U32) eHAL_STATUS_SUCCESS) |
| 4154 | { |
| 4155 | PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d\n"), status);) |
| 4156 | } |
| 4157 | break; |
| 4158 | #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK)) |
| 4159 | case eLIM_HAL_FINISH_LEARN_WAIT_STATE: |
| 4160 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 4161 | __limProcessFinishLearnRsp(pMac); |
| 4162 | break; |
| 4163 | #endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK)) |
| 4164 | //WLAN_SUSPEND_LINK Related |
| 4165 | case eLIM_HAL_RESUME_LINK_WAIT_STATE: |
| 4166 | if( pMac->lim.gpLimResumeCallback ) |
| 4167 | { |
| 4168 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 4169 | pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData ); |
| 4170 | pMac->lim.gpLimResumeCallback = NULL; |
| 4171 | pMac->lim.gpLimResumeData = NULL; |
| 4172 | pMac->lim.gLimSystemInScanLearnMode = 0; |
| 4173 | } |
| 4174 | else |
| 4175 | { |
| 4176 | limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state\n"); |
| 4177 | return; |
| 4178 | } |
| 4179 | break; |
| 4180 | //end WLAN_SUSPEND_LINK Related |
| 4181 | |
| 4182 | default: |
| 4183 | limLog(pMac, LOGW, FL("Rcvd FinishScanRsp not in WAIT State, state %d\n"), |
| 4184 | pMac->lim.gLimHalScanState); |
| 4185 | break; |
| 4186 | } |
| 4187 | return; |
| 4188 | } |
| 4189 | /** |
| 4190 | * @function : limProcessMlmHalAddBARsp |
| 4191 | * |
| 4192 | * @brief: Process WDA_ADDBA_RSP coming from HAL |
| 4193 | * |
| 4194 | * |
| 4195 | * @param pMac The global tpAniSirGlobal object |
| 4196 | * |
| 4197 | * @param tSirMsgQ The MsgQ header containing the response buffer |
| 4198 | * |
| 4199 | * @return none |
| 4200 | */ |
| 4201 | void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac, |
| 4202 | tpSirMsgQ limMsgQ ) |
| 4203 | { |
| 4204 | // Send LIM_MLM_ADDBA_CNF to LIM |
| 4205 | tpLimMlmAddBACnf pMlmAddBACnf; |
| 4206 | tpPESession psessionEntry; |
| 4207 | tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr; |
| 4208 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 4209 | limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0); |
| 4210 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 4211 | //now LIM can process any defer message. |
| 4212 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 4213 | if (pAddBAParams == NULL) { |
| 4214 | PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL\n"));) |
| 4215 | return; |
| 4216 | } |
| 4217 | if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL) |
| 4218 | { |
| 4219 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d\n"),pAddBAParams->sessionId );) |
| 4220 | palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr); |
| 4221 | return; |
| 4222 | } |
| 4223 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 4224 | limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0); |
| 4225 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 4226 | |
| 4227 | // Allocate for LIM_MLM_ADDBA_CNF |
| 4228 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, |
| 4229 | (void **) &pMlmAddBACnf, sizeof( tLimMlmAddBACnf ))) { |
| 4230 | limLog( pMac, LOGP, FL(" palAllocateMemory failed with error code %d\n")); |
| 4231 | palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr); |
| 4232 | return; |
| 4233 | } |
| 4234 | palZeroMemory( pMac->hHdd, (void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf )); |
| 4235 | // Copy the peer MAC |
| 4236 | palCopyMemory( pMac->hHdd, pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr, |
| 4237 | sizeof( tSirMacAddr )); |
| 4238 | // Copy other ADDBA Rsp parameters |
| 4239 | pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken; |
| 4240 | pMlmAddBACnf->baTID = pAddBAParams->baTID; |
| 4241 | pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy; |
| 4242 | pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize; |
| 4243 | pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout; |
| 4244 | pMlmAddBACnf->baDirection = pAddBAParams->baDirection; |
| 4245 | pMlmAddBACnf->sessionId = psessionEntry->peSessionId; |
| 4246 | if(eHAL_STATUS_SUCCESS == pAddBAParams->status) |
| 4247 | pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS; |
| 4248 | else |
| 4249 | pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 4250 | palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr); |
| 4251 | // Send ADDBA CNF to LIM |
| 4252 | limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf ); |
| 4253 | } |
| 4254 | /** |
| 4255 | * \brief Process LIM_MLM_ADDBA_CNF |
| 4256 | * |
| 4257 | * \sa limProcessMlmAddBACnf |
| 4258 | * |
| 4259 | * \param pMac The global tpAniSirGlobal object |
| 4260 | * |
| 4261 | * \param tSirMsgQ The MsgQ header containing the response buffer |
| 4262 | * |
| 4263 | * \return none |
| 4264 | */ |
| 4265 | void limProcessMlmAddBACnf( tpAniSirGlobal pMac, |
| 4266 | tANI_U32 *pMsgBuf ) |
| 4267 | { |
| 4268 | tpLimMlmAddBACnf pMlmAddBACnf; |
| 4269 | tpDphHashNode pSta; |
| 4270 | tANI_U16 aid; |
| 4271 | tLimBAState curBaState; |
| 4272 | tpPESession psessionEntry = NULL; |
| 4273 | if(pMsgBuf == NULL) |
| 4274 | { |
| 4275 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 4276 | return; |
| 4277 | } |
| 4278 | pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf; |
| 4279 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL) |
| 4280 | { |
| 4281 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4282 | palFreeMemory( pMac->hHdd, (void *) pMsgBuf ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4283 | return; |
| 4284 | } |
| 4285 | // First, extract the DPH entry |
| 4286 | pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 4287 | if( NULL == pSta ) |
| 4288 | { |
| 4289 | PELOGE(limLog( pMac, LOGE, |
| 4290 | FL( "STA context not found - ignoring ADDBA CNF from HAL\n" ));) |
| 4291 | palFreeMemory( pMac->hHdd, (void *) pMsgBuf ); |
| 4292 | return; |
| 4293 | } |
| 4294 | LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState); |
| 4295 | // Need to validate SME state |
| 4296 | if( eLIM_BA_STATE_WT_ADD_RSP != curBaState) |
| 4297 | { |
| 4298 | PELOGE(limLog( pMac, LOGE, |
| 4299 | FL( "Received unexpected ADDBA CNF when STA BA state is %d\n" ), |
| 4300 | curBaState );) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4301 | palFreeMemory( pMac->hHdd, (void *) pMsgBuf ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4302 | return; |
| 4303 | } |
| 4304 | // Restore STA BA state |
| 4305 | LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4306 | if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4307 | { |
| 4308 | // Update LIM internal cache... |
| 4309 | if( eBA_RECIPIENT == pMlmAddBACnf->baDirection ) |
| 4310 | { |
| 4311 | pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1; |
| 4312 | pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1; |
| 4313 | pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy; |
| 4314 | pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize; |
| 4315 | pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout; |
| 4316 | } |
| 4317 | else |
| 4318 | { |
| 4319 | pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1; |
| 4320 | pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1; |
| 4321 | pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy; |
| 4322 | pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize; |
| 4323 | pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout; |
| 4324 | } |
| 4325 | } |
| 4326 | if( eBA_RECIPIENT == pMlmAddBACnf->baDirection ) |
| 4327 | { |
| 4328 | // |
| 4329 | // Package LIM_MLM_ADDBA_RSP to MLME, with proper |
| 4330 | // status code. MLME will then send an ADDBA RSP |
| 4331 | // over the air to the peer MAC entity |
| 4332 | // |
| 4333 | if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac, |
| 4334 | pMlmAddBACnf->peerMacAddr, |
| 4335 | pMlmAddBACnf->addBAResultCode, |
| 4336 | pMlmAddBACnf->baDialogToken, |
| 4337 | (tANI_U8) pMlmAddBACnf->baTID, |
| 4338 | (tANI_U8) pMlmAddBACnf->baPolicy, |
| 4339 | pMlmAddBACnf->baBufferSize, |
| 4340 | pMlmAddBACnf->baTimeout,psessionEntry)) |
| 4341 | { |
| 4342 | PELOGW(limLog( pMac, LOGW, |
| 4343 | FL( "Failed to post LIM_MLM_ADDBA_RSP to " )); |
| 4344 | limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );) |
| 4345 | } |
| 4346 | } |
| 4347 | // Free the memory allocated for LIM_MLM_ADDBA_CNF |
| 4348 | palFreeMemory( pMac->hHdd, (void *) pMsgBuf ); |
| 4349 | } |
| 4350 | /** |
| 4351 | * \brief Process LIM_MLM_DELBA_CNF |
| 4352 | * |
| 4353 | * \sa limProcessMlmDelBACnf |
| 4354 | * |
| 4355 | * \param pMac The global tpAniSirGlobal object |
| 4356 | * |
| 4357 | * \param tSirMsgQ The MsgQ header containing the response buffer |
| 4358 | * |
| 4359 | * \return none |
| 4360 | */ |
| 4361 | void limProcessMlmDelBACnf( tpAniSirGlobal pMac, |
| 4362 | tANI_U32 *pMsgBuf ) |
| 4363 | { |
| 4364 | tpLimMlmDelBACnf pMlmDelBACnf; |
| 4365 | tpDphHashNode pSta; |
| 4366 | tANI_U16 aid; |
| 4367 | // tANI_U8 sessionId; |
| 4368 | tLimBAState curBaState; |
| 4369 | tpPESession psessionEntry; |
| 4370 | |
| 4371 | if(pMsgBuf == NULL) |
| 4372 | { |
| 4373 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));) |
| 4374 | return; |
| 4375 | } |
| 4376 | pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf; |
| 4377 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL) |
| 4378 | { |
| 4379 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4380 | palFreeMemory( pMac->hHdd, (void *) pMsgBuf ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4381 | return; |
| 4382 | } |
| 4383 | // First, extract the DPH entry |
| 4384 | pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable ); |
| 4385 | if( NULL == pSta ) |
| 4386 | { |
| 4387 | limLog( pMac, LOGE, |
| 4388 | FL( "STA context not found - ignoring DELBA CNF from HAL\n" )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4389 | palFreeMemory( pMac->hHdd, (void *) pMsgBuf ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4390 | return; |
| 4391 | } |
| 4392 | if(NULL == pMlmDelBACnf) |
| 4393 | { |
| 4394 | limLog( pMac, LOGE, |
| 4395 | FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL\n" )); |
| 4396 | return; |
| 4397 | } |
| 4398 | // Need to validate baState |
| 4399 | LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState); |
| 4400 | if( eLIM_BA_STATE_WT_DEL_RSP != curBaState ) |
| 4401 | { |
| 4402 | limLog( pMac, LOGE, |
| 4403 | FL( "Received unexpected DELBA CNF when STA BA state is %d\n" ), |
| 4404 | curBaState ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4405 | palFreeMemory( pMac->hHdd, (void *) pMsgBuf ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4406 | return; |
| 4407 | } |
| 4408 | // Restore STA BA state |
| 4409 | LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE); |
| 4410 | // Free the memory allocated for LIM_MLM_DELBA_CNF |
| 4411 | palFreeMemory( pMac->hHdd, (void *) pMsgBuf ); |
| 4412 | } |
| 4413 | /** |
| 4414 | * \brief Process SIR_LIM_DEL_BA_IND |
| 4415 | * |
| 4416 | * \sa limProcessMlmHalBADeleteInd |
| 4417 | * |
| 4418 | * \param pMac The global tpAniSirGlobal object |
| 4419 | * |
| 4420 | * \param tSirMsgQ The MsgQ header containing the indication buffer |
| 4421 | * |
| 4422 | * \return none |
| 4423 | */ |
| 4424 | void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac, |
| 4425 | tpSirMsgQ limMsgQ ) |
| 4426 | { |
| 4427 | tSirRetStatus status = eSIR_SUCCESS; |
| 4428 | tpBADeleteParams pBADeleteParams; |
| 4429 | tpDphHashNode pSta; |
| 4430 | tANI_U16 aid; |
| 4431 | tLimBAState curBaState; |
| 4432 | tpPESession psessionEntry; |
| 4433 | tANI_U8 sessionId; |
| 4434 | |
| 4435 | pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr; |
| 4436 | |
| 4437 | if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL) |
| 4438 | { |
| 4439 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4440 | palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4441 | return; |
| 4442 | } |
| 4443 | // First, extract the DPH entry |
| 4444 | pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable ); |
| 4445 | if( NULL == pSta ) |
| 4446 | { |
| 4447 | limLog( pMac, LOGE, |
| 4448 | FL( "STA context not found - ignoring BA Delete IND from HAL\n" )); |
| 4449 | goto returnAfterCleanup; |
| 4450 | } |
| 4451 | |
| 4452 | // Need to validate BA state |
| 4453 | LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState); |
| 4454 | if( eLIM_BA_STATE_IDLE != curBaState ) |
| 4455 | { |
| 4456 | limLog( pMac, LOGE, |
| 4457 | FL( "Received unexpected BA Delete IND when STA BA state is %d\n" ), |
| 4458 | curBaState ); |
| 4459 | goto returnAfterCleanup; |
| 4460 | } |
| 4461 | |
| 4462 | // Validate if a BA is active for the requested TID |
| 4463 | // AND in that desired direction |
| 4464 | if( eBA_INITIATOR == pBADeleteParams->baDirection ) |
| 4465 | { |
| 4466 | if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBATx ) |
| 4467 | status = eSIR_FAILURE; |
| 4468 | } |
| 4469 | else |
| 4470 | { |
| 4471 | if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBARx ) |
| 4472 | status = eSIR_FAILURE; |
| 4473 | } |
| 4474 | if( eSIR_FAILURE == status ) |
| 4475 | { |
| 4476 | limLog( pMac, LOGW, |
| 4477 | FL("Received an INVALID DELBA Delete Ind for TID %d...\n"), |
| 4478 | pBADeleteParams->baTID ); |
| 4479 | } |
| 4480 | else |
| 4481 | { |
| 4482 | // Post DELBA REQ to MLME... |
| 4483 | if( eSIR_SUCCESS != |
| 4484 | (status = limPostMlmDelBAReq( pMac, |
| 4485 | pSta, |
| 4486 | pBADeleteParams->baDirection, |
| 4487 | pBADeleteParams->baTID, |
| 4488 | eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry ))) |
| 4489 | { |
| 4490 | limLog( pMac, LOGE, |
| 4491 | FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d\n" ), status); |
| 4492 | } |
| 4493 | else |
| 4494 | { |
| 4495 | limLog( pMac, LOGE, |
| 4496 | FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ), |
| 4497 | pBADeleteParams->reasonCode, pBADeleteParams->baTID ); |
| 4498 | limPrintMacAddr( pMac, pSta->staAddr, LOGE ); |
| 4499 | } |
| 4500 | } |
| 4501 | returnAfterCleanup: |
| 4502 | // Free the memory allocated for SIR_LIM_DEL_BA_IND |
| 4503 | palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr ); |
| 4504 | } |
| 4505 | /** |
| 4506 | * @function : limProcessSetMimoRsp() |
| 4507 | * |
| 4508 | * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL |
| 4509 | * after Processing the Req from the SME (PMC) |
| 4510 | * |
| 4511 | * LOGIC: |
| 4512 | * |
| 4513 | * ASSUMPTIONS: |
| 4514 | * NA |
| 4515 | * |
| 4516 | * NOTE: |
| 4517 | * NA |
| 4518 | * |
| 4519 | * @param pMac - Pointer to Global MAC structure |
| 4520 | * @param limMsg - Lim Message structure object with the MimoPSparam in body |
| 4521 | * @return None |
| 4522 | */ |
| 4523 | |
| 4524 | void |
| 4525 | limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg) |
| 4526 | { |
| 4527 | #if 0 |
| 4528 | tSirRetStatus retStatus; |
| 4529 | tpSetMIMOPS pMIMO_PSParams; |
| 4530 | |
| 4531 | |
| 4532 | do { |
| 4533 | |
| 4534 | pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr; |
| 4535 | if( NULL == pMIMO_PSParams ) { |
| 4536 | PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");) |
| 4537 | return; |
| 4538 | } |
| 4539 | |
| 4540 | /** If Updation of the HAL Fail's*/ |
| 4541 | if (pMIMO_PSParams->status != eSIR_SUCCESS) { |
| 4542 | limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed\n")); |
| 4543 | break; |
| 4544 | } |
| 4545 | |
| 4546 | if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) || |
| 4547 | (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) ) |
| 4548 | break; |
| 4549 | |
| 4550 | pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState; |
| 4551 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState)); |
| 4552 | |
| 4553 | /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled) |
| 4554 | * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave |
| 4555 | * the Action Frame is being sent at first before setting the internal structures |
| 4556 | */ |
| 4557 | if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) { |
| 4558 | tSirMacAddr macAddr; |
| 4559 | |
| 4560 | /** Obtain the AP's Mac Address */ |
| 4561 | palCopyMemory(pMac -> hHdd, (tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr)); |
| 4562 | |
| 4563 | /** Send Action Frame with the corresponding mode */ |
| 4564 | retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState); |
| 4565 | if (retStatus != eSIR_SUCCESS) { |
| 4566 | PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed\n"));) |
| 4567 | break; |
| 4568 | } |
| 4569 | } |
| 4570 | PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));) |
| 4571 | }while(0); |
| 4572 | |
| 4573 | palFreeMemory( pMac->hHdd, (void *) pMIMO_PSParams ); |
| 4574 | #endif |
| 4575 | } |
| 4576 | /** |
| 4577 | * @function : limHandleDelBssInReAssocContext |
| 4578 | * @brief : While Processing the ReAssociation Response Frame in STA, |
| 4579 | * a. immediately after receiving the Reassoc Response the RxCleanUp is |
| 4580 | * being issued and the end of DelBSS the new BSS is being added. |
| 4581 | * |
| 4582 | * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context |
| 4583 | * change, We need to update CSR with ReAssocCNF Response with the |
| 4584 | * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS |
| 4585 | * context only |
| 4586 | * |
| 4587 | * @param : pMac - tpAniSirGlobal |
| 4588 | * pStaDs - Station Descriptor |
| 4589 | * |
| 4590 | * @return : none |
| 4591 | */ |
| 4592 | static void |
| 4593 | limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry) |
| 4594 | { |
| 4595 | tLimMlmReassocCnf mlmReassocCnf; |
| 4596 | /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/ |
| 4597 | /** Set the MlmState to IDLE*/ |
| 4598 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4599 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4600 | /* Update PE session Id*/ |
| 4601 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 4602 | switch (psessionEntry->limMlmState) { |
| 4603 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 4604 | case eLIM_SME_WT_REASSOC_STATE : |
| 4605 | { |
| 4606 | tpSirAssocRsp assocRsp; |
| 4607 | tpDphHashNode pStaDs; |
| 4608 | tSirRetStatus retStatus = eSIR_SUCCESS; |
| 4609 | #ifdef ANI_PRODUCT_TYPE_CLIENT |
| 4610 | tSchBeaconStruct beaconStruct; |
| 4611 | #endif |
| 4612 | /** Delete the older STA Table entry */ |
| 4613 | limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry); |
| 4614 | /** |
| 4615 | * Add an entry for AP to hash table |
| 4616 | * maintained by DPH module |
| 4617 | */ |
| 4618 | if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL) |
| 4619 | { |
| 4620 | // Could not add hash table entry |
| 4621 | PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));) |
| 4622 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE); |
| 4623 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 4624 | mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS; |
| 4625 | goto Error; |
| 4626 | } |
| 4627 | /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame |
| 4628 | * is being stored to be used here for sending ADDBSS |
| 4629 | */ |
| 4630 | assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData; |
| 4631 | limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry); |
| 4632 | limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry); |
| 4633 | #ifdef ANI_PRODUCT_TYPE_CLIENT |
| 4634 | limExtractApCapabilities( pMac, |
| 4635 | (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields, |
| 4636 | limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ), |
| 4637 | &beaconStruct ); |
| 4638 | if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 4639 | limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry); |
| 4640 | if(beaconStruct.erpPresent) { |
| 4641 | if (beaconStruct.erpIEInfo.barkerPreambleMode) |
| 4642 | psessionEntry->beaconParams.fShortPreamble = 0; |
| 4643 | else |
| 4644 | psessionEntry->beaconParams.fShortPreamble = 1; |
| 4645 | } |
| 4646 | //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one. |
| 4647 | if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct, |
| 4648 | &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) { |
| 4649 | limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n")); |
| 4650 | retStatus = eSIR_FAILURE; |
| 4651 | } |
| 4652 | #elif defined(ANI_AP_CLIENT_SDK) |
| 4653 | if (eSIR_SUCCESS != limStaSendAddBss( pMac, (*assocRsp), &psessionEntry->pLimReAssocReq->neighborBssList.bssList[0], |
| 4654 | false, psessionEntry)) { |
| 4655 | limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n")); |
| 4656 | retStatus = eSIR_FAILURE; |
| 4657 | } |
| 4658 | #endif |
| 4659 | if (retStatus != eSIR_SUCCESS) |
| 4660 | { |
| 4661 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 4662 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 4663 | palFreeMemory(pMac->hHdd, assocRsp); |
| 4664 | pMac->lim.gLimAssocResponseData = NULL; |
| 4665 | goto Error; |
| 4666 | } |
| 4667 | palFreeMemory(pMac->hHdd, assocRsp); |
| 4668 | psessionEntry->limAssocResponseData = NULL; |
| 4669 | } |
| 4670 | break; |
| 4671 | case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: |
| 4672 | { |
| 4673 | /** Case wherein the DisAssoc / Deauth |
| 4674 | * being sent as response to ReAssoc Req*/ |
| 4675 | /** Send the Reason code as the same received in Disassoc / Deauth Frame*/ |
| 4676 | mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason; |
| 4677 | mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger; |
| 4678 | /** Set the SME State back to WT_Reassoc State*/ |
| 4679 | psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4680 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4681 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry); |
| 4682 | if((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| |
| 4683 | (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) |
| 4684 | { |
| 4685 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4686 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4687 | } |
| 4688 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 4689 | } |
| 4690 | break; |
| 4691 | #endif |
| 4692 | default: |
| 4693 | PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State\n"));) |
| 4694 | mlmReassocCnf.resultCode = eSIR_SME_REFUSED; |
| 4695 | mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 4696 | goto Error; |
| 4697 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4698 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4699 | Error: |
| 4700 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 4701 | } |
| 4702 | |
| 4703 | /* Added For BT -AMP Support */ |
| 4704 | static void |
| 4705 | limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry) |
| 4706 | { |
| 4707 | tLimMlmStartCnf mlmStartCnf; |
| 4708 | tANI_U32 val; |
| 4709 | tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr; |
| 4710 | |
| 4711 | if( eHAL_STATUS_SUCCESS == pAddBssParams->status ) |
| 4712 | { |
| 4713 | limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n")); |
| 4714 | if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE) |
| 4715 | { |
| 4716 | if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId, |
| 4717 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS ) |
| 4718 | goto end; |
| 4719 | } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) { |
| 4720 | if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId, |
| 4721 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS ) |
| 4722 | goto end; |
| 4723 | } |
| 4724 | |
| 4725 | // Set MLME state |
| 4726 | psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE; |
| 4727 | psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self |
| 4728 | psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx; |
| 4729 | schEdcaProfileUpdate(pMac, psessionEntry); |
| 4730 | limInitAIDpool(pMac,psessionEntry); |
| 4731 | // Create timers used by LIM |
| 4732 | if (!pMac->lim.gLimTimersCreated) |
| 4733 | limCreateTimers(pMac); |
| 4734 | /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */ |
| 4735 | if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val )) |
| 4736 | limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n")); |
| 4737 | pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0; |
| 4738 | // Apply previously set configuration at HW |
| 4739 | limApplyConfiguration(pMac,psessionEntry); |
| 4740 | psessionEntry->staId = pAddBssParams->staContext.staIdx; |
| 4741 | mlmStartCnf.resultCode = eSIR_SME_SUCCESS; |
| 4742 | } |
| 4743 | else |
| 4744 | { |
| 4745 | limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ),pAddBssParams->status ); |
| 4746 | mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 4747 | } |
| 4748 | mlmStartCnf.sessionId = psessionEntry->peSessionId; |
| 4749 | limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf ); |
| 4750 | end: |
| 4751 | if( 0 != limMsgQ->bodyptr ) |
| 4752 | palFreeMemory( pMac->hHdd, (void *) pAddBssParams ); |
| 4753 | } |
| 4754 | |
| 4755 | /** |
| 4756 | * @function : limHandleAddBssInReAssocContext |
| 4757 | * @brief : While Processing the ReAssociation Response Frame in STA, |
| 4758 | * a. immediately after receiving the Reassoc Response the RxCleanUp is |
| 4759 | * being issued and the end of DelBSS the new BSS is being added. |
| 4760 | * |
| 4761 | * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context |
| 4762 | * change, We need to update CSR with ReAssocCNF Response with the |
| 4763 | * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS |
| 4764 | * context only |
| 4765 | * |
| 4766 | * @param : pMac - tpAniSirGlobal |
| 4767 | * pStaDs - Station Descriptor |
| 4768 | * |
| 4769 | * @return : none |
| 4770 | */ |
| 4771 | void |
| 4772 | limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry) |
| 4773 | { |
| 4774 | tLimMlmReassocCnf mlmReassocCnf; |
| 4775 | /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/ |
| 4776 | /** Set the MlmState to IDLE*/ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4777 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
| 4778 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4779 | switch (psessionEntry->limSmeState) { |
| 4780 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 4781 | case eLIM_SME_WT_REASSOC_STATE : { |
| 4782 | tpSirAssocRsp assocRsp; |
| 4783 | tpDphHashNode pStaDs; |
| 4784 | tSirRetStatus retStatus = eSIR_SUCCESS; |
| 4785 | #ifdef ANI_PRODUCT_TYPE_CLIENT |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame^] | 4786 | tSchBeaconStruct *pBeaconStruct; |
| 4787 | if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, |
| 4788 | (void **)&pBeaconStruct, sizeof(tSchBeaconStruct))) |
| 4789 | { |
| 4790 | limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limHandleAddBssInReAssocContext\n") ); |
| 4791 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 4792 | mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 4793 | goto Error; |
| 4794 | } |
| 4795 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4796 | #endif |
| 4797 | // Get the AP entry from DPH hash table |
| 4798 | pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 4799 | if (pStaDs == NULL ) |
| 4800 | { |
| 4801 | PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash\n"));) |
| 4802 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 4803 | mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame^] | 4804 | palFreeMemory(pMac->hHdd, pBeaconStruct); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4805 | goto Error; |
| 4806 | } |
| 4807 | /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame |
| 4808 | * is being stored to be used here for sending ADDBSS |
| 4809 | */ |
| 4810 | assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData; |
| 4811 | limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry); |
| 4812 | limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry); |
| 4813 | #ifdef ANI_PRODUCT_TYPE_CLIENT |
| 4814 | limExtractApCapabilities( pMac, |
| 4815 | (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields, |
| 4816 | limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame^] | 4817 | pBeaconStruct ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4818 | if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame^] | 4819 | limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry); |
| 4820 | |
| 4821 | if(pBeaconStruct->erpPresent) |
| 4822 | { |
| 4823 | if (pBeaconStruct->erpIEInfo.barkerPreambleMode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4824 | psessionEntry->beaconParams.fShortPreamble = 0; |
| 4825 | else |
| 4826 | psessionEntry->beaconParams.fShortPreamble = 1; |
| 4827 | } |
| 4828 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame^] | 4829 | if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4830 | &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) { |
| 4831 | limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n")); |
| 4832 | retStatus = eSIR_FAILURE; |
| 4833 | } |
| 4834 | #elif defined(ANI_AP_CLIENT_SDK) |
| 4835 | if (eSIR_SUCCESS != limStaSendAddBss( pMac, (*assocRsp), &pMac->lim.gpLimReassocReq->neighborBssList.bssList[0], true)) { |
| 4836 | limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n")); |
| 4837 | retStatus = eSIR_FAILURE; |
| 4838 | } |
| 4839 | #endif |
| 4840 | if (retStatus != eSIR_SUCCESS) |
| 4841 | { |
| 4842 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 4843 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 4844 | palFreeMemory(pMac->hHdd, assocRsp); |
| 4845 | pMac->lim.gLimAssocResponseData = NULL; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame^] | 4846 | palFreeMemory(pMac->hHdd, pBeaconStruct); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4847 | goto Error; |
| 4848 | } |
| 4849 | palFreeMemory(pMac->hHdd, assocRsp); |
| 4850 | psessionEntry->limAssocResponseData = NULL; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame^] | 4851 | palFreeMemory(pMac->hHdd, pBeaconStruct); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4852 | } |
| 4853 | break; |
| 4854 | case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth |
| 4855 | * being sent as response to ReAssoc Req*/ |
| 4856 | /** Send the Reason code as the same received in Disassoc / Deauth Frame*/ |
| 4857 | mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason; |
| 4858 | mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger; |
| 4859 | /** Set the SME State back to WT_Reassoc State*/ |
| 4860 | psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE; |
| 4861 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry); |
| 4862 | if(psessionEntry->limSystemRole == eLIM_STA_ROLE) |
| 4863 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
| 4864 | |
| 4865 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 4866 | } |
| 4867 | break; |
| 4868 | #endif |
| 4869 | default: |
| 4870 | PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State\n"));) |
| 4871 | mlmReassocCnf.resultCode = eSIR_SME_REFUSED; |
| 4872 | mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 4873 | goto Error; |
| 4874 | } |
| 4875 | return; |
| 4876 | Error: |
| 4877 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 4878 | } |
| 4879 | |
| 4880 | #if 0 |
| 4881 | static void |
| 4882 | limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf) |
| 4883 | { |
| 4884 | tSirSmeAssocCnf assocCnf; |
| 4885 | tpDphHashNode pStaDs; |
| 4886 | tpPESession psessionEntry; |
| 4887 | tANI_U8 sessionId; |
| 4888 | |
| 4889 | if(pMsgBuf == NULL) |
| 4890 | { |
| 4891 | limLog(pMac, LOGE, FL("pMsgBuf is NULL \n")); |
| 4892 | goto end; |
| 4893 | } |
| 4894 | if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) || |
| 4895 | !__limIsSmeAssocCnfValid(&assocCnf)) |
| 4896 | { |
| 4897 | limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message \n")); |
| 4898 | goto end; |
| 4899 | } |
| 4900 | if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL) |
| 4901 | { |
| 4902 | limLog(pMac, LOGE, FL("session does not exist for given bssId\n")); |
| 4903 | goto end; |
| 4904 | } |
| 4905 | if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) || |
| 4906 | ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE))) |
| 4907 | { |
| 4908 | limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X\n"), |
| 4909 | msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole); |
| 4910 | goto end; |
| 4911 | } |
| 4912 | pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable); |
| 4913 | if (pStaDs == NULL) |
| 4914 | { |
| 4915 | limLog(pMac, LOG1, |
| 4916 | FL("Received invalid message %X due to no STA context, for aid %d, peer "), |
| 4917 | msgType, assocCnf.aid); |
| 4918 | limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1); |
| 4919 | /* |
| 4920 | ** send a DISASSOC_IND message to WSM to make sure |
| 4921 | ** the state in WSM and LIM is the same |
| 4922 | **/ |
| 4923 | limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED, |
| 4924 | eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry); |
| 4925 | goto end; |
| 4926 | } |
| 4927 | if ((pStaDs && |
| 4928 | (( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pStaDs->staAddr, |
| 4929 | (tANI_U8 *) assocCnf.peerMacAddr, |
| 4930 | sizeof(tSirMacAddr)) ) || |
| 4931 | (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) || |
| 4932 | ((pStaDs->mlmStaContext.subType == LIM_ASSOC) && |
| 4933 | (msgType != eWNI_SME_ASSOC_CNF)) || |
| 4934 | ((pStaDs->mlmStaContext.subType == LIM_REASSOC) && |
| 4935 | (msgType != eWNI_SME_REASSOC_CNF))))) |
| 4936 | { |
| 4937 | limLog(pMac, LOG1, |
| 4938 | FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "), |
| 4939 | msgType, assocCnf.aid); |
| 4940 | limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1); |
| 4941 | goto end; |
| 4942 | } |
| 4943 | /* |
| 4944 | ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF |
| 4945 | ** has been received |
| 4946 | **/ |
| 4947 | limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer\n")); |
| 4948 | limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId); |
| 4949 | if (assocCnf.statusCode == eSIR_SME_SUCCESS) |
| 4950 | { |
| 4951 | /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence |
| 4952 | * when it had received Assoc Request frame. Now, PE just needs to send |
| 4953 | * Association Response frame to the requesting BTAMP-STA. |
| 4954 | */ |
| 4955 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
| 4956 | limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) \n"), pStaDs->assocId); |
| 4957 | limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr, |
| 4958 | pStaDs->mlmStaContext.subType, pStaDs, psessionEntry); |
| 4959 | goto end; |
| 4960 | } // (assocCnf.statusCode == eSIR_SME_SUCCESS) |
| 4961 | else |
| 4962 | { |
| 4963 | // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated |
| 4964 | limRejectAssociation(pMac, pStaDs->staAddr, |
| 4965 | pStaDs->mlmStaContext.subType, |
| 4966 | true, pStaDs->mlmStaContext.authType, |
| 4967 | pStaDs->assocId, true, |
| 4968 | assocCnf.statusCode, psessionEntry); |
| 4969 | return; |
| 4970 | } |
| 4971 | end: |
| 4972 | if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL ) |
| 4973 | { |
| 4974 | if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame) |
| 4975 | { |
| 4976 | palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame); |
| 4977 | ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL; |
| 4978 | } |
| 4979 | |
| 4980 | palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]); |
| 4981 | psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL; |
| 4982 | } |
| 4983 | } /*** end __limProcessSmeAssocCnfNew() ***/ |
| 4984 | #endif |
| 4985 | |
| 4986 | #ifdef WLAN_SOFTAP_FEATURE |
| 4987 | void |
| 4988 | limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){ |
| 4989 | tBeaconGenParams *pBeaconGenParams = NULL; |
| 4990 | tSirMsgQ limMsg; |
| 4991 | /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/ |
| 4992 | if(psessionEntry == NULL ){ |
| 4993 | PELOGE( limLog( pMac, LOGE, |
| 4994 | FL( "Error:Unable to get the PESessionEntry\n" ));) |
| 4995 | return; |
| 4996 | } |
| 4997 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, |
| 4998 | (void **) &pBeaconGenParams, (sizeof(*pBeaconGenParams)))) |
| 4999 | { |
| 5000 | PELOGE( limLog( pMac, LOGP, |
| 5001 | FL( "Unable to PAL allocate memory during sending beaconPreMessage\n" ));) |
| 5002 | return; |
| 5003 | } |
| 5004 | palZeroMemory( pMac->hHdd, pBeaconGenParams, sizeof(*pBeaconGenParams)); |
| 5005 | palCopyMemory( pMac->hHdd, (void *) pBeaconGenParams->bssId, |
| 5006 | (void *)psessionEntry->bssId, |
| 5007 | SIR_MAC_ADDR_LENGTH ); |
| 5008 | limMsg.bodyptr = pBeaconGenParams; |
| 5009 | schProcessPreBeaconInd(pMac, &limMsg); |
| 5010 | return; |
| 5011 | } |
| 5012 | #endif |