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