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