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