Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012, Code Aurora Forum. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * |
| 24 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 25 | * This file limProcessAssocRspFrame.cc contains the code |
| 26 | * for processing Re/Association Response Frame. |
| 27 | * Author: Chandra Modumudi |
| 28 | * Date: 03/18/02 |
| 29 | * History:- |
| 30 | * Date Modified by Modification Information |
| 31 | * -------------------------------------------------------------------- |
| 32 | * |
| 33 | */ |
| 34 | |
| 35 | #include "wniApi.h" |
| 36 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 37 | #include "wniCfgAp.h" |
| 38 | #else |
| 39 | #include "wniCfgSta.h" |
| 40 | #endif |
| 41 | #include "aniGlobal.h" |
| 42 | #include "cfgApi.h" |
| 43 | |
| 44 | #include "utilsApi.h" |
| 45 | #include "pmmApi.h" |
| 46 | #include "limTypes.h" |
| 47 | #include "limUtils.h" |
| 48 | #include "limAssocUtils.h" |
| 49 | #include "limSecurityUtils.h" |
| 50 | #include "limSerDesUtils.h" |
| 51 | #include "limStaHashApi.h" |
| 52 | #include "limSendMessages.h" |
| 53 | |
| 54 | #ifdef FEATURE_WLAN_CCX |
| 55 | #include "ccxApi.h" |
| 56 | #endif |
| 57 | |
| 58 | extern tSirRetStatus schBeaconEdcaProcess(tpAniSirGlobal pMac, tSirMacEdcaParamSetIE *edca, tpPESession psessionEntry); |
| 59 | |
| 60 | |
| 61 | /** |
| 62 | * @function : limUpdateAssocStaDatas |
| 63 | * |
| 64 | * @brief : This function is called to Update the Station Descriptor (dph) Details from |
| 65 | * Association / ReAssociation Response Frame |
| 66 | * |
| 67 | *LOGIC: |
| 68 | * |
| 69 | *ASSUMPTIONS: |
| 70 | * |
| 71 | *NOTE: |
| 72 | * |
| 73 | * @param pMac - Pointer to Global MAC structure |
| 74 | * @param pStaDs - Station Descriptor in DPH |
| 75 | * @param pAssocRsp - Pointer to Association Response Structure |
| 76 | * |
| 77 | * @return None |
| 78 | */ |
| 79 | void limUpdateAssocStaDatas(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpSirAssocRsp pAssocRsp,tpPESession psessionEntry) |
| 80 | { |
| 81 | tANI_U32 prop; |
| 82 | tANI_U32 phyMode; |
| 83 | tANI_U32 val; |
| 84 | //tpSirBoardCapabilities pBoardCaps; |
| 85 | tANI_BOOLEAN qosMode; |
| 86 | tANI_U16 rxHighestRate = 0; |
| 87 | |
| 88 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 89 | |
| 90 | pStaDs->staType= STA_ENTRY_SELF; |
| 91 | |
| 92 | limGetQosMode(psessionEntry, &qosMode); |
| 93 | // set the ani peer bit, if self mode is one of the proprietary modes |
| 94 | if(IS_DOT11_MODE_PROPRIETARY(psessionEntry->dot11mode)) |
| 95 | { |
| 96 | wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &prop); |
| 97 | |
| 98 | if (prop) |
| 99 | { |
| 100 | pStaDs->aniPeer = eHAL_SET; |
| 101 | pStaDs->propCapability = pAssocRsp->propIEinfo.capability; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | //pMac->lim.gLimMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
| 106 | pStaDs->mlmStaContext.authType = psessionEntry->limCurrentAuthType; |
| 107 | |
| 108 | // Add capabilities information, rates and AID |
| 109 | pStaDs->mlmStaContext.capabilityInfo = pAssocRsp->capabilityInfo; |
| 110 | pStaDs->shortPreambleEnabled= (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble; |
| 111 | |
| 112 | //Update HT Capabilites only when the self mode supports HT |
| 113 | if(IS_DOT11_MODE_HT(psessionEntry->dot11mode)) { |
| 114 | pStaDs->mlmStaContext.htCapability = pAssocRsp->HTCaps.present; |
| 115 | |
| 116 | if ( pAssocRsp->HTCaps.present ) { |
| 117 | pStaDs->htGreenfield = ( tANI_U8 ) pAssocRsp->HTCaps.greenField; |
| 118 | pStaDs->htSupportedChannelWidthSet = ( tANI_U8 ) (pAssocRsp->HTCaps.supportedChannelWidthSet ? |
| 119 | pAssocRsp->HTInfo.recommendedTxWidthSet : |
| 120 | pAssocRsp->HTCaps.supportedChannelWidthSet ); |
| 121 | pStaDs->htLsigTXOPProtection = ( tANI_U8 ) pAssocRsp->HTCaps.lsigTXOPProtection; |
| 122 | pStaDs->htMIMOPSState = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave; |
| 123 | pStaDs->htMaxAmsduLength = ( tANI_U8 ) pAssocRsp->HTCaps.maximalAMSDUsize; |
| 124 | pStaDs->htAMpduDensity = pAssocRsp->HTCaps.mpduDensity; |
| 125 | pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz; |
| 126 | pStaDs->htShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz; |
| 127 | pStaDs->htShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz; |
| 128 | pStaDs->htMaxRxAMpduFactor = pAssocRsp->HTCaps.maxRxAMPDUFactor; |
| 129 | limFillRxHighestSupportedRate(pMac, &rxHighestRate, pAssocRsp->HTCaps.supportedMCSSet); |
| 130 | pStaDs->supportedRates.rxHighestDataRate = rxHighestRate; |
| 131 | |
| 132 | //FIXME_AMPDU |
| 133 | // In the future, may need to check for "assoc.HTCaps.delayedBA" |
| 134 | // For now, it is IMMEDIATE BA only on ALL TID's |
| 135 | pStaDs->baPolicyFlag = 0xFF; |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | if (limPopulateOwnRateSet(pMac, &pStaDs->supportedRates, pAssocRsp->HTCaps.supportedMCSSet, false,psessionEntry) != eSIR_SUCCESS) { |
| 140 | limLog(pMac, LOGP, FL("could not get rateset and extended rate set\n")); |
| 141 | return; |
| 142 | } |
| 143 | |
| 144 | //If one of the rates is 11g rates, set the ERP mode. |
| 145 | if ((phyMode == WNI_CFG_PHY_MODE_11G) && sirIsArate(pStaDs->supportedRates.llaRates[0] & 0x7f)) |
| 146 | pStaDs->erpEnabled = eHAL_SET; |
| 147 | |
| 148 | |
| 149 | val = WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET_LEN; |
| 150 | if (wlan_cfgGetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 151 | (tANI_U8 *) &pStaDs->mlmStaContext.propRateSet.propRate, |
| 152 | &val) != eSIR_SUCCESS) { |
| 153 | /// Could not get prop rateset from CFG. Log error. |
| 154 | limLog(pMac, LOGP, FL("could not retrieve prop rateset\n")); |
| 155 | return; |
| 156 | } |
| 157 | pStaDs->mlmStaContext.propRateSet.numPropRates = (tANI_U8) val; |
| 158 | |
| 159 | pStaDs->qosMode = 0; |
| 160 | pStaDs->lleEnabled = 0; |
| 161 | |
| 162 | // update TSID to UP mapping |
| 163 | //if (pMac->lim.gLimQosEnabled) |
| 164 | if (qosMode) { |
| 165 | if (pAssocRsp->edcaPresent) { |
| 166 | tSirRetStatus status; |
| 167 | status = schBeaconEdcaProcess(pMac,&pAssocRsp->edca, psessionEntry); |
| 168 | PELOG2(limLog(pMac, LOG2, "Edca set update based on AssocRsp: status %d\n", |
| 169 | status);) |
| 170 | if (status != eSIR_SUCCESS) { |
| 171 | PELOGE(limLog(pMac, LOGE, FL("Edca error in AssocResp \n"));) |
| 172 | } else { // update default tidmap based on ACM |
| 173 | pStaDs->qosMode = 1; |
| 174 | pStaDs->lleEnabled = 1; |
| 175 | } |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | pStaDs->wmeEnabled = 0; |
| 180 | pStaDs->wsmEnabled = 0; |
| 181 | if (psessionEntry->limWmeEnabled && pAssocRsp->wmeEdcaPresent) |
| 182 | { |
| 183 | tSirRetStatus status; |
| 184 | status = schBeaconEdcaProcess(pMac,&pAssocRsp->edca, psessionEntry); |
| 185 | PELOGW(limLog(pMac, LOGW, "WME Edca set update based on AssocRsp: status %d\n", status);) |
| 186 | |
| 187 | if (status != eSIR_SUCCESS) |
| 188 | PELOGE(limLog(pMac, LOGE, FL("WME Edca error in AssocResp - ignoring\n"));) |
| 189 | else { // update default tidmap based on HashACM |
| 190 | pStaDs->qosMode = 1; |
| 191 | pStaDs->wmeEnabled = 1; |
| 192 | } |
| 193 | } |
| 194 | else { |
| 195 | /* We received assoc rsp from a legacy AP. So fill in the default |
| 196 | * local EDCA params. This is needed (refer to bug #14989) as we'll |
| 197 | * be passing the gLimEdcaParams to HAL in limProcessStaMlmAddBssRsp(). |
| 198 | */ |
| 199 | schSetDefaultEdcaParams(pMac, psessionEntry); |
| 200 | } |
| 201 | |
| 202 | |
| 203 | } |
| 204 | |
| 205 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 206 | /** |
| 207 | * @function : limUpdateReAssocGlobals |
| 208 | * |
| 209 | * @brief : This function is called to Update the Globals (LIM) during ReAssoc. |
| 210 | * |
| 211 | *LOGIC: |
| 212 | * |
| 213 | *ASSUMPTIONS: |
| 214 | * |
| 215 | *NOTE: |
| 216 | * |
| 217 | * @param pMac - Pointer to Global MAC structure |
| 218 | * @param pAssocRsp - Pointer to Association Response Structure |
| 219 | * |
| 220 | * @return None |
| 221 | */ |
| 222 | |
| 223 | void limUpdateReAssocGlobals(tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,tpPESession psessionEntry) |
| 224 | { |
| 225 | /** |
| 226 | * Update the status for PMM module |
| 227 | */ |
| 228 | pmmResetPmmState(pMac); |
| 229 | |
| 230 | // Update the current Bss Information |
| 231 | palCopyMemory( pMac->hHdd, psessionEntry->bssId, |
| 232 | psessionEntry->limReAssocbssId, sizeof(tSirMacAddr)); |
| 233 | psessionEntry->currentOperChannel = psessionEntry->limReassocChannelId; |
| 234 | psessionEntry->limCurrentBssCaps = psessionEntry->limReassocBssCaps; |
| 235 | psessionEntry->limCurrentBssQosCaps = psessionEntry->limReassocBssQosCaps; |
| 236 | psessionEntry->limCurrentBssPropCap = psessionEntry->limReassocBssPropCap; |
| 237 | psessionEntry->limCurrentTitanHtCaps = psessionEntry->limReassocTitanHtCaps; |
| 238 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &psessionEntry->ssId, |
| 239 | (tANI_U8 *) &psessionEntry->limReassocSSID, |
| 240 | psessionEntry->limReassocSSID.length+1); |
| 241 | |
| 242 | // Store assigned AID for TIM processing |
| 243 | psessionEntry->limAID = pAssocRsp->aid & 0x3FFF; |
| 244 | /** Set the State Back to ReAssoc Rsp*/ |
| 245 | psessionEntry->limMlmState = eLIM_MLM_WT_REASSOC_RSP_STATE; |
| 246 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState)); |
| 247 | |
| 248 | |
| 249 | } |
| 250 | #endif |
| 251 | |
| 252 | /** |
| 253 | * @function : limProcessAssocRspFrame |
| 254 | * |
| 255 | * @brief : This function is called by limProcessMessageQueue() upon |
| 256 | * Re/Association Response frame reception. |
| 257 | * |
| 258 | *LOGIC: |
| 259 | * |
| 260 | *ASSUMPTIONS: |
| 261 | * |
| 262 | *NOTE: |
| 263 | * |
| 264 | * @param pMac - Pointer to Global MAC structure |
| 265 | * @param *pRxPacketInfo - A pointer to Rx packet info structure |
| 266 | * @param subType - Indicates whether it is Association Response (=0) or |
| 267 | * Reassociation Response (=1) frame |
| 268 | * |
| 269 | * @return None |
| 270 | */ |
| 271 | |
| 272 | void |
| 273 | limProcessAssocRspFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U8 subType,tpPESession psessionEntry) |
| 274 | { |
| 275 | tANI_U8 *pBody; |
| 276 | tANI_U16 caps; |
| 277 | tANI_U32 frameLen; |
| 278 | tSirMacAddr currentBssId; |
| 279 | tpSirMacMgmtHdr pHdr; |
| 280 | tSirMacCapabilityInfo localCapabilities; |
| 281 | tpDphHashNode pStaDs; |
| 282 | tpSirAssocRsp pAssocRsp; |
| 283 | tLimMlmAssocCnf mlmAssocCnf; |
| 284 | |
| 285 | #ifdef ANI_PRODUCT_TYPE_CLIENT |
| 286 | tSchBeaconStruct beaconStruct; |
| 287 | #endif |
| 288 | |
| 289 | //Initialize status code to success. |
| 290 | |
| 291 | pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 292 | |
| 293 | mlmAssocCnf.resultCode = eSIR_SME_SUCCESS; |
| 294 | /* Update PE session Id*/ |
| 295 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 296 | |
| 297 | |
| 298 | if (psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE ) |
| 299 | { |
| 300 | // Should not have received Re/Association Response |
| 301 | // frame on AP. Log error |
| 302 | limLog(pMac, LOGE, |
| 303 | FL("received Re/Assoc response frame on role %d \n"), |
| 304 | psessionEntry->limSystemRole); |
| 305 | |
| 306 | return; |
| 307 | } |
| 308 | |
| 309 | |
| 310 | pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 311 | frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 312 | |
| 313 | if (((subType == LIM_ASSOC) && |
| 314 | (psessionEntry->limMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE)) || |
| 315 | ((subType == LIM_REASSOC) && |
| 316 | ((psessionEntry->limMlmState != eLIM_MLM_WT_REASSOC_RSP_STATE) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 317 | #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] | 318 | && (psessionEntry->limMlmState != eLIM_MLM_WT_FT_REASSOC_RSP_STATE) |
| 319 | #endif |
| 320 | ))) |
| 321 | { |
| 322 | /// Received unexpected Re/Association Response frame |
| 323 | |
| 324 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
| 325 | PELOG1(limLog(pMac, LOG1, FL("mlm state is set to %d session=%d\n"), |
| 326 | psessionEntry->limMlmState, psessionEntry->peSessionId);) |
| 327 | #endif |
| 328 | // Log error |
| 329 | if (!pHdr->fc.retry) |
| 330 | { |
| 331 | limLog(pMac, LOGE, |
| 332 | FL("received Re/Assoc rsp frame in unexpected state\n")); |
| 333 | limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState); |
| 334 | } |
| 335 | |
| 336 | return; |
| 337 | } |
| 338 | #if 0 |
| 339 | if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) != |
| 340 | eSIR_SUCCESS) |
| 341 | { |
| 342 | /// Could not get BSSID from CFG. Log error. |
| 343 | limLog(pMac, LOGP, FL("could not retrieve BSSID\n")); |
| 344 | return; |
| 345 | } |
| 346 | #endif //TO SUPPORT BT-AMP |
| 347 | sirCopyMacAddr(currentBssId,psessionEntry->bssId); |
| 348 | |
| 349 | if (subType == LIM_ASSOC) |
| 350 | { |
| 351 | if (!palEqualMemory( pMac->hHdd,pHdr->sa, currentBssId, sizeof(tSirMacAddr)) ) |
| 352 | { |
| 353 | /** |
| 354 | * Received Association Response frame from an entity |
| 355 | * other than one to which request was initiated. |
| 356 | * Ignore this and wait until Association Failure Timeout. |
| 357 | */ |
| 358 | |
| 359 | // Log error |
| 360 | PELOG1(limLog(pMac, LOG1, |
| 361 | FL("received AssocRsp frame from unexpected peer ")); |
| 362 | limPrintMacAddr(pMac, pHdr->sa, LOG1);) |
| 363 | |
| 364 | return; |
| 365 | } |
| 366 | } |
| 367 | else |
| 368 | { |
| 369 | if ( !palEqualMemory( pMac->hHdd,pHdr->sa, psessionEntry->limReAssocbssId, sizeof(tSirMacAddr)) ) |
| 370 | { |
| 371 | /** |
| 372 | * Received Reassociation Response frame from an entity |
| 373 | * other than one to which request was initiated. |
| 374 | * Ignore this and wait until Reassociation Failure Timeout. |
| 375 | */ |
| 376 | |
| 377 | // Log error |
| 378 | PELOG1(limLog(pMac, LOG1, |
| 379 | FL("received ReassocRsp frame from unexpected peer "));) |
| 380 | PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);) |
| 381 | |
| 382 | return; |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | if ( palAllocateMemory(pMac->hHdd, (void **)&pAssocRsp, sizeof(*pAssocRsp)) != eHAL_STATUS_SUCCESS) { |
| 387 | limLog(pMac, LOGP, FL("Pal Allocate Memory failed in AssocRsp\n")); |
| 388 | return; |
| 389 | } |
| 390 | |
| 391 | // Get pointer to Re/Association Response frame body |
| 392 | pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 393 | |
| 394 | // parse Re/Association Response frame. |
| 395 | if (sirConvertAssocRespFrame2Struct( |
| 396 | pMac, pBody, frameLen, pAssocRsp) == eSIR_FAILURE) |
| 397 | { |
| 398 | if (palFreeMemory(pMac->hHdd, pAssocRsp) != eHAL_STATUS_SUCCESS) |
| 399 | { |
| 400 | limLog(pMac, LOGP, FL("PalFree Memory failed \n")); |
| 401 | return; |
| 402 | } |
| 403 | PELOGE(limLog(pMac, LOGE, FL("Parse error Assoc resp subtype %d, length=%d\n"), frameLen,subType);) |
| 404 | return; |
| 405 | } |
| 406 | |
| 407 | if(!pAssocRsp->suppRatesPresent) |
| 408 | { |
| 409 | PELOGE(limLog(pMac, LOGW, FL("assoc response does not have supported rate set"));) |
| 410 | palCopyMemory(pMac->hHdd, &pAssocRsp->supportedRates, |
| 411 | &psessionEntry->rateSet, sizeof(tSirMacRateSet)); |
| 412 | } |
| 413 | |
| 414 | mlmAssocCnf.protStatusCode = pAssocRsp->statusCode; |
| 415 | |
| 416 | if( psessionEntry->assocRsp != NULL ) |
| 417 | { |
| 418 | palFreeMemory(pMac->hHdd, psessionEntry->assocRsp); |
| 419 | psessionEntry->assocRsp = NULL; |
| 420 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame^] | 421 | if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->assocRsp, frameLen)) != eHAL_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 422 | { |
| 423 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc response, len = %d"), frameLen);) |
| 424 | } |
| 425 | else |
| 426 | { |
| 427 | //Store the Assoc response. This is sent to csr/hdd in join cnf response. |
| 428 | palCopyMemory(pMac->hHdd, psessionEntry->assocRsp, pBody, frameLen); |
| 429 | psessionEntry->assocRspLen = frameLen; |
| 430 | } |
| 431 | |
| 432 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 433 | if (psessionEntry->ricData != NULL) |
| 434 | { |
| 435 | palFreeMemory(pMac->hHdd, psessionEntry->ricData); |
| 436 | psessionEntry->ricData = NULL; |
| 437 | } |
| 438 | if(pAssocRsp->ricPresent) |
| 439 | { |
| 440 | psessionEntry->RICDataLen = pAssocRsp->num_RICData * sizeof(tDot11fIERICDataDesc); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame^] | 441 | if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->ricData, psessionEntry->RICDataLen)) != eHAL_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 442 | { |
| 443 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc response"));) |
| 444 | psessionEntry->RICDataLen = 0; |
| 445 | } |
| 446 | else |
| 447 | { |
| 448 | palCopyMemory(pMac->hHdd, psessionEntry->ricData, &pAssocRsp->RICData[0], psessionEntry->RICDataLen); |
| 449 | } |
| 450 | } |
| 451 | else |
| 452 | { |
| 453 | psessionEntry->RICDataLen = 0; |
| 454 | psessionEntry->ricData = NULL; |
| 455 | } |
| 456 | #endif |
| 457 | |
| 458 | #ifdef FEATURE_WLAN_CCX |
| 459 | if (psessionEntry->tspecIes != NULL) |
| 460 | { |
| 461 | palFreeMemory(pMac->hHdd, psessionEntry->tspecIes); |
| 462 | psessionEntry->tspecIes = NULL; |
| 463 | } |
| 464 | if(pAssocRsp->tspecPresent) |
| 465 | { |
| 466 | psessionEntry->tspecLen = pAssocRsp->num_tspecs * sizeof(tDot11fIEWMMTSPEC); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame^] | 467 | if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->tspecIes, psessionEntry->tspecLen)) != eHAL_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 468 | { |
| 469 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc response"));) |
| 470 | psessionEntry->tspecLen = 0; |
| 471 | } |
| 472 | else |
| 473 | { |
| 474 | palCopyMemory(pMac->hHdd, psessionEntry->tspecIes, &pAssocRsp->TSPECInfo[0], psessionEntry->tspecLen); |
| 475 | } |
| 476 | PELOG1(limLog(pMac, LOG1, FL(" Tspec EID present in assoc rsp "));) |
| 477 | } |
| 478 | else |
| 479 | { |
| 480 | psessionEntry->tspecLen = 0; |
| 481 | psessionEntry->tspecIes = NULL; |
| 482 | PELOG1(limLog(pMac, LOG1, FL(" Tspec EID *NOT* present in assoc rsp "));) |
| 483 | } |
| 484 | #endif |
| 485 | |
| 486 | if (pAssocRsp->capabilityInfo.ibss) |
| 487 | { |
| 488 | /** |
| 489 | * Received Re/Association Response from peer |
| 490 | * with IBSS capability set. |
| 491 | * Ignore the frame and wait until Re/assoc |
| 492 | * failure timeout. |
| 493 | */ |
| 494 | |
| 495 | // Log error |
| 496 | limLog(pMac, LOGE, |
| 497 | FL("received Re/AssocRsp frame with IBSS capability\n")); |
| 498 | palFreeMemory(pMac->hHdd, pAssocRsp); |
| 499 | return; |
| 500 | } |
| 501 | |
| 502 | if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS) |
| 503 | { |
| 504 | /** |
| 505 | * Could not get Capabilities value |
| 506 | * from CFG. Log error. |
| 507 | */ |
| 508 | palFreeMemory(pMac->hHdd, pAssocRsp); |
| 509 | limLog(pMac, LOGP, FL("could not retrieve Capabilities value\n")); |
| 510 | return; |
| 511 | } |
| 512 | limCopyU16((tANI_U8 *) &localCapabilities, caps); |
| 513 | |
| 514 | if (subType == LIM_ASSOC) // Stop Association failure timer |
| 515 | limDeactivateAndChangeTimer(pMac, eLIM_ASSOC_FAIL_TIMER); |
| 516 | else // Stop Reassociation failure timer |
| 517 | limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER); |
| 518 | |
| 519 | if (pAssocRsp->statusCode != eSIR_MAC_SUCCESS_STATUS) |
| 520 | { |
| 521 | // Re/Association response was received |
| 522 | // either with failure code. |
| 523 | // Log error. |
| 524 | PELOGE(limLog(pMac, LOGE, FL("received Re/AssocRsp frame failure code %d\n"), pAssocRsp->statusCode);) |
| 525 | // Need to update 'association failure' error counter |
| 526 | // along with STATUS CODE |
| 527 | |
| 528 | // Return Assoc confirm to SME with received failure code |
| 529 | |
| 530 | if (pAssocRsp->propIEinfo.loadBalanceInfoPresent) |
| 531 | { |
| 532 | mlmAssocCnf.resultCode = eSIR_SME_TRANSFER_STA; |
| 533 | palCopyMemory( pMac->hHdd, pMac->lim.gLimAlternateRadio.bssId, |
| 534 | pAssocRsp->propIEinfo.alternateRadio.bssId, sizeof(tSirMacAddr)); |
| 535 | pMac->lim.gLimAlternateRadio.channelId = |
| 536 | pAssocRsp->propIEinfo.alternateRadio.channelId; |
| 537 | }else |
| 538 | mlmAssocCnf.resultCode = eSIR_SME_ASSOC_REFUSED; |
| 539 | |
| 540 | // Delete Pre-auth context for the associated BSS |
| 541 | if (limSearchPreAuthList(pMac, pHdr->sa)) |
| 542 | limDeletePreAuthNode(pMac, pHdr->sa); |
| 543 | |
| 544 | goto assocReject; |
| 545 | } |
| 546 | else if ((pAssocRsp->aid & 0x3FFF) > 2007) |
| 547 | { |
| 548 | // Re/Association response was received |
| 549 | // with invalid AID value |
| 550 | // Log error |
| 551 | PELOGW(limLog(pMac, LOGW, FL("received Re/AssocRsp frame with invalid aid %X \n"), pAssocRsp->aid);) |
| 552 | mlmAssocCnf.resultCode = eSIR_SME_INVALID_ASSOC_RSP_RXED; |
| 553 | mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 554 | |
| 555 | // Send advisory Disassociation frame to AP |
| 556 | limSendDisassocMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_REASON, pHdr->sa,psessionEntry); |
| 557 | |
| 558 | goto assocReject; |
| 559 | } |
| 560 | // Association Response received with success code |
| 561 | |
| 562 | if (subType == LIM_REASSOC) |
| 563 | { |
| 564 | // Log success |
| 565 | PELOG1(limLog(pMac, LOG1, FL("Successfully Reassociated with BSS\n"));) |
| 566 | #ifdef FEATURE_WLAN_CCX |
| 567 | { |
| 568 | tANI_U8 cnt = 0; |
| 569 | if (pAssocRsp->tsmPresent) |
| 570 | { |
| 571 | limLog(pMac, LOGW, "TSM IE Present in Reassoc Rsp\n"); |
| 572 | // Start the TSM timer only if the TSPEC Ie is present in the reassoc rsp |
| 573 | if (pAssocRsp->tspecPresent) { |
| 574 | // Find the TSPEC IE with VO user priority |
| 575 | for (cnt=0; cnt<pAssocRsp->num_tspecs; cnt++) { |
| 576 | if ( upToAc(pAssocRsp->TSPECInfo[cnt].user_priority) == EDCA_AC_VO) { |
| 577 | psessionEntry->ccxContext.tsm.tid = pAssocRsp->TSPECInfo[cnt].user_priority; |
| 578 | vos_mem_copy(&psessionEntry->ccxContext.tsm.tsmInfo, |
| 579 | &pAssocRsp->tsmIE, sizeof(tSirMacCCXTSMIE)); |
| 580 | limActivateTSMStatsTimer(pMac, psessionEntry); |
| 581 | if(psessionEntry->ccxContext.tsm.tsmInfo.state) { |
| 582 | psessionEntry->ccxContext.tsm.tsmMetrics.RoamingCount++; |
| 583 | } |
| 584 | break; |
| 585 | } |
| 586 | } |
| 587 | } else { |
| 588 | limLog(pMac, LOGE, "TSM present but TSPEC IE not present in Reassoc Rsp\n"); |
| 589 | } |
| 590 | } |
| 591 | } |
| 592 | #endif |
| 593 | if (psessionEntry->pLimMlmJoinReq) |
| 594 | { |
| 595 | palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq); |
| 596 | psessionEntry->pLimMlmJoinReq = NULL; |
| 597 | } |
| 598 | |
| 599 | psessionEntry->limAssocResponseData = (void *) pAssocRsp; /** Store the ReAssocRsp Frame in DphTable to be used |
| 600 | during processing DelSta nd DelBss to send AddBss again*/ |
| 601 | pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 602 | |
| 603 | if(!pStaDs) |
| 604 | { |
| 605 | PELOGE(limLog(pMac, LOG1, FL("could not get hash entry at DPH for \n"));) |
| 606 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
| 607 | mlmAssocCnf.resultCode = eSIR_SME_INVALID_ASSOC_RSP_RXED; |
| 608 | mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 609 | |
| 610 | // Send advisory Disassociation frame to AP |
| 611 | limSendDisassocMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_REASON, pHdr->sa,psessionEntry); |
| 612 | |
| 613 | goto assocReject; |
| 614 | } |
| 615 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 616 | #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] | 617 | if (psessionEntry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE) |
| 618 | { |
| 619 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
| 620 | PELOGE(limLog(pMac, LOGE, FL("Sending self sta\n"));) |
| 621 | #endif |
| 622 | pmmResetPmmState(pMac); |
| 623 | |
| 624 | limUpdateAssocStaDatas(pMac, pStaDs, pAssocRsp,psessionEntry); |
| 625 | |
| 626 | // Store assigned AID for TIM processing |
| 627 | psessionEntry->limAID = pAssocRsp->aid & 0x3FFF; |
| 628 | |
| 629 | limAddFTStaSelf(pMac, (pAssocRsp->aid & 0x3FFF), psessionEntry); |
| 630 | |
| 631 | return; |
| 632 | } |
| 633 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 634 | |
| 635 | /* If we're re-associating to the same BSS, we don't want to invoke delete |
| 636 | * STA, delete BSS, as that would remove the already established TSPEC. |
| 637 | * Just go ahead and re-add the BSS, STA with new capability information. |
| 638 | * However, if we're re-associating to a different BSS, then follow thru |
| 639 | * with del STA, del BSS, add BSS, add STA. |
| 640 | */ |
| 641 | if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId)) |
| 642 | limHandleAddBssInReAssocContext(pMac, pStaDs, psessionEntry); |
| 643 | else |
| 644 | { |
| 645 | // reset the uapsd mask settings since we're re-associating to new AP |
| 646 | pMac->lim.gUapsdPerAcDeliveryEnableMask = 0; |
| 647 | pMac->lim.gUapsdPerAcTriggerEnableMask = 0; |
| 648 | |
| 649 | if (limCleanupRxPath(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS) |
| 650 | goto assocReject; |
| 651 | } |
| 652 | return; |
| 653 | } |
| 654 | |
| 655 | // Log success |
| 656 | PELOG1(limLog(pMac, LOG1, FL("Successfully Associated with BSS\n"));) |
| 657 | #ifdef FEATURE_WLAN_CCX |
| 658 | if(psessionEntry->ccxContext.tsm.tsmInfo.state) |
| 659 | { |
| 660 | psessionEntry->ccxContext.tsm.tsmMetrics.RoamingCount = 0; |
| 661 | } |
| 662 | #endif |
| 663 | /** |
| 664 | * Update the status for PMM module |
| 665 | */ |
| 666 | pmmResetPmmState(pMac); |
| 667 | |
| 668 | // Store assigned AID for TIM processing |
| 669 | psessionEntry->limAID = pAssocRsp->aid & 0x3FFF; |
| 670 | |
| 671 | |
| 672 | //STA entry was created during pre-assoc state. |
| 673 | if ((pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL) |
| 674 | { |
| 675 | // Could not add hash table entry |
| 676 | PELOGE(limLog(pMac, LOGE, FL("could not get hash entry at DPH for \n"));) |
| 677 | limPrintMacAddr(pMac, pHdr->sa, LOGE); |
| 678 | |
| 679 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 680 | mlmAssocCnf.protStatusCode = eSIR_SME_SUCCESS; |
| 681 | |
| 682 | |
| 683 | limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF, |
| 684 | (tANI_U32 *) &mlmAssocCnf); |
| 685 | palFreeMemory(pMac->hHdd, pAssocRsp); |
| 686 | return; |
| 687 | } |
| 688 | |
| 689 | // Delete Pre-auth context for the associated BSS |
| 690 | if (limSearchPreAuthList(pMac, pHdr->sa)) |
| 691 | limDeletePreAuthNode(pMac, pHdr->sa); |
| 692 | |
| 693 | limUpdateAssocStaDatas(pMac, pStaDs, pAssocRsp,psessionEntry); |
| 694 | #ifdef ANI_PRODUCT_TYPE_CLIENT |
| 695 | // Extract the AP capabilities from the beacon that was received earlier |
| 696 | // TODO - Watch out for an error response! |
| 697 | limExtractApCapabilities( pMac, |
| 698 | (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields, |
| 699 | limGetIElenFromBssDescription( &psessionEntry->pLimJoinReq->bssDescription ), |
| 700 | &beaconStruct ); |
| 701 | |
| 702 | if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 703 | limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry); |
| 704 | |
| 705 | if(beaconStruct.erpPresent) { |
| 706 | if (beaconStruct.erpIEInfo.barkerPreambleMode) |
| 707 | psessionEntry->beaconParams.fShortPreamble = false; |
| 708 | else |
| 709 | psessionEntry->beaconParams.fShortPreamble = true; |
| 710 | } |
| 711 | |
| 712 | |
| 713 | //Update the BSS Entry, this entry was added during preassoc. |
| 714 | if( eSIR_SUCCESS == limStaSendAddBss( pMac, pAssocRsp, &beaconStruct, |
| 715 | &psessionEntry->pLimJoinReq->bssDescription, true, psessionEntry)) |
| 716 | { |
| 717 | palFreeMemory(pMac->hHdd, pAssocRsp); |
| 718 | return; |
| 719 | } |
| 720 | else |
| 721 | { |
| 722 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 723 | mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 724 | } |
| 725 | |
| 726 | #elif defined(ANI_AP_CLIENT_SDK) |
| 727 | if( eSIR_SUCCESS == limStaSendAddBss( pMac, *pAssocRsp, |
| 728 | &psessionEntry->pLimJoinReq->neighborBssList.bssList[0], true)) |
| 729 | { |
| 730 | palFreeMemory(pMac->hHdd, pAssocRsp); |
| 731 | return; |
| 732 | } |
| 733 | else |
| 734 | { |
| 735 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 736 | mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 737 | } |
| 738 | #else |
| 739 | palFreeMemory(pMac->hHdd, pAssocRsp); |
| 740 | return; |
| 741 | #endif |
| 742 | |
| 743 | |
| 744 | assocReject: |
| 745 | if ((subType == LIM_ASSOC) |
| 746 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 747 | || ((subType == LIM_REASSOC) && (psessionEntry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE)) |
| 748 | #endif |
| 749 | ) { |
| 750 | PELOGE(limLog(pMac, LOGE, FL("Assoc Rejected by the peer. Reason: %d\n"), mlmAssocCnf.resultCode);) |
| 751 | pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE; |
| 752 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState)); |
| 753 | |
| 754 | if (psessionEntry->pLimMlmJoinReq) |
| 755 | { |
| 756 | palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq); |
| 757 | psessionEntry->pLimMlmJoinReq = NULL; |
| 758 | } |
| 759 | if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId, |
| 760 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS) |
| 761 | PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));) |
| 762 | if (subType == LIM_ASSOC) |
| 763 | { |
| 764 | limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF, (tANI_U32 *) &mlmAssocCnf); |
| 765 | } |
| 766 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 767 | else |
| 768 | { |
| 769 | mlmAssocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 770 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmAssocCnf); |
| 771 | } |
| 772 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 773 | } else { |
| 774 | limRestorePreReassocState( pMac, |
| 775 | eSIR_SME_REASSOC_REFUSED, mlmAssocCnf.protStatusCode,psessionEntry); |
| 776 | } |
| 777 | |
| 778 | /* CR: vos packet memory is leaked when assoc rsp timeouted/failed. */ |
| 779 | /* notify TL that association is failed so that TL can flush the cached frame */ |
| 780 | WLANTL_AssocFailed (psessionEntry->staId); |
| 781 | |
| 782 | |
| 783 | palFreeMemory(pMac->hHdd, pAssocRsp); |
| 784 | return; |
| 785 | } /*** end limProcessAssocRspFrame() ***/ |
| 786 | |