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