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