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