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