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