Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /* |
| 43 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 44 | * This file limAssocUtils.cc contains the utility functions |
| 45 | * LIM uses while processing (Re) Association messages. |
| 46 | * Author: Chandra Modumudi |
| 47 | * Date: 02/13/02 |
| 48 | * History:- |
| 49 | * Date Modified by Modification Information |
| 50 | * -------------------------------------------------------------------- |
| 51 | * 05/26/10 js WPA handling in (Re)Assoc frames |
| 52 | * |
| 53 | */ |
| 54 | |
| 55 | #include "palTypes.h" |
| 56 | #include "aniGlobal.h" |
| 57 | #include "wniApi.h" |
| 58 | #include "sirCommon.h" |
| 59 | |
| 60 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 61 | #include "wniCfgAp.h" |
| 62 | #else |
| 63 | #include "wniCfgSta.h" |
| 64 | #endif |
| 65 | #include "pmmApi.h" |
| 66 | #include "cfgApi.h" |
| 67 | |
| 68 | #include "schApi.h" |
| 69 | #include "utilsApi.h" |
| 70 | #include "limUtils.h" |
| 71 | #include "limAssocUtils.h" |
| 72 | #include "limSecurityUtils.h" |
| 73 | #include "limSerDesUtils.h" |
| 74 | #include "limStaHashApi.h" |
| 75 | #include "limAdmitControl.h" |
| 76 | #include "limSendMessages.h" |
| 77 | #include "limIbssPeerMgmt.h" |
| 78 | #include "limSession.h" |
| 79 | |
| 80 | #include "vos_types.h" |
| 81 | #include "wlan_qct_wda.h" |
| 82 | |
| 83 | /* |
| 84 | * fill up the rate info properly based on what is actually supported by the peer |
| 85 | * TBD TBD TBD |
| 86 | */ |
| 87 | void |
| 88 | limFillSupportedRatesInfo( |
| 89 | tpAniSirGlobal pMac, |
| 90 | tpDphHashNode pSta, |
| 91 | tpSirSupportedRates pRates, |
| 92 | tpPESession psessionEntry) |
| 93 | { |
| 94 | //pSta will be NULL for self entry, so get the opRateMode based on the self mode. |
| 95 | //For the peer entry get it from the peer Capabilities present in hash table |
| 96 | if(pSta == NULL) |
| 97 | pRates->opRateMode = limGetStaRateMode((tANI_U8)psessionEntry->dot11mode); |
| 98 | else |
| 99 | pRates->opRateMode = limGetStaPeerType(pMac, pSta, psessionEntry); |
| 100 | |
| 101 | } |
| 102 | |
| 103 | |
| 104 | /** |
| 105 | * limCmpSSid() |
| 106 | * |
| 107 | *FUNCTION: |
| 108 | * This function is called in various places within LIM code |
| 109 | * to determine whether received SSid is same as SSID in use. |
| 110 | * |
| 111 | *LOGIC: |
| 112 | * |
| 113 | *ASSUMPTIONS: |
| 114 | * NA |
| 115 | * |
| 116 | *NOTE: |
| 117 | * NA |
| 118 | * |
| 119 | * @param *prxSSid - pointer to SSID structure |
| 120 | * |
| 121 | * @return status - true for SSID match else false. |
| 122 | */ |
| 123 | |
| 124 | tANI_U8 |
| 125 | limCmpSSid(tpAniSirGlobal pMac, tSirMacSSid *prxSSid,tpPESession psessionEntry) |
| 126 | { |
| 127 | |
| 128 | if( palEqualMemory( pMac->hHdd, (tANI_U8* ) prxSSid, (tANI_U8 *) &psessionEntry->ssId, |
| 129 | (tANI_U8) (psessionEntry->ssId.length + 1))) |
| 130 | return true; |
| 131 | else |
| 132 | return false; |
| 133 | |
| 134 | } /****** end limCmpSSid() ******/ |
| 135 | |
| 136 | |
| 137 | |
| 138 | /** |
| 139 | * limCompareCapabilities() |
| 140 | * |
| 141 | *FUNCTION: |
| 142 | * This function is called during Association/Reassociation |
| 143 | * frame handling to determine whether received capabilities |
| 144 | * match with local capabilities or not. |
| 145 | * |
| 146 | *LOGIC: |
| 147 | * |
| 148 | *ASSUMPTIONS: |
| 149 | * NA |
| 150 | * |
| 151 | *NOTE: |
| 152 | * NA |
| 153 | * |
| 154 | * @param pMac - Pointer to Global MAC structure |
| 155 | * @param pAssocReq - Pointer to received Assoc Req frame |
| 156 | * @param pLocalCapabs - Pointer to local capabilities |
| 157 | * |
| 158 | * @return status - true for Capabilitity match else false. |
| 159 | */ |
| 160 | |
| 161 | tANI_U8 |
| 162 | limCompareCapabilities(tpAniSirGlobal pMac, |
| 163 | tSirAssocReq *pAssocReq, |
| 164 | tSirMacCapabilityInfo *pLocalCapabs,tpPESession psessionEntry) |
| 165 | { |
| 166 | tANI_U32 val; |
| 167 | |
| 168 | |
| 169 | if ( ((psessionEntry->limSystemRole == eLIM_AP_ROLE)|| |
| 170 | (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && |
| 171 | (pAssocReq->capabilityInfo.ibss) ) |
| 172 | { |
| 173 | // Requesting STA asserting IBSS capability. |
| 174 | return false; |
| 175 | } |
| 176 | |
| 177 | // Compare CF capabilities |
| 178 | if (pAssocReq->capabilityInfo.cfPollable || |
| 179 | pAssocReq->capabilityInfo.cfPollReq) |
| 180 | { |
| 181 | // AP does not support PCF functionality |
| 182 | return false; |
| 183 | } |
| 184 | |
| 185 | #if 0 //See CR24696 for analysis |
| 186 | // Compare privacy capability |
| 187 | if (pAssocReq->capabilityInfo.privacy != pLocalCapabs->privacy) |
| 188 | { |
| 189 | // AP does not support privacy |
| 190 | return false; |
| 191 | } |
| 192 | #endif |
| 193 | |
| 194 | // Compare short preamble capability |
| 195 | if (pAssocReq->capabilityInfo.shortPreamble && |
| 196 | (pAssocReq->capabilityInfo.shortPreamble != |
| 197 | pLocalCapabs->shortPreamble)) |
| 198 | { |
| 199 | PELOG1(limLog(pMac, LOG1, |
| 200 | FL("Allowing a STA requesting short preamble while AP does not support it\n"));) |
| 201 | #if 0 |
| 202 | // AP does not support short preamable |
| 203 | return false; |
| 204 | #endif |
| 205 | } |
| 206 | |
| 207 | |
| 208 | limLog(pMac, LOGW, "QoS in AssocReq: %d, local ShortP: %d\n", |
| 209 | pAssocReq->capabilityInfo.qos, |
| 210 | pLocalCapabs->qos); |
| 211 | |
| 212 | // Compare QoS capability |
| 213 | if (pAssocReq->capabilityInfo.qos && |
| 214 | (pAssocReq->capabilityInfo.qos != pLocalCapabs->qos)) |
| 215 | { |
| 216 | /*Temporary hack for UPF to skip 11e capability check in order to interop with |
| 217 | CSR - proper fix needs to be put in place*/ |
| 218 | if ( 0 != vos_get_skip_11e_check()) |
| 219 | { |
| 220 | limLog(pMac, LOG1, FL("Received unmatched QOS but cfg to suppress - continuing\n")); |
| 221 | } |
| 222 | else |
| 223 | { |
| 224 | // AP does not support QoS capability |
| 225 | return false; |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | |
| 230 | /* |
| 231 | * If AP supports shortSlot and if apple user has |
| 232 | * enforced association only from shortSlot station, |
| 233 | * then AP must reject any station that does not support |
| 234 | * shortSlot |
| 235 | */ |
| 236 | if ( ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && (pLocalCapabs->shortSlotTime == 1) ) |
| 237 | |
| 238 | { |
| 239 | if (wlan_cfgGetInt(pMac, WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY, &val) != eSIR_SUCCESS) |
| 240 | { |
| 241 | limLog(pMac, LOGP, FL("error getting WNI_CFG_FORCE_SHORT_SLOT_ASSOC_ONLY \n")); |
| 242 | return false; |
| 243 | } |
| 244 | if(val) |
| 245 | { |
| 246 | if (pAssocReq->capabilityInfo.shortSlotTime != pLocalCapabs->shortSlotTime) |
| 247 | return false; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | return true; |
| 252 | } /****** end limCompareCapabilities() ******/ |
| 253 | |
| 254 | |
| 255 | /** |
| 256 | * limCheckRxBasicRates() |
| 257 | * |
| 258 | *FUNCTION: |
| 259 | * This function is called during Association/Reassociation |
| 260 | * frame handling to determine whether received rates in |
| 261 | * Assoc/Reassoc request frames include all BSS basic rates |
| 262 | * or not. |
| 263 | * |
| 264 | *LOGIC: |
| 265 | * |
| 266 | *ASSUMPTIONS: |
| 267 | * NA |
| 268 | * |
| 269 | *NOTE: |
| 270 | * NA |
| 271 | * |
| 272 | * @param rxRateSet - pointer to SSID structure |
| 273 | * |
| 274 | * @return status - true if ALL BSS basic rates are present in the |
| 275 | * received rateset else false. |
| 276 | */ |
| 277 | |
| 278 | tANI_U8 |
| 279 | limCheckRxBasicRates(tpAniSirGlobal pMac, tSirMacRateSet rxRateSet,tpPESession psessionEntry) |
| 280 | { |
| 281 | tSirMacRateSet *pRateSet, basicRate; |
| 282 | tANI_U8 i, j, k, match; |
| 283 | |
| 284 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRateSet, sizeof(tSirMacRateSet))) |
| 285 | { |
| 286 | // Log error |
| 287 | limLog(pMac, LOGP, FL("call to palAllocateMemory failed for RATESET\n")); |
| 288 | |
| 289 | return false; |
| 290 | } |
| 291 | |
| 292 | |
| 293 | #if 0 |
| 294 | if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, |
| 295 | (tANI_U8 *) &pRateSet->rate, |
| 296 | (tANI_U32 *) &cfgLen) != eSIR_SUCCESS) |
| 297 | { |
| 298 | /// Could not get Operational rateset from CFG. Log error. |
| 299 | limLog(pMac, LOGP, FL("could not retrieve Operational rateset\n")); |
| 300 | |
| 301 | // Free up memory allocated for rateset |
| 302 | palFreeMemory( pMac->hHdd, (tANI_U8 *) pRateSet); |
| 303 | |
| 304 | return false; |
| 305 | } |
| 306 | #endif //TO SUPPORT BT-AMP |
| 307 | |
| 308 | /* Copy operational rate set from session Entry */ |
| 309 | palCopyMemory(pMac->hHdd, pRateSet->rate, (psessionEntry->rateSet.rate), psessionEntry->rateSet.numRates); |
| 310 | |
| 311 | pRateSet->numRates = psessionEntry->rateSet.numRates; |
| 312 | |
| 313 | // Extract BSS basic rateset from operational rateset |
| 314 | for (i = 0, j = 0; i < pRateSet->numRates; i++) |
| 315 | { |
| 316 | if ((pRateSet->rate[i] & 0x80) == 0x80) |
| 317 | { |
| 318 | // msb is set, so this is a basic rate |
| 319 | basicRate.rate[j++] = pRateSet->rate[i]; |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | /* |
| 324 | * For each BSS basic rate, find if it is present in the |
| 325 | * received rateset. |
| 326 | */ |
| 327 | for (k = 0; k < j; k++) |
| 328 | { |
| 329 | match = 0; |
| 330 | for (i = 0; i < rxRateSet.numRates; i++) |
| 331 | { |
| 332 | if ((rxRateSet.rate[i] | 0x80) == basicRate.rate[k]) |
| 333 | match = 1; |
| 334 | } |
| 335 | |
| 336 | if (!match) |
| 337 | { |
| 338 | // Free up memory allocated for rateset |
| 339 | palFreeMemory( pMac->hHdd, (tANI_U8 *) pRateSet); |
| 340 | |
| 341 | return false; |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | // Free up memory allocated for rateset |
| 346 | palFreeMemory( pMac->hHdd, (tANI_U8 *) pRateSet); |
| 347 | |
| 348 | return true; |
| 349 | } /****** end limCheckRxBasicRates() ******/ |
| 350 | |
| 351 | |
| 352 | |
| 353 | /** |
| 354 | * limCheckMCSSet() |
| 355 | * |
| 356 | *FUNCTION: |
| 357 | * This function is called during Association/Reassociation |
| 358 | * frame handling to determine whether received MCS rates in |
| 359 | * Assoc/Reassoc request frames includes all Basic MCS Rate Set or not. |
| 360 | * |
| 361 | *LOGIC: |
| 362 | * |
| 363 | *ASSUMPTIONS: |
| 364 | * NA |
| 365 | * |
| 366 | *NOTE: |
| 367 | * NA |
| 368 | * |
| 369 | * @param supportedMCSSet - pointer to Supported MCS Rate Set |
| 370 | * |
| 371 | * @return status - true if ALL MCS Basic Rate Set rates are present in the |
| 372 | * received rateset else false. |
| 373 | */ |
| 374 | |
| 375 | tANI_U8 |
| 376 | limCheckMCSSet(tpAniSirGlobal pMac, tANI_U8* supportedMCSSet) |
| 377 | { |
| 378 | tANI_U8 basicMCSSet[SIZE_OF_BASIC_MCS_SET] = {0}; |
| 379 | tANI_U32 cfgLen = 0; |
| 380 | tANI_U8 i; |
| 381 | tANI_U8 validBytes; |
| 382 | tANI_U8 lastByteMCSMask = 0x1f; |
| 383 | |
| 384 | |
| 385 | cfgLen = WNI_CFG_BASIC_MCS_SET_LEN; |
| 386 | if (wlan_cfgGetStr(pMac, WNI_CFG_BASIC_MCS_SET, |
| 387 | (tANI_U8 *) basicMCSSet, |
| 388 | (tANI_U32 *) &cfgLen) != eSIR_SUCCESS) |
| 389 | { |
| 390 | /// Could not get Basic MCS rateset from CFG. Log error. |
| 391 | limLog(pMac, LOGP, FL("could not retrieve Basic MCS rateset\n")); |
| 392 | return false; |
| 393 | } |
| 394 | |
| 395 | validBytes = VALID_MCS_SIZE/8; |
| 396 | |
| 397 | //check if all the Basic MCS Bits are set in supported MCS bitmap |
| 398 | for(i=0; i<validBytes; i++) |
| 399 | { |
| 400 | if( (basicMCSSet[i] & supportedMCSSet[i]) != basicMCSSet[i]) |
| 401 | { |
| 402 | PELOGW(limLog(pMac, LOGW, FL("One of Basic MCS Set Rates is not supported by the Station."));) |
| 403 | return false; |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | //check the last 5 bits of the valid MCS bitmap |
| 408 | if( ((basicMCSSet[i] & lastByteMCSMask) & (supportedMCSSet[i] & lastByteMCSMask)) != |
| 409 | (basicMCSSet[i] & lastByteMCSMask)) |
| 410 | { |
| 411 | PELOGW(limLog(pMac, LOGW, FL("One of Basic MCS Set Rates is not supported by the Station."));) |
| 412 | return false; |
| 413 | } |
| 414 | |
| 415 | return true; |
| 416 | } |
| 417 | |
| 418 | #ifdef WLAN_SOFTAP_FEATURE |
| 419 | |
| 420 | #define SECURITY_SUITE_TYPE_MASK 0xFF |
| 421 | #define SECURITY_SUITE_TYPE_WEP40 0x1 |
| 422 | #define SECURITY_SUITE_TYPE_TKIP 0x2 |
| 423 | #define SECURITY_SUITE_TYPE_CCMP 0x4 |
| 424 | #define SECURITY_SUITE_TYPE_WEP104 0x4 |
| 425 | |
| 426 | /** |
| 427 | * limCheckRxRSNIeMatch() |
| 428 | * |
| 429 | *FUNCTION: |
| 430 | * This function is called during Association/Reassociation |
| 431 | * frame handling to determine whether received RSN in |
| 432 | * Assoc/Reassoc request frames include supported cipher suites or not. |
| 433 | * |
| 434 | *LOGIC: |
| 435 | * |
| 436 | *ASSUMPTIONS: |
| 437 | * NA |
| 438 | * |
| 439 | *NOTE: |
| 440 | * NA |
| 441 | * |
| 442 | * @param rxRSNIe - received RSN IE in (Re)Assco req |
| 443 | * |
| 444 | * @return status - true if ALL BSS basic rates are present in the |
| 445 | * received rateset else false. |
| 446 | */ |
| 447 | |
| 448 | tANI_U8 |
| 449 | limCheckRxRSNIeMatch(tpAniSirGlobal pMac, tDot11fIERSN rxRSNIe,tpPESession pSessionEntry, tANI_U8 staIsHT) |
| 450 | { |
| 451 | tDot11fIERSN *pRSNIe; |
| 452 | tANI_U8 i, j, match, onlyNonHtCipher = 1; |
| 453 | |
| 454 | |
| 455 | //RSN IE should be received from PE |
| 456 | pRSNIe = &pSessionEntry->gStartBssRSNIe; |
| 457 | |
| 458 | // Check groupwise cipher suite |
| 459 | for (i = 0; i < sizeof(rxRSNIe.gp_cipher_suite); i++) |
| 460 | { |
| 461 | if (pRSNIe->gp_cipher_suite[i] != rxRSNIe.gp_cipher_suite[i]) |
| 462 | { |
| 463 | return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS; |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | /* |
| 468 | * For each Pairwise cipher suite check whether we support |
| 469 | * received pairwise |
| 470 | */ |
| 471 | match = 0; |
| 472 | for (i = 0; i < rxRSNIe.pwise_cipher_suite_count; i++) |
| 473 | { |
| 474 | for(j = 0; j < pRSNIe->pwise_cipher_suite_count; j++) |
| 475 | { |
| 476 | if(palEqualMemory(pMac,&rxRSNIe.pwise_cipher_suites[i], |
| 477 | &pRSNIe->pwise_cipher_suites[j], |
| 478 | sizeof(pRSNIe->pwise_cipher_suites[j]))) |
| 479 | { |
| 480 | match = 1; |
| 481 | break; |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | if ((staIsHT) |
| 486 | #ifdef ANI_LITTLE_BYTE_ENDIAN |
| 487 | &&( (rxRSNIe.pwise_cipher_suites[i][3] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP)) |
| 488 | #else |
| 489 | &&( (rxRSNIe.pwise_cipher_suites[i][0] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP)) |
| 490 | #endif |
| 491 | { |
| 492 | onlyNonHtCipher=0; |
| 493 | } |
| 494 | |
| 495 | } |
| 496 | |
| 497 | if ((!match) || ((staIsHT) && onlyNonHtCipher)) |
| 498 | { |
| 499 | return eSIR_MAC_INVALID_PAIRWISE_CIPHER_STATUS; |
| 500 | } |
| 501 | /* Check RSN capabilities */ |
| 502 | if(rxRSNIe.preauth == true) //this is supported by AP only |
| 503 | { |
| 504 | return eSIR_MAC_INVALID_RSN_IE_CAPABILITIES_STATUS; |
| 505 | } |
| 506 | |
| 507 | return eSIR_SUCCESS; |
| 508 | } /****** end limCheckRxRSNIeMatch() ******/ |
| 509 | |
| 510 | /** |
| 511 | * limCheckRxWPAIeMatch() |
| 512 | * |
| 513 | *FUNCTION: |
| 514 | * This function is called during Association/Reassociation |
| 515 | * frame handling to determine whether received RSN in |
| 516 | * Assoc/Reassoc request frames include supported cipher suites or not. |
| 517 | * |
| 518 | *LOGIC: |
| 519 | * |
| 520 | *ASSUMPTIONS: |
| 521 | * NA |
| 522 | * |
| 523 | *NOTE: |
| 524 | * NA |
| 525 | * |
| 526 | * @param rxWPAIe - Received WPA IE in (Re)Assco req |
| 527 | * |
| 528 | * @return status - true if ALL BSS basic rates are present in the |
| 529 | * received rateset else false. |
| 530 | */ |
| 531 | |
| 532 | tANI_U8 |
| 533 | limCheckRxWPAIeMatch(tpAniSirGlobal pMac, tDot11fIEWPA rxWPAIe,tpPESession pSessionEntry, tANI_U8 staIsHT) |
| 534 | { |
| 535 | tDot11fIEWPA *pWPAIe; |
| 536 | tANI_U8 i, j, match, onlyNonHtCipher = 1; |
| 537 | |
| 538 | // WPA IE should be received from PE |
| 539 | pWPAIe = &pSessionEntry->gStartBssWPAIe; |
| 540 | |
| 541 | // Check groupwise cipher suite |
| 542 | for (i = 0; i < 4; i++) |
| 543 | { |
| 544 | if (pWPAIe->multicast_cipher[i] != rxWPAIe.multicast_cipher[i]) |
| 545 | { |
| 546 | return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS; |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | /* |
| 551 | * For each Pairwise cipher suite check whether we support |
| 552 | * received pairwise |
| 553 | */ |
| 554 | match = 0; |
| 555 | for (i = 0; i < rxWPAIe.unicast_cipher_count; i++) |
| 556 | { |
| 557 | for(j = 0; j < pWPAIe->unicast_cipher_count; j++) |
| 558 | { |
| 559 | if(palEqualMemory(pMac,rxWPAIe.unicast_ciphers[i], |
| 560 | pWPAIe->unicast_ciphers[j], |
| 561 | 4)) |
| 562 | { |
| 563 | match = 1; |
| 564 | break; |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | if ((staIsHT) |
| 569 | #ifdef ANI_LITTLE_BYTE_ENDIAN |
| 570 | &&( (rxWPAIe.unicast_ciphers[i][3] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP)) |
| 571 | #else |
| 572 | &&( (rxWPAIe.unicast_ciphers[i][0] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP)) |
| 573 | #endif |
| 574 | { |
| 575 | onlyNonHtCipher=0; |
| 576 | } |
| 577 | |
| 578 | } |
| 579 | |
| 580 | if ((!match) || ((staIsHT) && onlyNonHtCipher)) |
| 581 | { |
| 582 | return eSIR_MAC_CIPHER_SUITE_REJECTED_STATUS; |
| 583 | } |
| 584 | |
| 585 | return eSIR_SUCCESS; |
| 586 | } /****** end limCheckRxWPAIeMatch() ******/ |
| 587 | |
| 588 | #endif /* WLAN_SOFTAP_FEATURE */ |
| 589 | |
| 590 | /** |
| 591 | * limCleanupRxPath() |
| 592 | * |
| 593 | *FUNCTION: |
| 594 | * This function is called to cleanup STA state at SP & RFP. |
| 595 | * |
| 596 | *LOGIC: |
| 597 | * To circumvent RFP's handling of dummy packet when it does not |
| 598 | * have an incomplete packet for the STA to be deleted, a packet |
| 599 | * with 'more framgents' bit set will be queued to RFP's WQ before |
| 600 | * queuing 'dummy packet'. |
| 601 | * A 'dummy' BD is pushed into RFP's WQ with type=00, subtype=1010 |
| 602 | * (Disassociation frame) and routing flags in BD set to eCPU's |
| 603 | * Low Priority WQ. |
| 604 | * RFP cleans up its local context for the STA id mentioned in the |
| 605 | * BD and then pushes BD to eCPU's low priority WQ. |
| 606 | * |
| 607 | *ASSUMPTIONS: |
| 608 | * NA |
| 609 | * |
| 610 | *NOTE: |
| 611 | * NA |
| 612 | * |
| 613 | * @param pMac Pointer to Global MAC structure |
| 614 | * @param pStaDs Pointer to the per STA data structure |
| 615 | * initialized by LIM and maintained at DPH |
| 616 | * |
| 617 | * @return None |
| 618 | */ |
| 619 | |
| 620 | tSirRetStatus |
| 621 | limCleanupRxPath(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry) |
| 622 | { |
| 623 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 624 | |
| 625 | |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 626 | PELOG2(limLog( pMac, LOG2, FL("**Initiate cleanup"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 627 | |
| 628 | limAbortBackgroundScan( pMac ); |
| 629 | |
| 630 | if (pMac->lim.gLimAddtsSent) |
| 631 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 632 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 633 | tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer); |
| 634 | } |
| 635 | |
| 636 | if (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_ASSOC_CNF_STATE) |
| 637 | { |
| 638 | limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, |
| 639 | pStaDs->assocId); |
| 640 | |
| 641 | if (!pStaDs->mlmStaContext.updateContext) |
| 642 | { |
| 643 | /** |
| 644 | * There is no context at Polaris to delete. |
| 645 | * Release our assigned AID back to the free pool |
| 646 | */ |
| 647 | if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) || |
| 648 | (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) |
| 649 | { |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 650 | limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 651 | } |
| 652 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry); |
| 653 | |
| 654 | return retCode; |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | //delete all tspecs associated with this sta. |
| 659 | limAdmitControlDeleteSta(pMac, pStaDs->assocId); |
| 660 | |
| 661 | #if (WNI_POLARIS_FW_PRODUCT==AP) |
| 662 | // Reset PMM state for this STA if it exists |
| 663 | if (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) |
| 664 | pmmUpdatePMMode(pMac, pStaDs->assocId, 0); |
| 665 | #endif |
| 666 | |
| 667 | /** |
| 668 | * Make STA hash entry invalid at eCPU so that DPH |
| 669 | * does not process any more data packets and |
| 670 | * releases those BDs |
| 671 | */ |
| 672 | pStaDs->valid = 0; |
| 673 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; |
| 674 | |
| 675 | if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) |
| 676 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 677 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 678 | psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 679 | /* Deactivating probe after heart beat timer */ |
| 680 | limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER); |
| 681 | limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry); |
| 682 | limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER); |
| 683 | pMac->lim.gLastBeaconDtimCount = 0; |
| 684 | pMac->lim.gLastBeaconDtimPeriod = 0; |
| 685 | |
| 686 | #ifdef FEATURE_WLAN_CCX |
| 687 | limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER); |
| 688 | #endif |
| 689 | |
| 690 | /** |
| 691 | * Update the status for PMM module |
| 692 | */ |
| 693 | pmmResetPmmState(pMac); |
| 694 | } |
| 695 | #ifdef WLAN_DEBUG |
| 696 | // increment a debug count |
| 697 | pMac->lim.gLimNumRxCleanup++; |
| 698 | #endif |
| 699 | |
| 700 | if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) { |
| 701 | retCode = limDelBss( pMac, pStaDs, psessionEntry->bssIdx, psessionEntry); |
| 702 | } |
| 703 | else |
| 704 | retCode = limDelSta( pMac, pStaDs, true, psessionEntry); |
| 705 | |
| 706 | return retCode; |
| 707 | |
| 708 | } /*** end limCleanupRxPath() ***/ |
| 709 | |
| 710 | |
| 711 | /** |
| 712 | * limSendDelStaCnf() |
| 713 | * |
| 714 | *FUNCTION: |
| 715 | * This function is called to send appropriate CNF message to SME |
| 716 | * |
| 717 | *LOGIC: |
| 718 | * |
| 719 | * |
| 720 | *ASSUMPTIONS: |
| 721 | * NA |
| 722 | * |
| 723 | *NOTE: |
| 724 | * NA |
| 725 | * |
| 726 | * @param pMac Pointer to Global MAC structure |
| 727 | * @param tpAniSirGlobal pMac, |
| 728 | * @param tSirMacAddr staDsAddr, |
| 729 | * @param tANI_U16 staDsAssocId, |
| 730 | * @param tLimMlmStaContext mlmStaContext, |
| 731 | * @param tSirResultCodes statusCode |
| 732 | * |
| 733 | * @return None |
| 734 | */ |
| 735 | |
| 736 | void |
| 737 | limSendDelStaCnf(tpAniSirGlobal pMac, tSirMacAddr staDsAddr, |
| 738 | tANI_U16 staDsAssocId, tLimMlmStaContext mlmStaContext, tSirResultCodes statusCode,tpPESession psessionEntry) |
| 739 | { |
| 740 | |
| 741 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 742 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 743 | tLimMlmPurgeStaInd mlmPurgeStaInd; |
| 744 | |
| 745 | if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) |
| 746 | { |
| 747 | // Set BSSID at CFG to null |
| 748 | tSirMacAddr nullAddr = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
| 749 | #if 0 |
| 750 | if (cfgSetStr(pMac, WNI_CFG_BSSID, (tANI_U8 *) &nullAddr, |
| 751 | sizeof(tSirMacAddr)) != eSIR_SUCCESS) |
| 752 | { |
| 753 | /// Could not update BSSID at CFG. Log error. |
| 754 | limLog(pMac, LOGP, FL("could not update BSSID at CFG\n")); |
| 755 | |
| 756 | return; |
| 757 | } |
| 758 | #endif//TO SUPPORT BT-AMP |
| 759 | |
| 760 | sirCopyMacAddr(nullAddr,psessionEntry->bssId); |
| 761 | |
| 762 | // Free up buffer allocated for JoinReq held by |
| 763 | // MLM state machine |
| 764 | if (psessionEntry->pLimMlmJoinReq) |
| 765 | { |
| 766 | palFreeMemory( pMac->hHdd, (tANI_U8 *) psessionEntry->pLimMlmJoinReq); |
| 767 | psessionEntry->pLimMlmJoinReq = NULL; |
| 768 | } |
| 769 | |
| 770 | psessionEntry->limAID = 0; |
| 771 | |
| 772 | |
| 773 | } |
| 774 | |
| 775 | if ((mlmStaContext.cleanupTrigger == |
| 776 | eLIM_HOST_DISASSOC) || |
| 777 | (mlmStaContext.cleanupTrigger == |
| 778 | eLIM_LINK_MONITORING_DISASSOC) || |
| 779 | (mlmStaContext.cleanupTrigger == |
| 780 | eLIM_PROMISCUOUS_MODE_DISASSOC)) |
| 781 | { |
| 782 | /** |
| 783 | * Host or LMM driven Disassociation. |
| 784 | * Issue Disassoc Confirm to SME. |
| 785 | */ |
| 786 | limLog( pMac, LOGW, FL("Lim Posting DISASSOC_CNF to Sme. Trigger: %X\n"), mlmStaContext.cleanupTrigger); |
| 787 | |
| 788 | |
| 789 | palCopyMemory( pMac->hHdd, |
| 790 | (tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
| 791 | (tANI_U8 *) staDsAddr, |
| 792 | sizeof(tSirMacAddr)); |
| 793 | mlmDisassocCnf.resultCode = statusCode; |
| 794 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 795 | mlmDisassocCnf.aid = staDsAssocId; |
| 796 | #endif |
| 797 | mlmDisassocCnf.disassocTrigger = |
| 798 | mlmStaContext.cleanupTrigger; |
| 799 | /* Update PE session Id*/ |
| 800 | mlmDisassocCnf.sessionId = psessionEntry->peSessionId; |
| 801 | |
| 802 | limPostSmeMessage(pMac, |
| 803 | LIM_MLM_DISASSOC_CNF, |
| 804 | (tANI_U32 *) &mlmDisassocCnf); |
| 805 | } |
| 806 | else if ((mlmStaContext.cleanupTrigger == |
| 807 | eLIM_HOST_DEAUTH) || |
| 808 | (mlmStaContext.cleanupTrigger == |
| 809 | eLIM_LINK_MONITORING_DEAUTH)) |
| 810 | { |
| 811 | /** |
| 812 | * Host or LMM driven Deauthentication. |
| 813 | * Issue Deauth Confirm to SME. |
| 814 | */ |
| 815 | limLog( pMac, LOGW, FL("Lim Posting DEAUTH_CNF to Sme. Trigger: %X\n"), mlmStaContext.cleanupTrigger); |
| 816 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
| 817 | (tANI_U8 *) staDsAddr, |
| 818 | sizeof(tSirMacAddr)); |
| 819 | mlmDeauthCnf.resultCode = statusCode; |
| 820 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 821 | mlmDeauthCnf.aid = staDsAssocId; |
| 822 | #endif |
| 823 | mlmDeauthCnf.deauthTrigger = |
| 824 | mlmStaContext.cleanupTrigger; |
| 825 | /* PE session Id */ |
| 826 | mlmDeauthCnf.sessionId = psessionEntry->peSessionId; |
| 827 | |
| 828 | limPostSmeMessage(pMac, |
| 829 | LIM_MLM_DEAUTH_CNF, |
| 830 | (tANI_U32 *) &mlmDeauthCnf); |
| 831 | } |
| 832 | else if ((mlmStaContext.cleanupTrigger == |
| 833 | eLIM_PEER_ENTITY_DISASSOC) || |
| 834 | (mlmStaContext.cleanupTrigger == |
| 835 | eLIM_PEER_ENTITY_DEAUTH)) |
| 836 | { |
| 837 | /** |
| 838 | * Received Disassociation/Deauthentication from peer. |
| 839 | * Issue Purge Ind to SME. |
| 840 | */ |
| 841 | limLog( pMac, LOGW, FL("Lim Posting PURGE_STA_IND to Sme. Trigger: %X\n"), mlmStaContext.cleanupTrigger) ; |
| 842 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmPurgeStaInd.peerMacAddr, |
| 843 | (tANI_U8 *) staDsAddr, |
| 844 | sizeof(tSirMacAddr)); |
| 845 | mlmPurgeStaInd.reasonCode = (tANI_U8) mlmStaContext.disassocReason; |
| 846 | mlmPurgeStaInd.aid = staDsAssocId; |
| 847 | mlmPurgeStaInd.purgeTrigger = mlmStaContext.cleanupTrigger; |
| 848 | mlmPurgeStaInd.sessionId = psessionEntry->peSessionId; |
| 849 | |
| 850 | limPostSmeMessage(pMac, |
| 851 | LIM_MLM_PURGE_STA_IND, |
| 852 | (tANI_U32 *) &mlmPurgeStaInd); |
| 853 | } |
| 854 | else if(mlmStaContext.cleanupTrigger == eLIM_JOIN_FAILURE) |
| 855 | { |
| 856 | //PE setup the peer entry in HW upfront, right after join is completed. |
| 857 | //If there is a failure during rest of the assoc sequence, this context needs to be cleaned up. |
| 858 | tANI_U8 smesessionId; |
| 859 | tANI_U16 smetransactionId; |
| 860 | |
| 861 | smesessionId = psessionEntry->smeSessionId; |
| 862 | smetransactionId = psessionEntry->transactionId; |
| 863 | |
| 864 | psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 865 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 867 | //if it is a reassoc failure to join new AP |
Madan Mohan Koyyalamudi | f33324b | 2012-11-06 19:16:17 -0800 | [diff] [blame] | 868 | if((mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE) || |
| 869 | (mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_FAILURE)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 870 | { |
| 871 | if(mlmStaContext.resultCode != eSIR_SME_SUCCESS ) |
| 872 | { |
| 873 | peDeleteSession(pMac, psessionEntry); |
| 874 | psessionEntry = NULL; |
| 875 | } |
| 876 | |
| 877 | limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, |
| 878 | mlmStaContext.resultCode, mlmStaContext.protStatusCode, psessionEntry, |
| 879 | smesessionId, smetransactionId); |
| 880 | } |
| 881 | else |
| 882 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 883 | palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq); |
| 884 | psessionEntry->pLimJoinReq = NULL; |
| 885 | |
| 886 | if(mlmStaContext.resultCode != eSIR_SME_SUCCESS) |
| 887 | { |
| 888 | peDeleteSession(pMac,psessionEntry); |
| 889 | psessionEntry = NULL; |
| 890 | } |
| 891 | |
| 892 | limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, mlmStaContext.resultCode, mlmStaContext.protStatusCode, |
| 893 | psessionEntry, smesessionId, smetransactionId); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 894 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 895 | |
| 896 | } |
| 897 | |
| 898 | if((NULL != psessionEntry) |
| 899 | #ifdef WLAN_SOFTAP_FEATURE |
| 900 | && (eLIM_AP_ROLE != psessionEntry->limSystemRole ) |
| 901 | #endif |
| 902 | ) |
| 903 | { |
| 904 | peDeleteSession(pMac,psessionEntry); |
| 905 | psessionEntry = NULL; |
| 906 | } |
| 907 | } |
| 908 | |
| 909 | /** |
| 910 | * limRejectAssociation() |
| 911 | * |
| 912 | *FUNCTION: |
| 913 | * This function is called whenever Re/Association Request need |
| 914 | * to be rejected due to failure in assigning an AID or failure |
| 915 | * in adding STA context at Polaris or reject by applications. |
| 916 | * |
| 917 | *LOGIC: |
| 918 | * Resources allocated if any are freedup and (Re) Association |
| 919 | * Response frame is sent to requesting STA. Pre-Auth context |
| 920 | * will be added for this STA if it does not exist already |
| 921 | * |
| 922 | *ASSUMPTIONS: |
| 923 | * |
| 924 | *NOTE: |
| 925 | * |
| 926 | * @param *pBd - A pointer to Buffer descriptor + associated PDUs |
| 927 | * @param subType - Indicates whether it is Association Request (=0) or |
| 928 | * Reassociation Request (=1) frame |
| 929 | * @param addPreAuthContext - Indicates whether pre-auth context |
| 930 | * to be added for this STA |
| 931 | * @param authType - Indicates auth type to be added |
| 932 | * @param staId - Indicates staId of the STA being rejected |
| 933 | * association |
| 934 | * @param deleteSta - Indicates whether to delete STA context |
| 935 | * at Polaris |
| 936 | * @param rCode - Indicates what reasonCode to be sent in |
| 937 | * Re/Assoc response to STA |
| 938 | * |
| 939 | * @return None |
| 940 | */ |
| 941 | |
| 942 | void |
| 943 | limRejectAssociation(tpAniSirGlobal pMac, tSirMacAddr peerAddr, tANI_U8 subType, |
| 944 | tANI_U8 addPreAuthContext, tAniAuthType authType, |
| 945 | tANI_U16 staId, tANI_U8 deleteSta, tSirResultCodes rCode, tpPESession psessionEntry ) |
| 946 | { |
| 947 | tpDphHashNode pStaDs; |
| 948 | |
| 949 | if (addPreAuthContext) |
| 950 | { |
| 951 | // Create entry for this STA in pre-auth list |
| 952 | struct tLimPreAuthNode *pAuthNode; |
| 953 | |
| 954 | pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable); |
| 955 | |
| 956 | if (pAuthNode) |
| 957 | { |
| 958 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pAuthNode->peerMacAddr, |
| 959 | peerAddr, |
| 960 | sizeof(tSirMacAddr)); |
| 961 | pAuthNode->fTimerStarted = 0; |
| 962 | pAuthNode->mlmState = eLIM_MLM_AUTHENTICATED_STATE; |
| 963 | pAuthNode->authType = (tAniAuthType) authType; |
| 964 | limAddPreAuthNode(pMac, pAuthNode); |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | if (deleteSta == true) |
| 969 | { |
| 970 | pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable); |
| 971 | |
| 972 | if (pStaDs == NULL) |
| 973 | { |
| 974 | limLog(pMac, LOGW, |
| 975 | FL("No STA context, yet rejecting Association\n")); |
| 976 | |
| 977 | return; |
| 978 | } |
| 979 | |
| 980 | /** |
| 981 | * Polaris has state for this STA. |
| 982 | * Trigger cleanup. |
| 983 | */ |
| 984 | pStaDs->mlmStaContext.cleanupTrigger = eLIM_REASSOC_REJECT; |
| 985 | |
| 986 | // Receive path cleanup |
| 987 | limCleanupRxPath(pMac, pStaDs, psessionEntry); |
| 988 | |
| 989 | // Send Re/Association Response with |
| 990 | // status code to requesting STA. |
| 991 | limSendAssocRspMgmtFrame(pMac, |
| 992 | rCode, |
| 993 | 0, |
| 994 | peerAddr, |
| 995 | subType, 0,psessionEntry); |
| 996 | |
| 997 | if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL) |
| 998 | { |
| 999 | // Assoction confirmation is complete, free the copy of association request frame |
| 1000 | if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame) |
| 1001 | { |
| 1002 | palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame); |
| 1003 | ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL; |
| 1004 | } |
| 1005 | palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]); |
| 1006 | psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL; |
| 1007 | } |
| 1008 | } |
| 1009 | else |
| 1010 | { |
| 1011 | limSendAssocRspMgmtFrame(pMac, |
| 1012 | eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS, |
| 1013 | 1, |
| 1014 | peerAddr, |
| 1015 | subType, 0,psessionEntry); |
| 1016 | // Log error |
| 1017 | limLog(pMac, LOGW, |
| 1018 | FL("received Re/Assoc req when max associated STAs reached from \n")); |
| 1019 | limPrintMacAddr(pMac, peerAddr, LOGW); |
| 1020 | limSendSmeMaxAssocExceededNtf(pMac, peerAddr, psessionEntry->smeSessionId); |
| 1021 | } |
| 1022 | } /*** end limRejectAssociation() ***/ |
| 1023 | |
| 1024 | #ifdef WLAN_SOFTAP_FEATURE |
| 1025 | |
| 1026 | /** ------------------------------------------------------------- |
| 1027 | \fn limDecideApProtectionOnHt20Delete |
| 1028 | \brief protection related function while HT20 station is getting deleted. |
| 1029 | \param tpAniSirGlobal pMac |
| 1030 | \param tpDphHashNode pStaDs |
| 1031 | \param tpUpdateBeaconParams pBeaconParams |
| 1032 | \return None |
| 1033 | -------------------------------------------------------------*/ |
| 1034 | static void |
| 1035 | limDecideApProtectionOnHt20Delete(tpAniSirGlobal pMac, |
| 1036 | tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry) |
| 1037 | { |
| 1038 | tANI_U32 i = 0; |
| 1039 | PELOG1( limLog(pMac, LOG1, FL("(%d) A HT 20 STA is disassociated. Addr is "), |
| 1040 | psessionEntry->gLimHt20Params.numSta); |
| 1041 | limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);) |
| 1042 | if (psessionEntry->gLimHt20Params.numSta > 0) |
| 1043 | { |
| 1044 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 1045 | { |
| 1046 | if (psessionEntry->protStaCache[i].active) |
| 1047 | { |
| 1048 | if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr, |
| 1049 | pStaDs->staAddr, sizeof(tSirMacAddr))) |
| 1050 | { |
| 1051 | psessionEntry->gLimHt20Params.numSta--; |
| 1052 | psessionEntry->protStaCache[i].active = false; |
| 1053 | break; |
| 1054 | } |
| 1055 | } |
| 1056 | } |
| 1057 | } |
| 1058 | |
| 1059 | if (psessionEntry->gLimHt20Params.numSta == 0) |
| 1060 | { |
| 1061 | // disable protection |
| 1062 | limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry); |
| 1063 | } |
| 1064 | } |
| 1065 | /** ------------------------------------------------------------- |
| 1066 | \fn limDecideApProtectionOnDelete |
| 1067 | \brief Decides about protection related settings when a station is getting deleted. |
| 1068 | \param tpAniSirGlobal pMac |
| 1069 | \param tpDphHashNode pStaDs |
| 1070 | \param tpUpdateBeaconParams pBeaconParams |
| 1071 | \return None |
| 1072 | -------------------------------------------------------------*/ |
| 1073 | void |
| 1074 | limDecideApProtectionOnDelete(tpAniSirGlobal pMac, |
| 1075 | tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry) |
| 1076 | { |
| 1077 | tANI_U32 phyMode; |
| 1078 | tHalBitVal erpEnabled = eHAL_CLEAR; |
| 1079 | tSirRFBand rfBand = SIR_BAND_UNKNOWN; |
| 1080 | tANI_U32 i; |
| 1081 | |
| 1082 | if(NULL == pStaDs) |
| 1083 | return; |
| 1084 | |
| 1085 | limGetRfBand(pMac, &rfBand, psessionEntry); |
| 1086 | if(SIR_BAND_5_GHZ == rfBand) |
| 1087 | { |
| 1088 | //we are HT. if we are 11A, then protection is not required. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1089 | if(true == psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1090 | { |
| 1091 | //we are HT and 11A station is leaving. |
| 1092 | //protection consideration required. |
| 1093 | //HT station leaving ==> this case is commonly handled between both the bands below. |
| 1094 | if((psessionEntry->beaconParams.llaCoexist) && |
| 1095 | (false == pStaDs->mlmStaContext.htCapability)) |
| 1096 | { |
| 1097 | PELOG1(limLog(pMac, LOG1, FL("(%d) A 11A STA is disassociated. Addr is "), |
| 1098 | psessionEntry->gLim11aParams.numSta); |
| 1099 | limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);) |
| 1100 | if (psessionEntry->gLim11aParams.numSta > 0) |
| 1101 | { |
| 1102 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 1103 | { |
| 1104 | if (psessionEntry->protStaCache[i].active) |
| 1105 | { |
| 1106 | if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr, |
| 1107 | pStaDs->staAddr, sizeof(tSirMacAddr))) |
| 1108 | { |
| 1109 | psessionEntry->gLim11aParams.numSta--; |
| 1110 | psessionEntry->protStaCache[i].active = false; |
| 1111 | break; |
| 1112 | } |
| 1113 | } |
| 1114 | } |
| 1115 | } |
| 1116 | |
| 1117 | if(psessionEntry->gLim11aParams.numSta == 0) |
| 1118 | { |
| 1119 | // disable protection |
| 1120 | limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry); |
| 1121 | } |
| 1122 | } |
| 1123 | } |
| 1124 | } |
| 1125 | else if(SIR_BAND_2_4_GHZ == rfBand) |
| 1126 | { |
| 1127 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1128 | |
| 1129 | erpEnabled = pStaDs->erpEnabled; |
| 1130 | //we are HT or 11G and 11B station is getting deleted. |
| 1131 | if (((phyMode == WNI_CFG_PHY_MODE_11G) || |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1132 | psessionEntry->htCapability) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1133 | (erpEnabled == eHAL_CLEAR)) |
| 1134 | { |
| 1135 | PELOG1(limLog(pMac, LOG1, FL("(%d) A legacy STA is disassociated. Addr is "), |
| 1136 | psessionEntry->gLim11bParams.numSta); |
| 1137 | limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);) |
| 1138 | if (psessionEntry->gLim11bParams.numSta > 0) |
| 1139 | { |
| 1140 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 1141 | { |
| 1142 | if (psessionEntry->protStaCache[i].active) |
| 1143 | { |
| 1144 | if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr, |
| 1145 | pStaDs->staAddr, sizeof(tSirMacAddr))) |
| 1146 | { |
| 1147 | psessionEntry->gLim11bParams.numSta--; |
| 1148 | psessionEntry->protStaCache[i].active = false; |
| 1149 | break; |
| 1150 | } |
| 1151 | } |
| 1152 | } |
| 1153 | } |
| 1154 | |
| 1155 | if (psessionEntry->gLim11bParams.numSta == 0) |
| 1156 | { |
| 1157 | // disable protection |
| 1158 | PELOG1(limLog(pMac, LOG1, FL("No 11B STA exists\n"));) |
| 1159 | limEnable11gProtection(pMac, false, false, pBeaconParams,psessionEntry); |
| 1160 | } |
| 1161 | } |
| 1162 | //(non-11B station is leaving) or (we are not 11G or HT AP) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1163 | else if(psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1164 | { //we are HT AP and non-11B station is leaving. |
| 1165 | |
| 1166 | //11g station is leaving |
| 1167 | if(!pStaDs->mlmStaContext.htCapability) |
| 1168 | { |
| 1169 | PELOG1(limLog(pMac, LOG1, FL("(%d) A 11g STA is disassociated. Addr is "), |
| 1170 | psessionEntry->gLim11bParams.numSta); |
| 1171 | limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);) |
| 1172 | if (psessionEntry->gLim11gParams.numSta > 0) |
| 1173 | { |
| 1174 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 1175 | { |
| 1176 | if (psessionEntry->protStaCache[i].active) |
| 1177 | { |
| 1178 | if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr, |
| 1179 | pStaDs->staAddr, sizeof(tSirMacAddr))) |
| 1180 | { |
| 1181 | psessionEntry->gLim11gParams.numSta--; |
| 1182 | psessionEntry->protStaCache[i].active = false; |
| 1183 | break; |
| 1184 | } |
| 1185 | } |
| 1186 | } |
| 1187 | } |
| 1188 | |
| 1189 | if (psessionEntry->gLim11gParams.numSta == 0) |
| 1190 | { |
| 1191 | // disable protection |
| 1192 | limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry); |
| 1193 | } |
| 1194 | } |
| 1195 | } |
| 1196 | } |
| 1197 | |
| 1198 | //LSIG TXOP not supporting staiton leaving. applies to 2.4 as well as 5 GHZ. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1199 | if((true == psessionEntry->htCapability) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1200 | (true == pStaDs->mlmStaContext.htCapability)) |
| 1201 | { |
| 1202 | //HT non-GF leaving |
| 1203 | if(!pStaDs->htGreenfield) |
| 1204 | { |
| 1205 | PELOG1(limLog(pMac, LOG1, FL("(%d) A non-GF STA is disassociated. Addr is "), |
| 1206 | psessionEntry->gLimNonGfParams.numSta); |
| 1207 | limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);) |
| 1208 | if (psessionEntry->gLimNonGfParams.numSta > 0) |
| 1209 | { |
| 1210 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 1211 | { |
| 1212 | if (psessionEntry->protStaCache[i].active) |
| 1213 | { |
| 1214 | if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr, |
| 1215 | pStaDs->staAddr, sizeof(tSirMacAddr))) |
| 1216 | { |
| 1217 | psessionEntry->gLimNonGfParams.numSta--; |
| 1218 | psessionEntry->protStaCache[i].active = false; |
| 1219 | break; |
| 1220 | } |
| 1221 | } |
| 1222 | } |
| 1223 | } |
| 1224 | |
| 1225 | if (psessionEntry->gLimNonGfParams.numSta == 0) |
| 1226 | { |
| 1227 | // disable protection |
| 1228 | limEnableHTNonGfProtection(pMac, false, false, pBeaconParams,psessionEntry); |
| 1229 | } |
| 1230 | } |
| 1231 | //HT 20Mhz station leaving. |
| 1232 | if(psessionEntry->beaconParams.ht20Coexist && |
| 1233 | (eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)) |
| 1234 | { |
| 1235 | limDecideApProtectionOnHt20Delete(pMac, pStaDs, pBeaconParams,psessionEntry); |
| 1236 | } |
| 1237 | |
| 1238 | if(false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport && |
| 1239 | (false == pStaDs->htLsigTXOPProtection)) |
| 1240 | { |
| 1241 | PELOG1( limLog(pMac, LOG1, FL("(%d) A HT LSIG not supporting STA is disassociated. Addr is "), |
| 1242 | psessionEntry->gLimLsigTxopParams.numSta); |
| 1243 | limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);) |
| 1244 | if (psessionEntry->gLimLsigTxopParams.numSta > 0) |
| 1245 | { |
| 1246 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 1247 | { |
| 1248 | if (psessionEntry->protStaCache[i].active) |
| 1249 | { |
| 1250 | if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr, |
| 1251 | pStaDs->staAddr, sizeof(tSirMacAddr))) |
| 1252 | { |
| 1253 | psessionEntry->gLimLsigTxopParams.numSta--; |
| 1254 | psessionEntry->protStaCache[i].active = false; |
| 1255 | break; |
| 1256 | } |
| 1257 | } |
| 1258 | } |
| 1259 | } |
| 1260 | |
| 1261 | if (psessionEntry->gLimLsigTxopParams.numSta == 0) |
| 1262 | { |
| 1263 | // disable protection |
| 1264 | limEnableHTLsigTxopProtection(pMac, true, false, pBeaconParams,psessionEntry); |
| 1265 | } |
| 1266 | } |
| 1267 | } |
| 1268 | } |
| 1269 | |
| 1270 | #endif |
| 1271 | |
| 1272 | |
| 1273 | /** ------------------------------------------------------------- |
| 1274 | \fn limDecideShortPreamble |
| 1275 | \brief Decides about any short preamble reated change because of new station joining. |
| 1276 | \param tpAniSirGlobal pMac |
| 1277 | \param tpDphHashNode pStaDs |
| 1278 | \param tpUpdateBeaconParams pBeaconParams |
| 1279 | \return None |
| 1280 | -------------------------------------------------------------*/ |
| 1281 | void limDecideShortPreamble(tpAniSirGlobal pMac, |
| 1282 | tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry ) |
| 1283 | { |
| 1284 | tANI_U32 i; |
| 1285 | |
| 1286 | if (pStaDs->shortPreambleEnabled == eHAL_CLEAR) |
| 1287 | { |
| 1288 | PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short preamble STA is disassociated. Addr is "), |
| 1289 | psessionEntry->gLimNoShortParams.numNonShortPreambleSta); |
| 1290 | limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);) |
| 1291 | if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta > 0) |
| 1292 | { |
| 1293 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 1294 | { |
| 1295 | if (psessionEntry->gLimNoShortParams.staNoShortCache[i].active) |
| 1296 | { |
| 1297 | if (palEqualMemory( pMac->hHdd, psessionEntry->gLimNoShortParams.staNoShortCache[i].addr, |
| 1298 | pStaDs->staAddr, sizeof(tSirMacAddr))) |
| 1299 | { |
| 1300 | psessionEntry->gLimNoShortParams.numNonShortPreambleSta--; |
| 1301 | psessionEntry->gLimNoShortParams.staNoShortCache[i].active = false; |
| 1302 | break; |
| 1303 | } |
| 1304 | } |
| 1305 | } |
| 1306 | } |
| 1307 | |
| 1308 | if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta == 0) |
| 1309 | { |
| 1310 | // enable short preamble |
| 1311 | PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short preamble support now.\n"));) |
| 1312 | //reset the cache |
| 1313 | palZeroMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->gLimNoShortParams , sizeof(tLimNoShortParams)); |
| 1314 | if (limEnableShortPreamble(pMac, true, pBeaconParams, psessionEntry) != eSIR_SUCCESS) |
| 1315 | PELOGE(limLog(pMac, LOGE, FL("Cannot enable short preamble\n"));) |
| 1316 | } |
| 1317 | } |
| 1318 | } |
| 1319 | |
| 1320 | /** ------------------------------------------------------------- |
| 1321 | \fn limDecideShortSlot |
| 1322 | \brief Decides about any short slot time related change because of station leaving the BSS. |
| 1323 | \param tpAniSirGlobal pMac |
| 1324 | \param tpDphHashNode pStaDs |
| 1325 | \return None |
| 1326 | -------------------------------------------------------------*/ |
| 1327 | |
| 1328 | void |
| 1329 | limDecideShortSlot(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 1330 | tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry) |
| 1331 | { |
| 1332 | tANI_U32 i, val; |
| 1333 | if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR) |
| 1334 | { |
| 1335 | PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short slottime STA is disassociated. Addr is "), |
| 1336 | pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta); |
| 1337 | limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);) |
| 1338 | |
| 1339 | #ifdef WLAN_SOFTAP_FEATURE |
| 1340 | if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && |
| 1341 | psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta> 0) |
| 1342 | { |
| 1343 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 1344 | { |
| 1345 | if (psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active) |
| 1346 | { |
| 1347 | if (palEqualMemory( pMac->hHdd, psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr, |
| 1348 | pStaDs->staAddr, sizeof(tSirMacAddr))) |
| 1349 | { |
| 1350 | psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta--; |
| 1351 | psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = false; |
| 1352 | break; |
| 1353 | } |
| 1354 | } |
| 1355 | } |
| 1356 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1357 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1358 | #endif |
| 1359 | { |
| 1360 | if (pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta> 0) |
| 1361 | { |
| 1362 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 1363 | { |
| 1364 | if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active) |
| 1365 | { |
| 1366 | if (palEqualMemory( pMac->hHdd, pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr, |
| 1367 | pStaDs->staAddr, sizeof(tSirMacAddr))) |
| 1368 | { |
| 1369 | pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta--; |
| 1370 | pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = false; |
| 1371 | break; |
| 1372 | } |
| 1373 | } |
| 1374 | } |
| 1375 | } |
| 1376 | } |
| 1377 | |
| 1378 | wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val); |
| 1379 | |
| 1380 | #ifdef WLAN_SOFTAP_FEATURE |
| 1381 | if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) && |
| 1382 | (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta == 0)) |
| 1383 | { |
| 1384 | // enable short slot time |
| 1385 | PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short slot time support now.\n"));) |
| 1386 | //reset the cache |
| 1387 | palZeroMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->gLimNoShortSlotParams , sizeof(tLimNoShortSlotParams)); |
| 1388 | // in case of AP set SHORT_SLOT_TIME to enable |
| 1389 | if (psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1390 | { |
| 1391 | pBeaconParams->fShortSlotTime = true; |
| 1392 | pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1393 | psessionEntry->shortSlotTimeSupported = true; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1394 | } |
| 1395 | } |
| 1396 | else |
| 1397 | #endif |
| 1398 | { |
| 1399 | if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta == 0) |
| 1400 | { |
| 1401 | // enable short slot time |
| 1402 | PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short slot time support now.\n"));) |
| 1403 | //reset the cache |
| 1404 | palZeroMemory( pMac->hHdd, (tANI_U8 *)&pMac->lim.gLimNoShortSlotParams , sizeof(tLimNoShortSlotParams)); |
| 1405 | // in case of AP set SHORT_SLOT_TIME to enable |
| 1406 | if (psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1407 | { |
| 1408 | pBeaconParams->fShortSlotTime = true; |
| 1409 | pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1410 | psessionEntry->shortSlotTimeSupported = true; |
| 1411 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1412 | } |
| 1413 | } |
| 1414 | } |
| 1415 | } |
| 1416 | |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 1417 | void |
| 1418 | limPostReassocFailure(tpAniSirGlobal pMac, |
| 1419 | tSirResultCodes resultCode, |
| 1420 | tANI_U16 protStatusCode,tpPESession psessionEntry) |
| 1421 | { |
| 1422 | tLimMlmReassocCnf mlmReassocCnf; |
| 1423 | |
| 1424 | psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
| 1425 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE)); |
| 1426 | |
| 1427 | // 'Change' timer for future activations |
| 1428 | limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER); |
| 1429 | |
| 1430 | mlmReassocCnf.resultCode = resultCode; |
| 1431 | mlmReassocCnf.protStatusCode = protStatusCode; |
| 1432 | /* Update PE session Id */ |
| 1433 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 1434 | limPostSmeMessage(pMac, |
| 1435 | LIM_MLM_REASSOC_CNF, |
| 1436 | (tANI_U32 *) &mlmReassocCnf); |
| 1437 | } /*** end limPostReassocFailure() ***/ |
| 1438 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1439 | /** |
| 1440 | * limRestorePreReassocState() |
| 1441 | * |
| 1442 | *FUNCTION: |
| 1443 | * This function is called on STA role whenever Reasociation |
| 1444 | * Response with a reject code is received from AP. |
| 1445 | * |
| 1446 | *LOGIC: |
| 1447 | * Reassociation failure timer is stopped, Old (or current) AP's |
| 1448 | * context is restored both at Polaris & software |
| 1449 | * |
| 1450 | *ASSUMPTIONS: |
| 1451 | * |
| 1452 | *NOTE: |
| 1453 | * |
| 1454 | * @param pMac - Pointer to Global MAC structure |
| 1455 | * @param resultCode - Result code that specifies why Reassociation |
| 1456 | * attemp failed |
| 1457 | * |
| 1458 | * @return None |
| 1459 | */ |
| 1460 | |
| 1461 | void |
| 1462 | limRestorePreReassocState(tpAniSirGlobal pMac, |
| 1463 | tSirResultCodes resultCode, |
| 1464 | tANI_U16 protStatusCode,tpPESession psessionEntry) |
| 1465 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1466 | tANI_U8 chanNum, secChanOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1467 | tLimMlmReassocCnf mlmReassocCnf; |
| 1468 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1469 | psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1470 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1471 | |
| 1472 | // 'Change' timer for future activations |
| 1473 | limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER); |
| 1474 | |
| 1475 | // Update BSSID at CFG database |
| 1476 | #if 0 |
| 1477 | if (cfgSetStr(pMac, WNI_CFG_BSSID, |
| 1478 | pMac->lim.gLimCurrentBssId, |
| 1479 | sizeof(tSirMacAddr)) != eSIR_SUCCESS) |
| 1480 | { |
| 1481 | /// Could not update BSSID at CFG. Log error. |
| 1482 | limLog(pMac, LOGP, FL("could not update BSSID at CFG\n")); |
| 1483 | return; |
| 1484 | } |
Madan Mohan Koyyalamudi | 70322d5 | 2012-10-18 20:07:33 -0700 | [diff] [blame] | 1485 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1486 | |
| 1487 | // chanNum = pMac->lim.gLimCurrentChannelId; |
| 1488 | |
| 1489 | /* To support BT-AMP */ |
| 1490 | chanNum = psessionEntry->currentOperChannel; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1491 | secChanOffset = psessionEntry->htSecondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1492 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1493 | limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1494 | |
| 1495 | /** @ToDo : Need to Integrate the STOP the DataTransfer to the AP from 11H code */ |
| 1496 | |
| 1497 | mlmReassocCnf.resultCode = resultCode; |
| 1498 | mlmReassocCnf.protStatusCode = protStatusCode; |
| 1499 | /* Update PE session Id */ |
| 1500 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 1501 | limPostSmeMessage(pMac, |
| 1502 | LIM_MLM_REASSOC_CNF, |
| 1503 | (tANI_U32 *) &mlmReassocCnf); |
| 1504 | } /*** end limRestorePreReassocState() ***/ |
| 1505 | |
| 1506 | |
| 1507 | |
| 1508 | /** |
| 1509 | * limIsReassocInProgress() |
| 1510 | * |
| 1511 | *FUNCTION: |
| 1512 | * This function is called to see if STA is in wt-reassoc-rsp state. |
| 1513 | * |
| 1514 | *LOGIC: |
| 1515 | * |
| 1516 | *ASSUMPTIONS: |
| 1517 | * |
| 1518 | *NOTE: |
| 1519 | * |
| 1520 | * @param pMac - Pointer to Global MAC structure |
| 1521 | * |
| 1522 | * @return eANI_BOOLEAN_TRUE When STA is waiting for Reassoc response from AP \n |
| 1523 | * else eANI_BOOLEAN_FALSE |
| 1524 | */ |
| 1525 | |
| 1526 | eAniBoolean |
| 1527 | limIsReassocInProgress(tpAniSirGlobal pMac,tpPESession psessionEntry) |
| 1528 | { |
Dhanashri Atre | af3e84d | 2013-01-18 18:03:06 -0800 | [diff] [blame] | 1529 | if (psessionEntry == NULL) |
| 1530 | { |
| 1531 | return eANI_BOOLEAN_FALSE; |
| 1532 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1533 | if(((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&& |
| 1534 | ((psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE) || |
| 1535 | (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_LINK_FAIL_STATE))) |
| 1536 | return eANI_BOOLEAN_TRUE; |
| 1537 | |
| 1538 | return eANI_BOOLEAN_FALSE; |
| 1539 | } /*** end limIsReassocInProgress() ***/ |
| 1540 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1541 | #ifdef WLAN_FEATURE_11AC |
| 1542 | tSirRetStatus limPopulateVhtMcsSet(tpAniSirGlobal pMac, |
| 1543 | tpSirSupportedRates pRates, |
| 1544 | tDot11fIEVHTCaps *pPeerVHTCaps, |
| 1545 | tpPESession psessionEntry) |
| 1546 | { |
| 1547 | tANI_U32 val; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1548 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1549 | if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode)) |
| 1550 | { |
| 1551 | if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_MCS_MAP,&val) != |
| 1552 | eSIR_SUCCESS ) |
| 1553 | { |
| 1554 | PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX MCS MAP\n"));) |
| 1555 | goto error; |
| 1556 | } |
| 1557 | pRates->vhtRxMCSMap = (tANI_U16)val; |
| 1558 | |
| 1559 | if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_MCS_MAP,&val ) != |
| 1560 | eSIR_SUCCESS ) |
| 1561 | { |
| 1562 | PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT TX MCS MAP\n"));) |
| 1563 | goto error; |
| 1564 | } |
| 1565 | pRates->vhtTxMCSMap = (tANI_U16)val; |
| 1566 | |
| 1567 | if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,&val ) != |
| 1568 | eSIR_SUCCESS ) |
| 1569 | { |
| 1570 | PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP\n"));) |
| 1571 | goto error; |
| 1572 | } |
| 1573 | pRates->vhtRxHighestDataRate = (tANI_U16)val; |
| 1574 | |
| 1575 | if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,&val ) != |
| 1576 | eSIR_SUCCESS ) |
| 1577 | { |
| 1578 | PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP\n"));) |
| 1579 | goto error; |
| 1580 | } |
| 1581 | pRates->vhtTxHighestDataRate = (tANI_U16)val; |
| 1582 | |
| 1583 | if( pPeerVHTCaps != NULL) |
| 1584 | { |
| 1585 | pRates->vhtTxHighestDataRate = SIR_MIN(pRates->vhtTxHighestDataRate, pPeerVHTCaps->txSupDataRate); |
| 1586 | pRates->vhtRxHighestDataRate = SIR_MIN(pRates->vhtRxHighestDataRate, pPeerVHTCaps->rxHighSupDataRate); |
| 1587 | |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 1588 | // Acquire PEER MCS map if we exceed. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1589 | // We compare/update only the last 2 bits of the map as we support only single BSS. |
| 1590 | // Firmware takes care of this comparison |
| 1591 | pRates->vhtRxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap |
| 1592 | pRates->vhtRxMCSMap |= (pPeerVHTCaps->rxMCSMap & 0x3); // Updating the last 2 bits in the bitmap |
| 1593 | |
| 1594 | // Firmware takes care of this comparison |
| 1595 | pRates->vhtTxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap |
| 1596 | pRates->vhtTxMCSMap |= (pPeerVHTCaps->txMCSMap & 0x3); // Updating the last 2 bits in the bitmap |
| 1597 | } |
| 1598 | } |
| 1599 | return eSIR_SUCCESS; |
| 1600 | error: |
| 1601 | |
| 1602 | return eSIR_FAILURE; |
| 1603 | |
| 1604 | } |
| 1605 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1606 | |
| 1607 | /** |
| 1608 | * limPopulateOwnRateSet |
| 1609 | * |
| 1610 | * FUNCTION: |
| 1611 | * This function is called by limProcessAssocRsp() or |
| 1612 | * limAddStaInIBSS() |
| 1613 | * - It creates a combined rate set of 12 rates max which |
| 1614 | * comprises the basic and extended rates read from CFG |
| 1615 | * - It sorts the combined rate Set and copy it in the |
| 1616 | * rate array of the pSTA descriptor |
| 1617 | * - It sets the erpEnabled bit of the STA descriptor |
| 1618 | * |
| 1619 | * NOTE: |
| 1620 | * ERP bit is set iff the dph PHY mode is 11G and there is at least |
| 1621 | * an A rate in the supported or extended rate sets |
| 1622 | * |
| 1623 | * @param pMac - Pointer to Global MAC structure |
| 1624 | * @param basicOnly - When passed value is true, only basic |
| 1625 | * rates are copied to DPH node else |
| 1626 | * all supported rates are copied |
| 1627 | * @return eSIR_SUCCESS or eSIR_FAILURE |
| 1628 | * |
| 1629 | */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1630 | #ifdef WLAN_FEATURE_11AC |
| 1631 | tSirRetStatus |
| 1632 | limPopulateOwnRateSet(tpAniSirGlobal pMac, |
| 1633 | tpSirSupportedRates pRates, |
| 1634 | tANI_U8* pSupportedMCSSet, |
| 1635 | tANI_U8 basicOnly, |
| 1636 | tpPESession psessionEntry, |
| 1637 | tDot11fIEVHTCaps *pVHTCaps) |
| 1638 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1639 | tSirRetStatus |
| 1640 | limPopulateOwnRateSet(tpAniSirGlobal pMac, |
| 1641 | tpSirSupportedRates pRates, |
| 1642 | tANI_U8* pSupportedMCSSet, |
| 1643 | tANI_U8 basicOnly, |
| 1644 | tpPESession psessionEntry) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1645 | #endif |
| 1646 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1647 | { |
| 1648 | tSirMacRateSet tempRateSet; |
| 1649 | tSirMacRateSet tempRateSet2; |
| 1650 | tANI_U32 i,j,val,min,isArate; |
| 1651 | tANI_U32 phyMode = 0; |
| 1652 | |
| 1653 | isArate = 0; |
| 1654 | |
| 1655 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1656 | |
| 1657 | // Get own rate set |
| 1658 | #if 0 |
| 1659 | val = WNI_CFG_OPERATIONAL_RATE_SET_LEN; |
| 1660 | if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, |
| 1661 | (tANI_U8 *) &tempRateSet.rate, |
| 1662 | &val) != eSIR_SUCCESS) |
| 1663 | { |
| 1664 | /// Could not get rateset from CFG. Log error. |
| 1665 | limLog(pMac, LOGP, FL("could not retrieve rateset\n")); |
| 1666 | } |
| 1667 | #endif // TO SUPPORT BT-AMP |
| 1668 | |
| 1669 | /* copy operational rate set from psessionEntry */ |
| 1670 | palCopyMemory(pMac->hHdd,(tANI_U8 *)tempRateSet.rate,(tANI_U8*)(psessionEntry->rateSet.rate), psessionEntry->rateSet.numRates); |
| 1671 | tempRateSet.numRates = psessionEntry->rateSet.numRates; |
| 1672 | |
| 1673 | if (phyMode == WNI_CFG_PHY_MODE_11G) |
| 1674 | { |
| 1675 | |
| 1676 | // get own extended rate set |
| 1677 | #if 0 |
| 1678 | val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN; |
| 1679 | if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 1680 | (tANI_U8 *) &tempRateSet2.rate, |
| 1681 | &val) != eSIR_SUCCESS) |
| 1682 | { |
| 1683 | /// Could not get extended rateset from CFG. Log error. |
| 1684 | limLog(pMac, LOGP, FL("could not retrieve extended rateset\n")); |
| 1685 | } |
| 1686 | tempRateSet2.numRates = (tANI_U8) val; |
| 1687 | #endif |
| 1688 | |
| 1689 | palCopyMemory(pMac->hHdd,(tANI_U8 *)tempRateSet2.rate, (tANI_U8*)(psessionEntry->extRateSet.rate), psessionEntry->extRateSet.numRates); |
| 1690 | tempRateSet2.numRates = psessionEntry->extRateSet.numRates; |
| 1691 | |
| 1692 | } |
| 1693 | else |
| 1694 | tempRateSet2.numRates = 0; |
| 1695 | |
| 1696 | |
| 1697 | if ((tempRateSet.numRates + tempRateSet2.numRates) > 12) |
| 1698 | { |
| 1699 | //we are in big trouble |
| 1700 | limLog(pMac, LOGP, FL("more than 12 rates in CFG\n")); |
| 1701 | //panic |
| 1702 | goto error; |
| 1703 | } |
| 1704 | |
| 1705 | |
| 1706 | //copy all rates in tempRateSet, there are 12 rates max |
| 1707 | for (i = 0;i < tempRateSet2.numRates; i++) |
| 1708 | tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i]; |
| 1709 | tempRateSet.numRates += tempRateSet2.numRates; |
| 1710 | |
| 1711 | /** |
| 1712 | * Sort rates in tempRateSet (they are likely to be already sorted) |
| 1713 | * put the result in pSupportedRates |
| 1714 | */ |
| 1715 | { |
| 1716 | tANI_U8 aRateIndex = 0; |
| 1717 | tANI_U8 bRateIndex = 0; |
| 1718 | |
| 1719 | palZeroMemory( pMac->hHdd, (tANI_U8 *) pRates, sizeof(tSirSupportedRates)); |
| 1720 | for(i = 0;i < tempRateSet.numRates; i++) |
| 1721 | { |
| 1722 | min = 0; |
| 1723 | val = 0xff; |
| 1724 | isArate = 0; |
| 1725 | for(j = 0;j < tempRateSet.numRates; j++) |
| 1726 | { |
| 1727 | if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val) |
| 1728 | { |
| 1729 | val = tempRateSet.rate[j] & 0x7f; |
| 1730 | min = j; |
| 1731 | } |
| 1732 | } |
| 1733 | |
| 1734 | if (sirIsArate(tempRateSet.rate[min] & 0x7f)) |
| 1735 | isArate = 1; |
| 1736 | |
| 1737 | /* |
| 1738 | * HAL needs to know whether the rate is basic rate or not, as it needs to |
| 1739 | * update the response rate table accordingly. e.g. if one of the 11a rates is |
| 1740 | * basic rate, then that rate can be used for sending control frames. |
| 1741 | * HAL updates the response rate table whenever basic rate set is changed. |
| 1742 | */ |
| 1743 | if (basicOnly) |
| 1744 | { |
| 1745 | if (tempRateSet.rate[min] & 0x80) |
| 1746 | { |
| 1747 | if (isArate) |
| 1748 | pRates->llaRates[aRateIndex++] = tempRateSet.rate[min]; |
| 1749 | else |
| 1750 | pRates->llbRates[bRateIndex++] = tempRateSet.rate[min]; |
| 1751 | } |
| 1752 | } |
| 1753 | else |
| 1754 | { |
| 1755 | if (isArate) |
| 1756 | pRates->llaRates[aRateIndex++] = tempRateSet.rate[min]; |
| 1757 | else |
| 1758 | pRates->llbRates[bRateIndex++] = tempRateSet.rate[min]; |
| 1759 | } |
| 1760 | tempRateSet.rate[min] = 0xff; |
| 1761 | } |
| 1762 | |
| 1763 | } |
| 1764 | |
| 1765 | |
| 1766 | if(IS_DOT11_MODE_HT(psessionEntry->dot11mode)) |
| 1767 | { |
| 1768 | val = SIZE_OF_SUPPORTED_MCS_SET; |
| 1769 | if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET, |
| 1770 | pRates->supportedMCSSet, |
| 1771 | &val) != eSIR_SUCCESS) |
| 1772 | { |
| 1773 | /// Could not get rateset from CFG. Log error. |
| 1774 | PELOGE(limLog(pMac, LOGE, FL("could not retrieve supportedMCSSet\n"));) |
| 1775 | goto error; |
| 1776 | } |
| 1777 | |
| 1778 | |
| 1779 | //if supported MCS Set of the peer is passed in, then do the intersection |
| 1780 | //else use the MCS set from local CFG. |
| 1781 | |
| 1782 | if(pSupportedMCSSet != NULL) |
| 1783 | { |
| 1784 | for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) |
| 1785 | pRates->supportedMCSSet[i] &= pSupportedMCSSet[i]; |
| 1786 | |
| 1787 | } |
| 1788 | |
| 1789 | PELOG2(limLog(pMac, LOG2, FL("MCS Rate Set Bitmap: \n"));) |
| 1790 | for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) |
| 1791 | PELOGW(limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);) |
| 1792 | } |
| 1793 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1794 | #ifdef WLAN_FEATURE_11AC |
| 1795 | limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry); |
| 1796 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1797 | |
| 1798 | return eSIR_SUCCESS; |
| 1799 | |
| 1800 | error: |
| 1801 | |
| 1802 | return eSIR_FAILURE; |
| 1803 | } /*** limPopulateOwnRateSet() ***/ |
| 1804 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1805 | /** |
| 1806 | * limPopulateMatchingRateSet |
| 1807 | * FUNCTION: |
| 1808 | * This is called at the time of Association Request |
| 1809 | * processing on AP and while adding peer's context |
| 1810 | * in IBSS role to process the CFG rate sets and |
| 1811 | * the rate sets received in the Assoc request on AP |
| 1812 | * or Beacon/Probe Response from peer in IBSS. |
| 1813 | * |
| 1814 | * LOGIC: |
| 1815 | * 1. It makes the intersection between our own rate Sat |
| 1816 | * and extemcded rate set and the ones received in the |
| 1817 | * association request. |
| 1818 | * 2. It creates a combined rate set of 12 rates max which |
| 1819 | * comprised the basic and extended rates |
| 1820 | * 3. It sorts the combined rate Set and copy it in the |
| 1821 | * rate array of the pSTA descriptor |
| 1822 | * |
| 1823 | * ASSUMPTION: |
| 1824 | * The parser has already ensured unicity of the rates in the |
| 1825 | * association request structure |
| 1826 | * |
| 1827 | * @param: pMac - Pointer to Global MAC structure |
| 1828 | * pStaDs - Pointer to DPH node |
| 1829 | * pOperRateSet - Pointer to peer's supported rateset |
| 1830 | * pExtRateSet - Pointer to peer's extended rateset |
| 1831 | * |
| 1832 | * @return: eSIR_SUCCESS or eSIR_FAILURE |
| 1833 | */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1834 | #ifdef WLAN_FEATURE_11AC |
| 1835 | tSirRetStatus |
| 1836 | limPopulateMatchingRateSet(tpAniSirGlobal pMac, |
| 1837 | tpDphHashNode pStaDs, |
| 1838 | tSirMacRateSet *pOperRateSet, |
| 1839 | tSirMacRateSet *pExtRateSet, |
| 1840 | tANI_U8* pSupportedMCSSet, |
| 1841 | tSirMacPropRateSet *pAniLegRateSet, |
| 1842 | tpPESession psessionEntry, |
| 1843 | tDot11fIEVHTCaps *pVHTCaps) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1844 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1845 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1846 | tSirRetStatus |
| 1847 | limPopulateMatchingRateSet(tpAniSirGlobal pMac, |
| 1848 | tpDphHashNode pStaDs, |
| 1849 | tSirMacRateSet *pOperRateSet, |
| 1850 | tSirMacRateSet *pExtRateSet, |
| 1851 | tANI_U8* pSupportedMCSSet, |
| 1852 | tSirMacPropRateSet *pAniLegRateSet, |
| 1853 | tpPESession psessionEntry) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1854 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1855 | { |
| 1856 | tSirMacRateSet tempRateSet; |
| 1857 | tSirMacRateSet tempRateSet2; |
| 1858 | tANI_U32 i,j,val,min,isArate; |
| 1859 | tANI_U32 phyMode; |
| 1860 | tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET]; |
| 1861 | |
| 1862 | isArate=0; |
| 1863 | |
| 1864 | // limGetPhyMode(pMac, &phyMode); |
| 1865 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1866 | |
| 1867 | // get own rate set |
| 1868 | // val = WNI_CFG_OPERATIONAL_RATE_SET_LEN; |
| 1869 | #if 0 |
| 1870 | if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, |
| 1871 | (tANI_U8 *) &tempRateSet.rate, |
| 1872 | &val) != eSIR_SUCCESS) |
| 1873 | { |
| 1874 | /// Could not get rateset from CFG. Log error. |
| 1875 | limLog(pMac, LOGP, FL("could not retrieve rateset\n")); |
| 1876 | } |
| 1877 | |
| 1878 | #endif // TO SUPPORT BT-AMP |
| 1879 | |
| 1880 | /* copy operational rate set from psessionEntry */ |
| 1881 | palCopyMemory(pMac->hHdd,(tempRateSet.rate),(psessionEntry->rateSet.rate),psessionEntry->rateSet.numRates); |
| 1882 | tempRateSet.numRates = (tANI_U8) psessionEntry->rateSet.numRates; |
| 1883 | |
| 1884 | if (phyMode == WNI_CFG_PHY_MODE_11G) |
| 1885 | { |
| 1886 | |
| 1887 | #if 0 |
| 1888 | // get own extended rate set |
| 1889 | val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN; |
| 1890 | if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 1891 | (tANI_U8 *) &tempRateSet2.rate, |
| 1892 | &val) != eSIR_SUCCESS) |
| 1893 | #endif |
| 1894 | palCopyMemory(pMac->hHdd,(tempRateSet2.rate),(psessionEntry->extRateSet.rate),psessionEntry->extRateSet.numRates); |
| 1895 | tempRateSet2.numRates = (tANI_U8) psessionEntry->extRateSet.numRates; |
| 1896 | } |
| 1897 | else |
| 1898 | tempRateSet2.numRates = 0; |
| 1899 | |
| 1900 | if ((tempRateSet.numRates + tempRateSet2.numRates) > 12) |
| 1901 | { |
| 1902 | PELOGE(limLog(pMac, LOGE, FL("more than 12 rates in CFG\n"));) |
| 1903 | goto error; |
| 1904 | } |
| 1905 | |
| 1906 | /** |
| 1907 | * Handling of the rate set IEs is the following: |
| 1908 | * - keep only rates that we support and that the station supports |
| 1909 | * - sort and the rates into the pSta->rate array |
| 1910 | */ |
| 1911 | |
| 1912 | // Copy all rates in tempRateSet, there are 12 rates max |
| 1913 | for(i = 0; i < tempRateSet2.numRates; i++) |
| 1914 | tempRateSet.rate[i + tempRateSet.numRates] = |
| 1915 | tempRateSet2.rate[i]; |
| 1916 | |
| 1917 | tempRateSet.numRates += tempRateSet2.numRates; |
| 1918 | |
| 1919 | /** |
| 1920 | * Sort rates in tempRateSet (they are likely to be already sorted) |
| 1921 | * put the result in tempRateSet2 |
| 1922 | */ |
| 1923 | tempRateSet2.numRates = 0; |
| 1924 | |
| 1925 | for(i = 0;i < tempRateSet.numRates; i++) |
| 1926 | { |
| 1927 | min = 0; |
| 1928 | val = 0xff; |
| 1929 | |
| 1930 | for(j = 0;j < tempRateSet.numRates; j++) |
| 1931 | if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val) |
| 1932 | { |
| 1933 | val = tempRateSet.rate[j] & 0x7f; |
| 1934 | min = j; |
| 1935 | } |
| 1936 | |
| 1937 | tempRateSet2.rate[tempRateSet2.numRates++] = |
| 1938 | tempRateSet.rate[min]; |
| 1939 | tempRateSet.rate[min] = 0xff; |
| 1940 | } |
| 1941 | |
| 1942 | |
| 1943 | /** |
| 1944 | * Copy received rates in tempRateSet, the parser has ensured |
| 1945 | * unicity of the rates so there cannot be more than 12 |
| 1946 | */ |
| 1947 | for(i = 0; i < pOperRateSet->numRates; i++) |
| 1948 | { |
| 1949 | tempRateSet.rate[i] = pOperRateSet->rate[i]; |
| 1950 | } |
| 1951 | |
| 1952 | tempRateSet.numRates = pOperRateSet->numRates; |
| 1953 | |
| 1954 | if (pExtRateSet->numRates) |
| 1955 | { |
| 1956 | if((tempRateSet.numRates + pExtRateSet->numRates) > 12 ) |
| 1957 | { |
| 1958 | limLog( pMac, LOG2, |
| 1959 | "Sum of SUPPORTED and EXTENDED Rate Set (%1d) exceeds 12!", |
| 1960 | tempRateSet.numRates + pExtRateSet->numRates ); |
| 1961 | |
| 1962 | if( tempRateSet.numRates < 12 ) |
| 1963 | { |
| 1964 | int found = 0; |
| 1965 | int tail = tempRateSet.numRates; |
| 1966 | |
| 1967 | for( i = 0; i < pExtRateSet->numRates; i++ ) |
| 1968 | { |
| 1969 | found = 0; |
| 1970 | for( j = 0; j < (tANI_U32) tail; j++ ) |
| 1971 | { |
| 1972 | if((tempRateSet.rate[j] & 0x7F) == |
| 1973 | (pExtRateSet->rate[i] & 0x7F)) |
| 1974 | { |
| 1975 | found = 1; |
| 1976 | break; |
| 1977 | } |
| 1978 | } |
| 1979 | |
| 1980 | if( !found ) |
| 1981 | { |
| 1982 | tempRateSet.rate[tempRateSet.numRates++] = |
| 1983 | pExtRateSet->rate[i]; |
| 1984 | |
| 1985 | if( tempRateSet.numRates >= 12 ) |
| 1986 | break; |
| 1987 | } |
| 1988 | } |
| 1989 | } |
| 1990 | else |
| 1991 | limLog( pMac, LOG2, |
| 1992 | "Relying only on the SUPPORTED Rate Set IE..." ); |
| 1993 | } |
| 1994 | else |
| 1995 | { |
| 1996 | for(j = 0; j < pExtRateSet->numRates; j++) |
| 1997 | tempRateSet.rate[i+j] = pExtRateSet->rate[j]; |
| 1998 | |
| 1999 | tempRateSet.numRates += pExtRateSet->numRates; |
| 2000 | } |
| 2001 | } |
| 2002 | |
| 2003 | { |
| 2004 | tpSirSupportedRates rates = &pStaDs->supportedRates; |
| 2005 | tANI_U8 aRateIndex = 0; |
| 2006 | tANI_U8 bRateIndex = 0; |
| 2007 | palZeroMemory( pMac->hHdd, (tANI_U8 *) rates, sizeof(tSirSupportedRates)); |
| 2008 | for(i = 0;i < tempRateSet2.numRates; i++) |
| 2009 | { |
| 2010 | for(j = 0;j < tempRateSet.numRates; j++) |
| 2011 | { |
| 2012 | if ((tempRateSet2.rate[i] & 0x7F) == |
| 2013 | (tempRateSet.rate[j] & 0x7F)) |
| 2014 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2015 | if (sirIsArate(tempRateSet2.rate[i] & 0x7f)) |
| 2016 | { |
| 2017 | isArate=1; |
| 2018 | rates->llaRates[aRateIndex++] = tempRateSet2.rate[i]; |
| 2019 | } |
| 2020 | else |
| 2021 | rates->llbRates[bRateIndex++] = tempRateSet2.rate[i]; |
| 2022 | break; |
| 2023 | } |
| 2024 | } |
| 2025 | } |
| 2026 | |
| 2027 | |
| 2028 | //Now add the Polaris rates only when Proprietary rates are enabled. |
| 2029 | val = 0; |
| 2030 | if(wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_RATES_ENABLED, &val) != eSIR_SUCCESS) |
| 2031 | { |
| 2032 | limLog(pMac, LOGP, FL("could not retrieve prop rate enabled flag from CFG\n")); |
| 2033 | } |
| 2034 | else if(val) |
| 2035 | { |
| 2036 | for(i=0; i<pAniLegRateSet->numPropRates; i++) |
| 2037 | rates->aniLegacyRates[i] = pAniLegRateSet->propRate[i]; |
| 2038 | } |
| 2039 | |
| 2040 | } |
| 2041 | |
| 2042 | |
| 2043 | //compute the matching MCS rate set, if peer is 11n capable and self mode is 11n |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2044 | #ifdef FEATURE_WLAN_TDLS |
| 2045 | if(pStaDs->mlmStaContext.htCapability) |
| 2046 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2047 | if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) && |
| 2048 | (pStaDs->mlmStaContext.htCapability)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2049 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2050 | { |
| 2051 | val = SIZE_OF_SUPPORTED_MCS_SET; |
| 2052 | if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET, |
| 2053 | mcsSet, |
| 2054 | &val) != eSIR_SUCCESS) |
| 2055 | { |
| 2056 | /// Could not get rateset from CFG. Log error. |
| 2057 | limLog(pMac, LOGP, FL("could not retrieve supportedMCSSet\n")); |
| 2058 | goto error; |
| 2059 | } |
| 2060 | |
| 2061 | for(i=0; i<val; i++) |
| 2062 | pStaDs->supportedRates.supportedMCSSet[i] = mcsSet[i] & pSupportedMCSSet[i]; |
| 2063 | |
| 2064 | PELOG2(limLog(pMac, LOG2, FL("limPopulateMatchingRateSet: MCS Rate Set Bitmap from CFG and DPH : \n"));) |
| 2065 | for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) |
| 2066 | { |
| 2067 | PELOG2(limLog(pMac, LOG2,FL("%x %x "), mcsSet[i], pStaDs->supportedRates.supportedMCSSet[i]);) |
| 2068 | } |
| 2069 | } |
| 2070 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2071 | #ifdef WLAN_FEATURE_11AC |
| 2072 | limPopulateVhtMcsSet(pMac, &pStaDs->supportedRates, pVHTCaps, psessionEntry); |
| 2073 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2074 | /** |
| 2075 | * Set the erpEnabled bit iff the phy is in G mode and at least |
| 2076 | * one A rate is supported |
| 2077 | */ |
| 2078 | if ((phyMode == WNI_CFG_PHY_MODE_11G) && isArate) |
| 2079 | pStaDs->erpEnabled = eHAL_SET; |
| 2080 | |
| 2081 | |
| 2082 | |
| 2083 | return eSIR_SUCCESS; |
| 2084 | |
| 2085 | error: |
| 2086 | |
| 2087 | return eSIR_FAILURE; |
| 2088 | } /*** limPopulateMatchingRateSet() ***/ |
| 2089 | |
| 2090 | |
| 2091 | |
| 2092 | /** |
| 2093 | * limAddSta() |
| 2094 | * |
| 2095 | *FUNCTION: |
| 2096 | * This function is called to add an STA context at hardware |
| 2097 | * whenever a STA is (Re) Associated. |
| 2098 | * |
| 2099 | *LOGIC: |
| 2100 | * |
| 2101 | *ASSUMPTIONS: |
| 2102 | * NA |
| 2103 | * |
| 2104 | *NOTE: |
| 2105 | * NA |
| 2106 | * |
| 2107 | * @param pMac - Pointer to Global MAC structure |
| 2108 | * @param pStaDs - Pointer to the STA datastructure created by |
| 2109 | * LIM and maintained by DPH |
| 2110 | * @return retCode - Indicates success or failure return code |
| 2111 | */ |
| 2112 | |
| 2113 | tSirRetStatus |
| 2114 | limAddSta( |
| 2115 | tpAniSirGlobal pMac, |
| 2116 | tpDphHashNode pStaDs,tpPESession psessionEntry) |
| 2117 | { |
| 2118 | tpAddStaParams pAddStaParams = NULL; |
| 2119 | tSirMsgQ msgQ; |
| 2120 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 2121 | tSirMacAddr staMac, *pStaAddr; |
| 2122 | tANI_U8 i; |
| 2123 | #ifdef WLAN_FEATURE_P2P |
| 2124 | tpSirAssocReq pAssocReq; |
| 2125 | tANI_U8 *p2pIe = NULL; |
| 2126 | #endif |
| 2127 | #if 0 |
| 2128 | retCode = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg); |
| 2129 | if (retCode != eSIR_SUCCESS) |
| 2130 | limLog(pMac, LOGP, FL("could not retrieve STA MAC\n")); |
| 2131 | #endif //To SUPPORT BT-AMP |
| 2132 | |
| 2133 | |
| 2134 | sirCopyMacAddr(staMac,psessionEntry->selfMacAddr); |
| 2135 | |
| 2136 | if( eHAL_STATUS_SUCCESS != |
| 2137 | palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams ))) |
| 2138 | { |
| 2139 | limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA\n" )); |
| 2140 | return eSIR_MEM_ALLOC_FAILED; |
| 2141 | } |
| 2142 | palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams)); |
| 2143 | |
| 2144 | if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) || |
| 2145 | (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) || |
| 2146 | (limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) ) |
| 2147 | pStaAddr = &pStaDs->staAddr; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2148 | #ifdef FEATURE_WLAN_TDLS |
| 2149 | /* SystemRole shouldn't be matter if staType is TDLS peer */ |
| 2150 | else if(STA_ENTRY_TDLS_PEER == pStaDs->staType) |
| 2151 | { |
| 2152 | pStaAddr = &pStaDs->staAddr ; |
| 2153 | } |
| 2154 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2155 | else |
| 2156 | pStaAddr = &staMac; |
| 2157 | |
| 2158 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac, |
| 2159 | (tANI_U8 *) *pStaAddr, sizeof(tSirMacAddr)); |
| 2160 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId, |
| 2161 | psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 2162 | |
| 2163 | limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry); |
| 2164 | |
| 2165 | //Copy legacy rates |
| 2166 | palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddStaParams->supportedRates, |
| 2167 | (tANI_U8*)&pStaDs->supportedRates, sizeof(tSirSupportedRates)); |
| 2168 | |
| 2169 | pAddStaParams->assocId = pStaDs->assocId; |
| 2170 | |
| 2171 | pAddStaParams->wmmEnabled = pStaDs->qosMode; |
| 2172 | pAddStaParams->listenInterval = pStaDs->mlmStaContext.listenInterval; |
| 2173 | pAddStaParams->shortPreambleSupported = pStaDs->shortPreambleEnabled; |
| 2174 | #ifdef WLAN_SOFTAP_FEATURE |
| 2175 | if((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) && (pStaDs->mlmStaContext.subType == LIM_REASSOC)) |
| 2176 | { |
| 2177 | /* TBD - need to remove this REASSOC check after fixinf rmmod issue */ |
| 2178 | pAddStaParams->updateSta = pStaDs->mlmStaContext.updateContext; |
| 2179 | } |
| 2180 | #endif |
| 2181 | pStaDs->valid = 0; |
| 2182 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE; |
| 2183 | |
| 2184 | // This will indicate HAL to "allocate" a new STA index |
| 2185 | pAddStaParams->staIdx = HAL_STA_INVALID_IDX; |
| 2186 | pAddStaParams->staType = pStaDs->staType; |
| 2187 | |
| 2188 | pAddStaParams->status = eHAL_STATUS_SUCCESS; |
| 2189 | pAddStaParams->respReqd = 1; |
| 2190 | //Update HT Capability |
| 2191 | |
| 2192 | if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||(limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) || (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2193 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2194 | pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2195 | #ifdef WLAN_FEATURE_11AC |
| 2196 | pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability; |
| 2197 | #endif |
| 2198 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2199 | #ifdef FEATURE_WLAN_TDLS |
| 2200 | /* SystemRole shouldn't be matter if staType is TDLS peer */ |
| 2201 | else if(STA_ENTRY_TDLS_PEER == pStaDs->staType) |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2202 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2203 | pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability; |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2204 | #ifdef WLAN_FEATURE_11AC |
| 2205 | pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability; |
| 2206 | #endif |
| 2207 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2208 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2209 | else |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2210 | { |
| 2211 | pAddStaParams->htCapable = psessionEntry->htCapability; |
| 2212 | #ifdef WLAN_FEATURE_11AC |
| 2213 | pAddStaParams->vhtCapable = psessionEntry->vhtCapability; |
| 2214 | #endif |
| 2215 | |
| 2216 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2217 | |
| 2218 | pAddStaParams->greenFieldCapable = pStaDs->htGreenfield; |
| 2219 | pAddStaParams->maxAmpduDensity= pStaDs->htAMpduDensity; |
| 2220 | pAddStaParams->maxAmpduSize = pStaDs->htMaxRxAMpduFactor; |
| 2221 | pAddStaParams->fDsssCckMode40Mhz = pStaDs->htDsssCckRate40MHzSupport; |
| 2222 | pAddStaParams->fShortGI20Mhz = pStaDs->htShortGI20Mhz; |
| 2223 | pAddStaParams->fShortGI40Mhz = pStaDs->htShortGI40Mhz; |
| 2224 | pAddStaParams->lsigTxopProtection = pStaDs->htLsigTXOPProtection; |
| 2225 | pAddStaParams->maxAmsduSize = pStaDs->htMaxAmsduLength; |
| 2226 | pAddStaParams->txChannelWidthSet = pStaDs->htSupportedChannelWidthSet; |
| 2227 | pAddStaParams->mimoPS = pStaDs->htMIMOPSState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2228 | |
| 2229 | #ifdef WLAN_FEATURE_11AC |
| 2230 | if(pAddStaParams->vhtCapable) |
| 2231 | { |
Mohit Khanna | 7d5aeb2 | 2012-09-11 16:21:57 -0700 | [diff] [blame] | 2232 | pAddStaParams->vhtTxChannelWidthSet = pStaDs->vhtSupportedChannelWidthSet; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 2233 | pAddStaParams->vhtTxBFCapable = |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2234 | #ifdef FEATURE_WLAN_TDLS |
| 2235 | (( STA_ENTRY_PEER == pStaDs->staType ) || (STA_ENTRY_TDLS_PEER == pStaDs->staType)) ? |
| 2236 | pStaDs->vhtBeamFormerCapable : psessionEntry->txBFIniFeatureEnabled ; |
| 2237 | #else |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 2238 | ( STA_ENTRY_PEER == pStaDs->staType ) ? pStaDs->vhtBeamFormerCapable : |
| 2239 | psessionEntry->txBFIniFeatureEnabled ; |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2240 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2241 | } |
| 2242 | #endif |
| 2243 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 2244 | #ifdef FEATURE_WLAN_TDLS |
| 2245 | if((STA_ENTRY_PEER == pStaDs->staType) || |
| 2246 | (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 2247 | #else |
| 2248 | if (STA_ENTRY_PEER == pStaDs->staType) |
| 2249 | #endif |
| 2250 | { |
| 2251 | /* peer STA get the LDPC capability from pStaDs, which populated from |
| 2252 | * HT/VHT capability*/ |
Leela V Kiran Kumar Reddy Chirala | b1f7d34 | 2013-02-11 00:27:02 -0800 | [diff] [blame] | 2253 | if(pAddStaParams->vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP) |
| 2254 | { |
| 2255 | pAddStaParams->htLdpcCapable = 0; |
| 2256 | pAddStaParams->vhtLdpcCapable = 0; |
| 2257 | } |
| 2258 | else |
| 2259 | { |
| 2260 | pAddStaParams->htLdpcCapable = pStaDs->htLdpcCapable; |
| 2261 | pAddStaParams->vhtLdpcCapable = pStaDs->vhtLdpcCapable; |
| 2262 | } |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 2263 | } |
| 2264 | else if( STA_ENTRY_SELF == pStaDs->staType) |
| 2265 | { |
| 2266 | /* For Self STA get the LDPC capability from config.ini*/ |
| 2267 | pAddStaParams->htLdpcCapable = |
| 2268 | (psessionEntry->txLdpcIniFeatureEnabled & 0x01); |
| 2269 | pAddStaParams->vhtLdpcCapable = |
| 2270 | ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01); |
| 2271 | } |
| 2272 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2273 | /* Update PE session ID*/ |
| 2274 | pAddStaParams->sessionId = psessionEntry->peSessionId; |
| 2275 | |
| 2276 | if (psessionEntry->parsedAssocReq != NULL) |
| 2277 | { |
| 2278 | #ifdef WLAN_FEATURE_P2P |
| 2279 | // Get a copy of the already parsed Assoc Request |
| 2280 | pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId]; |
| 2281 | if ( pAssocReq && pAssocReq->addIEPresent && pAssocReq->addIE.length ) { |
| 2282 | p2pIe = limGetP2pIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length); |
| 2283 | } |
| 2284 | pAddStaParams->p2pCapableSta = (p2pIe != NULL); |
| 2285 | #endif |
| 2286 | } |
| 2287 | |
| 2288 | //Disable BA. It will be set as part of ADDBA negotiation. |
| 2289 | for( i = 0; i < STACFG_MAX_TC; i++ ) |
| 2290 | { |
| 2291 | pAddStaParams->staTCParams[i].txUseBA = eBA_DISABLE; |
| 2292 | pAddStaParams->staTCParams[i].rxUseBA = eBA_DISABLE; |
| 2293 | } |
| 2294 | |
| 2295 | #ifdef WLAN_SOFTAP_FEATURE |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2296 | #ifdef FEATURE_WLAN_TDLS |
| 2297 | if(pStaDs->wmeEnabled && \ |
| 2298 | ((eLIM_AP_ROLE == psessionEntry->limSystemRole) || (STA_ENTRY_TDLS_PEER == pStaDs->staType)) ) |
| 2299 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2300 | if(pStaDs->wmeEnabled && (eLIM_AP_ROLE == psessionEntry->limSystemRole)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2301 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2302 | { |
| 2303 | pAddStaParams->uAPSD = 0; |
| 2304 | /* update UAPSD and send it to LIM to add STA */ |
| 2305 | // bitmap MSB <- LSB MSB 4 bits are for |
| 2306 | // trigger enabled AC setting and LSB 4 bits |
| 2307 | // are for delivery enabled AC setting |
| 2308 | // 7 6 5 4 3 2 1 0 |
| 2309 | // BE BK VI VO BE BK VI VO |
| 2310 | pAddStaParams->uAPSD |= pStaDs->qos.capability.qosInfo.acvo_uapsd; |
| 2311 | pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acvi_uapsd << 1); |
| 2312 | pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbk_uapsd << 2); |
| 2313 | pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbe_uapsd << 3); |
| 2314 | //making delivery enabled and trigger enabled setting the same. |
| 2315 | pAddStaParams->uAPSD |= pAddStaParams->uAPSD << 4; |
| 2316 | |
| 2317 | pAddStaParams->maxSPLen = pStaDs->qos.capability.qosInfo.maxSpLen; |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2318 | limLog( pMac, LOG1, FL( "uAPSD = 0x%x, maxSpLen = %d" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2319 | pAddStaParams->uAPSD, pAddStaParams->maxSPLen); |
| 2320 | } |
| 2321 | #endif |
| 2322 | //we need to defer the message until we get the response back from HAL. |
| 2323 | if (pAddStaParams->respReqd) |
| 2324 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2325 | |
| 2326 | msgQ.type = WDA_ADD_STA_REQ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2327 | |
| 2328 | msgQ.reserved = 0; |
| 2329 | msgQ.bodyptr = pAddStaParams; |
| 2330 | msgQ.bodyval = 0; |
| 2331 | |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2332 | limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ for assocId %d\n" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2333 | pStaDs->assocId); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2334 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2335 | |
| 2336 | retCode = wdaPostCtrlMsg( pMac, &msgQ ); |
| 2337 | if( eSIR_SUCCESS != retCode) |
| 2338 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2339 | if (pAddStaParams->respReqd) |
| 2340 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2341 | limLog( pMac, LOGE, FL("ADD_STA_REQ for aId %d failed (reason %X)\n"), |
| 2342 | pStaDs->assocId, retCode ); |
| 2343 | palFreeMemory(pMac->hHdd, (void*)pAddStaParams); |
| 2344 | } |
| 2345 | |
| 2346 | return retCode; |
| 2347 | } |
| 2348 | |
| 2349 | |
| 2350 | /** |
| 2351 | * limDelSta() |
| 2352 | * |
| 2353 | *FUNCTION: |
| 2354 | * This function is called to delete an STA context at hardware |
| 2355 | * whenever a STA is disassociated |
| 2356 | * |
| 2357 | *LOGIC: |
| 2358 | * |
| 2359 | *ASSUMPTIONS: |
| 2360 | * NA |
| 2361 | * |
| 2362 | *NOTE: |
| 2363 | * NA |
| 2364 | * |
| 2365 | * @param pMac - Pointer to Global MAC structure |
| 2366 | * @param pStaDs - Pointer to the STA datastructure created by |
| 2367 | * LIM and maintained by DPH |
| 2368 | * @param fRespReqd - flag to indicate whether the delete is synchronous (true) |
| 2369 | * or not (false) |
| 2370 | * @return retCode - Indicates success or failure return code |
| 2371 | */ |
| 2372 | |
| 2373 | tSirRetStatus |
| 2374 | limDelSta( |
| 2375 | tpAniSirGlobal pMac, |
| 2376 | tpDphHashNode pStaDs, |
| 2377 | tANI_BOOLEAN fRespReqd, |
| 2378 | tpPESession psessionEntry) |
| 2379 | { |
| 2380 | tpDeleteStaParams pDelStaParams = NULL; |
| 2381 | tSirMsgQ msgQ; |
| 2382 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 2383 | |
| 2384 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **) &pDelStaParams, sizeof( tDeleteStaParams ))) |
| 2385 | { |
| 2386 | limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" )); |
| 2387 | return eSIR_MEM_ALLOC_FAILED; |
| 2388 | } |
| 2389 | |
| 2390 | palZeroMemory( pMac->hHdd, (tANI_U8 *) pDelStaParams, sizeof(tDeleteStaParams)); |
| 2391 | |
| 2392 | // |
| 2393 | // DPH contains the STA index only for "peer" STA entries. |
| 2394 | // LIM global contains "self" STA index |
| 2395 | // Thus, |
| 2396 | // if( STA role ) |
| 2397 | // get STA index from LIM global |
| 2398 | // else |
| 2399 | // get STA index from DPH |
| 2400 | // |
| 2401 | |
| 2402 | #if 0 |
| 2403 | /* Since we have not created any STA, no need to send msg to delete |
| 2404 | * STA to HAL */ |
| 2405 | if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) { |
| 2406 | pDelStaParams->staIdx = 1; /* TODO : This is workaround. Need to find right STA Index before sending to HAL */ |
| 2407 | //return retCode; |
| 2408 | } |
| 2409 | #endif |
| 2410 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2411 | #ifdef FEATURE_WLAN_TDLS |
| 2412 | if( ((eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) && (pStaDs->staType != STA_ENTRY_TDLS_PEER)) ||(eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ) |
| 2413 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2414 | if( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||(eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2415 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2416 | pDelStaParams->staIdx= psessionEntry->staId; |
| 2417 | |
| 2418 | else |
| 2419 | pDelStaParams->staIdx= pStaDs->staIndex; |
| 2420 | |
| 2421 | pDelStaParams->assocId = pStaDs->assocId; |
| 2422 | pStaDs->valid = 0; |
| 2423 | |
| 2424 | if (! fRespReqd) |
| 2425 | pDelStaParams->respReqd = 0; |
| 2426 | else |
| 2427 | { |
| 2428 | //when limDelSta is called from processSmeAssocCnf then mlmState is already set properly. |
| 2429 | if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs)) |
| 2430 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2431 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2432 | SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, eLIM_MLM_WT_DEL_STA_RSP_STATE); |
| 2433 | } |
| 2434 | if ( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) || |
| 2435 | (eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ) |
| 2436 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2437 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2438 | |
| 2439 | psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; |
| 2440 | |
| 2441 | } |
| 2442 | pDelStaParams->respReqd = 1; |
| 2443 | //we need to defer the message until we get the response back from HAL. |
| 2444 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 2445 | } |
| 2446 | |
| 2447 | /* Update PE session ID*/ |
| 2448 | pDelStaParams->sessionId = psessionEntry->peSessionId; |
| 2449 | |
| 2450 | pDelStaParams->status = eHAL_STATUS_SUCCESS; |
| 2451 | msgQ.type = WDA_DELETE_STA_REQ; |
| 2452 | msgQ.reserved = 0; |
| 2453 | msgQ.bodyptr = pDelStaParams; |
| 2454 | msgQ.bodyval = 0; |
| 2455 | |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2456 | limLog( pMac, LOG1, FL( "Sending SIR_HAL_DELETE_STA_REQ for STAID: %X and AssocID: %d" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2457 | pDelStaParams->staIdx, pDelStaParams->assocId); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2458 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2459 | retCode = wdaPostCtrlMsg( pMac, &msgQ ); |
| 2460 | if( eSIR_SUCCESS != retCode) |
| 2461 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2462 | if(fRespReqd) |
| 2463 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2464 | limLog( pMac, LOGE, FL("Posting DELETE_STA_REQ to HAL failed, reason=%X\n"), |
| 2465 | retCode ); |
| 2466 | palFreeMemory(pMac->hHdd, (void*)pDelStaParams); |
| 2467 | } |
| 2468 | |
| 2469 | return retCode; |
| 2470 | } |
| 2471 | |
| 2472 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2473 | /*------------------------------------------------------------------------ |
| 2474 | * limAddFTStaSelf() |
| 2475 | * |
| 2476 | * FUNCTION: |
| 2477 | * |
| 2478 | * This function is called to add a STA once we have connected with a new |
| 2479 | * AP, that we have performed an FT to. |
| 2480 | * |
| 2481 | * The Add STA Response is created and now after the ADD Bss Is Successful |
| 2482 | * we add the self sta. We update with the association id from the reassoc |
| 2483 | * response from the AP. |
| 2484 | *------------------------------------------------------------------------ |
| 2485 | */ |
| 2486 | tSirRetStatus limAddFTStaSelf(tpAniSirGlobal pMac, tANI_U16 assocId, tpPESession psessionEntry) |
| 2487 | { |
| 2488 | tpAddStaParams pAddStaParams = NULL; |
| 2489 | tSirMsgQ msgQ; |
| 2490 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 2491 | |
| 2492 | pAddStaParams = pMac->ft.ftPEContext.pAddStaReq; |
| 2493 | pAddStaParams->assocId = assocId; |
| 2494 | |
| 2495 | msgQ.type = SIR_HAL_ADD_STA_REQ; |
| 2496 | msgQ.reserved = 0; |
| 2497 | msgQ.bodyptr = pAddStaParams; |
| 2498 | msgQ.bodyval = 0; |
| 2499 | |
| 2500 | |
| 2501 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
| 2502 | limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ), pAddStaParams->assocId); |
| 2503 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2504 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2505 | |
| 2506 | psessionEntry->limPrevMlmState = psessionEntry->limMlmState; |
Varun Reddy Yeturu | e3bbf6e | 2013-02-08 18:50:55 -0800 | [diff] [blame] | 2507 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_ADD_STA_RSP_STATE)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2508 | psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE; |
| 2509 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 2510 | { |
| 2511 | limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X\n"), retCode ); |
| 2512 | palFreeMemory(pMac->hHdd, (void*)pAddStaParams); |
| 2513 | } |
| 2514 | // |
| 2515 | // Dont need it any more |
| 2516 | pMac->ft.ftPEContext.pAddStaReq = NULL; |
| 2517 | return retCode; |
| 2518 | } |
| 2519 | |
| 2520 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 2521 | |
| 2522 | /** |
| 2523 | * limAddStaSelf() |
| 2524 | * |
| 2525 | *FUNCTION: |
| 2526 | * This function is called to add an STA context at hardware |
| 2527 | * whenever a STA is (Re) Associated. |
| 2528 | * |
| 2529 | *LOGIC: |
| 2530 | * |
| 2531 | *ASSUMPTIONS: |
| 2532 | * NA |
| 2533 | * |
| 2534 | *NOTE: |
| 2535 | * NA |
| 2536 | * |
| 2537 | * @param pMac - Pointer to Global MAC structure |
| 2538 | * @param pStaDs - Pointer to the STA datastructure created by |
| 2539 | * LIM and maintained by DPH |
| 2540 | * @return retCode - Indicates success or failure return code |
| 2541 | */ |
| 2542 | |
| 2543 | tSirRetStatus |
| 2544 | limAddStaSelf(tpAniSirGlobal pMac,tANI_U16 staIdx, tANI_U8 updateSta, tpPESession psessionEntry) |
| 2545 | { |
| 2546 | tpAddStaParams pAddStaParams = NULL; |
| 2547 | tSirMsgQ msgQ; |
| 2548 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 2549 | tSirMacAddr staMac; |
| 2550 | tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF; |
| 2551 | |
| 2552 | #if 0 |
| 2553 | retCode =wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg); |
| 2554 | if (retCode != eSIR_SUCCESS) |
| 2555 | { |
| 2556 | /// Could not get BSSID from CFG. Log error. |
| 2557 | limLog(pMac, LOGP, FL("could not retrieve STA MAC\n")); |
| 2558 | return retCode; |
| 2559 | } |
| 2560 | #endif //TO SUPPORT BT-AMP |
| 2561 | sirCopyMacAddr(staMac,psessionEntry->selfMacAddr); |
| 2562 | |
| 2563 | if( eHAL_STATUS_SUCCESS != |
| 2564 | palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams ))) |
| 2565 | { |
| 2566 | limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" )); |
| 2567 | return eSIR_MEM_ALLOC_FAILED; |
| 2568 | } |
| 2569 | palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams)); |
| 2570 | |
| 2571 | /// Add STA context at MAC HW (BMU, RHP & TFP) |
| 2572 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac, |
| 2573 | (tANI_U8 *) staMac, sizeof(tSirMacAddr)); |
| 2574 | |
| 2575 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId, |
| 2576 | psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 2577 | |
| 2578 | pAddStaParams->assocId = psessionEntry->limAID; |
| 2579 | pAddStaParams->staType = STA_ENTRY_SELF; |
| 2580 | pAddStaParams->status = eHAL_STATUS_SUCCESS; |
| 2581 | pAddStaParams->respReqd = 1; |
| 2582 | |
| 2583 | /* Update PE session ID */ |
| 2584 | pAddStaParams->sessionId = psessionEntry->peSessionId; |
| 2585 | |
| 2586 | // This will indicate HAL to "allocate" a new STA index |
| 2587 | pAddStaParams->staIdx = staIdx; |
| 2588 | pAddStaParams->updateSta = updateSta; |
| 2589 | |
| 2590 | pAddStaParams->shortPreambleSupported = psessionEntry->beaconParams.fShortPreamble; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2591 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2592 | #ifdef WLAN_FEATURE_11AC |
| 2593 | limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry,NULL); |
| 2594 | #else |
| 2595 | limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry); |
| 2596 | #endif |
| 2597 | if( psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2598 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2599 | pAddStaParams->htCapable = psessionEntry->htCapability; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2600 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2601 | /* |
| 2602 | * To resolve the interop problem with Broadcom AP, |
| 2603 | * where TQ STA could not pass traffic with GF enabled, |
| 2604 | * TQ STA will do Greenfield only with TQ AP, for |
| 2605 | * everybody else it will be turned off. |
| 2606 | */ |
| 2607 | if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator)) |
| 2608 | { |
| 2609 | limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry")); |
| 2610 | pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
| 2611 | } |
| 2612 | else |
| 2613 | #endif |
| 2614 | |
| 2615 | #ifdef WLAN_SOFTAP_FEATURE |
| 2616 | pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry); |
| 2617 | pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry); |
| 2618 | pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry ); |
| 2619 | pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry ); |
| 2620 | pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry ); |
| 2621 | pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry ); |
| 2622 | pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry ); |
| 2623 | pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry); |
| 2624 | pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry ); |
| 2625 | pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry); |
| 2626 | pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry); |
| 2627 | pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry); |
| 2628 | #else |
| 2629 | pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD ); |
| 2630 | pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET ); |
| 2631 | pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE ); |
| 2632 | pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE ); |
| 2633 | pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION ); |
| 2634 | pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA ); |
| 2635 | pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY ); |
| 2636 | pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR); |
| 2637 | pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH ); |
| 2638 | pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ); |
| 2639 | pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ); |
| 2640 | pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ); |
| 2641 | #endif |
| 2642 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2643 | #ifdef WLAN_FEATURE_11AC |
| 2644 | pAddStaParams->vhtCapable = psessionEntry->vhtCapability; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2645 | pAddStaParams->vhtTxChannelWidthSet = psessionEntry->apChanWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 2646 | pAddStaParams->vhtTxBFCapable = psessionEntry->txBFIniFeatureEnabled; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2647 | #endif |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 2648 | |
| 2649 | /* For Self STA get the LDPC capability from session i.e config.ini*/ |
| 2650 | pAddStaParams->htLdpcCapable = |
| 2651 | (psessionEntry->txLdpcIniFeatureEnabled & 0x01); |
| 2652 | pAddStaParams->vhtLdpcCapable = |
| 2653 | ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01); |
| 2654 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2655 | if(wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS) |
| 2656 | limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n")); |
| 2657 | pAddStaParams->listenInterval = (tANI_U16)listenInterval; |
| 2658 | |
| 2659 | #ifdef WLAN_FEATURE_P2P |
| 2660 | if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona) |
| 2661 | { |
| 2662 | pAddStaParams->p2pCapableSta = 1; |
| 2663 | } |
| 2664 | #endif |
| 2665 | |
| 2666 | limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry); |
| 2667 | |
| 2668 | msgQ.type = WDA_ADD_STA_REQ; |
| 2669 | // |
| 2670 | // FIXME_GEN4 |
| 2671 | // A global counter (dialog token) is required to keep track of |
| 2672 | // all PE <-> HAL communication(s) |
| 2673 | // |
| 2674 | msgQ.reserved = 0; |
| 2675 | msgQ.bodyptr = pAddStaParams; |
| 2676 | msgQ.bodyval = 0; |
| 2677 | |
| 2678 | limLog( pMac, LOGW, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ), |
| 2679 | pAddStaParams->assocId); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2680 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2681 | |
| 2682 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 2683 | { |
| 2684 | limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X\n"), retCode ); |
| 2685 | palFreeMemory(pMac->hHdd, (void*)pAddStaParams); |
| 2686 | } |
| 2687 | return retCode; |
| 2688 | } |
| 2689 | |
| 2690 | |
| 2691 | /** |
| 2692 | * limTeardownInfraBSS() |
| 2693 | * |
| 2694 | *FUNCTION: |
| 2695 | * This function is called by various LIM functions to teardown |
| 2696 | * an established Infrastructure BSS |
| 2697 | * |
| 2698 | *LOGIC: |
| 2699 | * |
| 2700 | *ASSUMPTIONS: |
| 2701 | * |
| 2702 | *NOTE: |
| 2703 | * |
| 2704 | * @param pMac - Pointer to Global MAC structure |
| 2705 | * @return None |
| 2706 | */ |
| 2707 | |
| 2708 | void |
| 2709 | limTeardownInfraBss(tpAniSirGlobal pMac,tpPESession psessionEntry) |
| 2710 | { |
| 2711 | tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 2712 | |
| 2713 | /** |
| 2714 | * Send Broadcast Disassociate frame with |
| 2715 | * 'leaving BSS' reason. |
| 2716 | */ |
| 2717 | limSendDisassocMgmtFrame(pMac, |
| 2718 | eSIR_MAC_DISASSOC_LEAVING_BSS_REASON, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 2719 | bcAddr,psessionEntry, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2720 | } /*** end limTeardownInfraBss() ***/ |
| 2721 | |
| 2722 | |
| 2723 | /** |
| 2724 | * limHandleCnfWaitTimeout() |
| 2725 | * |
| 2726 | *FUNCTION: |
| 2727 | * This function is called by limProcessMessageQueue to handle |
| 2728 | * various confirmation failure cases. |
| 2729 | * |
| 2730 | *LOGIC: |
| 2731 | * |
| 2732 | *ASSUMPTIONS: |
| 2733 | * |
| 2734 | *NOTE: |
| 2735 | * |
| 2736 | * @param pMac - Pointer to Global MAC structure |
| 2737 | * @param pStaDs - Pointer to a sta descriptor |
| 2738 | * @return None |
| 2739 | */ |
| 2740 | |
| 2741 | void limHandleCnfWaitTimeout(tpAniSirGlobal pMac, tANI_U16 staId) |
| 2742 | { |
| 2743 | tpDphHashNode pStaDs; |
| 2744 | tLimSystemRole systemRole; |
| 2745 | tpPESession psessionEntry = NULL; |
| 2746 | |
| 2747 | if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId))== NULL) |
| 2748 | { |
| 2749 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n")); |
| 2750 | return; |
| 2751 | } |
| 2752 | systemRole = limGetSystemRole(psessionEntry); |
| 2753 | pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable); |
| 2754 | |
| 2755 | if (pStaDs == NULL) |
| 2756 | { |
| 2757 | PELOGW(limLog(pMac, LOGW, FL("No STA context in SIR_LIM_CNF_WAIT_TIMEOUT.\n"));) |
| 2758 | return; |
| 2759 | } |
| 2760 | |
| 2761 | switch (pStaDs->mlmStaContext.mlmState) { |
| 2762 | case eLIM_MLM_WT_ASSOC_CNF_STATE: |
| 2763 | PELOGW(limLog(pMac, LOGW, FL("Did not receive Assoc Cnf in eLIM_MLM_WT_ASSOC_CNF_STATE sta Assoc id %d\n"), pStaDs->assocId);) |
| 2764 | limPrintMacAddr(pMac, pStaDs->staAddr, LOGW); |
| 2765 | |
| 2766 | if ( (systemRole == eLIM_AP_ROLE)|| (systemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 2767 | { |
| 2768 | limRejectAssociation( |
| 2769 | pMac, |
| 2770 | pStaDs->staAddr, |
| 2771 | pStaDs->mlmStaContext.subType, |
| 2772 | true, |
| 2773 | pStaDs->mlmStaContext.authType, |
| 2774 | pStaDs->assocId, |
| 2775 | true, |
| 2776 | (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2777 | psessionEntry); |
| 2778 | } |
| 2779 | break; |
| 2780 | |
| 2781 | default: |
| 2782 | limLog(pMac, LOGW, FL("Received CNF_WAIT_TIMEOUT in state %d\n"), |
| 2783 | pStaDs->mlmStaContext.mlmState); |
| 2784 | } |
| 2785 | } |
| 2786 | |
| 2787 | |
| 2788 | /** |
| 2789 | * limDeleteDphHashEntry() |
| 2790 | * |
| 2791 | *FUNCTION: |
| 2792 | * This function is called whenever we need to delete |
| 2793 | * the dph hash entry |
| 2794 | * |
| 2795 | *LOGIC: |
| 2796 | * |
| 2797 | *ASSUMPTIONS: |
| 2798 | * |
| 2799 | *NOTE: |
| 2800 | * |
| 2801 | * @param pMac Pointer to Global MAC structure |
| 2802 | * @param tANI_U16 staId |
| 2803 | * @return None |
| 2804 | */ |
| 2805 | |
| 2806 | void |
| 2807 | limDeleteDphHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 staId,tpPESession psessionEntry) |
| 2808 | { |
| 2809 | tANI_U16 aid; |
| 2810 | tpDphHashNode pStaDs; |
| 2811 | tUpdateBeaconParams beaconParams; |
| 2812 | tLimSystemRole systemRole; |
| 2813 | |
| 2814 | beaconParams.paramChangeBitmap = 0; |
| 2815 | limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, staId); |
| 2816 | if (NULL == psessionEntry) |
| 2817 | { |
| 2818 | PELOGE(limLog(pMac, LOGE, FL("NULL psessionEntry"));) |
| 2819 | return; |
| 2820 | } |
| 2821 | systemRole = limGetSystemRole(psessionEntry); |
| 2822 | beaconParams.bssIdx = psessionEntry->bssIdx; |
| 2823 | pStaDs = dphLookupHashEntry(pMac, staAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 2824 | if (pStaDs != NULL) |
| 2825 | { |
| 2826 | PELOGW(limLog(pMac, LOGW, FL("Deleting DPH Hash entry for STAID: %X\n "), staId);) |
| 2827 | // update the station count and perform associated actions |
| 2828 | // do this before deleting the dph hash entry |
| 2829 | limUtilCountStaDel(pMac, pStaDs, psessionEntry); |
| 2830 | |
| 2831 | if((eLIM_AP_ROLE == psessionEntry->limSystemRole) || |
| 2832 | (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)) |
| 2833 | { |
| 2834 | #ifdef WLAN_SOFTAP_FEATURE |
| 2835 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){ |
| 2836 | if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE){ |
| 2837 | limDecideApProtectionOnDelete(pMac, pStaDs, &beaconParams,psessionEntry); |
| 2838 | } |
| 2839 | } |
| 2840 | #endif |
| 2841 | |
| 2842 | if(eLIM_STA_IN_IBSS_ROLE == systemRole) |
| 2843 | limIbssDecideProtectionOnDelete(pMac, pStaDs, &beaconParams, psessionEntry); |
| 2844 | |
| 2845 | limDecideShortPreamble(pMac, pStaDs, &beaconParams, psessionEntry); |
| 2846 | limDecideShortSlot(pMac, pStaDs, &beaconParams, psessionEntry); |
| 2847 | |
| 2848 | //Send message to HAL about beacon parameter change. |
| 2849 | PELOGW(limLog(pMac, LOGW, FL("param bitmap = %d \n"), beaconParams.paramChangeBitmap);) |
| 2850 | if(beaconParams.paramChangeBitmap) |
| 2851 | { |
| 2852 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 2853 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 2854 | } |
| 2855 | } |
| 2856 | if (dphDeleteHashEntry(pMac, staAddr, staId, &psessionEntry->dph.dphHashTable) != eSIR_SUCCESS) |
| 2857 | limLog(pMac, LOGP, FL("error deleting hash entry\n")); |
| 2858 | } |
| 2859 | } |
| 2860 | |
| 2861 | |
| 2862 | |
| 2863 | /** |
| 2864 | * limCheckAndAnnounceJoinSuccess() |
| 2865 | * |
| 2866 | *FUNCTION: |
| 2867 | * This function is called upon receiving Beacon/Probe Response |
| 2868 | * frame in WT_JOIN_BEACON_STATE to check if the received |
| 2869 | * Beacon/Probe Response is from the BSS that we're attempting |
| 2870 | * to join. |
| 2871 | * |
| 2872 | *LOGIC: |
| 2873 | * If the Beacon/Probe Response is indeed from the BSS we're |
| 2874 | * attempting to join, join success is sent to SME. |
| 2875 | * |
| 2876 | *ASSUMPTIONS: |
| 2877 | * |
| 2878 | *NOTE: |
| 2879 | * |
| 2880 | * @param pMac Pointer to Global MAC structure |
| 2881 | * @param pBPR Pointer to received Beacon/Probe Response |
| 2882 | * @param pHdr Pointer to received Beacon/Probe Response |
| 2883 | * MAC header |
| 2884 | * @return None |
| 2885 | */ |
| 2886 | |
| 2887 | void |
| 2888 | limCheckAndAnnounceJoinSuccess(tpAniSirGlobal pMac, |
| 2889 | tSirProbeRespBeacon *pBPR, |
| 2890 | tpSirMacMgmtHdr pHdr,tpPESession psessionEntry) |
| 2891 | { |
| 2892 | tSirMacSSid currentSSID; |
| 2893 | tLimMlmJoinCnf mlmJoinCnf; |
Madan Mohan Koyyalamudi | 666d33a | 2012-11-29 11:32:59 -0800 | [diff] [blame] | 2894 | #ifdef WLAN_FEATURE_P2P |
| 2895 | tANI_U32 val = 0; |
| 2896 | tANI_U32 *noa1DurationFromBcn = NULL; |
| 2897 | tANI_U32 *noa2DurationFromBcn = NULL; |
| 2898 | tANI_U32 noa; |
| 2899 | tANI_U32 TotalNum_NoADesc = 0; |
| 2900 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2901 | |
| 2902 | palCopyMemory( pMac->hHdd, currentSSID.ssId, |
| 2903 | psessionEntry->ssId.ssId, |
| 2904 | psessionEntry->ssId.length); |
| 2905 | |
| 2906 | currentSSID.length = (tANI_U8)psessionEntry->ssId.length ; |
| 2907 | |
| 2908 | if ( |
| 2909 | /* Check for SSID only in probe response. Beacons may not carry |
| 2910 | SSID information in hidden SSID case */ |
| 2911 | ( (SIR_MAC_MGMT_FRAME == pHdr->fc.type) && |
| 2912 | (SIR_MAC_MGMT_PROBE_RSP == pHdr->fc.subType) ) && |
| 2913 | currentSSID.length && |
| 2914 | (!palEqualMemory( pMac->hHdd,(tANI_U8 *) &pBPR->ssId, |
| 2915 | (tANI_U8 *) ¤tSSID, |
| 2916 | (tANI_U8) (1 + currentSSID.length)) )) |
| 2917 | { |
| 2918 | /** |
| 2919 | * Received SSID does not match with the one we've. |
| 2920 | * Ignore received Beacon frame |
| 2921 | */ |
| 2922 | PELOG1(limLog(pMac, LOG1, FL("SSID received in Beacon does not match\n"));) |
| 2923 | #ifdef WLAN_DEBUG |
| 2924 | pMac->lim.gLimBcnSSIDMismatchCnt++; |
| 2925 | #endif |
| 2926 | return; |
| 2927 | } |
| 2928 | |
| 2929 | if( (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_STA_ROLE)) |
| 2930 | { |
| 2931 | PELOG1(limLog(pMac, LOG1, FL("Received Beacon/PR with matching BSSID\n"));) |
| 2932 | |
| 2933 | // Deactivate Join Failure timer |
| 2934 | limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER); |
Madan Mohan Koyyalamudi | 9aff9ff | 2012-11-29 11:27:25 -0800 | [diff] [blame] | 2935 | // Deactivate Periodic Join timer |
| 2936 | limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2937 | |
Madan Mohan Koyyalamudi | 666d33a | 2012-11-29 11:32:59 -0800 | [diff] [blame] | 2938 | #ifdef WLAN_FEATURE_P2P |
| 2939 | if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona && |
| 2940 | pBPR->P2PProbeRes.NoticeOfAbsence.present) |
| 2941 | { |
| 2942 | |
| 2943 | noa1DurationFromBcn = (tANI_U32*)(pBPR->P2PProbeRes.NoticeOfAbsence.NoADesc + 1); |
| 2944 | |
| 2945 | if(pBPR->P2PProbeRes.NoticeOfAbsence.num_NoADesc) |
| 2946 | TotalNum_NoADesc = pBPR->P2PProbeRes.NoticeOfAbsence.num_NoADesc/SIZE_OF_NOA_DESCRIPTOR; |
| 2947 | |
| 2948 | noa = *noa1DurationFromBcn; |
| 2949 | |
| 2950 | if(TotalNum_NoADesc > 1) |
| 2951 | { |
| 2952 | noa2DurationFromBcn = (tANI_U32*)(pBPR->P2PProbeRes.NoticeOfAbsence.NoADesc + SIZE_OF_NOA_DESCRIPTOR + 1); |
| 2953 | noa += *noa2DurationFromBcn; |
| 2954 | } |
| 2955 | |
| 2956 | /*If MAX Noa exceeds 3 secs we will consider only 3 secs to |
| 2957 | * avoid arbitary values in noa duration field |
| 2958 | */ |
| 2959 | noa = noa > MAX_NOA_PERIOD_IN_MICROSECS ? MAX_NOA_PERIOD_IN_MICROSECS : noa; |
| 2960 | noa = noa/1000; //Convert to ms |
| 2961 | |
| 2962 | if( wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,&val) == eSIR_SUCCESS ) |
| 2963 | { |
| 2964 | psessionEntry->defaultAuthFailureTimeout = val; |
| 2965 | ccmCfgSetInt(pMac,WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT ,val + noa, NULL, eANI_BOOLEAN_FALSE); |
| 2966 | } |
| 2967 | } |
| 2968 | else |
| 2969 | { |
| 2970 | psessionEntry->defaultAuthFailureTimeout = 0; |
| 2971 | } |
| 2972 | #endif |
| 2973 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2974 | // Update Beacon Interval at CFG database |
| 2975 | |
| 2976 | if ( pBPR->HTCaps.present ) |
| 2977 | limUpdateStaRunTimeHTCapability( pMac, &pBPR->HTCaps ); |
| 2978 | if ( pBPR->HTInfo.present ) |
| 2979 | limUpdateStaRunTimeHTInfo( pMac, &pBPR->HTInfo, psessionEntry); |
| 2980 | psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2981 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2982 | |
| 2983 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 2984 | // In case of BP, we need to adopt to all rates |
| 2985 | // advertised by AP. Update the operational rates at CFG |
| 2986 | if (cfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, |
| 2987 | (tANI_U8 *) &pBPR->supportedRates.rate, |
| 2988 | pBPR->supportedRates.numRates) |
| 2989 | != eSIR_SUCCESS) |
| 2990 | limLog(pMac, LOGP, FL("could not update Oper.rates at CFG\n")); |
| 2991 | |
| 2992 | #endif |
| 2993 | |
| 2994 | /** |
| 2995 | * Announce join success by sending |
| 2996 | * Join confirm to SME. |
| 2997 | */ |
| 2998 | mlmJoinCnf.resultCode = eSIR_SME_SUCCESS; |
| 2999 | mlmJoinCnf.protStatusCode = eSIR_MAC_SUCCESS_STATUS; |
| 3000 | /* Update PE sessionId*/ |
| 3001 | mlmJoinCnf.sessionId = psessionEntry->peSessionId; |
| 3002 | limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf); |
| 3003 | } // if ((pMac->lim.gLimSystemRole == IBSS.... |
| 3004 | } |
| 3005 | |
| 3006 | /** |
| 3007 | * limExtractApCapabilities() |
| 3008 | * |
| 3009 | *FUNCTION: |
| 3010 | * This function is called to extract all of the AP's capabilities |
| 3011 | * from the IEs received from it in Beacon/Probe Response frames |
| 3012 | * |
| 3013 | *LOGIC: |
| 3014 | * This routine mimics the limExtractApCapability() API. The difference here |
| 3015 | * is that this API returns the entire tSirProbeRespBeacon info as is. It is |
| 3016 | * left to the caller of this API to use this info as required |
| 3017 | * |
| 3018 | *ASSUMPTIONS: |
| 3019 | * NA |
| 3020 | * |
| 3021 | *NOTE: |
| 3022 | * |
| 3023 | * @param pMac Pointer to Global MAC structure |
| 3024 | * @param pIE Pointer to starting IE in Beacon/Probe Response |
| 3025 | * @param ieLen Length of all IEs combined |
| 3026 | * @param beaconStruct A pointer to tSirProbeRespBeacon that needs to be |
| 3027 | * populated |
| 3028 | * @return status A status reporting eSIR_SUCCESS or eSIR_FAILURE |
| 3029 | */ |
| 3030 | tSirRetStatus limExtractApCapabilities( tpAniSirGlobal pMac, |
| 3031 | tANI_U8 *pIE, |
| 3032 | tANI_U16 ieLen, |
| 3033 | tpSirProbeRespBeacon beaconStruct ) |
| 3034 | { |
| 3035 | palZeroMemory( pMac->hHdd, (tANI_U8 *) beaconStruct, sizeof( tSirProbeRespBeacon )); |
| 3036 | |
| 3037 | PELOG3(limLog( pMac, LOG3, |
| 3038 | FL( "In limExtractApCapabilities: The IE's being received are:\n" )); |
| 3039 | sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );) |
| 3040 | |
| 3041 | // Parse the Beacon IE's, Don't try to parse if we dont have anything in IE |
| 3042 | if (ieLen > 0) { |
| 3043 | if( eSIR_SUCCESS != sirParseBeaconIE( pMac, beaconStruct, pIE, (tANI_U32)ieLen )) |
| 3044 | { |
| 3045 | limLog( pMac, LOGE, FL("APCapExtract: Beacon parsing error!\n")); |
| 3046 | return eSIR_FAILURE; |
| 3047 | } |
| 3048 | } |
| 3049 | |
| 3050 | return eSIR_SUCCESS; |
| 3051 | } |
| 3052 | |
| 3053 | |
| 3054 | /** |
| 3055 | * limDelBss() |
| 3056 | * |
| 3057 | *FUNCTION: |
| 3058 | * This function is called to delete BSS context at hardware |
| 3059 | * whenever a STA is disassociated |
| 3060 | * |
| 3061 | *LOGIC: |
| 3062 | * |
| 3063 | *ASSUMPTIONS: |
| 3064 | * NA |
| 3065 | * |
| 3066 | *NOTE: |
| 3067 | * NA |
| 3068 | * |
| 3069 | * @param pMac - Pointer to Global MAC structure |
| 3070 | * @param pStaDs - Pointer to the STA datastructure created by |
| 3071 | * LIM and maintained by DPH |
| 3072 | * @return retCode - Indicates success or failure return code |
| 3073 | */ |
| 3074 | |
| 3075 | tSirRetStatus |
| 3076 | limDelBss(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tANI_U16 bssIdx,tpPESession psessionEntry) |
| 3077 | { |
| 3078 | tpDeleteBssParams pDelBssParams = NULL; |
| 3079 | tSirMsgQ msgQ; |
| 3080 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 3081 | |
| 3082 | if( eHAL_STATUS_SUCCESS != |
| 3083 | palAllocateMemory( pMac->hHdd, (void **) &pDelBssParams, sizeof( tDeleteBssParams ))) |
| 3084 | { |
| 3085 | limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_BSS\n" )); |
| 3086 | return eSIR_MEM_ALLOC_FAILED; |
| 3087 | } |
| 3088 | palZeroMemory( pMac->hHdd, (tANI_U8 *) pDelBssParams, sizeof(tDeleteBssParams)); |
| 3089 | |
| 3090 | |
| 3091 | pDelBssParams->sessionId = psessionEntry->peSessionId; //update PE session Id |
| 3092 | |
| 3093 | //DPH was storing the AssocID in staID field, |
| 3094 | //staID is actually assigned by HAL when AddSTA message is sent. |
| 3095 | if (pStaDs != NULL) |
| 3096 | { |
| 3097 | pDelBssParams->bssIdx= pStaDs->bssId; |
| 3098 | pStaDs->valid = 0; |
| 3099 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE; |
| 3100 | } |
| 3101 | else |
| 3102 | pDelBssParams->bssIdx = bssIdx; |
| 3103 | psessionEntry->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3104 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_BSS_RSP_STATE)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3105 | |
| 3106 | pDelBssParams->status= eHAL_STATUS_SUCCESS; |
| 3107 | pDelBssParams->respReqd = 1; |
| 3108 | PELOGW(limLog( pMac, LOGW, FL("Sending HAL_DELETE_BSS_REQ for BSSID: %X\n"), |
| 3109 | pDelBssParams->bssIdx);) |
| 3110 | |
| 3111 | //we need to defer the message until we get the response back from HAL. |
| 3112 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 3113 | |
| 3114 | msgQ.type = WDA_DELETE_BSS_REQ; |
| 3115 | msgQ.reserved = 0; |
| 3116 | msgQ.bodyptr = pDelBssParams; |
| 3117 | msgQ.bodyval = 0; |
| 3118 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3119 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3120 | |
| 3121 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 3122 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3123 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3124 | limLog( pMac, LOGE, FL("Posting DELETE_BSS_REQ to HAL failed, reason=%X\n"), retCode ); |
| 3125 | palFreeMemory(pMac->hHdd, (void*)pDelBssParams); |
| 3126 | } |
| 3127 | |
| 3128 | return retCode; |
| 3129 | } |
| 3130 | |
| 3131 | |
| 3132 | #ifdef ANI_PRODUCT_TYPE_CLIENT |
| 3133 | |
| 3134 | /** |
| 3135 | * limSendAddBss() |
| 3136 | * |
| 3137 | *FUNCTION: |
| 3138 | * |
| 3139 | *LOGIC: |
| 3140 | * 1) LIM receives eWNI_SME_JOIN_REQ |
| 3141 | * 2) For a valid eWNI_SME_JOIN_REQ, LIM sends |
| 3142 | * SIR_HAL_ADD_BSS_REQ to HAL |
| 3143 | * |
| 3144 | *ASSUMPTIONS: |
| 3145 | * JOIN REQ parameters are saved in pMac->lim.gLimMlmJoinReq |
| 3146 | * ADD BSS parameters can be obtained from two sources: |
| 3147 | * 1) pMac->lim.gLimMlmJoinReq |
| 3148 | * 2) beaconStruct, passed as paramter |
| 3149 | * So, if a reqd parameter is found in bssDescriptions |
| 3150 | * then it is given preference over beaconStruct |
| 3151 | * |
| 3152 | *NOTE: |
| 3153 | * |
| 3154 | * @param pMac Pointer to Global MAC structure |
| 3155 | * pAssocRsp contains the structured assoc/reassoc Response got from AP |
| 3156 | * beaconstruct Has the ProbeRsp/Beacon structured details |
| 3157 | * bssDescription bssDescription passed to PE from the SME |
| 3158 | * @return None |
| 3159 | */ |
| 3160 | |
| 3161 | tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp, |
| 3162 | tpSchBeaconStruct pBeaconStruct, tpSirBssDescription bssDescription, tANI_U8 updateEntry, |
| 3163 | tpPESession psessionEntry) |
| 3164 | |
| 3165 | { |
| 3166 | tSirMsgQ msgQ; |
| 3167 | tpAddBssParams pAddBssParams = NULL; |
| 3168 | tANI_U32 retCode; |
| 3169 | tANI_U8 i; |
| 3170 | tpDphHashNode pStaDs = NULL; |
| 3171 | tANI_U8 chanWidthSupp = 0; |
| 3172 | // Package SIR_HAL_ADD_BSS_REQ message parameters |
| 3173 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, |
| 3174 | (void **) &pAddBssParams, |
| 3175 | sizeof( tAddBssParams ))) |
| 3176 | { |
| 3177 | limLog( pMac, LOGP, |
| 3178 | FL( "Unable to PAL allocate memory during ADD_BSS\n" )); |
| 3179 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 3180 | goto returnFailure; |
| 3181 | } |
| 3182 | else |
| 3183 | palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams )); |
| 3184 | |
| 3185 | palCopyMemory( pMac->hHdd, pAddBssParams->bssId,bssDescription->bssId, |
| 3186 | sizeof( tSirMacAddr )); |
| 3187 | // Fill in tAddBssParams selfMacAddr |
| 3188 | palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, |
| 3189 | psessionEntry->selfMacAddr, |
| 3190 | sizeof( tSirMacAddr )); |
| 3191 | |
| 3192 | if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE) |
| 3193 | { |
| 3194 | pAddBssParams->bssType = eSIR_BTAMP_AP_MODE; |
| 3195 | } |
| 3196 | else |
| 3197 | { |
| 3198 | pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE; |
| 3199 | } |
| 3200 | |
| 3201 | pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA; |
| 3202 | |
| 3203 | /* Update PE session ID */ |
| 3204 | pAddBssParams->sessionId = psessionEntry->peSessionId; |
| 3205 | |
| 3206 | pAddBssParams->beaconInterval = bssDescription->beaconInterval; |
| 3207 | |
| 3208 | pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod; |
| 3209 | pAddBssParams->updateBss = updateEntry; |
| 3210 | |
| 3211 | |
| 3212 | pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount; |
| 3213 | pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod; |
| 3214 | pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration; |
| 3215 | pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining; |
| 3216 | |
| 3217 | pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates; |
| 3218 | palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate, |
| 3219 | pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates ); |
| 3220 | |
| 3221 | pAddBssParams->nwType = bssDescription->nwType; |
| 3222 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3223 | pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3224 | pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist; |
| 3225 | pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist; |
| 3226 | pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist; |
| 3227 | pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist; |
| 3228 | |
| 3229 | |
| 3230 | // Use the advertised capabilities from the received beacon/PR |
| 3231 | |
| 3232 | |
| 3233 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present )) |
| 3234 | { |
| 3235 | pAddBssParams->htCapable = pAssocRsp->HTCaps.present; |
| 3236 | |
| 3237 | if ( pBeaconStruct->HTInfo.present ) |
| 3238 | { |
| 3239 | pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pAssocRsp->HTInfo.opMode; |
| 3240 | pAddBssParams->dualCTSProtection = ( tANI_U8 ) pAssocRsp->HTInfo.dualCTSProtection; |
| 3241 | #ifdef WLAN_SOFTAP_FEATURE |
| 3242 | chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry); |
| 3243 | #else |
| 3244 | chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET); |
| 3245 | #endif |
| 3246 | if( (pAssocRsp->HTCaps.supportedChannelWidthSet) && |
| 3247 | (chanWidthSupp) ) |
| 3248 | { |
| 3249 | pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet; |
| 3250 | pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset; |
| 3251 | } |
| 3252 | else |
| 3253 | { |
| 3254 | pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3255 | pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3256 | } |
| 3257 | pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent; |
| 3258 | pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport; |
| 3259 | pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode; |
| 3260 | } |
| 3261 | } |
| 3262 | |
| 3263 | pAddBssParams->currentOperChannel = bssDescription->channelId; |
| 3264 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3265 | #ifdef WLAN_FEATURE_11AC |
| 3266 | if (psessionEntry->vhtCapability && ( pAssocRsp->VHTCaps.present )) |
| 3267 | { |
| 3268 | pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present; |
| 3269 | pAddBssParams->vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; |
| 3270 | pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac, |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 3271 | pAddBssParams->currentOperChannel, |
| 3272 | pAddBssParams->currentExtChannel, |
| 3273 | psessionEntry->apCenterChan, |
| 3274 | psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3275 | } |
| 3276 | else |
| 3277 | { |
| 3278 | pAddBssParams->vhtCapable = 0; |
| 3279 | } |
| 3280 | #endif |
| 3281 | |
| 3282 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3283 | // Populate the STA-related parameters here |
| 3284 | // Note that the STA here refers to the AP |
| 3285 | { |
| 3286 | /* staType = PEER*/ |
| 3287 | pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA |
| 3288 | |
| 3289 | palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId, |
| 3290 | bssDescription->bssId, |
| 3291 | sizeof( tSirMacAddr )); |
| 3292 | pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval; |
| 3293 | |
| 3294 | /* Fill Assoc id from the dph table */ |
| 3295 | pStaDs = dphLookupHashEntry(pMac, pAddBssParams->staContext.bssId, |
| 3296 | &pAddBssParams->staContext.assocId, &psessionEntry->dph.dphHashTable); |
| 3297 | if (pStaDs == NULL) |
| 3298 | { |
| 3299 | PELOGE(limLog(pMac, LOGE, FL("Couldn't get assoc id for" |
| 3300 | "MAC ADDR: %02x:%02x:%02x:%02x:%02x:%02x"), |
| 3301 | pAddBssParams->staContext.staMac[0], |
| 3302 | pAddBssParams->staContext.staMac[1], |
| 3303 | pAddBssParams->staContext.staMac[2], |
| 3304 | pAddBssParams->staContext.staMac[3], |
| 3305 | pAddBssParams->staContext.staMac[4], |
| 3306 | pAddBssParams->staContext.staMac[5] |
| 3307 | );) |
| 3308 | } |
| 3309 | pAddBssParams->staContext.uAPSD = 0; |
| 3310 | pAddBssParams->staContext.maxSPLen = 0; |
| 3311 | pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble; |
| 3312 | pAddBssParams->staContext.updateSta = updateEntry; |
| 3313 | |
| 3314 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present )) |
| 3315 | { |
| 3316 | pAddBssParams->staContext.us32MaxAmpduDuration = 0; |
| 3317 | pAddBssParams->staContext.htCapable = 1; |
| 3318 | pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField; |
| 3319 | pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection; |
| 3320 | if( (pAssocRsp->HTCaps.supportedChannelWidthSet) && |
| 3321 | (chanWidthSupp) ) |
| 3322 | { |
| 3323 | pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3324 | |
| 3325 | #ifdef WLAN_FEATURE_11AC |
| 3326 | if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present )) |
| 3327 | { |
| 3328 | pAddBssParams->staContext.vhtCapable = 1; |
| 3329 | pAddBssParams->staContext.vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; //pMac->lim.apChanWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 3330 | if ( (pAssocRsp->VHTCaps.suBeamFormerCap || |
| 3331 | pAssocRsp->VHTCaps.muBeamformerCap) && |
| 3332 | psessionEntry->txBFIniFeatureEnabled ) |
| 3333 | { |
| 3334 | pAddBssParams->staContext.vhtTxBFCapable = 1; |
| 3335 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3336 | } |
| 3337 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3338 | } |
| 3339 | else |
| 3340 | { |
| 3341 | pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3342 | } |
| 3343 | pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave; |
| 3344 | pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA; |
| 3345 | pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize; |
| 3346 | pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity; |
| 3347 | pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz; |
| 3348 | pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz; |
| 3349 | pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz; |
| 3350 | pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor; |
Leela V Kiran Kumar Reddy Chirala | b1f7d34 | 2013-02-11 00:27:02 -0800 | [diff] [blame] | 3351 | if( pAddBssParams->staContext.vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP ) |
| 3352 | { |
| 3353 | pAddBssParams->staContext.htLdpcCapable = 0; |
| 3354 | pAddBssParams->staContext.vhtLdpcCapable = 0; |
| 3355 | } |
| 3356 | else |
| 3357 | { |
| 3358 | pAddBssParams->staContext.htLdpcCapable = (tANI_U8)pAssocRsp->HTCaps.advCodingCap; |
| 3359 | pAddBssParams->staContext.vhtLdpcCapable = (tANI_U8)pAssocRsp->VHTCaps.ldpcCodingCap; |
| 3360 | } |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 3361 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3362 | if( pBeaconStruct->HTInfo.present ) |
| 3363 | pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode; |
| 3364 | } |
| 3365 | |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 3366 | //If WMM IE or 802.11E IE is not present and AP is HT AP then enable WMM |
| 3367 | if ((psessionEntry->limWmeEnabled && (pAssocRsp->wmeEdcaPresent || pAddBssParams->htCapable)) || |
| 3368 | (psessionEntry->limQosEnabled && (pAssocRsp->edcaPresent || pAddBssParams->htCapable))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3369 | pAddBssParams->staContext.wmmEnabled = 1; |
| 3370 | else |
| 3371 | pAddBssParams->staContext.wmmEnabled = 0; |
| 3372 | |
| 3373 | //Update the rates |
| 3374 | |
| 3375 | pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 3376 | if (pStaDs != NULL) |
| 3377 | { |
| 3378 | limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry); |
| 3379 | palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddBssParams->staContext.supportedRates, |
| 3380 | (tANI_U8*)&pStaDs->supportedRates, |
| 3381 | sizeof(tSirSupportedRates)); |
| 3382 | } |
| 3383 | else |
| 3384 | PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates.\n"));) |
| 3385 | |
| 3386 | } |
| 3387 | |
| 3388 | //Disable BA. It will be set as part of ADDBA negotiation. |
| 3389 | for( i = 0; i < STACFG_MAX_TC; i++ ) |
| 3390 | { |
| 3391 | pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE; |
| 3392 | pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE; |
| 3393 | pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE; |
| 3394 | pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE; |
| 3395 | } |
| 3396 | |
| 3397 | pAddBssParams->staContext.encryptType = psessionEntry->encryptType; |
| 3398 | |
| 3399 | #if defined WLAN_FEATURE_VOWIFI |
| 3400 | pAddBssParams->maxTxPower = psessionEntry->maxTxPower; |
| 3401 | #endif |
| 3402 | // FIXME_GEN4 - Any other value that can be used for initialization? |
| 3403 | pAddBssParams->status = eHAL_STATUS_SUCCESS; |
| 3404 | pAddBssParams->respReqd = true; |
| 3405 | |
| 3406 | pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona |
| 3407 | |
| 3408 | #ifdef WLAN_FEATURE_P2P |
| 3409 | if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona) |
| 3410 | { |
| 3411 | pAddBssParams->staContext.p2pCapableSta = 1; |
| 3412 | } |
| 3413 | #endif |
| 3414 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3415 | pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled || |
| 3416 | limIsconnectedOnDFSChannel(bssDescription->channelId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3417 | |
| 3418 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3419 | pAddBssParams->extSetStaKeyParamValid = 0; |
| 3420 | #endif |
| 3421 | |
| 3422 | // Set a new state for MLME |
| 3423 | if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState ) |
| 3424 | psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE; |
| 3425 | else |
| 3426 | psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3427 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3428 | |
| 3429 | //we need to defer the message until we get the response back from HAL. |
| 3430 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 3431 | |
| 3432 | msgQ.type = WDA_ADD_BSS_REQ; |
| 3433 | /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/ |
| 3434 | msgQ.reserved = 0; |
| 3435 | msgQ.bodyptr = pAddBssParams; |
| 3436 | msgQ.bodyval = 0; |
| 3437 | |
| 3438 | limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3439 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3440 | |
| 3441 | retCode = wdaPostCtrlMsg( pMac, &msgQ ); |
| 3442 | if( eSIR_SUCCESS != retCode) |
| 3443 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3444 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3445 | palFreeMemory(pMac->hHdd, pAddBssParams); |
| 3446 | limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"), |
| 3447 | retCode ); |
| 3448 | goto returnFailure; |
| 3449 | |
| 3450 | } |
| 3451 | else |
| 3452 | return retCode; |
| 3453 | |
| 3454 | returnFailure: |
| 3455 | // Clean-up will be done by the caller... |
| 3456 | return retCode; |
| 3457 | } |
| 3458 | |
| 3459 | |
| 3460 | |
| 3461 | |
| 3462 | tSirRetStatus limStaSendAddBssPreAssoc( tpAniSirGlobal pMac, tANI_U8 updateEntry, tpPESession psessionEntry) |
| 3463 | { |
| 3464 | tSirMsgQ msgQ; |
| 3465 | tpAddBssParams pAddBssParams = NULL; |
| 3466 | tANI_U32 retCode; |
| 3467 | tANI_U8 i; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3468 | tSchBeaconStruct *pBeaconStruct; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3469 | tANI_U8 chanWidthSupp = 0; |
| 3470 | tpSirBssDescription bssDescription = &psessionEntry->pLimJoinReq->bssDescription; |
| 3471 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3472 | if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, |
| 3473 | (void **)&pBeaconStruct, sizeof(tSchBeaconStruct))) |
| 3474 | { |
| 3475 | limLog(pMac, LOGE, FL("Unable to PAL allocate memory during ADD_BSS\n") ); |
| 3476 | return eSIR_MEM_ALLOC_FAILED; |
| 3477 | } |
| 3478 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3479 | |
| 3480 | // Package SIR_HAL_ADD_BSS_REQ message parameters |
| 3481 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, |
| 3482 | (void **) &pAddBssParams, |
| 3483 | sizeof( tAddBssParams ))) |
| 3484 | { |
| 3485 | limLog( pMac, LOGP, |
| 3486 | FL( "Unable to PAL allocate memory during ADD_BSS\n" )); |
| 3487 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 3488 | goto returnFailure; |
| 3489 | } |
| 3490 | |
| 3491 | palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams )); |
| 3492 | |
| 3493 | |
| 3494 | limExtractApCapabilities( pMac, |
| 3495 | (tANI_U8 *) bssDescription->ieFields, |
| 3496 | limGetIElenFromBssDescription( bssDescription ), |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3497 | pBeaconStruct ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3498 | |
| 3499 | if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3500 | limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3501 | palCopyMemory( pMac->hHdd, pAddBssParams->bssId,bssDescription->bssId, |
| 3502 | sizeof( tSirMacAddr )); |
| 3503 | |
| 3504 | // Fill in tAddBssParams selfMacAddr |
| 3505 | palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, |
| 3506 | psessionEntry->selfMacAddr, |
| 3507 | sizeof( tSirMacAddr )); |
| 3508 | |
| 3509 | /* Incorrect BSS Type which caused UMA Descriptor to be overwritten on |
| 3510 | * top of an already established Infra link. This lead to issues in |
| 3511 | * concurrent data transfer. |
| 3512 | */ |
| 3513 | |
| 3514 | pAddBssParams->bssType = psessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE; |
| 3515 | pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA; |
| 3516 | |
| 3517 | pAddBssParams->beaconInterval = bssDescription->beaconInterval; |
| 3518 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3519 | pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3520 | pAddBssParams->updateBss = updateEntry; |
| 3521 | |
| 3522 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3523 | pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount; |
| 3524 | pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod; |
| 3525 | pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration; |
| 3526 | pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3527 | |
| 3528 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3529 | pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3530 | palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3531 | pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3532 | |
| 3533 | pAddBssParams->nwType = bssDescription->nwType; |
| 3534 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3535 | pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3536 | pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist; |
| 3537 | pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist; |
| 3538 | pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist; |
| 3539 | pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist; |
| 3540 | |
| 3541 | // Use the advertised capabilities from the received beacon/PR |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3542 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3543 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3544 | pAddBssParams->htCapable = pBeaconStruct->HTCaps.present; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3545 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3546 | if ( pBeaconStruct->HTInfo.present ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3547 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3548 | pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode; |
| 3549 | pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3550 | |
| 3551 | #ifdef WLAN_SOFTAP_FEATURE |
| 3552 | chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry); |
| 3553 | #else |
| 3554 | chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET); |
| 3555 | #endif |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3556 | if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3557 | (chanWidthSupp) ) |
| 3558 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3559 | pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet; |
| 3560 | pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3561 | } |
| 3562 | else |
| 3563 | { |
| 3564 | pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3565 | pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3566 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3567 | pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent; |
| 3568 | pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport; |
| 3569 | pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3570 | } |
| 3571 | } |
| 3572 | |
| 3573 | pAddBssParams->currentOperChannel = bssDescription->channelId; |
| 3574 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3575 | #ifdef WLAN_FEATURE_11AC |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3576 | if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present )) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3577 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3578 | pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present; |
| 3579 | pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 3580 | pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac, |
| 3581 | pAddBssParams->currentOperChannel, |
| 3582 | pAddBssParams->currentExtChannel, |
| 3583 | psessionEntry->apCenterChan, |
| 3584 | psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3585 | } |
| 3586 | else |
| 3587 | { |
| 3588 | pAddBssParams->vhtCapable = 0; |
| 3589 | } |
| 3590 | #endif |
| 3591 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3592 | // Populate the STA-related parameters here |
| 3593 | // Note that the STA here refers to the AP |
| 3594 | { |
| 3595 | pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA |
| 3596 | |
| 3597 | palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId, |
| 3598 | bssDescription->bssId, |
| 3599 | sizeof( tSirMacAddr )); |
| 3600 | pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval; |
| 3601 | |
| 3602 | pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this? |
| 3603 | pAddBssParams->staContext.uAPSD = 0; |
| 3604 | pAddBssParams->staContext.maxSPLen = 0; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3605 | pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3606 | pAddBssParams->staContext.updateSta = updateEntry; |
| 3607 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3608 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3609 | { |
| 3610 | pAddBssParams->staContext.us32MaxAmpduDuration = 0; |
| 3611 | pAddBssParams->staContext.htCapable = 1; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3612 | pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField; |
| 3613 | pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection; |
| 3614 | if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3615 | (chanWidthSupp) ) |
| 3616 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3617 | pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3618 | #ifdef WLAN_FEATURE_11AC |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3619 | if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present )) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3620 | { |
| 3621 | pAddBssParams->staContext.vhtCapable = 1; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3622 | pAddBssParams->staContext.vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 3623 | if ((pBeaconStruct->VHTCaps.suBeamFormerCap || |
| 3624 | pBeaconStruct->VHTCaps.muBeamformerCap) && |
| 3625 | psessionEntry->txBFIniFeatureEnabled ) |
| 3626 | { |
| 3627 | pAddBssParams->staContext.vhtTxBFCapable = 1; |
| 3628 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3629 | } |
| 3630 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3631 | } |
| 3632 | else |
| 3633 | { |
| 3634 | pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3635 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3636 | pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave; |
| 3637 | pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA; |
| 3638 | pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize; |
| 3639 | pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity; |
| 3640 | pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz; |
| 3641 | pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz; |
| 3642 | pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz; |
| 3643 | pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor; |
Leela V Kiran Kumar Reddy Chirala | b1f7d34 | 2013-02-11 00:27:02 -0800 | [diff] [blame] | 3644 | if( pAddBssParams->staContext.vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP ) |
| 3645 | { |
| 3646 | pAddBssParams->staContext.htLdpcCapable = 0; |
| 3647 | pAddBssParams->staContext.vhtLdpcCapable = 0; |
| 3648 | } |
| 3649 | else |
| 3650 | { |
| 3651 | pAddBssParams->staContext.htLdpcCapable = (tANI_U8)pBeaconStruct->HTCaps.advCodingCap; |
| 3652 | pAddBssParams->staContext.vhtLdpcCapable = (tANI_U8)pBeaconStruct->VHTCaps.ldpcCodingCap; |
| 3653 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3654 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3655 | if( pBeaconStruct->HTInfo.present ) |
| 3656 | pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3657 | } |
| 3658 | |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 3659 | //If WMM IE or 802.11E IE is not present and AP is HT AP then enable WMM |
| 3660 | if ((psessionEntry->limWmeEnabled && (pBeaconStruct->wmeEdcaPresent || pAddBssParams->staContext.htCapable)) || |
| 3661 | (psessionEntry->limQosEnabled && (pBeaconStruct->edcaPresent || pAddBssParams->staContext.htCapable))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3662 | pAddBssParams->staContext.wmmEnabled = 1; |
| 3663 | else |
| 3664 | pAddBssParams->staContext.wmmEnabled = 0; |
| 3665 | |
| 3666 | //Update the rates |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3667 | #ifdef WLAN_FEATURE_11AC |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3668 | limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3669 | pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry, |
| 3670 | &pBeaconStruct->VHTCaps); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3671 | #else |
| 3672 | limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3673 | pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3674 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3675 | limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,psessionEntry); |
| 3676 | |
| 3677 | } |
| 3678 | |
| 3679 | |
| 3680 | //Disable BA. It will be set as part of ADDBA negotiation. |
| 3681 | for( i = 0; i < STACFG_MAX_TC; i++ ) |
| 3682 | { |
| 3683 | pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE; |
| 3684 | pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE; |
| 3685 | pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE; |
| 3686 | pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE; |
| 3687 | } |
| 3688 | |
| 3689 | pAddBssParams->staContext.encryptType = psessionEntry->encryptType; |
| 3690 | |
| 3691 | #if defined WLAN_FEATURE_VOWIFI |
| 3692 | pAddBssParams->maxTxPower = psessionEntry->maxTxPower; |
| 3693 | #endif |
| 3694 | |
| 3695 | pAddBssParams->status = eHAL_STATUS_SUCCESS; |
| 3696 | pAddBssParams->respReqd = true; |
| 3697 | |
| 3698 | pAddBssParams->staContext.sessionId = psessionEntry->peSessionId; |
| 3699 | pAddBssParams->sessionId = psessionEntry->peSessionId; |
| 3700 | |
| 3701 | pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona |
| 3702 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3703 | pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled || |
| 3704 | limIsconnectedOnDFSChannel(bssDescription->channelId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3705 | |
| 3706 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3707 | pAddBssParams->extSetStaKeyParamValid = 0; |
| 3708 | #endif |
| 3709 | |
| 3710 | // Set a new state for MLME |
| 3711 | |
| 3712 | //pMac->lim.gLimMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE; |
| 3713 | psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE; |
| 3714 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3715 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3716 | |
| 3717 | //we need to defer the message until we get the response back from HAL. |
| 3718 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 3719 | |
| 3720 | msgQ.type = WDA_ADD_BSS_REQ; |
| 3721 | /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/ |
| 3722 | msgQ.reserved = 0; |
| 3723 | msgQ.bodyptr = pAddBssParams; |
| 3724 | msgQ.bodyval = 0; |
| 3725 | |
| 3726 | limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3727 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3728 | |
| 3729 | retCode = wdaPostCtrlMsg( pMac, &msgQ ); |
| 3730 | if( eSIR_SUCCESS != retCode) |
| 3731 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3732 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3733 | palFreeMemory(pMac->hHdd, pAddBssParams); |
| 3734 | limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"), |
| 3735 | retCode ); |
| 3736 | goto returnFailure; |
| 3737 | |
| 3738 | } |
| 3739 | else |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3740 | { |
| 3741 | palFreeMemory(pMac->hHdd, pBeaconStruct); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3742 | return retCode; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3743 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3744 | |
| 3745 | returnFailure: |
| 3746 | // Clean-up will be done by the caller... |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3747 | palFreeMemory(pMac->hHdd, pBeaconStruct); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3748 | return retCode; |
| 3749 | } |
| 3750 | |
| 3751 | |
| 3752 | |
| 3753 | |
| 3754 | |
| 3755 | #elif defined(ANI_AP_CLIENT_SDK) |
| 3756 | tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp, |
| 3757 | tpSirNeighborBssInfo neighborBssInfo, tANI_U8 updateEntry, |
| 3758 | tpPESession psessionEntry) |
| 3759 | { |
| 3760 | tSirMsgQ msgQ; |
| 3761 | tpAddBssParams pAddBssParams = NULL; |
| 3762 | tANI_U32 retCode; |
| 3763 | tANI_U8 i; |
| 3764 | tpDphHashNode pStaDs = NULL; |
| 3765 | |
| 3766 | // Package SIR_HAL_ADD_BSS_REQ message parameters |
| 3767 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, |
| 3768 | (void **) &pAddBssParams, |
| 3769 | sizeof( tAddBssParams ))) |
| 3770 | { |
| 3771 | limLog( pMac, LOGP, |
| 3772 | FL( "Unable to PAL allocate memory during ADD_BSS\n" )); |
| 3773 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 3774 | goto returnFailure; |
| 3775 | } |
| 3776 | else |
| 3777 | palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams )); |
| 3778 | |
| 3779 | palCopyMemory( pMac->hHdd, pAddBssParams->bssId,neighborBssInfo->bssId, |
| 3780 | sizeof( tSirMacAddr )); |
| 3781 | |
| 3782 | #ifdef WLAN_SOFTAP_FEATURE |
| 3783 | // Fill in tAddBssParams selfMacAddr |
| 3784 | palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, psessionEntry->selfMacAddr, |
| 3785 | sizeof( tSirMacAddr )); |
| 3786 | #endif |
| 3787 | |
| 3788 | pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE; |
| 3789 | pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA; |
| 3790 | pAddBssParams->beaconInterval = (tANI_U16) neighborBssInfo->beaconInterval; |
| 3791 | pAddBssParams->dtimPeriod = neighborBssInfo->dtimPeriod; |
| 3792 | pAddBssParams->updateBss = updateEntry; |
| 3793 | |
| 3794 | |
| 3795 | /* The following parameters are commented since the information is not available from the |
| 3796 | * neighborBssInfo. This needs to be fixed later */ |
| 3797 | #if 0 |
| 3798 | |
| 3799 | pAddBssParams->cfParamSet.cfpCount = beaconStruct.cfParamSet.cfpCount; |
| 3800 | pAddBssParams->cfParamSet.cfpPeriod = beaconStruct.cfParamSet.cfpPeriod; |
| 3801 | pAddBssParams->cfParamSet.cfpMaxDuration = beaconStruct.cfParamSet.cfpMaxDuration; |
| 3802 | pAddBssParams->cfParamSet.cfpDurRemaining = beaconStruct.cfParamSet.cfpDurRemaining; |
| 3803 | #endif |
| 3804 | pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates; |
| 3805 | palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate, |
| 3806 | pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates ); |
| 3807 | |
| 3808 | /* Update PE session ID */ |
| 3809 | pAddBssParams->sessionId = psessionEntry->peSessionId; |
| 3810 | |
| 3811 | pAddBssParams->nwType = neighborBssInfo->nwType; |
| 3812 | |
| 3813 | pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime; |
| 3814 | pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist; |
| 3815 | pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist; |
| 3816 | pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist; |
| 3817 | pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist; |
| 3818 | |
| 3819 | // Use the advertised capabilities from the received beacon/PR |
| 3820 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( neighborBssInfo->HTCapsPresent )) |
| 3821 | { |
| 3822 | pAddBssParams->htCapable = pAssocRsp->HTCaps.present; |
| 3823 | |
| 3824 | if ( neighborBssInfo->HTInfoPresent ) |
| 3825 | { |
| 3826 | pAddBssParams->htOperMode = pAssocRsp->HTInfo.opMode; |
| 3827 | pAddBssParams->dualCTSProtection = ( tANI_U8 )pAssocRsp->HTInfo.dualCTSProtection; |
| 3828 | |
| 3829 | if(pAssocRsp->HTCaps.supportedChannelWidthSet) |
| 3830 | { |
| 3831 | pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet; |
| 3832 | pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset; |
| 3833 | } |
| 3834 | else |
| 3835 | { |
| 3836 | pAddBssParams->txChannelWidthSet = (tANI_U8)pAssocRsp->HTCaps.supportedChannelWidthSet; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3837 | pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3838 | } |
| 3839 | pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent; |
| 3840 | pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport; |
| 3841 | pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode; |
| 3842 | } |
| 3843 | } |
| 3844 | |
| 3845 | pAddBssParams->currentOperChannel = neighborBssInfo->channelId; |
| 3846 | |
| 3847 | // Populate the STA-related parameters here |
| 3848 | // Note that the STA here refers to the AP |
| 3849 | { |
| 3850 | pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA |
| 3851 | |
| 3852 | palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId, |
| 3853 | neighborBssInfo->bssId, |
| 3854 | sizeof( tSirMacAddr )); |
| 3855 | pAddBssParams->staContext.listenInterval = (tANI_U8) neighborBssInfo->beaconInterval; |
| 3856 | |
| 3857 | pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this? |
| 3858 | pAddBssParams->staContext.uAPSD = 0; |
| 3859 | pAddBssParams->staContext.maxSPLen = 0; |
| 3860 | pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble; |
| 3861 | pAddBssParams->staContext.updateSta = updateEntry; |
| 3862 | |
| 3863 | |
| 3864 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present )) |
| 3865 | { |
| 3866 | pAddBssParams->staContext.us32MaxAmpduDuration = 0; |
| 3867 | pAddBssParams->staContext.htCapable = 1; |
| 3868 | pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField; |
| 3869 | pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection; |
| 3870 | pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )(pAssocRsp->HTCaps.supportedChannelWidthSet ? |
| 3871 | pAssocRsp->HTInfo.recommendedTxWidthSet : |
| 3872 | pAssocRsp->HTCaps.supportedChannelWidthSet ); |
| 3873 | pAddBssParams->staContext.mimoPS = pAssocRsp->HTCaps.mimoPowerSave; |
| 3874 | pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA; |
| 3875 | pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize; |
| 3876 | pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity; |
| 3877 | pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz; |
| 3878 | pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz; |
| 3879 | pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz; |
| 3880 | pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor; |
| 3881 | |
| 3882 | if( pAssocRsp->HTInfo.present ) |
| 3883 | pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode; |
| 3884 | } |
| 3885 | |
| 3886 | if ((psessionEntry->limWmeEnabled && pAssocRsp->wmeEdcaPresent) || |
| 3887 | (psessionEntry->limQosEnabled && pAssocRsp->edcaPresent)) |
| 3888 | pAddBssParams->staContext.wmmEnabled = 1; |
| 3889 | else |
| 3890 | pAddBssParams->staContext.wmmEnabled = 0; |
| 3891 | |
| 3892 | //Update the rates |
| 3893 | |
| 3894 | pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 3895 | if (pStaDs != NULL) |
| 3896 | { |
| 3897 | limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry); |
| 3898 | palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddBssParams->staContext.supportedRates, |
| 3899 | (tANI_U8*)&pStaDs->supportedRates, |
| 3900 | sizeof(tSirSupportedRates)); |
| 3901 | } |
| 3902 | else |
| 3903 | PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates.\n"));) |
| 3904 | |
| 3905 | } |
| 3906 | |
| 3907 | //Disable BA. It will be set as part of ADDBA negotiation. |
| 3908 | for( i = 0; i < SMAC_STACFG_MAX_TC; i++ ) |
| 3909 | { |
| 3910 | pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE; |
| 3911 | pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE; |
| 3912 | pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE; |
| 3913 | pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE; |
| 3914 | } |
| 3915 | |
| 3916 | #if defined WLAN_FEATURE_VOWIFI |
| 3917 | pAddBssParams->maxTxPower = psessionEntry->maxTxPower; |
| 3918 | #endif |
| 3919 | // FIXME_GEN4 - Any other value that can be used for initialization? |
| 3920 | pAddBssParams->status = eHAL_STATUS_SUCCESS; |
| 3921 | pAddBssParams->respReqd = true; |
| 3922 | |
| 3923 | pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona |
| 3924 | |
| 3925 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3926 | pAddBssParams->extSetStaKeyParamValid = 0; |
| 3927 | #endif |
| 3928 | |
| 3929 | // Set a new state for MLME |
| 3930 | if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState ) |
| 3931 | psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE; |
| 3932 | else |
| 3933 | psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3934 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3935 | |
| 3936 | //we need to defer the message until we get the response back from HAL. |
| 3937 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 3938 | |
| 3939 | msgQ.type = SIR_HAL_ADD_BSS_REQ; |
| 3940 | /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/ |
| 3941 | msgQ.reserved = 0; |
| 3942 | msgQ.bodyptr = pAddBssParams; |
| 3943 | msgQ.bodyval = 0; |
| 3944 | |
| 3945 | limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3946 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3947 | |
| 3948 | retCode = halPostMsgApi( pMac, &msgQ ); |
| 3949 | if( eSIR_SUCCESS != retCode) |
| 3950 | { |
| 3951 | palFreeMemory(pMac->hHdd, pAddBssParams); |
| 3952 | limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"), |
| 3953 | retCode ); |
| 3954 | } |
| 3955 | else |
| 3956 | return retCode; |
| 3957 | |
| 3958 | returnFailure: |
| 3959 | // Clean-up will be done by the caller... |
| 3960 | return retCode; |
| 3961 | } |
| 3962 | |
| 3963 | #endif // ANI_PRODUCT_TYPE_CLIENT |
| 3964 | |
| 3965 | /** ------------------------------------------------------------- |
| 3966 | \fn limPrepareAndSendDelStaCnf |
| 3967 | \brief deletes DPH entry |
| 3968 | changes the MLM mode for station. |
| 3969 | calls limSendDelStaCnf |
| 3970 | \param tpAniSirGlobal pMac |
| 3971 | \param tpDphHashNode pStaDs |
| 3972 | \return none |
| 3973 | -------------------------------------------------------------*/ |
| 3974 | |
| 3975 | |
| 3976 | void |
| 3977 | limPrepareAndSendDelStaCnf(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tSirResultCodes statusCode,tpPESession psessionEntry) |
| 3978 | { |
| 3979 | tANI_U16 staDsAssocId = 0; |
| 3980 | tSirMacAddr staDsAddr; |
| 3981 | tLimMlmStaContext mlmStaContext; |
| 3982 | |
| 3983 | if(pStaDs == NULL) |
| 3984 | { |
| 3985 | PELOGW(limLog(pMac, LOGW, FL("pStaDs is NULL\n"));) |
| 3986 | return; |
| 3987 | } |
| 3988 | staDsAssocId = pStaDs->assocId; |
| 3989 | palCopyMemory( pMac->hHdd, (tANI_U8 *)staDsAddr, |
| 3990 | pStaDs->staAddr, |
| 3991 | sizeof(tSirMacAddr)); |
| 3992 | |
| 3993 | mlmStaContext = pStaDs->mlmStaContext; |
| 3994 | if(eSIR_SME_SUCCESS == statusCode) |
| 3995 | { |
| 3996 | if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) || |
| 3997 | (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) |
| 3998 | { |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 3999 | limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4000 | } |
| 4001 | |
| 4002 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry); |
| 4003 | } |
| 4004 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) |
| 4005 | { |
| 4006 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4007 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4008 | } |
| 4009 | |
| 4010 | limSendDelStaCnf(pMac, staDsAddr, staDsAssocId, mlmStaContext, statusCode,psessionEntry); |
| 4011 | } |
| 4012 | |
| 4013 | /** ------------------------------------------------------------- |
| 4014 | \fn limGetStaRateMode |
| 4015 | \brief Gets the Station Rate Mode. |
| 4016 | \param tANI_U8 dot11Mode |
| 4017 | \return none |
| 4018 | -------------------------------------------------------------*/ |
| 4019 | tStaRateMode limGetStaRateMode(tANI_U8 dot11Mode) |
| 4020 | { |
| 4021 | switch(dot11Mode) |
| 4022 | { |
| 4023 | case WNI_CFG_DOT11_MODE_11A: |
| 4024 | return eSTA_11a; |
| 4025 | case WNI_CFG_DOT11_MODE_11B: |
| 4026 | return eSTA_11b; |
| 4027 | case WNI_CFG_DOT11_MODE_11G: |
| 4028 | return eSTA_11bg; |
| 4029 | case WNI_CFG_DOT11_MODE_11N: |
| 4030 | return eSTA_11n; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4031 | #ifdef WLAN_FEATURE_11AC |
| 4032 | case WNI_CFG_DOT11_MODE_11AC: |
| 4033 | return eSTA_11ac; |
| 4034 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4035 | case WNI_CFG_DOT11_MODE_ALL: |
| 4036 | default: |
| 4037 | return eSTA_11n; |
| 4038 | |
| 4039 | } |
| 4040 | } |
| 4041 | |
| 4042 | /** ------------------------------------------------------------- |
| 4043 | \fn limInitPreAuthTimerTable |
| 4044 | \brief Initialize the Pre Auth Tanle and creates the timer for |
| 4045 | each node for the timeout value got from cfg. |
| 4046 | \param tpAniSirGlobal pMac |
| 4047 | \param tpLimPreAuthTable pPreAuthTimerTable |
| 4048 | \return none |
| 4049 | -------------------------------------------------------------*/ |
| 4050 | void limInitPreAuthTimerTable(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable) |
| 4051 | { |
| 4052 | tANI_U32 cfgValue; |
| 4053 | tANI_U32 authNodeIdx; |
| 4054 | tpLimPreAuthNode pAuthNode = pPreAuthTimerTable->pTable; |
| 4055 | |
| 4056 | // Get AUTH_RSP Timers value |
| 4057 | |
| 4058 | if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT, |
| 4059 | &cfgValue) != eSIR_SUCCESS) |
| 4060 | { |
| 4061 | /* |
| 4062 | ** Could not get AUTH_RSP timeout value |
| 4063 | ** from CFG. Log error. |
| 4064 | **/ |
| 4065 | limLog(pMac, LOGP, |
| 4066 | FL("could not retrieve AUTH_RSP timeout value\n")); |
| 4067 | return; |
| 4068 | } |
| 4069 | |
| 4070 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 4071 | for(authNodeIdx=0; authNodeIdx<pPreAuthTimerTable->numEntry; authNodeIdx++, pAuthNode++) |
| 4072 | { |
| 4073 | if (tx_timer_create(&pAuthNode->timer, |
| 4074 | "AUTH RESPONSE TIMEOUT", |
| 4075 | limAuthResponseTimerHandler, |
| 4076 | authNodeIdx, |
| 4077 | cfgValue, |
| 4078 | 0, |
| 4079 | TX_NO_ACTIVATE) != TX_SUCCESS) |
| 4080 | { |
| 4081 | // Cannot create timer. Log error. |
| 4082 | limLog(pMac, LOGP, FL("Cannot create Auth Rsp timer of Index :%d.\n"), authNodeIdx); |
| 4083 | return; |
| 4084 | } |
| 4085 | pAuthNode->authNodeIdx = (tANI_U8)authNodeIdx; |
| 4086 | pAuthNode->fFree = 1; |
| 4087 | } |
| 4088 | |
| 4089 | } |
| 4090 | |
| 4091 | /** ------------------------------------------------------------- |
| 4092 | \fn limAcquireFreePreAuthNode |
| 4093 | \brief Retrives a free Pre Auth node from Pre Auth Table. |
| 4094 | \param tpAniSirGlobal pMac |
| 4095 | \param tpLimPreAuthTable pPreAuthTimerTable |
| 4096 | \return none |
| 4097 | -------------------------------------------------------------*/ |
| 4098 | tLimPreAuthNode * limAcquireFreePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable) |
| 4099 | { |
| 4100 | tANI_U32 i; |
| 4101 | tLimPreAuthNode *pTempNode = pPreAuthTimerTable->pTable; |
| 4102 | for (i=0; i<pPreAuthTimerTable->numEntry; i++,pTempNode++) |
| 4103 | { |
| 4104 | if (pTempNode->fFree == 1) |
| 4105 | { |
| 4106 | pTempNode->fFree = 0; |
| 4107 | return pTempNode; |
| 4108 | } |
| 4109 | } |
| 4110 | |
| 4111 | return NULL; |
| 4112 | } |
| 4113 | |
| 4114 | /** ------------------------------------------------------------- |
| 4115 | \fn limGetPreAuthNodeFromIndex |
| 4116 | \brief Depending on the Index this retrives the pre auth node. |
| 4117 | \param tpAniSirGlobal pMac |
| 4118 | \param tpLimPreAuthTable pAuthTable |
| 4119 | \param tANI_U32 authNodeIdx |
| 4120 | \return none |
| 4121 | -------------------------------------------------------------*/ |
| 4122 | tLimPreAuthNode * limGetPreAuthNodeFromIndex(tpAniSirGlobal pMac, |
| 4123 | tpLimPreAuthTable pAuthTable, tANI_U32 authNodeIdx) |
| 4124 | { |
| 4125 | if ((authNodeIdx >= pAuthTable->numEntry) || (pAuthTable->pTable == NULL)) |
| 4126 | { |
| 4127 | limLog(pMac, LOGE, FL("Invalid Auth Timer Index : %d NumEntry : %d\n"), |
| 4128 | authNodeIdx, pAuthTable->numEntry); |
| 4129 | return NULL; |
| 4130 | } |
| 4131 | |
| 4132 | return pAuthTable->pTable + authNodeIdx; |
| 4133 | } |
| 4134 | |
| 4135 | /* Util API to check if the channels supported by STA is within range */ |
| 4136 | tSirRetStatus limIsDot11hSupportedChannelsValid(tpAniSirGlobal pMac, tSirAssocReq *assoc) |
| 4137 | { |
| 4138 | /* |
| 4139 | * Allow all the stations to join with us. |
| 4140 | * 802.11h-2003 11.6.1 => An AP may use the supported channels list for associated STAs |
| 4141 | * as an input into an algorithm used to select a new channel for the BSS. |
| 4142 | * The specification of the algorithm is beyond the scope of this amendment. |
| 4143 | */ |
| 4144 | |
| 4145 | return (eSIR_SUCCESS); |
| 4146 | } |
| 4147 | |
| 4148 | /* Util API to check if the txpower supported by STA is within range */ |
| 4149 | tSirRetStatus limIsDot11hPowerCapabilitiesInRange(tpAniSirGlobal pMac, tSirAssocReq *assoc,tpPESession psessionEntry) |
| 4150 | { |
| 4151 | tPowerdBm localMaxTxPower; |
| 4152 | tANI_U32 localPwrConstraint; |
| 4153 | |
| 4154 | localMaxTxPower = cfgGetRegulatoryMaxTransmitPower(pMac, psessionEntry->currentOperChannel); |
| 4155 | |
| 4156 | if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) { |
| 4157 | limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg\n" )); |
| 4158 | return eSIR_FAILURE; |
| 4159 | } |
| 4160 | localMaxTxPower -= (tPowerdBm)localPwrConstraint; |
| 4161 | |
| 4162 | /** |
| 4163 | * The min Tx Power of the associating station should not be greater than (regulatory |
| 4164 | * max tx power - local power constraint configured on AP). |
| 4165 | */ |
| 4166 | if(assoc->powerCapability.minTxPower > localMaxTxPower) |
| 4167 | { |
| 4168 | limLog(pMac, LOGW, FL("minTxPower (STA) = %d, localMaxTxPower (AP) = %d\n"), |
| 4169 | assoc->powerCapability.minTxPower, localMaxTxPower); |
| 4170 | return (eSIR_FAILURE); |
| 4171 | } |
| 4172 | |
| 4173 | return (eSIR_SUCCESS); |
| 4174 | } |
| 4175 | |
| 4176 | /** ------------------------------------------------------------- |
| 4177 | \fn limFillRxHighestSupportedRate |
| 4178 | \brief Fills in the Rx Highest Supported Data Rate field from |
| 4179 | \ the 'supported MCS set' field in HT capability element. |
| 4180 | \param tpAniSirGlobal pMac |
| 4181 | \param tpSirSupportedRates pRates |
| 4182 | \param tANI_U8* pSupportedMCSSet |
| 4183 | \return none |
| 4184 | -------------------------------------------------------------*/ |
| 4185 | void limFillRxHighestSupportedRate(tpAniSirGlobal pMac, tANI_U16 *rxHighestRate, tANI_U8* pSupportedMCSSet) |
| 4186 | { |
| 4187 | tSirMacRxHighestSupportRate *pRxHighestRate; |
| 4188 | tANI_U8 *pBuf; |
| 4189 | tANI_U16 rate=0; |
| 4190 | |
| 4191 | pBuf = pSupportedMCSSet + MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET; |
| 4192 | rate = limGetU16(pBuf); |
| 4193 | |
| 4194 | pRxHighestRate = (tSirMacRxHighestSupportRate *) &rate; |
| 4195 | *rxHighestRate = pRxHighestRate->rate; |
| 4196 | |
| 4197 | return; |
| 4198 | } |