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