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