blob: 9f12869adb439c95ef6835f2a47956c7683e93ac [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Edhar, Mahesh Kumar0d82c212015-02-03 17:47:16 +05302 * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
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 Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
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 Nakkala92f07d82013-01-08 21:16:34 -080028/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * 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 Dash6f438272015-03-03 18:01:06 +053045#include "wniCfg.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070046#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 */
68void
69limFillSupportedRatesInfo(
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
105tANI_U8
106limCmpSSid(tpAniSirGlobal pMac, tSirMacSSid *prxSSid,tpPESession psessionEntry)
107{
108
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530109 if (vos_mem_compare((tANI_U8* ) prxSSid, (tANI_U8 *) &psessionEntry->ssId,
110 (tANI_U8) (psessionEntry->ssId.length + 1)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700111 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
142tANI_U8
143limCompareCapabilities(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 Singhdcbd8272014-01-09 14:16:01 +0530155 limLog(pMac, LOG1,FL("Requesting STA asserting IBSS capability"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700156 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 Singhdcbd8272014-01-09 14:16:01 +0530164 limLog(pMac, LOG1,FL(" AP does not support PCF functionality"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700165 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 Shahbc35fb72013-12-12 18:14:06 +0530182
183 // Allowing a STA requesting short preamble while
184 // AP does not support it
Jeff Johnson295189b2012-06-20 16:38:30 -0700185#if 0
186 // AP does not support short preamable
187 return false;
188#endif
189 }
190
191
Nirav Shahbc35fb72013-12-12 18:14:06 +0530192 limLog(pMac, LOG1, "QoS in AssocReq: %d, local capabs qos: %d",
Jeff Johnson295189b2012-06-20 16:38:30 -0700193 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 Shahbc35fb72013-12-12 18:14:06 +0530204 limLog(pMac, LOG1, FL("Received unmatched QOS but cfg to suppress"
205 " - continuing"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700206 }
207 else
208 {
209 // AP does not support QoS capability
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530210 limLog(pMac, LOG1,FL("AP does not support QoS capability"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700211 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 Lokere80007262013-03-18 19:45:50 -0700227 limLog(pMac, LOGP, FL("error getting WNI_CFG_FORCE_SHORT_SLOT_ASSOC_ONLY "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700228 return false;
229 }
230 if(val)
231 {
232 if (pAssocReq->capabilityInfo.shortSlotTime != pLocalCapabs->shortSlotTime)
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530233 {
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 Johnson295189b2012-06-20 16:38:30 -0700239 }
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
269tANI_U8
270limCheckRxBasicRates(tpAniSirGlobal pMac, tSirMacRateSet rxRateSet,tpPESession psessionEntry)
271{
272 tSirMacRateSet *pRateSet, basicRate;
273 tANI_U8 i, j, k, match;
274
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530275 pRateSet = vos_mem_malloc(sizeof(tSirMacRateSet));
276 if (NULL == pRateSet)
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530278 limLog(pMac, LOGP, FL("call to AllocateMemory failed for RATESET"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700279
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 Lokere80007262013-03-18 19:45:50 -0700290 limLog(pMac, LOGP, FL("could not retrieve Operational rateset"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700291
292 // Free up memory allocated for rateset
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530293 vos_mem_free((tANI_U8 *) pRateSet);
Jeff Johnson295189b2012-06-20 16:38:30 -0700294
295 return false;
296 }
297 #endif //TO SUPPORT BT-AMP
298
299 /* Copy operational rate set from session Entry */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530300 vos_mem_copy(pRateSet->rate, (psessionEntry->rateSet.rate),
301 psessionEntry->rateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700302
303 pRateSet->numRates = psessionEntry->rateSet.numRates;
304
305 // Extract BSS basic rateset from operational rateset
Kiran Kumar Lokerea328bcd2013-04-22 22:02:05 -0700306 for (i = 0, j = 0; ((i < pRateSet->numRates) && (i < SIR_MAC_RATESET_EID_MAX)) ; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 {
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 Sonia75019a2013-05-01 01:08:22 -0700322 for (i = 0; ((i < rxRateSet.numRates) && (i < SIR_MAC_RATESET_EID_MAX)); i++)
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 {
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 Gopalachari3999e2e2013-07-12 10:57:01 +0530331 vos_mem_free((tANI_U8 *)pRateSet);
Jeff Johnson295189b2012-06-20 16:38:30 -0700332
333 return false;
334 }
335 }
336
337 // Free up memory allocated for rateset
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530338 vos_mem_free((tANI_U8 *)pRateSet);
Jeff Johnson295189b2012-06-20 16:38:30 -0700339
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
367tANI_U8
368limCheckMCSSet(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 Lokere80007262013-03-18 19:45:50 -0700383 limLog(pMac, LOGP, FL("could not retrieve Basic MCS rateset"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 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 Shahbc35fb72013-12-12 18:14:06 +0530394 //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 Johnson295189b2012-06-20 16:38:30 -0700397 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 Shahbc35fb72013-12-12 18:14:06 +0530405 //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 Johnson295189b2012-06-20 16:38:30 -0700408 return false;
409 }
410
411 return true;
412}
413
Jeff Johnson295189b2012-06-20 16:38:30 -0700414
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
443tANI_U8
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700444limCheckRxRSNIeMatch(tpAniSirGlobal pMac, tDot11fIERSN rxRSNIe,tpPESession pSessionEntry,
445 tANI_U8 staIsHT, tANI_BOOLEAN *pmfConnection)
Jeff Johnson295189b2012-06-20 16:38:30 -0700446{
447 tDot11fIERSN *pRSNIe;
448 tANI_U8 i, j, match, onlyNonHtCipher = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700449#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700450 tANI_BOOLEAN weArePMFCapable;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800451 tANI_BOOLEAN weRequirePMF;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700452 tANI_BOOLEAN theyArePMFCapable;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800453 tANI_BOOLEAN theyRequirePMF;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700454#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700455
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 Singhdcbd8272014-01-09 14:16:01 +0530465 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 Johnson295189b2012-06-20 16:38:30 -0700468 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 Gopalachari3999e2e2013-07-12 10:57:01 +0530481 if (vos_mem_compare(&rxRSNIe.pwise_cipher_suites[i],
482 &pRSNIe->pwise_cipher_suites[j],
483 sizeof(pRSNIe->pwise_cipher_suites[j])))
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 {
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 Singhdcbd8272014-01-09 14:16:01 +0530504 limLog(pMac, LOG1, FL("pairwise cipher suite does not match(%d)"
505 "staIsHT %d onlyNonHtCipher %d"),match,staIsHT,
506 onlyNonHtCipher);
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 return eSIR_MAC_INVALID_PAIRWISE_CIPHER_STATUS;
508 }
Venkata Prathyusha Kuntupalliea7098e2013-01-31 16:08:13 -0800509 /* 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 Johnson295189b2012-06-20 16:38:30 -0700513 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530514 limLog(pMac, LOG1, FL("Preuthentication Capability is set"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 return eSIR_MAC_INVALID_RSN_IE_CAPABILITIES_STATUS;
516 }
517
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700518 *pmfConnection = eANI_BOOLEAN_FALSE;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800519
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700520#ifdef WLAN_FEATURE_11W
Chet Lanctot8cecea22014-02-11 19:09:36 -0800521 weArePMFCapable = pSessionEntry->pLimStartBssReq->pmfCapable;
522 weRequirePMF = pSessionEntry->pLimStartBssReq->pmfRequired;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700523 theyArePMFCapable = (rxRSNIe.RSN_Cap[0] >> 7) & 0x1;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800524 theyRequirePMF = (rxRSNIe.RSN_Cap[0] >> 6) & 0x1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700525
Chet Lanctotec4de332013-10-11 15:42:22 -0700526 if ((theyRequirePMF && theyArePMFCapable && !weArePMFCapable) ||
527 (weRequirePMF && !theyArePMFCapable))
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700528 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530529 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 Lanctot4b9abd72013-06-27 11:14:56 -0700534 return eSIR_MAC_ROBUST_MGMT_FRAMES_POLICY_VIOLATION;
535 }
536
537 if(theyArePMFCapable && weArePMFCapable)
538 *pmfConnection = eANI_BOOLEAN_TRUE;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800539
540 limLog(pMac, LOG1, FL("weAreCapable %d, weRequire %d, theyAreCapable %d, "
541 "theyRequire %d, PMFconnection %d"),
542 weArePMFCapable, weRequirePMF, theyArePMFCapable, theyRequirePMF, *pmfConnection);
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700543#endif
544
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 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
570tANI_U8
571limCheckRxWPAIeMatch(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 Singhdcbd8272014-01-09 14:16:01 +0530584 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 Johnson295189b2012-06-20 16:38:30 -0700587 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 Gopalachari3999e2e2013-07-12 10:57:01 +0530600 if (vos_mem_compare(rxWPAIe.unicast_ciphers[i],
601 pWPAIe->unicast_ciphers[j],
602 4))
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 {
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 Singhdcbd8272014-01-09 14:16:01 +0530623 limLog(pMac, LOG1, FL("pairwise cipher suite does not match(%d)"
624 "staIsHT %d onlyNonHtCipher %d"),match,staIsHT,
625 onlyNonHtCipher);
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 return eSIR_MAC_CIPHER_SUITE_REJECTED_STATUS;
627 }
628
629 return eSIR_SUCCESS;
630} /****** end limCheckRxWPAIeMatch() ******/
631
Jeff Johnson295189b2012-06-20 16:38:30 -0700632
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
663tSirRetStatus
664limCleanupRxPath(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
665{
666 tSirRetStatus retCode = eSIR_SUCCESS;
667
668
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530669 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 Johnson295189b2012-06-20 16:38:30 -0700673
674 limAbortBackgroundScan( pMac );
Agarwal Ashish87039eb2014-01-15 14:13:15 +0530675 psessionEntry->isCiscoVendorAP = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 if (pMac->lim.gLimAddtsSent)
677 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700678 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
680 }
681
682 if (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_ASSOC_CNF_STATE)
683 {
684 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER,
685 pStaDs->assocId);
686
687 if (!pStaDs->mlmStaContext.updateContext)
688 {
689 /**
690 * There is no context at Polaris to delete.
691 * Release our assigned AID back to the free pool
692 */
693 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
694 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
695 {
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800696 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 }
698 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
699
700 return retCode;
701 }
702 }
703
704 //delete all tspecs associated with this sta.
705 limAdmitControlDeleteSta(pMac, pStaDs->assocId);
706
Jeff Johnson295189b2012-06-20 16:38:30 -0700707
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 Johnsone7245742012-09-05 17:12:55 -0700718 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 /* Deactivating probe after heart beat timer */
721 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
Leela Venkata Kiran Kumar Reddy Chiralade5d0592013-09-20 17:09:35 -0700722 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
724 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
725 pMac->lim.gLastBeaconDtimCount = 0;
726 pMac->lim.gLastBeaconDtimPeriod = 0;
727
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800728#ifdef FEATURE_WLAN_ESE
729#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700730 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
731#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800733#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700734#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 Singhde7f0512015-10-23 14:31:15 +0530746 /* 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 Johnson295189b2012-06-20 16:38:30 -0700754 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 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
785void
786limSendDelStaCnf(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 Ahuja2fea3d12014-12-18 17:31:31 +0530794 limLog(pMac, LOG1, FL("Sessionid: %d staDsAssocId: %d Trigger: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530795 "statusCode: %d staDsAddr: "MAC_ADDRESS_STR),psessionEntry->peSessionId,
796 staDsAssocId, mlmStaContext.cleanupTrigger, statusCode,
797 MAC_ADDR_ARRAY(staDsAddr));
798
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 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 Lokere80007262013-03-18 19:45:50 -0700808 limLog(pMac, LOGP, FL("could not update BSSID at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700809
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 Gopalachari3999e2e2013-07-12 10:57:01 +0530820 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 psessionEntry->pLimMlmJoinReq = NULL;
822 }
823
824 psessionEntry->limAID = 0;
825
826
827 }
828
829 if ((mlmStaContext.cleanupTrigger ==
830 eLIM_HOST_DISASSOC) ||
831 (mlmStaContext.cleanupTrigger ==
832 eLIM_LINK_MONITORING_DISASSOC) ||
833 (mlmStaContext.cleanupTrigger ==
834 eLIM_PROMISCUOUS_MODE_DISASSOC))
835 {
836 /**
837 * Host or LMM driven Disassociation.
838 * Issue Disassoc Confirm to SME.
839 */
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530840 limLog( pMac, LOGW, FL("Lim Posting DISASSOC_CNF to Sme.Trigger: %d"),
841 mlmStaContext.cleanupTrigger);
Jeff Johnson295189b2012-06-20 16:38:30 -0700842
843
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530844 vos_mem_copy((tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
845 (tANI_U8 *) staDsAddr,
846 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 mlmDisassocCnf.resultCode = statusCode;
Wu Gao742b7352015-10-16 19:10:40 +0800848 mlmDisassocCnf.aid = staDsAssocId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 mlmDisassocCnf.disassocTrigger =
850 mlmStaContext.cleanupTrigger;
851 /* Update PE session Id*/
852 mlmDisassocCnf.sessionId = psessionEntry->peSessionId;
853
854 limPostSmeMessage(pMac,
855 LIM_MLM_DISASSOC_CNF,
856 (tANI_U32 *) &mlmDisassocCnf);
857 }
858 else if ((mlmStaContext.cleanupTrigger ==
859 eLIM_HOST_DEAUTH) ||
860 (mlmStaContext.cleanupTrigger ==
861 eLIM_LINK_MONITORING_DEAUTH))
862 {
863 /**
864 * Host or LMM driven Deauthentication.
865 * Issue Deauth Confirm to SME.
866 */
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530867 limLog( pMac, LOGW, FL("Lim Posting DEAUTH_CNF to Sme.Trigger: %d"),
868 mlmStaContext.cleanupTrigger);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530869 vos_mem_copy((tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
870 (tANI_U8 *) staDsAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 sizeof(tSirMacAddr));
872 mlmDeauthCnf.resultCode = statusCode;
Wu Gao742b7352015-10-16 19:10:40 +0800873 mlmDeauthCnf.aid = staDsAssocId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 mlmDeauthCnf.deauthTrigger =
875 mlmStaContext.cleanupTrigger;
876 /* PE session Id */
877 mlmDeauthCnf.sessionId = psessionEntry->peSessionId;
878
879 limPostSmeMessage(pMac,
880 LIM_MLM_DEAUTH_CNF,
881 (tANI_U32 *) &mlmDeauthCnf);
882 }
883 else if ((mlmStaContext.cleanupTrigger ==
884 eLIM_PEER_ENTITY_DISASSOC) ||
885 (mlmStaContext.cleanupTrigger ==
886 eLIM_PEER_ENTITY_DEAUTH))
887 {
888 /**
889 * Received Disassociation/Deauthentication from peer.
890 * Issue Purge Ind to SME.
891 */
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530892 limLog( pMac, LOGW, FL("Lim Posting PURGE_STA_IND to Sme.Trigger: %d"),
893 mlmStaContext.cleanupTrigger) ;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530894 vos_mem_copy((tANI_U8 *) &mlmPurgeStaInd.peerMacAddr,
895 (tANI_U8 *) staDsAddr,
896 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 mlmPurgeStaInd.reasonCode = (tANI_U8) mlmStaContext.disassocReason;
898 mlmPurgeStaInd.aid = staDsAssocId;
899 mlmPurgeStaInd.purgeTrigger = mlmStaContext.cleanupTrigger;
900 mlmPurgeStaInd.sessionId = psessionEntry->peSessionId;
901
902 limPostSmeMessage(pMac,
903 LIM_MLM_PURGE_STA_IND,
904 (tANI_U32 *) &mlmPurgeStaInd);
905 }
906 else if(mlmStaContext.cleanupTrigger == eLIM_JOIN_FAILURE)
907 {
908 //PE setup the peer entry in HW upfront, right after join is completed.
909 //If there is a failure during rest of the assoc sequence, this context needs to be cleaned up.
910 tANI_U8 smesessionId;
911 tANI_U16 smetransactionId;
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530912 tLimSmeStates tempLimSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700913
914 smesessionId = psessionEntry->smeSessionId;
915 smetransactionId = psessionEntry->transactionId;
916
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530917 tempLimSmeState = psessionEntry->limSmeState;
Jeff Johnson295189b2012-06-20 16:38:30 -0700918 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700919 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700920
Jeff Johnsone7245742012-09-05 17:12:55 -0700921 //if it is a reassoc failure to join new AP
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530922 //eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA result code is used
923 //during assoc and reassoc, so sme state req to distinguish them
Madan Mohan Koyyalamudif33324b2012-11-06 19:16:17 -0800924 if((mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE) ||
Santhosh Kumar Padmaa2291d72014-05-23 18:08:50 +0530925 (mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_FAILURE) ||
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530926 (mlmStaContext.resultCode == eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE) ||
927 (mlmStaContext.resultCode == eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA
928 && tempLimSmeState == eLIM_SME_WT_REASSOC_STATE)
929 )
Jeff Johnsone7245742012-09-05 17:12:55 -0700930 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530931 limLog( pMac, LOG1, FL("Lim Posting eWNI_SME_REASSOC_RSP to SME"
932 "resultCode: %d, statusCode: %d,"
933 "sessionId: %d"),
934 mlmStaContext.resultCode,
935 mlmStaContext.protStatusCode,
936 psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -0700937 if(mlmStaContext.resultCode != eSIR_SME_SUCCESS )
938 {
939 peDeleteSession(pMac, psessionEntry);
940 psessionEntry = NULL;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530941 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700942 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
943 mlmStaContext.resultCode, mlmStaContext.protStatusCode, psessionEntry,
944 smesessionId, smetransactionId);
945 }
946 else
947 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530948 vos_mem_free(psessionEntry->pLimJoinReq);
949 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700950
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530951 limLog( pMac, LOG1, FL("Lim Posting eWNI_SME_JOIN_RSP to SME."
952 "resultCode: %d,statusCode: %d,"
953 "sessionId: %d"),
954 mlmStaContext.resultCode,
955 mlmStaContext.protStatusCode,
956 psessionEntry->peSessionId);
957 if(mlmStaContext.resultCode != eSIR_SME_SUCCESS)
958 {
959 peDeleteSession(pMac,psessionEntry);
960 psessionEntry = NULL;
961 }
962
963 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, mlmStaContext.resultCode, mlmStaContext.protStatusCode,
Jeff Johnson295189b2012-06-20 16:38:30 -0700964 psessionEntry, smesessionId, smetransactionId);
Jeff Johnsone7245742012-09-05 17:12:55 -0700965 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700966
967 }
968
969 if((NULL != psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700970 && (eLIM_AP_ROLE != psessionEntry->limSystemRole )
Jeff Johnson295189b2012-06-20 16:38:30 -0700971 )
972 {
973 peDeleteSession(pMac,psessionEntry);
974 psessionEntry = NULL;
975 }
976}
977
978/**
979 * limRejectAssociation()
980 *
981 *FUNCTION:
982 * This function is called whenever Re/Association Request need
983 * to be rejected due to failure in assigning an AID or failure
984 * in adding STA context at Polaris or reject by applications.
985 *
986 *LOGIC:
987 * Resources allocated if any are freedup and (Re) Association
988 * Response frame is sent to requesting STA. Pre-Auth context
989 * will be added for this STA if it does not exist already
990 *
991 *ASSUMPTIONS:
992 *
993 *NOTE:
994 *
995 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
996 * @param subType - Indicates whether it is Association Request (=0) or
997 * Reassociation Request (=1) frame
998 * @param addPreAuthContext - Indicates whether pre-auth context
999 * to be added for this STA
1000 * @param authType - Indicates auth type to be added
1001 * @param staId - Indicates staId of the STA being rejected
1002 * association
1003 * @param deleteSta - Indicates whether to delete STA context
1004 * at Polaris
1005 * @param rCode - Indicates what reasonCode to be sent in
1006 * Re/Assoc response to STA
1007 *
1008 * @return None
1009 */
1010
1011void
1012limRejectAssociation(tpAniSirGlobal pMac, tSirMacAddr peerAddr, tANI_U8 subType,
1013 tANI_U8 addPreAuthContext, tAniAuthType authType,
1014 tANI_U16 staId, tANI_U8 deleteSta, tSirResultCodes rCode, tpPESession psessionEntry )
1015{
1016 tpDphHashNode pStaDs;
1017
Abhishek Singhdcbd8272014-01-09 14:16:01 +05301018 limLog(pMac, LOG1, FL("Sessionid: %d authType: %d subType: %d "
1019 "addPreAuthContext: %d staId: %d deleteSta: %d rCode : %d "
1020 "peerAddr: "MAC_ADDRESS_STR),psessionEntry->peSessionId,
1021 authType, subType, addPreAuthContext, staId, deleteSta, rCode,
1022 MAC_ADDR_ARRAY(peerAddr));
1023
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 if (addPreAuthContext)
1025 {
1026 // Create entry for this STA in pre-auth list
1027 struct tLimPreAuthNode *pAuthNode;
1028
1029 pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable);
1030
1031 if (pAuthNode)
1032 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301033 vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001034 peerAddr,
1035 sizeof(tSirMacAddr));
1036 pAuthNode->fTimerStarted = 0;
1037 pAuthNode->mlmState = eLIM_MLM_AUTHENTICATED_STATE;
1038 pAuthNode->authType = (tAniAuthType) authType;
Edhar, Mahesh Kumar0d82c212015-02-03 17:47:16 +05301039 pAuthNode->timestamp = vos_timer_get_system_ticks();
Jeff Johnson295189b2012-06-20 16:38:30 -07001040 limAddPreAuthNode(pMac, pAuthNode);
1041 }
1042 }
1043
1044 if (deleteSta == true)
1045 {
1046 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
1047
1048 if (pStaDs == NULL)
1049 {
1050 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001051 FL("No STA context, yet rejecting Association"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001052
1053 return;
1054 }
1055
1056 /**
1057 * Polaris has state for this STA.
1058 * Trigger cleanup.
1059 */
1060 pStaDs->mlmStaContext.cleanupTrigger = eLIM_REASSOC_REJECT;
1061
1062 // Receive path cleanup
1063 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1064
1065 // Send Re/Association Response with
1066 // status code to requesting STA.
1067 limSendAssocRspMgmtFrame(pMac,
1068 rCode,
1069 0,
1070 peerAddr,
1071 subType, 0,psessionEntry);
1072
1073 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL)
1074 {
1075 // Assoction confirmation is complete, free the copy of association request frame
1076 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
1077 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301078 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
1080 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301081 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07001082 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
1083 }
1084 }
1085 else
1086 {
1087 limSendAssocRspMgmtFrame(pMac,
1088 eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS,
1089 1,
1090 peerAddr,
1091 subType, 0,psessionEntry);
1092 // Log error
1093 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001094 FL("received Re/Assoc req when max associated STAs reached from "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001095 limPrintMacAddr(pMac, peerAddr, LOGW);
1096 limSendSmeMaxAssocExceededNtf(pMac, peerAddr, psessionEntry->smeSessionId);
1097 }
1098} /*** end limRejectAssociation() ***/
1099
Jeff Johnson295189b2012-06-20 16:38:30 -07001100
1101/** -------------------------------------------------------------
1102\fn limDecideApProtectionOnHt20Delete
1103\brief protection related function while HT20 station is getting deleted.
1104\param tpAniSirGlobal pMac
1105\param tpDphHashNode pStaDs
1106\param tpUpdateBeaconParams pBeaconParams
1107\return None
1108 -------------------------------------------------------------*/
1109static void
1110limDecideApProtectionOnHt20Delete(tpAniSirGlobal pMac,
1111 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1112{
1113 tANI_U32 i = 0;
1114 PELOG1( limLog(pMac, LOG1, FL("(%d) A HT 20 STA is disassociated. Addr is "),
1115 psessionEntry->gLimHt20Params.numSta);
1116 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1117 if (psessionEntry->gLimHt20Params.numSta > 0)
1118 {
1119 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1120 {
1121 if (psessionEntry->protStaCache[i].active)
1122 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301123 if (vos_mem_compare(psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001124 pStaDs->staAddr, sizeof(tSirMacAddr)))
1125 {
1126 psessionEntry->gLimHt20Params.numSta--;
1127 psessionEntry->protStaCache[i].active = false;
1128 break;
1129 }
1130 }
1131 }
1132 }
1133
1134 if (psessionEntry->gLimHt20Params.numSta == 0)
1135 {
1136 // disable protection
Nirav Shahbc35fb72013-12-12 18:14:06 +05301137 limLog(pMac, LOG1, FL("No 11B STA exists, PESessionID %d"),
1138 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001139 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
1140 }
1141}
1142/** -------------------------------------------------------------
1143\fn limDecideApProtectionOnDelete
1144\brief Decides about protection related settings when a station is getting deleted.
1145\param tpAniSirGlobal pMac
1146\param tpDphHashNode pStaDs
1147\param tpUpdateBeaconParams pBeaconParams
1148\return None
1149 -------------------------------------------------------------*/
1150void
1151limDecideApProtectionOnDelete(tpAniSirGlobal pMac,
1152 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1153{
1154 tANI_U32 phyMode;
1155 tHalBitVal erpEnabled = eHAL_CLEAR;
1156 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1157 tANI_U32 i;
1158
1159 if(NULL == pStaDs)
1160 return;
1161
1162 limGetRfBand(pMac, &rfBand, psessionEntry);
1163 if(SIR_BAND_5_GHZ == rfBand)
1164 {
1165 //we are HT. if we are 11A, then protection is not required.
Jeff Johnsone7245742012-09-05 17:12:55 -07001166 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001167 {
1168 //we are HT and 11A station is leaving.
1169 //protection consideration required.
1170 //HT station leaving ==> this case is commonly handled between both the bands below.
1171 if((psessionEntry->beaconParams.llaCoexist) &&
1172 (false == pStaDs->mlmStaContext.htCapability))
1173 {
1174 PELOG1(limLog(pMac, LOG1, FL("(%d) A 11A STA is disassociated. Addr is "),
1175 psessionEntry->gLim11aParams.numSta);
1176 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1177 if (psessionEntry->gLim11aParams.numSta > 0)
1178 {
1179 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1180 {
1181 if (psessionEntry->protStaCache[i].active)
1182 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301183 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001184 pStaDs->staAddr, sizeof(tSirMacAddr)))
1185 {
1186 psessionEntry->gLim11aParams.numSta--;
1187 psessionEntry->protStaCache[i].active = false;
1188 break;
1189 }
1190 }
1191 }
1192 }
1193
1194 if(psessionEntry->gLim11aParams.numSta == 0)
1195 {
1196 // disable protection
1197 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
1198 }
1199 }
1200 }
1201 }
1202 else if(SIR_BAND_2_4_GHZ == rfBand)
1203 {
1204 limGetPhyMode(pMac, &phyMode, psessionEntry);
1205
1206 erpEnabled = pStaDs->erpEnabled;
1207 //we are HT or 11G and 11B station is getting deleted.
1208 if (((phyMode == WNI_CFG_PHY_MODE_11G) ||
Jeff Johnsone7245742012-09-05 17:12:55 -07001209 psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001210 (erpEnabled == eHAL_CLEAR))
1211 {
1212 PELOG1(limLog(pMac, LOG1, FL("(%d) A legacy STA is disassociated. Addr is "),
1213 psessionEntry->gLim11bParams.numSta);
1214 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1215 if (psessionEntry->gLim11bParams.numSta > 0)
1216 {
1217 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1218 {
1219 if (psessionEntry->protStaCache[i].active)
1220 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301221 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001222 pStaDs->staAddr, sizeof(tSirMacAddr)))
1223 {
1224 psessionEntry->gLim11bParams.numSta--;
1225 psessionEntry->protStaCache[i].active = false;
1226 break;
1227 }
1228 }
1229 }
1230 }
1231
1232 if (psessionEntry->gLim11bParams.numSta == 0)
1233 {
1234 // disable protection
Jeff Johnson295189b2012-06-20 16:38:30 -07001235 limEnable11gProtection(pMac, false, false, pBeaconParams,psessionEntry);
1236 }
1237 }
1238 //(non-11B station is leaving) or (we are not 11G or HT AP)
Jeff Johnsone7245742012-09-05 17:12:55 -07001239 else if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001240 { //we are HT AP and non-11B station is leaving.
1241
1242 //11g station is leaving
1243 if(!pStaDs->mlmStaContext.htCapability)
1244 {
1245 PELOG1(limLog(pMac, LOG1, FL("(%d) A 11g STA is disassociated. Addr is "),
1246 psessionEntry->gLim11bParams.numSta);
1247 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1248 if (psessionEntry->gLim11gParams.numSta > 0)
1249 {
1250 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1251 {
1252 if (psessionEntry->protStaCache[i].active)
1253 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301254 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001255 pStaDs->staAddr, sizeof(tSirMacAddr)))
1256 {
1257 psessionEntry->gLim11gParams.numSta--;
1258 psessionEntry->protStaCache[i].active = false;
1259 break;
1260 }
1261 }
1262 }
1263 }
1264
1265 if (psessionEntry->gLim11gParams.numSta == 0)
1266 {
1267 // disable protection
1268 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
1269 }
1270 }
1271 }
1272 }
1273
1274 //LSIG TXOP not supporting staiton leaving. applies to 2.4 as well as 5 GHZ.
Jeff Johnsone7245742012-09-05 17:12:55 -07001275 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001276 (true == pStaDs->mlmStaContext.htCapability))
1277 {
1278 //HT non-GF leaving
1279 if(!pStaDs->htGreenfield)
1280 {
1281 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-GF STA is disassociated. Addr is "),
1282 psessionEntry->gLimNonGfParams.numSta);
1283 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1284 if (psessionEntry->gLimNonGfParams.numSta > 0)
1285 {
1286 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1287 {
1288 if (psessionEntry->protStaCache[i].active)
1289 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301290 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001291 pStaDs->staAddr, sizeof(tSirMacAddr)))
1292 {
1293 psessionEntry->gLimNonGfParams.numSta--;
1294 psessionEntry->protStaCache[i].active = false;
1295 break;
1296 }
1297 }
1298 }
1299 }
1300
1301 if (psessionEntry->gLimNonGfParams.numSta == 0)
1302 {
1303 // disable protection
1304 limEnableHTNonGfProtection(pMac, false, false, pBeaconParams,psessionEntry);
1305 }
1306 }
1307 //HT 20Mhz station leaving.
1308 if(psessionEntry->beaconParams.ht20Coexist &&
1309 (eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet))
1310 {
1311 limDecideApProtectionOnHt20Delete(pMac, pStaDs, pBeaconParams,psessionEntry);
1312 }
1313
1314 if(false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport &&
1315 (false == pStaDs->htLsigTXOPProtection))
1316 {
1317 PELOG1( limLog(pMac, LOG1, FL("(%d) A HT LSIG not supporting STA is disassociated. Addr is "),
1318 psessionEntry->gLimLsigTxopParams.numSta);
1319 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1320 if (psessionEntry->gLimLsigTxopParams.numSta > 0)
1321 {
1322 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1323 {
1324 if (psessionEntry->protStaCache[i].active)
1325 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301326 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001327 pStaDs->staAddr, sizeof(tSirMacAddr)))
1328 {
1329 psessionEntry->gLimLsigTxopParams.numSta--;
1330 psessionEntry->protStaCache[i].active = false;
1331 break;
1332 }
1333 }
1334 }
1335 }
1336
1337 if (psessionEntry->gLimLsigTxopParams.numSta == 0)
1338 {
1339 // disable protection
1340 limEnableHTLsigTxopProtection(pMac, true, false, pBeaconParams,psessionEntry);
1341 }
1342 }
1343 }
1344}
1345
Jeff Johnson295189b2012-06-20 16:38:30 -07001346
1347
1348/** -------------------------------------------------------------
1349\fn limDecideShortPreamble
1350\brief Decides about any short preamble reated change because of new station joining.
1351\param tpAniSirGlobal pMac
1352\param tpDphHashNode pStaDs
1353\param tpUpdateBeaconParams pBeaconParams
1354\return None
1355 -------------------------------------------------------------*/
1356void limDecideShortPreamble(tpAniSirGlobal pMac,
1357 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry )
1358{
1359 tANI_U32 i;
1360
1361 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
1362 {
1363 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short preamble STA is disassociated. Addr is "),
1364 psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
1365 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1366 if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta > 0)
1367 {
1368 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1369 {
1370 if (psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
1371 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301372 if (vos_mem_compare( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001373 pStaDs->staAddr, sizeof(tSirMacAddr)))
1374 {
1375 psessionEntry->gLimNoShortParams.numNonShortPreambleSta--;
1376 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = false;
1377 break;
1378 }
1379 }
1380 }
1381 }
1382
1383 if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta == 0)
1384 {
1385 // enable short preamble
Jeff Johnson295189b2012-06-20 16:38:30 -07001386 //reset the cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301387 vos_mem_set((tANI_U8 *)&psessionEntry->gLimNoShortParams,
1388 sizeof(tLimNoShortParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001389 if (limEnableShortPreamble(pMac, true, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001390 PELOGE(limLog(pMac, LOGE, FL("Cannot enable short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 }
1392 }
1393}
1394
1395/** -------------------------------------------------------------
1396\fn limDecideShortSlot
1397\brief Decides about any short slot time related change because of station leaving the BSS.
1398\param tpAniSirGlobal pMac
1399\param tpDphHashNode pStaDs
1400\return None
1401 -------------------------------------------------------------*/
1402
1403void
1404limDecideShortSlot(tpAniSirGlobal pMac, tpDphHashNode pStaDs,
1405 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
1406{
1407 tANI_U32 i, val;
1408 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
1409 {
1410 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short slottime STA is disassociated. Addr is "),
1411 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
1412 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1413
Jeff Johnson295189b2012-06-20 16:38:30 -07001414 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
1415 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta> 0)
1416 {
1417 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1418 {
1419 if (psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
1420 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301421 if (vos_mem_compare(psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 pStaDs->staAddr, sizeof(tSirMacAddr)))
1423 {
1424 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta--;
1425 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
1426 break;
1427 }
1428 }
1429 }
1430 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001431 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001432 {
1433 if (pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta> 0)
1434 {
1435 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1436 {
1437 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
1438 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301439 if (vos_mem_compare(pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001440 pStaDs->staAddr, sizeof(tSirMacAddr)))
1441 {
1442 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta--;
1443 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
1444 break;
1445 }
1446 }
1447 }
1448 }
1449 }
1450
1451 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
1452
Jeff Johnson295189b2012-06-20 16:38:30 -07001453 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
1454 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta == 0))
1455 {
1456 // enable short slot time
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 //reset the cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301458 vos_mem_set((tANI_U8 *)&psessionEntry->gLimNoShortSlotParams,
1459 sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 // in case of AP set SHORT_SLOT_TIME to enable
1461 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1462 {
1463 pBeaconParams->fShortSlotTime = true;
1464 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnsone7245742012-09-05 17:12:55 -07001465 psessionEntry->shortSlotTimeSupported = true;
Jeff Johnson295189b2012-06-20 16:38:30 -07001466 }
1467 }
1468 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001469 {
1470 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta == 0)
1471 {
1472 // enable short slot time
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 //reset the cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301474 vos_mem_set((tANI_U8 *)&pMac->lim.gLimNoShortSlotParams,
1475 sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 // in case of AP set SHORT_SLOT_TIME to enable
1477 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1478 {
1479 pBeaconParams->fShortSlotTime = true;
1480 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnsone7245742012-09-05 17:12:55 -07001481 psessionEntry->shortSlotTimeSupported = true;
1482 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001483 }
1484 }
1485 }
1486}
1487
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -07001488void
1489limPostReassocFailure(tpAniSirGlobal pMac,
1490 tSirResultCodes resultCode,
1491 tANI_U16 protStatusCode,tpPESession psessionEntry)
1492{
1493 tLimMlmReassocCnf mlmReassocCnf;
1494
1495 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1496 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
1497
1498 // 'Change' timer for future activations
1499 limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
1500
1501 mlmReassocCnf.resultCode = resultCode;
1502 mlmReassocCnf.protStatusCode = protStatusCode;
1503 /* Update PE session Id */
1504 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
1505 limPostSmeMessage(pMac,
1506 LIM_MLM_REASSOC_CNF,
1507 (tANI_U32 *) &mlmReassocCnf);
1508} /*** end limPostReassocFailure() ***/
1509
Jeff Johnson295189b2012-06-20 16:38:30 -07001510/**
1511 * limRestorePreReassocState()
1512 *
1513 *FUNCTION:
1514 * This function is called on STA role whenever Reasociation
1515 * Response with a reject code is received from AP.
1516 *
1517 *LOGIC:
1518 * Reassociation failure timer is stopped, Old (or current) AP's
1519 * context is restored both at Polaris & software
1520 *
1521 *ASSUMPTIONS:
1522 *
1523 *NOTE:
1524 *
1525 * @param pMac - Pointer to Global MAC structure
1526 * @param resultCode - Result code that specifies why Reassociation
1527 * attemp failed
1528 *
1529 * @return None
1530 */
1531
1532void
1533limRestorePreReassocState(tpAniSirGlobal pMac,
1534 tSirResultCodes resultCode,
1535 tANI_U16 protStatusCode,tpPESession psessionEntry)
1536{
Jeff Johnsone7245742012-09-05 17:12:55 -07001537 tANI_U8 chanNum, secChanOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07001538 tLimMlmReassocCnf mlmReassocCnf;
1539
Abhishek Singhdcbd8272014-01-09 14:16:01 +05301540 limLog(pMac, LOG1, FL("sessionid: %d protStatusCode: %d resultCode: %d"),
1541 psessionEntry->smeSessionId, protStatusCode, resultCode);
1542
Jeff Johnson295189b2012-06-20 16:38:30 -07001543 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001544 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07001545
1546 // 'Change' timer for future activations
1547 limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
1548
1549 // Update BSSID at CFG database
1550 #if 0
1551 if (cfgSetStr(pMac, WNI_CFG_BSSID,
1552 pMac->lim.gLimCurrentBssId,
1553 sizeof(tSirMacAddr)) != eSIR_SUCCESS)
1554 {
1555 /// Could not update BSSID at CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001556 limLog(pMac, LOGP, FL("could not update BSSID at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001557 return;
1558 }
Madan Mohan Koyyalamudi70322d52012-10-18 20:07:33 -07001559 #endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001560
1561 // chanNum = pMac->lim.gLimCurrentChannelId;
1562
1563 /* To support BT-AMP */
1564 chanNum = psessionEntry->currentOperChannel;
Jeff Johnsone7245742012-09-05 17:12:55 -07001565 secChanOffset = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07001566
Jeff Johnsone7245742012-09-05 17:12:55 -07001567 limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001568
1569 /** @ToDo : Need to Integrate the STOP the DataTransfer to the AP from 11H code */
1570
1571 mlmReassocCnf.resultCode = resultCode;
1572 mlmReassocCnf.protStatusCode = protStatusCode;
1573 /* Update PE session Id */
1574 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
1575 limPostSmeMessage(pMac,
1576 LIM_MLM_REASSOC_CNF,
1577 (tANI_U32 *) &mlmReassocCnf);
1578} /*** end limRestorePreReassocState() ***/
1579
1580
1581
1582/**
1583 * limIsReassocInProgress()
1584 *
1585 *FUNCTION:
1586 * This function is called to see if STA is in wt-reassoc-rsp state.
1587 *
1588 *LOGIC:
1589 *
1590 *ASSUMPTIONS:
1591 *
1592 *NOTE:
1593 *
1594 * @param pMac - Pointer to Global MAC structure
1595 *
1596 * @return eANI_BOOLEAN_TRUE When STA is waiting for Reassoc response from AP \n
1597 * else eANI_BOOLEAN_FALSE
1598 */
1599
1600eAniBoolean
1601limIsReassocInProgress(tpAniSirGlobal pMac,tpPESession psessionEntry)
1602{
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001603 if (psessionEntry == NULL)
1604 {
1605 return eANI_BOOLEAN_FALSE;
1606 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001607 if(((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
1608 ((psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE) ||
1609 (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_LINK_FAIL_STATE)))
1610 return eANI_BOOLEAN_TRUE;
1611
1612 return eANI_BOOLEAN_FALSE;
1613} /*** end limIsReassocInProgress() ***/
1614
Jeff Johnsone7245742012-09-05 17:12:55 -07001615#ifdef WLAN_FEATURE_11AC
1616tSirRetStatus limPopulateVhtMcsSet(tpAniSirGlobal pMac,
1617 tpSirSupportedRates pRates,
1618 tDot11fIEVHTCaps *pPeerVHTCaps,
1619 tpPESession psessionEntry)
1620{
1621 tANI_U32 val;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001622 tANI_U32 selfStaDot11Mode=0;
1623 wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001624
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001625// if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
1626 if (IS_DOT11_MODE_VHT(selfStaDot11Mode))
Jeff Johnsone7245742012-09-05 17:12:55 -07001627 {
1628 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_MCS_MAP,&val) !=
1629 eSIR_SUCCESS )
1630 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001631 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX MCS MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001632 goto error;
1633 }
1634 pRates->vhtRxMCSMap = (tANI_U16)val;
1635
1636 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_MCS_MAP,&val ) !=
1637 eSIR_SUCCESS )
1638 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001639 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT TX MCS MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001640 goto error;
1641 }
1642 pRates->vhtTxMCSMap = (tANI_U16)val;
1643
1644 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,&val ) !=
1645 eSIR_SUCCESS )
1646 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001647 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001648 goto error;
1649 }
1650 pRates->vhtRxHighestDataRate = (tANI_U16)val;
1651
1652 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,&val ) !=
1653 eSIR_SUCCESS )
1654 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001655 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001656 goto error;
1657 }
1658 pRates->vhtTxHighestDataRate = (tANI_U16)val;
1659
1660 if( pPeerVHTCaps != NULL)
1661 {
1662 pRates->vhtTxHighestDataRate = SIR_MIN(pRates->vhtTxHighestDataRate, pPeerVHTCaps->txSupDataRate);
1663 pRates->vhtRxHighestDataRate = SIR_MIN(pRates->vhtRxHighestDataRate, pPeerVHTCaps->rxHighSupDataRate);
1664
Jeff Johnson1250df42012-12-10 14:31:52 -08001665 // Acquire PEER MCS map if we exceed.
Jeff Johnsone7245742012-09-05 17:12:55 -07001666 // We compare/update only the last 2 bits of the map as we support only single BSS.
1667 // Firmware takes care of this comparison
1668 pRates->vhtRxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
1669 pRates->vhtRxMCSMap |= (pPeerVHTCaps->rxMCSMap & 0x3); // Updating the last 2 bits in the bitmap
1670
1671 // Firmware takes care of this comparison
1672 pRates->vhtTxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
1673 pRates->vhtTxMCSMap |= (pPeerVHTCaps->txMCSMap & 0x3); // Updating the last 2 bits in the bitmap
1674 }
1675 }
1676 return eSIR_SUCCESS;
1677error:
1678
1679 return eSIR_FAILURE;
1680
1681}
1682#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001683
1684/**
1685 * limPopulateOwnRateSet
1686 *
1687 * FUNCTION:
1688 * This function is called by limProcessAssocRsp() or
1689 * limAddStaInIBSS()
1690 * - It creates a combined rate set of 12 rates max which
1691 * comprises the basic and extended rates read from CFG
1692 * - It sorts the combined rate Set and copy it in the
1693 * rate array of the pSTA descriptor
1694 * - It sets the erpEnabled bit of the STA descriptor
1695 *
1696 * NOTE:
1697 * ERP bit is set iff the dph PHY mode is 11G and there is at least
1698 * an A rate in the supported or extended rate sets
1699 *
1700 * @param pMac - Pointer to Global MAC structure
1701 * @param basicOnly - When passed value is true, only basic
1702 * rates are copied to DPH node else
1703 * all supported rates are copied
1704 * @return eSIR_SUCCESS or eSIR_FAILURE
1705 *
1706 */
Jeff Johnsone7245742012-09-05 17:12:55 -07001707#ifdef WLAN_FEATURE_11AC
1708tSirRetStatus
1709limPopulateOwnRateSet(tpAniSirGlobal pMac,
1710 tpSirSupportedRates pRates,
1711 tANI_U8* pSupportedMCSSet,
1712 tANI_U8 basicOnly,
1713 tpPESession psessionEntry,
1714 tDot11fIEVHTCaps *pVHTCaps)
1715#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001716tSirRetStatus
1717limPopulateOwnRateSet(tpAniSirGlobal pMac,
1718 tpSirSupportedRates pRates,
1719 tANI_U8* pSupportedMCSSet,
1720 tANI_U8 basicOnly,
1721 tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07001722#endif
1723
Jeff Johnson295189b2012-06-20 16:38:30 -07001724{
1725 tSirMacRateSet tempRateSet;
1726 tSirMacRateSet tempRateSet2;
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301727 tANI_U32 i,j,val,min,isArate;
Jeff Johnson295189b2012-06-20 16:38:30 -07001728 tANI_U32 phyMode = 0;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001729 tANI_U32 selfStaDot11Mode=0;
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301730
Jeff Johnson295189b2012-06-20 16:38:30 -07001731 isArate = 0;
1732
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001733 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001734 limGetPhyMode(pMac, &phyMode, psessionEntry);
1735
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301736 /* Include 11b rates only when the device configured in
1737 auto, 11a/b/g or 11b_only */
1738 if ( (selfStaDot11Mode == WNI_CFG_DOT11_MODE_ALL) ||
1739 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11A) ||
1740 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11AC) ||
Leela Venkata Kiran Kumar Reddy Chiralac9a10e52013-08-29 16:37:15 -07001741 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11N) ||
1742 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11G) ||
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301743 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11B) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001744 {
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301745 val = WNI_CFG_SUPPORTED_RATES_11B_LEN;
1746 wlan_cfgGetStr( pMac, WNI_CFG_SUPPORTED_RATES_11B,
1747 (tANI_U8 *)&tempRateSet.rate, &val );
1748 tempRateSet.numRates = (tANI_U8) val;
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001749 }
1750 else
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301751 tempRateSet.numRates = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001752
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301753 /* Include 11a rates when the device configured in non-11b mode */
1754 if (!IS_DOT11_MODE_11B(selfStaDot11Mode))
Jeff Johnson295189b2012-06-20 16:38:30 -07001755 {
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301756 val = WNI_CFG_SUPPORTED_RATES_11A_LEN;
1757 wlan_cfgGetStr( pMac, WNI_CFG_SUPPORTED_RATES_11A,
1758 (tANI_U8 *)&tempRateSet2.rate, &val );
Jeff Johnson295189b2012-06-20 16:38:30 -07001759 tempRateSet2.numRates = (tANI_U8) val;
Jeff Johnson295189b2012-06-20 16:38:30 -07001760 }
1761 else
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301762 tempRateSet2.numRates = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001763
1764 if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
1765 {
1766 //we are in big trouble
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001767 limLog(pMac, LOGP, FL("more than 12 rates in CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001768 //panic
1769 goto error;
1770 }
1771
Jeff Johnson295189b2012-06-20 16:38:30 -07001772 //copy all rates in tempRateSet, there are 12 rates max
1773 for (i = 0;i < tempRateSet2.numRates; i++)
1774 tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i];
1775 tempRateSet.numRates += tempRateSet2.numRates;
1776
1777 /**
1778 * Sort rates in tempRateSet (they are likely to be already sorted)
1779 * put the result in pSupportedRates
1780 */
1781 {
1782 tANI_U8 aRateIndex = 0;
1783 tANI_U8 bRateIndex = 0;
1784
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301785 vos_mem_set((tANI_U8 *) pRates, sizeof(tSirSupportedRates), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001786 for(i = 0;i < tempRateSet.numRates; i++)
1787 {
1788 min = 0;
1789 val = 0xff;
1790 isArate = 0;
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001791 for(j = 0; (j < tempRateSet.numRates) && (j < SIR_MAC_RATESET_EID_MAX); j++)
Jeff Johnson295189b2012-06-20 16:38:30 -07001792 {
1793 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
1794 {
1795 val = tempRateSet.rate[j] & 0x7f;
1796 min = j;
1797 }
1798 }
1799
1800 if (sirIsArate(tempRateSet.rate[min] & 0x7f))
1801 isArate = 1;
1802
1803 /*
1804 * HAL needs to know whether the rate is basic rate or not, as it needs to
1805 * update the response rate table accordingly. e.g. if one of the 11a rates is
1806 * basic rate, then that rate can be used for sending control frames.
1807 * HAL updates the response rate table whenever basic rate set is changed.
1808 */
1809 if (basicOnly)
1810 {
1811 if (tempRateSet.rate[min] & 0x80)
1812 {
1813 if (isArate)
1814 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1815 else
1816 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1817 }
1818 }
1819 else
1820 {
1821 if (isArate)
1822 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1823 else
1824 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1825 }
1826 tempRateSet.rate[min] = 0xff;
1827 }
1828
1829 }
1830
1831
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001832 //if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
1833 if (IS_DOT11_MODE_HT(selfStaDot11Mode))
Jeff Johnson295189b2012-06-20 16:38:30 -07001834 {
1835 val = SIZE_OF_SUPPORTED_MCS_SET;
1836 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
1837 pRates->supportedMCSSet,
1838 &val) != eSIR_SUCCESS)
1839 {
1840 /// Could not get rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001841 PELOGE(limLog(pMac, LOGE, FL("could not retrieve supportedMCSSet"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001842 goto error;
1843 }
1844
1845
1846 //if supported MCS Set of the peer is passed in, then do the intersection
1847 //else use the MCS set from local CFG.
1848
1849 if(pSupportedMCSSet != NULL)
1850 {
1851 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
1852 pRates->supportedMCSSet[i] &= pSupportedMCSSet[i];
1853
1854 }
1855
Abhishek Singh525045c2014-12-15 17:18:45 +05301856 limLog(pMac, LOG1, FL("MCS Rate Set Bitmap: "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
Sushant Kaushik0b343422015-05-25 17:15:55 +05301858 limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07001859 }
1860
Jeff Johnsone7245742012-09-05 17:12:55 -07001861#ifdef WLAN_FEATURE_11AC
1862 limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
1863#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001864
1865 return eSIR_SUCCESS;
1866
1867 error:
1868
1869 return eSIR_FAILURE;
1870} /*** limPopulateOwnRateSet() ***/
1871
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001872#ifdef WLAN_FEATURE_11AC
1873tSirRetStatus
1874limPopulatePeerRateSet(tpAniSirGlobal pMac,
1875
1876 tpSirSupportedRates pRates,
1877 tANI_U8* pSupportedMCSSet,
1878 tANI_U8 basicOnly,
1879 tpPESession psessionEntry,
1880 tDot11fIEVHTCaps *pVHTCaps)
1881#else
1882tSirRetStatus
1883limPopulatePeerRateSet(tpAniSirGlobal pMac,
1884 tpSirSupportedRates pRates,
1885 tANI_U8* pSupportedMCSSet,
1886 tANI_U8 basicOnly,
1887 tpPESession psessionEntry)
1888#endif
1889{
1890 tSirMacRateSet tempRateSet;
1891 tSirMacRateSet tempRateSet2;
1892 tANI_U32 i,j,val,min,isArate;
1893 isArate = 0;
1894
1895 /* copy operational rate set from psessionEntry */
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07001896 if ( psessionEntry->rateSet.numRates <= SIR_MAC_RATESET_EID_MAX )
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001897 {
Kiet Lam842c3e12013-11-16 22:40:57 +05301898 vos_mem_copy((tANI_U8 *)tempRateSet.rate,
1899 (tANI_U8*)(psessionEntry->rateSet.rate),
1900 psessionEntry->rateSet.numRates);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001901 tempRateSet.numRates = psessionEntry->rateSet.numRates;
1902 }
1903 else
1904 {
1905 limLog(pMac, LOGE, FL("more than SIR_MAC_RATESET_EID_MAX rates\n"));
1906 goto error;
1907 }
Leela Venkata Kiran Kumar Reddy Chirala891bf062013-10-03 14:30:53 -07001908 if ((psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G) ||
1909 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11A) ||
1910 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N))
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001911 {
1912
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07001913 if (psessionEntry->extRateSet.numRates <= SIR_MAC_RATESET_EID_MAX)
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001914 {
Kiet Lam842c3e12013-11-16 22:40:57 +05301915 vos_mem_copy((tANI_U8 *)tempRateSet2.rate,
1916 (tANI_U8*)(psessionEntry->extRateSet.rate),
1917 psessionEntry->extRateSet.numRates);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001918 tempRateSet2.numRates = psessionEntry->extRateSet.numRates;
1919 }
1920 else {
1921 limLog(pMac, LOGE, FL("psessionEntry->extRateSet.numRates more than SIR_MAC_RATESET_EID_MAX rates\n"));
1922 goto error;
1923 }
1924 }
1925 else
1926 tempRateSet2.numRates = 0;
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07001927 if ((tempRateSet.numRates + tempRateSet2.numRates) > SIR_MAC_RATESET_EID_MAX)
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001928 {
1929 //we are in big trouble
1930 limLog(pMac, LOGP, FL("more than 12 rates in CFG"));
1931 goto error;
1932 }
1933
1934
1935 //copy all rates in tempRateSet, there are 12 rates max
1936 for (i = 0;i < tempRateSet2.numRates; i++)
1937 tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i];
1938 tempRateSet.numRates += tempRateSet2.numRates;
1939 /**
1940 * Sort rates in tempRateSet (they are likely to be already sorted)
1941 * put the result in pSupportedRates
1942 */
1943 {
1944 tANI_U8 aRateIndex = 0;
1945 tANI_U8 bRateIndex = 0;
Kiet Lam842c3e12013-11-16 22:40:57 +05301946 vos_mem_set((tANI_U8 *) pRates, sizeof(tSirSupportedRates), 0);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001947 for(i = 0;i < tempRateSet.numRates; i++)
1948 {
1949 min = 0;
1950 val = 0xff;
1951 isArate = 0;
1952 for(j = 0; (j < tempRateSet.numRates) && (j < SIR_MAC_RATESET_EID_MAX); j++)
1953 {
1954 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
1955 {
1956 val = tempRateSet.rate[j] & 0x7f;
1957 min = j;
1958 }
1959 }
1960 if (sirIsArate(tempRateSet.rate[min] & 0x7f))
1961 isArate = 1;
1962 /*
1963 * HAL needs to know whether the rate is basic rate or not, as it needs to
1964 * update the response rate table accordingly. e.g. if one of the 11a rates is
1965 * basic rate, then that rate can be used for sending control frames.
1966 * HAL updates the response rate table whenever basic rate set is changed.
1967 */
1968 if (basicOnly)
1969 {
1970 if (tempRateSet.rate[min] & 0x80)
1971 {
1972 if (isArate)
1973 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1974 else
1975 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1976 }
1977 }
1978 else
1979 {
1980 if (isArate)
1981 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1982 else
1983 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1984 }
1985 tempRateSet.rate[min] = 0xff;
1986 }
1987 }
1988
1989
1990 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode))
1991 {
1992 val = SIZE_OF_SUPPORTED_MCS_SET;
1993 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
1994 pRates->supportedMCSSet,
1995 &val) != eSIR_SUCCESS)
1996 {
1997 /// Could not get rateset from CFG. Log error.
1998 PELOGE(limLog(pMac, LOGE, FL("could not retrieve supportedMCSSet"));)
1999 goto error;
2000 }
2001 //if supported MCS Set of the peer is passed in, then do the intersection
2002 //else use the MCS set from local CFG.
2003 if(pSupportedMCSSet != NULL)
2004 {
2005 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
2006 pRates->supportedMCSSet[i] &= pSupportedMCSSet[i];
2007 }
Abhishek Singh525045c2014-12-15 17:18:45 +05302008 limLog(pMac, LOG1, FL("MCS Rate Set Bitmap: "));
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002009 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
Sushant Kaushik0b343422015-05-25 17:15:55 +05302010 limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002011 }
2012#ifdef WLAN_FEATURE_11AC
2013 limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
2014#endif
2015 return eSIR_SUCCESS;
2016 error:
2017 return eSIR_FAILURE;
2018} /*** limPopulatePeerRateSet() ***/
2019
Jeff Johnson295189b2012-06-20 16:38:30 -07002020/**
2021 * limPopulateMatchingRateSet
2022 * FUNCTION:
2023 * This is called at the time of Association Request
2024 * processing on AP and while adding peer's context
2025 * in IBSS role to process the CFG rate sets and
2026 * the rate sets received in the Assoc request on AP
2027 * or Beacon/Probe Response from peer in IBSS.
2028 *
2029 * LOGIC:
2030 * 1. It makes the intersection between our own rate Sat
2031 * and extemcded rate set and the ones received in the
2032 * association request.
2033 * 2. It creates a combined rate set of 12 rates max which
2034 * comprised the basic and extended rates
2035 * 3. It sorts the combined rate Set and copy it in the
2036 * rate array of the pSTA descriptor
2037 *
2038 * ASSUMPTION:
2039 * The parser has already ensured unicity of the rates in the
2040 * association request structure
2041 *
2042 * @param: pMac - Pointer to Global MAC structure
2043 * pStaDs - Pointer to DPH node
2044 * pOperRateSet - Pointer to peer's supported rateset
2045 * pExtRateSet - Pointer to peer's extended rateset
2046 *
2047 * @return: eSIR_SUCCESS or eSIR_FAILURE
2048 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002049#ifdef WLAN_FEATURE_11AC
2050tSirRetStatus
2051limPopulateMatchingRateSet(tpAniSirGlobal pMac,
2052 tpDphHashNode pStaDs,
2053 tSirMacRateSet *pOperRateSet,
2054 tSirMacRateSet *pExtRateSet,
2055 tANI_U8* pSupportedMCSSet,
2056 tSirMacPropRateSet *pAniLegRateSet,
2057 tpPESession psessionEntry,
2058 tDot11fIEVHTCaps *pVHTCaps)
Jeff Johnson295189b2012-06-20 16:38:30 -07002059
Jeff Johnsone7245742012-09-05 17:12:55 -07002060#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002061tSirRetStatus
2062limPopulateMatchingRateSet(tpAniSirGlobal pMac,
2063 tpDphHashNode pStaDs,
2064 tSirMacRateSet *pOperRateSet,
2065 tSirMacRateSet *pExtRateSet,
2066 tANI_U8* pSupportedMCSSet,
2067 tSirMacPropRateSet *pAniLegRateSet,
2068 tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07002069#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002070{
2071 tSirMacRateSet tempRateSet;
2072 tSirMacRateSet tempRateSet2;
2073 tANI_U32 i,j,val,min,isArate;
2074 tANI_U32 phyMode;
2075 tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
2076
2077 isArate=0;
2078
2079 // limGetPhyMode(pMac, &phyMode);
2080 limGetPhyMode(pMac, &phyMode, psessionEntry);
2081
2082 // get own rate set
2083 // val = WNI_CFG_OPERATIONAL_RATE_SET_LEN;
2084 #if 0
2085 if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
2086 (tANI_U8 *) &tempRateSet.rate,
2087 &val) != eSIR_SUCCESS)
2088 {
2089 /// Could not get rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002090 limLog(pMac, LOGP, FL("could not retrieve rateset"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 }
2092
2093 #endif // TO SUPPORT BT-AMP
2094
2095 /* copy operational rate set from psessionEntry */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302096 vos_mem_copy((tempRateSet.rate), (psessionEntry->rateSet.rate),
2097 psessionEntry->rateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07002098 tempRateSet.numRates = (tANI_U8) psessionEntry->rateSet.numRates;
2099
2100 if (phyMode == WNI_CFG_PHY_MODE_11G)
2101 {
2102
2103 #if 0
2104 // get own extended rate set
2105 val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN;
2106 if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
2107 (tANI_U8 *) &tempRateSet2.rate,
2108 &val) != eSIR_SUCCESS)
2109 #endif
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302110 vos_mem_copy((tempRateSet2.rate), (psessionEntry->extRateSet.rate),
2111 psessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07002112 tempRateSet2.numRates = (tANI_U8) psessionEntry->extRateSet.numRates;
2113 }
2114 else
2115 tempRateSet2.numRates = 0;
2116
2117 if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
2118 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002119 PELOGE(limLog(pMac, LOGE, FL("more than 12 rates in CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002120 goto error;
2121 }
2122
2123 /**
2124 * Handling of the rate set IEs is the following:
2125 * - keep only rates that we support and that the station supports
2126 * - sort and the rates into the pSta->rate array
2127 */
2128
2129 // Copy all rates in tempRateSet, there are 12 rates max
2130 for(i = 0; i < tempRateSet2.numRates; i++)
2131 tempRateSet.rate[i + tempRateSet.numRates] =
2132 tempRateSet2.rate[i];
2133
2134 tempRateSet.numRates += tempRateSet2.numRates;
2135
2136 /**
2137 * Sort rates in tempRateSet (they are likely to be already sorted)
2138 * put the result in tempRateSet2
2139 */
2140 tempRateSet2.numRates = 0;
2141
2142 for(i = 0;i < tempRateSet.numRates; i++)
2143 {
2144 min = 0;
2145 val = 0xff;
2146
2147 for(j = 0;j < tempRateSet.numRates; j++)
2148 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
2149 {
2150 val = tempRateSet.rate[j] & 0x7f;
2151 min = j;
2152 }
2153
2154 tempRateSet2.rate[tempRateSet2.numRates++] =
2155 tempRateSet.rate[min];
2156 tempRateSet.rate[min] = 0xff;
2157 }
2158
2159
2160 /**
2161 * Copy received rates in tempRateSet, the parser has ensured
2162 * unicity of the rates so there cannot be more than 12
2163 */
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002164 for(i = 0; (i < pOperRateSet->numRates && i < SIR_MAC_RATESET_EID_MAX) ; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002165 {
2166 tempRateSet.rate[i] = pOperRateSet->rate[i];
2167 }
2168
2169 tempRateSet.numRates = pOperRateSet->numRates;
2170
2171 if (pExtRateSet->numRates)
2172 {
2173 if((tempRateSet.numRates + pExtRateSet->numRates) > 12 )
2174 {
Abhishek Singh525045c2014-12-15 17:18:45 +05302175 limLog( pMac, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 "Sum of SUPPORTED and EXTENDED Rate Set (%1d) exceeds 12!",
2177 tempRateSet.numRates + pExtRateSet->numRates );
2178
2179 if( tempRateSet.numRates < 12 )
2180 {
2181 int found = 0;
2182 int tail = tempRateSet.numRates;
2183
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002184 for( i = 0; (i < pExtRateSet->numRates && i < SIR_MAC_RATESET_EID_MAX); i++ )
Jeff Johnson295189b2012-06-20 16:38:30 -07002185 {
2186 found = 0;
2187 for( j = 0; j < (tANI_U32) tail; j++ )
2188 {
2189 if((tempRateSet.rate[j] & 0x7F) ==
2190 (pExtRateSet->rate[i] & 0x7F))
2191 {
2192 found = 1;
2193 break;
2194 }
2195 }
2196
2197 if( !found )
2198 {
2199 tempRateSet.rate[tempRateSet.numRates++] =
2200 pExtRateSet->rate[i];
2201
2202 if( tempRateSet.numRates >= 12 )
2203 break;
2204 }
2205 }
2206 }
2207 else
Abhishek Singh525045c2014-12-15 17:18:45 +05302208 limLog( pMac, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 "Relying only on the SUPPORTED Rate Set IE..." );
2210 }
2211 else
2212 {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002213 for(j = 0; ((j < pExtRateSet->numRates) && (j < SIR_MAC_RATESET_EID_MAX) && ((i+j) < SIR_MAC_RATESET_EID_MAX)); j++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002214 tempRateSet.rate[i+j] = pExtRateSet->rate[j];
2215
2216 tempRateSet.numRates += pExtRateSet->numRates;
2217 }
2218 }
2219
2220 {
2221 tpSirSupportedRates rates = &pStaDs->supportedRates;
2222 tANI_U8 aRateIndex = 0;
2223 tANI_U8 bRateIndex = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302224 vos_mem_set((tANI_U8 *) rates, sizeof(tSirSupportedRates), 0);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002225 for(i = 0;(i < tempRateSet2.numRates && i < SIR_MAC_RATESET_EID_MAX ); i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002226 {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002227 for(j = 0;(j < tempRateSet.numRates && j < SIR_MAC_RATESET_EID_MAX); j++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 {
2229 if ((tempRateSet2.rate[i] & 0x7F) ==
2230 (tempRateSet.rate[j] & 0x7F))
2231 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 if (sirIsArate(tempRateSet2.rate[i] & 0x7f))
2233 {
2234 isArate=1;
Kiran Kumar Lokerea328bcd2013-04-22 22:02:05 -07002235 if (aRateIndex < SIR_NUM_11A_RATES)
2236 rates->llaRates[aRateIndex++] = tempRateSet2.rate[i];
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 }
2238 else
Kiran Kumar Lokerea328bcd2013-04-22 22:02:05 -07002239 {
2240 if (bRateIndex < SIR_NUM_11B_RATES)
2241 rates->llbRates[bRateIndex++] = tempRateSet2.rate[i];
2242 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 break;
2244 }
2245 }
2246 }
2247
2248
2249 //Now add the Polaris rates only when Proprietary rates are enabled.
2250 val = 0;
2251 if(wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_RATES_ENABLED, &val) != eSIR_SUCCESS)
2252 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002253 limLog(pMac, LOGP, FL("could not retrieve prop rate enabled flag from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002254 }
2255 else if(val)
2256 {
2257 for(i=0; i<pAniLegRateSet->numPropRates; i++)
2258 rates->aniLegacyRates[i] = pAniLegRateSet->propRate[i];
2259 }
2260
2261 }
2262
2263
2264 //compute the matching MCS rate set, if peer is 11n capable and self mode is 11n
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002265#ifdef FEATURE_WLAN_TDLS
2266 if(pStaDs->mlmStaContext.htCapability)
2267#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002268 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
2269 (pStaDs->mlmStaContext.htCapability))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002270#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 {
2272 val = SIZE_OF_SUPPORTED_MCS_SET;
2273 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
2274 mcsSet,
2275 &val) != eSIR_SUCCESS)
2276 {
2277 /// Could not get rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002278 limLog(pMac, LOGP, FL("could not retrieve supportedMCSSet"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 goto error;
2280 }
2281
2282 for(i=0; i<val; i++)
2283 pStaDs->supportedRates.supportedMCSSet[i] = mcsSet[i] & pSupportedMCSSet[i];
2284
Abhishek Singh525045c2014-12-15 17:18:45 +05302285 limLog(pMac, LOG1, FL(" MCS Rate Set Bitmap from CFG and DPH : "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002286 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
2287 {
Abhishek Singh525045c2014-12-15 17:18:45 +05302288 limLog(pMac, LOG1,FL("%x %x "), mcsSet[i],
2289 pStaDs->supportedRates.supportedMCSSet[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 }
2291 }
2292
Jeff Johnsone7245742012-09-05 17:12:55 -07002293#ifdef WLAN_FEATURE_11AC
2294 limPopulateVhtMcsSet(pMac, &pStaDs->supportedRates, pVHTCaps, psessionEntry);
2295#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 /**
2297 * Set the erpEnabled bit iff the phy is in G mode and at least
2298 * one A rate is supported
2299 */
2300 if ((phyMode == WNI_CFG_PHY_MODE_11G) && isArate)
2301 pStaDs->erpEnabled = eHAL_SET;
2302
2303
2304
2305 return eSIR_SUCCESS;
2306
2307 error:
2308
2309 return eSIR_FAILURE;
2310} /*** limPopulateMatchingRateSet() ***/
2311
2312
2313
2314/**
2315 * limAddSta()
2316 *
2317 *FUNCTION:
2318 * This function is called to add an STA context at hardware
2319 * whenever a STA is (Re) Associated.
2320 *
2321 *LOGIC:
2322 *
2323 *ASSUMPTIONS:
2324 * NA
2325 *
2326 *NOTE:
2327 * NA
2328 *
2329 * @param pMac - Pointer to Global MAC structure
2330 * @param pStaDs - Pointer to the STA datastructure created by
2331 * LIM and maintained by DPH
2332 * @return retCode - Indicates success or failure return code
2333 */
2334
2335tSirRetStatus
2336limAddSta(
2337 tpAniSirGlobal pMac,
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002338 tpDphHashNode pStaDs, tANI_U8 updateEntry, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002339{
2340 tpAddStaParams pAddStaParams = NULL;
2341 tSirMsgQ msgQ;
2342 tSirRetStatus retCode = eSIR_SUCCESS;
2343 tSirMacAddr staMac, *pStaAddr;
2344 tANI_U8 i;
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 tpSirAssocReq pAssocReq;
2346 tANI_U8 *p2pIe = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002347 #if 0
2348 retCode = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2349 if (retCode != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002350 limLog(pMac, LOGP, FL("could not retrieve STA MAC"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002351 #endif //To SUPPORT BT-AMP
2352
2353
2354 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
2355
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302356 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
2357 psessionEntry->smeSessionId, updateEntry, psessionEntry->limSystemRole);
2358
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302359 pAddStaParams = vos_mem_malloc(sizeof(tAddStaParams));
2360 if (NULL == pAddStaParams)
2361 {
2362 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
2363 return eSIR_MEM_ALLOC_FAILED;
2364 }
2365 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002366
2367 if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||
2368 (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) ||
2369 (limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) )
2370 pStaAddr = &pStaDs->staAddr;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002371#ifdef FEATURE_WLAN_TDLS
2372 /* SystemRole shouldn't be matter if staType is TDLS peer */
2373 else if(STA_ENTRY_TDLS_PEER == pStaDs->staType)
2374 {
2375 pStaAddr = &pStaDs->staAddr ;
2376 }
2377#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002378 else
2379 pStaAddr = &staMac;
2380
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302381 limLog(pMac, LOG1, FL(MAC_ADDRESS_STR": Subtype(Assoc/Reassoc): %d "),
2382 MAC_ADDR_ARRAY(*pStaAddr), pStaDs->mlmStaContext.subType);
2383
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302384 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2385 (tANI_U8 *) *pStaAddr, sizeof(tSirMacAddr));
2386 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2387 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002388
2389 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
2390
2391 //Copy legacy rates
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302392 vos_mem_copy ((tANI_U8*)&pAddStaParams->supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -07002393 (tANI_U8*)&pStaDs->supportedRates, sizeof(tSirSupportedRates));
2394
2395 pAddStaParams->assocId = pStaDs->assocId;
2396
2397 pAddStaParams->wmmEnabled = pStaDs->qosMode;
2398 pAddStaParams->listenInterval = pStaDs->mlmStaContext.listenInterval;
2399 pAddStaParams->shortPreambleSupported = pStaDs->shortPreambleEnabled;
Abhishek Singhf08a82b2014-10-07 11:00:42 +05302400 pAddStaParams->currentOperChan = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002401 if((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) && (pStaDs->mlmStaContext.subType == LIM_REASSOC))
2402 {
2403 /* TBD - need to remove this REASSOC check after fixinf rmmod issue */
2404 pAddStaParams->updateSta = pStaDs->mlmStaContext.updateContext;
2405 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002406 pStaDs->valid = 0;
2407 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2408
Abhishek Singh525045c2014-12-15 17:18:45 +05302409 limLog(pMac, LOG1, FL(" Assoc ID: %d wmmEnabled = %d listenInterval = %d"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302410 " shortPreambleSupported: %d "), pAddStaParams->assocId,
2411 pAddStaParams->wmmEnabled, pAddStaParams->listenInterval,
2412 pAddStaParams->shortPreambleSupported);
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002413 // This will indicate HAL to "allocate" a new STA index
2414#ifdef FEATURE_WLAN_TDLS
2415 /* As there is corner case in-between add_sta and change_sta,if del_sta for other staIdx happened,
2416 * firmware return wrong staIdx (recently removed staIdx). Until we get a confirmation from the
2417 * firmware team it is now return correct staIdx for same sta_mac_addr for update case, we want
2418 * to get around it by passing valid staIdx given by add_sta time.
2419 */
2420 if((STA_ENTRY_TDLS_PEER == pStaDs->staType) &&
2421 (true == updateEntry))
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +05302422 {
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002423 pAddStaParams->staIdx = pStaDs->staIndex;
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +05302424 }
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002425 else
2426#endif
2427 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
Jeff Johnson295189b2012-06-20 16:38:30 -07002428 pAddStaParams->staType = pStaDs->staType;
2429
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002430 pAddStaParams->updateSta = updateEntry;
2431
Jeff Johnson295189b2012-06-20 16:38:30 -07002432 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2433 pAddStaParams->respReqd = 1;
2434 //Update HT Capability
2435
2436 if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||(limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) || (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE))
Jeff Johnsone7245742012-09-05 17:12:55 -07002437 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002438 pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
Jeff Johnsone7245742012-09-05 17:12:55 -07002439#ifdef WLAN_FEATURE_11AC
2440 pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
2441#endif
2442 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002443#ifdef FEATURE_WLAN_TDLS
2444 /* SystemRole shouldn't be matter if staType is TDLS peer */
2445 else if(STA_ENTRY_TDLS_PEER == pStaDs->staType)
Hoonki Lee99e53782013-02-12 18:07:03 -08002446 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002447 pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
Hoonki Lee99e53782013-02-12 18:07:03 -08002448#ifdef WLAN_FEATURE_11AC
2449 pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
2450#endif
2451 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002452#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002453 else
Jeff Johnsone7245742012-09-05 17:12:55 -07002454 {
2455 pAddStaParams->htCapable = psessionEntry->htCapability;
2456#ifdef WLAN_FEATURE_11AC
2457 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
2458#endif
2459
2460 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302461#ifdef WLAN_FEATURE_11AC
Abhishek Singh525045c2014-12-15 17:18:45 +05302462 limLog(pMac, LOG1, FL("vhtCapable: %d "), pAddStaParams->vhtCapable);
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302463#endif
Abhishek Singh525045c2014-12-15 17:18:45 +05302464 limLog(pMac, LOG1, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302465 pAddStaParams->staIdx,pAddStaParams->updateSta,
2466 pAddStaParams->htCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002467
2468 pAddStaParams->greenFieldCapable = pStaDs->htGreenfield;
2469 pAddStaParams->maxAmpduDensity= pStaDs->htAMpduDensity;
2470 pAddStaParams->maxAmpduSize = pStaDs->htMaxRxAMpduFactor;
2471 pAddStaParams->fDsssCckMode40Mhz = pStaDs->htDsssCckRate40MHzSupport;
2472 pAddStaParams->fShortGI20Mhz = pStaDs->htShortGI20Mhz;
2473 pAddStaParams->fShortGI40Mhz = pStaDs->htShortGI40Mhz;
2474 pAddStaParams->lsigTxopProtection = pStaDs->htLsigTXOPProtection;
2475 pAddStaParams->maxAmsduSize = pStaDs->htMaxAmsduLength;
2476 pAddStaParams->txChannelWidthSet = pStaDs->htSupportedChannelWidthSet;
2477 pAddStaParams->mimoPS = pStaDs->htMIMOPSState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002478
Abhishek Singh525045c2014-12-15 17:18:45 +05302479 limLog(pMac, LOG1, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302480 "maxAmpduDensity = %d"), pAddStaParams->greenFieldCapable,
2481 pAddStaParams->maxAmpduDensity, pAddStaParams->maxAmpduSize);
2482
Abhishek Singh525045c2014-12-15 17:18:45 +05302483 limLog(pMac, LOG1, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302484 "fShortGI40Mhz: %d"), pAddStaParams->fDsssCckMode40Mhz,
2485 pAddStaParams->fShortGI20Mhz, pAddStaParams->fShortGI40Mhz);
2486
Abhishek Singh525045c2014-12-15 17:18:45 +05302487 limLog(pMac, LOG1, FL("lsigTxopProtection: %d maxAmsduSize: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302488 "txChannelWidthSet: %d mimoPS: %d "), pAddStaParams->lsigTxopProtection,
2489 pAddStaParams->maxAmsduSize,pAddStaParams->txChannelWidthSet,
2490 pAddStaParams->mimoPS);
2491
Jeff Johnsone7245742012-09-05 17:12:55 -07002492#ifdef WLAN_FEATURE_11AC
2493 if(pAddStaParams->vhtCapable)
2494 {
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002495 pAddStaParams->vhtTxChannelWidthSet = pStaDs->vhtSupportedChannelWidthSet;
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002496 pAddStaParams->vhtTxBFCapable =
Hoonki Lee99e53782013-02-12 18:07:03 -08002497#ifdef FEATURE_WLAN_TDLS
2498 (( STA_ENTRY_PEER == pStaDs->staType ) || (STA_ENTRY_TDLS_PEER == pStaDs->staType)) ?
2499 pStaDs->vhtBeamFormerCapable : psessionEntry->txBFIniFeatureEnabled ;
2500#else
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002501 ( STA_ENTRY_PEER == pStaDs->staType ) ? pStaDs->vhtBeamFormerCapable :
2502 psessionEntry->txBFIniFeatureEnabled ;
Hoonki Lee99e53782013-02-12 18:07:03 -08002503#endif
Abhishek Singh525045c2014-12-15 17:18:45 +05302504 limLog(pMac, LOG1, FL("vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302505 pAddStaParams->vhtTxChannelWidthSet,pAddStaParams->vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07002506 }
2507#endif
2508
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002509#ifdef FEATURE_WLAN_TDLS
2510 if((STA_ENTRY_PEER == pStaDs->staType) ||
2511 (STA_ENTRY_TDLS_PEER == pStaDs->staType))
2512#else
2513 if (STA_ENTRY_PEER == pStaDs->staType)
2514#endif
2515 {
2516 /* peer STA get the LDPC capability from pStaDs, which populated from
2517 * HT/VHT capability*/
Sushant Kaushik4fb4da72015-02-20 21:37:29 +05302518 if(pAddStaParams->vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP)
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08002519 {
2520 pAddStaParams->htLdpcCapable = 0;
2521 pAddStaParams->vhtLdpcCapable = 0;
2522 }
2523 else
2524 {
2525 pAddStaParams->htLdpcCapable = pStaDs->htLdpcCapable;
2526 pAddStaParams->vhtLdpcCapable = pStaDs->vhtLdpcCapable;
2527 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002528 }
2529 else if( STA_ENTRY_SELF == pStaDs->staType)
2530 {
2531 /* For Self STA get the LDPC capability from config.ini*/
2532 pAddStaParams->htLdpcCapable =
2533 (psessionEntry->txLdpcIniFeatureEnabled & 0x01);
2534 pAddStaParams->vhtLdpcCapable =
2535 ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01);
2536 }
2537
Jeff Johnson295189b2012-06-20 16:38:30 -07002538 /* Update PE session ID*/
2539 pAddStaParams->sessionId = psessionEntry->peSessionId;
2540
2541 if (psessionEntry->parsedAssocReq != NULL)
2542 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002543 // Get a copy of the already parsed Assoc Request
2544 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
2545 if ( pAssocReq && pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
2546 p2pIe = limGetP2pIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
2547 }
2548 pAddStaParams->p2pCapableSta = (p2pIe != NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002549 }
2550
2551 //Disable BA. It will be set as part of ADDBA negotiation.
2552 for( i = 0; i < STACFG_MAX_TC; i++ )
2553 {
2554 pAddStaParams->staTCParams[i].txUseBA = eBA_DISABLE;
2555 pAddStaParams->staTCParams[i].rxUseBA = eBA_DISABLE;
2556 }
2557
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002558#ifdef FEATURE_WLAN_TDLS
2559 if(pStaDs->wmeEnabled && \
2560 ((eLIM_AP_ROLE == psessionEntry->limSystemRole) || (STA_ENTRY_TDLS_PEER == pStaDs->staType)) )
2561#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002562 if(pStaDs->wmeEnabled && (eLIM_AP_ROLE == psessionEntry->limSystemRole))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002563#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002564 {
2565 pAddStaParams->uAPSD = 0;
2566 /* update UAPSD and send it to LIM to add STA */
2567 // bitmap MSB <- LSB MSB 4 bits are for
2568 // trigger enabled AC setting and LSB 4 bits
2569 // are for delivery enabled AC setting
2570 // 7 6 5 4 3 2 1 0
2571 // BE BK VI VO BE BK VI VO
2572 pAddStaParams->uAPSD |= pStaDs->qos.capability.qosInfo.acvo_uapsd;
2573 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acvi_uapsd << 1);
2574 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbk_uapsd << 2);
2575 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbe_uapsd << 3);
2576 //making delivery enabled and trigger enabled setting the same.
2577 pAddStaParams->uAPSD |= pAddStaParams->uAPSD << 4;
2578
2579 pAddStaParams->maxSPLen = pStaDs->qos.capability.qosInfo.maxSpLen;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302580 limLog( pMac, LOG1, FL("uAPSD = 0x%x, maxSpLen = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002581 pAddStaParams->uAPSD, pAddStaParams->maxSPLen);
2582 }
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002583
2584#ifdef WLAN_FEATURE_11W
2585 pAddStaParams->rmfEnabled = pStaDs->rmfEnabled;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302586 limLog( pMac, LOG1, FL( "PMF enabled %d"), pAddStaParams->rmfEnabled);
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002587#endif
2588
Abhishek Singh525045c2014-12-15 17:18:45 +05302589 limLog(pMac, LOG1, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302590 "p2pCapableSta: %d"), pAddStaParams->htLdpcCapable,
2591 pAddStaParams->vhtLdpcCapable, pAddStaParams->p2pCapableSta);
2592
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002593 //we need to defer the message until we get the response back from HAL.
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 if (pAddStaParams->respReqd)
2595 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07002596
2597 msgQ.type = WDA_ADD_STA_REQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07002598
2599 msgQ.reserved = 0;
2600 msgQ.bodyptr = pAddStaParams;
2601 msgQ.bodyval = 0;
2602
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002603 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ for assocId %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002604 pStaDs->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07002605 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002606
2607 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2608 if( eSIR_SUCCESS != retCode)
2609 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002610 if (pAddStaParams->respReqd)
2611 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002612 limLog( pMac, LOGE, FL("ADD_STA_REQ for aId %d failed (reason %X)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002613 pStaDs->assocId, retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302614 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002615 }
2616
2617 return retCode;
2618}
2619
2620
2621/**
2622 * limDelSta()
2623 *
2624 *FUNCTION:
2625 * This function is called to delete an STA context at hardware
2626 * whenever a STA is disassociated
2627 *
2628 *LOGIC:
2629 *
2630 *ASSUMPTIONS:
2631 * NA
2632 *
2633 *NOTE:
2634 * NA
2635 *
2636 * @param pMac - Pointer to Global MAC structure
2637 * @param pStaDs - Pointer to the STA datastructure created by
2638 * LIM and maintained by DPH
2639 * @param fRespReqd - flag to indicate whether the delete is synchronous (true)
2640 * or not (false)
2641 * @return retCode - Indicates success or failure return code
2642 */
2643
2644tSirRetStatus
2645limDelSta(
2646 tpAniSirGlobal pMac,
2647 tpDphHashNode pStaDs,
2648 tANI_BOOLEAN fRespReqd,
2649 tpPESession psessionEntry)
2650{
2651 tpDeleteStaParams pDelStaParams = NULL;
2652 tSirMsgQ msgQ;
2653 tSirRetStatus retCode = eSIR_SUCCESS;
2654
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302655 pDelStaParams = vos_mem_malloc(sizeof( tDeleteStaParams ));
2656 if (NULL == pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07002657 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302658 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002659 return eSIR_MEM_ALLOC_FAILED;
2660 }
2661
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302662 vos_mem_set((tANI_U8 *) pDelStaParams, sizeof(tDeleteStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002663
2664 //
2665 // DPH contains the STA index only for "peer" STA entries.
2666 // LIM global contains "self" STA index
2667 // Thus,
2668 // if( STA role )
2669 // get STA index from LIM global
2670 // else
2671 // get STA index from DPH
2672 //
2673
2674#if 0
2675 /* Since we have not created any STA, no need to send msg to delete
2676 * STA to HAL */
2677 if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) {
2678 pDelStaParams->staIdx = 1; /* TODO : This is workaround. Need to find right STA Index before sending to HAL */
2679 //return retCode;
2680 }
2681#endif
2682
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002683#ifdef FEATURE_WLAN_TDLS
2684 if( ((eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) && (pStaDs->staType != STA_ENTRY_TDLS_PEER)) ||(eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
2685#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002686 if( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||(eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002687#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002688 pDelStaParams->staIdx= psessionEntry->staId;
2689
2690 else
2691 pDelStaParams->staIdx= pStaDs->staIndex;
2692
2693 pDelStaParams->assocId = pStaDs->assocId;
2694 pStaDs->valid = 0;
2695
2696 if (! fRespReqd)
2697 pDelStaParams->respReqd = 0;
2698 else
2699 {
2700 //when limDelSta is called from processSmeAssocCnf then mlmState is already set properly.
2701 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs))
2702 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002703 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002704 SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, eLIM_MLM_WT_DEL_STA_RSP_STATE);
2705 }
2706 if ( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||
2707 (eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
2708 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002709 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002710
2711 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
2712
2713 }
2714 pDelStaParams->respReqd = 1;
2715 //we need to defer the message until we get the response back from HAL.
2716 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
2717 }
2718
2719 /* Update PE session ID*/
2720 pDelStaParams->sessionId = psessionEntry->peSessionId;
2721
2722 pDelStaParams->status = eHAL_STATUS_SUCCESS;
2723 msgQ.type = WDA_DELETE_STA_REQ;
2724 msgQ.reserved = 0;
2725 msgQ.bodyptr = pDelStaParams;
2726 msgQ.bodyval = 0;
2727
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302728 limLog( pMac, LOG1, FL( "Sessionid %d :Sending SIR_HAL_DELETE_STA_REQ "
2729 "for STAID: %X and AssocID: %d MAC : "MAC_ADDRESS_STR ),
2730 pDelStaParams->sessionId,
2731 pDelStaParams->staIdx, pDelStaParams->assocId,
2732 MAC_ADDR_ARRAY(pStaDs->staAddr));
2733
Jeff Johnsone7245742012-09-05 17:12:55 -07002734 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002735 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2736 if( eSIR_SUCCESS != retCode)
2737 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002738 if(fRespReqd)
2739 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002740 limLog( pMac, LOGE, FL("Posting DELETE_STA_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002741 retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302742 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002743 }
2744
2745 return retCode;
2746}
2747
2748#if defined WLAN_FEATURE_VOWIFI_11R
2749/*------------------------------------------------------------------------
2750 * limAddFTStaSelf()
2751 *
2752 * FUNCTION:
2753 *
2754 * This function is called to add a STA once we have connected with a new
2755 * AP, that we have performed an FT to.
2756 *
2757 * The Add STA Response is created and now after the ADD Bss Is Successful
2758 * we add the self sta. We update with the association id from the reassoc
2759 * response from the AP.
2760 *------------------------------------------------------------------------
2761 */
2762tSirRetStatus limAddFTStaSelf(tpAniSirGlobal pMac, tANI_U16 assocId, tpPESession psessionEntry)
2763{
2764 tpAddStaParams pAddStaParams = NULL;
2765 tSirMsgQ msgQ;
2766 tSirRetStatus retCode = eSIR_SUCCESS;
2767
2768 pAddStaParams = pMac->ft.ftPEContext.pAddStaReq;
2769 pAddStaParams->assocId = assocId;
2770
2771 msgQ.type = SIR_HAL_ADD_STA_REQ;
2772 msgQ.reserved = 0;
2773 msgQ.bodyptr = pAddStaParams;
2774 msgQ.bodyval = 0;
2775
2776
2777#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002778 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002779#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002780 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002781
2782 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002783 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_ADD_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002784 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2785 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
2786 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002787 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302788 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002789 }
2790 //
2791 // Dont need it any more
2792 pMac->ft.ftPEContext.pAddStaReq = NULL;
2793 return retCode;
2794}
2795
2796#endif /* WLAN_FEATURE_VOWIFI_11R */
2797
2798/**
2799 * limAddStaSelf()
2800 *
2801 *FUNCTION:
2802 * This function is called to add an STA context at hardware
2803 * whenever a STA is (Re) Associated.
2804 *
2805 *LOGIC:
2806 *
2807 *ASSUMPTIONS:
2808 * NA
2809 *
2810 *NOTE:
2811 * NA
2812 *
2813 * @param pMac - Pointer to Global MAC structure
2814 * @param pStaDs - Pointer to the STA datastructure created by
2815 * LIM and maintained by DPH
2816 * @return retCode - Indicates success or failure return code
2817 */
2818
2819tSirRetStatus
2820limAddStaSelf(tpAniSirGlobal pMac,tANI_U16 staIdx, tANI_U8 updateSta, tpPESession psessionEntry)
2821{
2822 tpAddStaParams pAddStaParams = NULL;
2823 tSirMsgQ msgQ;
2824 tSirRetStatus retCode = eSIR_SUCCESS;
2825 tSirMacAddr staMac;
2826 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
krunal soni71343fb2013-09-16 16:16:26 -07002827 tANI_U32 shortGi20MhzSupport;
2828 tANI_U32 shortGi40MhzSupport;
Sushant Kaushikb90b4e22015-04-14 14:29:49 +05302829 tANI_U32 val;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002830 /*This self Sta dot 11 mode comes from the cfg and the expectation here is
2831 * that cfg carries the systemwide capability that device under
2832 * consideration can support. This capability gets plumbed into the cfg
2833 * cache at system initialization time via the .dat and .ini file override
2834 * mechanisms and will not change. If it does change, it is the
2835 * responsibility of SME to evict the selfSta and reissue a new AddStaSelf
2836 * command.*/
2837 tANI_U32 selfStaDot11Mode=0, selfTxWidth=0;
2838 wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfStaDot11Mode);
2839 limLog( pMac, LOG1, FL("cfgDot11Mode %d"),(int)selfStaDot11Mode);
2840 wlan_cfgGetInt(pMac,WNI_CFG_HT_CAP_INFO_SUPPORTED_CHAN_WIDTH_SET,&selfTxWidth);
2841 limLog( pMac, LOG1, FL("SGI 20 %d"),(int)selfTxWidth);
2842 limLog( pMac, LOG1, FL("Roam Channel Bonding Mode %d"),(int)pMac->roam.configParam.uCfgDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002843
2844 #if 0
2845 retCode =wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2846 if (retCode != eSIR_SUCCESS)
2847 {
2848 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002849 limLog(pMac, LOGP, FL("could not retrieve STA MAC"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 return retCode;
2851 }
2852 #endif //TO SUPPORT BT-AMP
2853 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302854 limLog(pMac, LOG1, FL(MAC_ADDRESS_STR": "),MAC_ADDR_ARRAY(staMac));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302855 pAddStaParams = vos_mem_malloc(sizeof(tAddStaParams));
2856 if (NULL == pAddStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07002857 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302858 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002859 return eSIR_MEM_ALLOC_FAILED;
2860 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302861 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002862
2863 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302864 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2865 (tANI_U8 *) staMac, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002866
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302867 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2868 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002869
2870 pAddStaParams->assocId = psessionEntry->limAID;
2871 pAddStaParams->staType = STA_ENTRY_SELF;
2872 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2873 pAddStaParams->respReqd = 1;
Abhishek Singhf08a82b2014-10-07 11:00:42 +05302874 pAddStaParams->currentOperChan = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002875 /* Update PE session ID */
2876 pAddStaParams->sessionId = psessionEntry->peSessionId;
2877
2878 // This will indicate HAL to "allocate" a new STA index
2879 pAddStaParams->staIdx = staIdx;
2880 pAddStaParams->updateSta = updateSta;
2881
Sushant Kaushikb90b4e22015-04-14 14:29:49 +05302882 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
2883 {
2884 limLog(pMac, LOGP, FL("Get short preamble failed. Set Default value"));
2885 pAddStaParams->shortPreambleSupported = 1;
2886 }
2887 pAddStaParams->shortPreambleSupported = val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002888
Jeff Johnsone7245742012-09-05 17:12:55 -07002889#ifdef WLAN_FEATURE_11AC
2890 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry,NULL);
2891#else
2892 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
2893#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002894// if( psessionEntry->htCapability)---> old check
2895 /*We used to check if the session is htCapable before setting the htCapable
2896 * flag. The check limited us from operating */
2897 if ( IS_DOT11_MODE_HT(selfStaDot11Mode) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002898 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002899 pAddStaParams->htCapable = TRUE ;
Jeff Johnson295189b2012-06-20 16:38:30 -07002900#ifdef DISABLE_GF_FOR_INTEROP
2901 /*
2902 * To resolve the interop problem with Broadcom AP,
2903 * where TQ STA could not pass traffic with GF enabled,
2904 * TQ STA will do Greenfield only with TQ AP, for
2905 * everybody else it will be turned off.
2906 */
2907 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2908 {
2909 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2910 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2911 }
2912 else
2913#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002914 {
2915 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2916 pAddStaParams->txChannelWidthSet =
2917 pMac->roam.configParam.channelBondingMode5GHz;
2918 // pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2919 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2920 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2921 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2922 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2923 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2924 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2925 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2926 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
krunal soni71343fb2013-09-16 16:16:26 -07002927 /*
2928 * We will read the gShortGI20Mhz from ini file, and if it is set
2929 * to 1 then we will tell Peer that we support 40Mhz short GI
2930 */
2931 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
2932 (pMac, WNI_CFG_SHORT_GI_20MHZ,
2933 &shortGi20MhzSupport)))
2934 {
2935 if (VOS_TRUE == shortGi20MhzSupport)
2936 {
2937 pAddStaParams->fShortGI20Mhz =
2938 WNI_CFG_SHORT_GI_20MHZ_STAMAX;
2939 //pAddStaParams->fShortGI20Mhz =
2940 //limGetHTCapability(pMac, eHT_SHORT_GI_20MHZ,
2941 // psessionEntry);
2942 }
2943 else
2944 {
2945 pAddStaParams->fShortGI20Mhz = VOS_FALSE;
2946 }
2947 }
2948 else
2949 {
2950 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
2951 "CFG,setting value to default"));)
2952 pAddStaParams->fShortGI20Mhz = WNI_CFG_SHORT_GI_20MHZ_STADEF;
2953 }
2954
2955 /*
2956 * We will read the gShortGI40Mhz from ini file, and if it is set
2957 * to 1 then we will tell Peer that we support 40Mhz short GI
2958 */
2959 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
2960 (pMac, WNI_CFG_SHORT_GI_40MHZ,
2961 &shortGi40MhzSupport)))
2962 {
2963 if (VOS_TRUE == shortGi40MhzSupport)
2964 {
2965 pAddStaParams->fShortGI40Mhz =
2966 WNI_CFG_SHORT_GI_40MHZ_STAMAX;
2967 //pAddStaParams->fShortGI40Mhz =
2968 //limGetHTCapability(pMac, eHT_SHORT_GI_40MHZ,
2969 // psessionEntry);
2970 }
2971 else
2972 {
2973 pAddStaParams->fShortGI40Mhz = VOS_FALSE;
2974 }
2975 }
2976 else
2977 {
2978 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
2979 "CFG,setting value to default"));)
2980 pAddStaParams->fShortGI40Mhz = WNI_CFG_SHORT_GI_40MHZ_STADEF;
2981 }
Abhishek Singh525045c2014-12-15 17:18:45 +05302982 limLog(pMac, LOG1, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302983 "maxAmpduSize = %d"), pAddStaParams->greenFieldCapable,
2984 pAddStaParams->maxAmpduDensity, pAddStaParams->maxAmpduSize);
2985
Abhishek Singh525045c2014-12-15 17:18:45 +05302986 limLog(pMac, LOG1, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302987 "fShortGI40Mhz: %d lsigTxopProtection: %d"),
2988 pAddStaParams->fDsssCckMode40Mhz, pAddStaParams->fShortGI20Mhz,
2989 pAddStaParams->fShortGI40Mhz, pAddStaParams->lsigTxopProtection);
2990
Abhishek Singh525045c2014-12-15 17:18:45 +05302991 limLog(pMac, LOG1, FL(" maxAmsduSize: %d txChannelWidthSet: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302992 "mimoPS: %d rifsMode %d delBASupport %d"),
2993 pAddStaParams->maxAmsduSize,
2994 pAddStaParams->txChannelWidthSet, pAddStaParams->mimoPS,
2995 pAddStaParams->rifsMode, pAddStaParams->delBASupport );
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002996 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002997 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002998#ifdef WLAN_FEATURE_11AC
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002999 pAddStaParams->vhtCapable = IS_DOT11_MODE_VHT(selfStaDot11Mode);
3000 if (pAddStaParams->vhtCapable){
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07003001 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08003002 limLog( pMac, LOG1, FL("VHT WIDTH SET %d"),pAddStaParams->vhtTxChannelWidthSet);
3003 }
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08003004 pAddStaParams->vhtTxBFCapable = psessionEntry->txBFIniFeatureEnabled;
Abhishek Singh525045c2014-12-15 17:18:45 +05303005 limLog(pMac, LOG1, FL("vhtCapable: %d vhtTxBFCapable %d "),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303006 pAddStaParams->vhtCapable, pAddStaParams->vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07003007#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08003008
3009 /* For Self STA get the LDPC capability from session i.e config.ini*/
3010 pAddStaParams->htLdpcCapable =
3011 (psessionEntry->txLdpcIniFeatureEnabled & 0x01);
3012 pAddStaParams->vhtLdpcCapable =
3013 ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01);
3014
Jeff Johnson295189b2012-06-20 16:38:30 -07003015 if(wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003016 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003017 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
3018
Jeff Johnson295189b2012-06-20 16:38:30 -07003019 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
3020 {
3021 pAddStaParams->p2pCapableSta = 1;
3022 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003023
Gopichand Nakkala681989c2013-03-06 22:27:48 -08003024 //limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
3025 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003026
Abhishek Singh525045c2014-12-15 17:18:45 +05303027 limLog(pMac, LOG1, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303028 pAddStaParams->staIdx,pAddStaParams->updateSta,
3029 pAddStaParams->htCapable);
3030
Abhishek Singh525045c2014-12-15 17:18:45 +05303031 limLog(pMac, LOG1, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303032 "p2pCapableSta: %d"),
3033 pAddStaParams->htLdpcCapable,pAddStaParams->vhtLdpcCapable,
3034 pAddStaParams->p2pCapableSta);
3035
Abhishek Singh525045c2014-12-15 17:18:45 +05303036 limLog(pMac, LOG1, FL(" sessionid: %d Assoc ID: %d listenInterval = %d"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303037 " shortPreambleSupported: %d "), psessionEntry->smeSessionId,
3038 pAddStaParams->assocId, pAddStaParams->listenInterval,
3039 pAddStaParams->shortPreambleSupported);
3040
Jeff Johnson295189b2012-06-20 16:38:30 -07003041 msgQ.type = WDA_ADD_STA_REQ;
3042 //
3043 // FIXME_GEN4
3044 // A global counter (dialog token) is required to keep track of
3045 // all PE <-> HAL communication(s)
3046 //
3047 msgQ.reserved = 0;
3048 msgQ.bodyptr = pAddStaParams;
3049 msgQ.bodyval = 0;
3050
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303051 limLog( pMac, LOGW, FL(MAC_ADDRESS_STR":Sessionid %d : "
3052 "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ),
3053 MAC_ADDR_ARRAY(pAddStaParams->staMac),
3054 pAddStaParams->sessionId,
3055 pAddStaParams->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07003056 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003057
3058 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
3059 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003060 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303061 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003062 }
3063 return retCode;
3064}
3065
3066
3067/**
3068 * limTeardownInfraBSS()
3069 *
3070 *FUNCTION:
3071 * This function is called by various LIM functions to teardown
3072 * an established Infrastructure BSS
3073 *
3074 *LOGIC:
3075 *
3076 *ASSUMPTIONS:
3077 *
3078 *NOTE:
3079 *
3080 * @param pMac - Pointer to Global MAC structure
3081 * @return None
3082 */
3083
3084void
3085limTeardownInfraBss(tpAniSirGlobal pMac,tpPESession psessionEntry)
3086{
3087 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3088
3089 /**
3090 * Send Broadcast Disassociate frame with
3091 * 'leaving BSS' reason.
3092 */
3093 limSendDisassocMgmtFrame(pMac,
3094 eSIR_MAC_DISASSOC_LEAVING_BSS_REASON,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003095 bcAddr,psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003096} /*** end limTeardownInfraBss() ***/
3097
3098
3099/**
3100 * limHandleCnfWaitTimeout()
3101 *
3102 *FUNCTION:
3103 * This function is called by limProcessMessageQueue to handle
3104 * various confirmation failure cases.
3105 *
3106 *LOGIC:
3107 *
3108 *ASSUMPTIONS:
3109 *
3110 *NOTE:
3111 *
3112 * @param pMac - Pointer to Global MAC structure
3113 * @param pStaDs - Pointer to a sta descriptor
3114 * @return None
3115 */
3116
3117void limHandleCnfWaitTimeout(tpAniSirGlobal pMac, tANI_U16 staId)
3118{
3119 tpDphHashNode pStaDs;
3120 tLimSystemRole systemRole;
3121 tpPESession psessionEntry = NULL;
3122
3123 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId))== NULL)
3124 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003125 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003126 return;
3127 }
3128 systemRole = limGetSystemRole(psessionEntry);
3129 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
3130
3131 if (pStaDs == NULL)
3132 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003133 PELOGW(limLog(pMac, LOGW, FL("No STA context in SIR_LIM_CNF_WAIT_TIMEOUT."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003134 return;
3135 }
3136
3137 switch (pStaDs->mlmStaContext.mlmState) {
3138 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003139 PELOGW(limLog(pMac, LOGW, FL("Did not receive Assoc Cnf in eLIM_MLM_WT_ASSOC_CNF_STATE sta Assoc id %d"), pStaDs->assocId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003140 limPrintMacAddr(pMac, pStaDs->staAddr, LOGW);
3141
3142 if ( (systemRole == eLIM_AP_ROLE)|| (systemRole == eLIM_BT_AMP_AP_ROLE) )
3143 {
3144 limRejectAssociation(
3145 pMac,
3146 pStaDs->staAddr,
3147 pStaDs->mlmStaContext.subType,
3148 true,
3149 pStaDs->mlmStaContext.authType,
3150 pStaDs->assocId,
3151 true,
3152 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
3153 psessionEntry);
3154 }
3155 break;
3156
3157 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003158 limLog(pMac, LOGW, FL("Received CNF_WAIT_TIMEOUT in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003159 pStaDs->mlmStaContext.mlmState);
3160 }
3161}
3162
3163
3164/**
3165 * limDeleteDphHashEntry()
3166 *
3167 *FUNCTION:
3168 * This function is called whenever we need to delete
3169 * the dph hash entry
3170 *
3171 *LOGIC:
3172 *
3173 *ASSUMPTIONS:
3174 *
3175 *NOTE:
3176 *
3177 * @param pMac Pointer to Global MAC structure
3178 * @param tANI_U16 staId
3179 * @return None
3180 */
3181
3182void
3183limDeleteDphHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 staId,tpPESession psessionEntry)
3184{
3185 tANI_U16 aid;
3186 tpDphHashNode pStaDs;
3187 tUpdateBeaconParams beaconParams;
3188 tLimSystemRole systemRole;
3189
Kaushik, Sushantfb156732014-01-07 15:36:03 +05303190 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Jeff Johnson295189b2012-06-20 16:38:30 -07003191 beaconParams.paramChangeBitmap = 0;
3192 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, staId);
3193 if (NULL == psessionEntry)
3194 {
3195 PELOGE(limLog(pMac, LOGE, FL("NULL psessionEntry"));)
3196 return;
3197 }
3198 systemRole = limGetSystemRole(psessionEntry);
3199 beaconParams.bssIdx = psessionEntry->bssIdx;
3200 pStaDs = dphLookupHashEntry(pMac, staAddr, &aid, &psessionEntry->dph.dphHashTable);
3201 if (pStaDs != NULL)
3202 {
3203 PELOGW(limLog(pMac, LOGW, FL("Deleting DPH Hash entry for STAID: %X\n "), staId);)
3204 // update the station count and perform associated actions
3205 // do this before deleting the dph hash entry
3206 limUtilCountStaDel(pMac, pStaDs, psessionEntry);
3207
3208 if((eLIM_AP_ROLE == psessionEntry->limSystemRole) ||
3209 (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole))
3210 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003211 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
3212 if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE){
3213 limDecideApProtectionOnDelete(pMac, pStaDs, &beaconParams,psessionEntry);
3214 }
3215 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003216
3217 if(eLIM_STA_IN_IBSS_ROLE == systemRole)
3218 limIbssDecideProtectionOnDelete(pMac, pStaDs, &beaconParams, psessionEntry);
3219
3220 limDecideShortPreamble(pMac, pStaDs, &beaconParams, psessionEntry);
3221 limDecideShortSlot(pMac, pStaDs, &beaconParams, psessionEntry);
3222
3223 //Send message to HAL about beacon parameter change.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003224 PELOGW(limLog(pMac, LOGW, FL("param bitmap = %d "), beaconParams.paramChangeBitmap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003225 if(beaconParams.paramChangeBitmap)
3226 {
3227 schSetFixedBeaconFields(pMac,psessionEntry);
3228 limSendBeaconParams(pMac, &beaconParams, psessionEntry );
3229 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08003230
3231#ifdef WLAN_FEATURE_11W
3232 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
3233#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003234 }
3235 if (dphDeleteHashEntry(pMac, staAddr, staId, &psessionEntry->dph.dphHashTable) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003236 limLog(pMac, LOGP, FL("error deleting hash entry"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003237 }
3238}
3239
3240
3241
3242/**
3243 * limCheckAndAnnounceJoinSuccess()
3244 *
3245 *FUNCTION:
3246 * This function is called upon receiving Beacon/Probe Response
3247 * frame in WT_JOIN_BEACON_STATE to check if the received
3248 * Beacon/Probe Response is from the BSS that we're attempting
3249 * to join.
3250 *
3251 *LOGIC:
3252 * If the Beacon/Probe Response is indeed from the BSS we're
3253 * attempting to join, join success is sent to SME.
3254 *
3255 *ASSUMPTIONS:
3256 *
3257 *NOTE:
3258 *
3259 * @param pMac Pointer to Global MAC structure
3260 * @param pBPR Pointer to received Beacon/Probe Response
3261 * @param pHdr Pointer to received Beacon/Probe Response
3262 * MAC header
3263 * @return None
3264 */
3265
3266void
3267limCheckAndAnnounceJoinSuccess(tpAniSirGlobal pMac,
3268 tSirProbeRespBeacon *pBPR,
3269 tpSirMacMgmtHdr pHdr,tpPESession psessionEntry)
3270{
3271 tSirMacSSid currentSSID;
3272 tLimMlmJoinCnf mlmJoinCnf;
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003273 tANI_U32 val = 0;
3274 tANI_U32 *noa1DurationFromBcn = NULL;
3275 tANI_U32 *noa2DurationFromBcn = NULL;
3276 tANI_U32 noa;
3277 tANI_U32 TotalNum_NoADesc = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003278
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303279 vos_mem_copy(currentSSID.ssId,
3280 psessionEntry->ssId.ssId,
3281 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003282
3283 currentSSID.length = (tANI_U8)psessionEntry->ssId.length ;
3284
3285 if (
3286 /* Check for SSID only in probe response. Beacons may not carry
3287 SSID information in hidden SSID case */
3288 ( (SIR_MAC_MGMT_FRAME == pHdr->fc.type) &&
3289 (SIR_MAC_MGMT_PROBE_RSP == pHdr->fc.subType) ) &&
3290 currentSSID.length &&
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303291 (!vos_mem_compare((tANI_U8 *) &pBPR->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07003292 (tANI_U8 *) &currentSSID,
3293 (tANI_U8) (1 + currentSSID.length)) ))
3294 {
3295 /**
3296 * Received SSID does not match with the one we've.
3297 * Ignore received Beacon frame
3298 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303299 limLog(pMac, LOG1, FL("SSID received in Beacon does not match"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003300#ifdef WLAN_DEBUG
3301 pMac->lim.gLimBcnSSIDMismatchCnt++;
3302#endif
3303 return;
3304 }
3305
3306 if( (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_STA_ROLE))
3307 {
Nirav Shahbc35fb72013-12-12 18:14:06 +05303308 limLog(pMac, LOG1, FL("Received Beacon/PR with matching BSSID"
3309 MAC_ADDRESS_STR "PESessionID %d"),
3310 MAC_ADDR_ARRAY(psessionEntry->bssId),
3311 psessionEntry->peSessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07003312 // Deactivate Join Failure timer
3313 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003314 // Deactivate Periodic Join timer
3315 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
Jeff Johnson295189b2012-06-20 16:38:30 -07003316
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003317 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona &&
3318 pBPR->P2PProbeRes.NoticeOfAbsence.present)
3319 {
3320
3321 noa1DurationFromBcn = (tANI_U32*)(pBPR->P2PProbeRes.NoticeOfAbsence.NoADesc + 1);
3322
3323 if(pBPR->P2PProbeRes.NoticeOfAbsence.num_NoADesc)
3324 TotalNum_NoADesc = pBPR->P2PProbeRes.NoticeOfAbsence.num_NoADesc/SIZE_OF_NOA_DESCRIPTOR;
3325
3326 noa = *noa1DurationFromBcn;
3327
3328 if(TotalNum_NoADesc > 1)
3329 {
3330 noa2DurationFromBcn = (tANI_U32*)(pBPR->P2PProbeRes.NoticeOfAbsence.NoADesc + SIZE_OF_NOA_DESCRIPTOR + 1);
3331 noa += *noa2DurationFromBcn;
3332 }
3333
3334 /*If MAX Noa exceeds 3 secs we will consider only 3 secs to
3335 * avoid arbitary values in noa duration field
3336 */
3337 noa = noa > MAX_NOA_PERIOD_IN_MICROSECS ? MAX_NOA_PERIOD_IN_MICROSECS : noa;
3338 noa = noa/1000; //Convert to ms
3339
3340 if( wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,&val) == eSIR_SUCCESS )
3341 {
3342 psessionEntry->defaultAuthFailureTimeout = val;
3343 ccmCfgSetInt(pMac,WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT ,val + noa, NULL, eANI_BOOLEAN_FALSE);
3344 }
3345 }
3346 else
3347 {
3348 psessionEntry->defaultAuthFailureTimeout = 0;
3349 }
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003350
Jeff Johnson295189b2012-06-20 16:38:30 -07003351 // Update Beacon Interval at CFG database
3352
3353 if ( pBPR->HTCaps.present )
3354 limUpdateStaRunTimeHTCapability( pMac, &pBPR->HTCaps );
3355 if ( pBPR->HTInfo.present )
3356 limUpdateStaRunTimeHTInfo( pMac, &pBPR->HTInfo, psessionEntry);
3357 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003358 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003359
Ganesh Kondabattiniaad38d92014-11-19 17:06:00 +05303360 /* update the capability info based on recently
3361 * received beacon/probe response frame */
3362 psessionEntry->limCurrentBssCaps = limGetU16((tANI_U8 *) &pBPR->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07003363
3364 /**
3365 * Announce join success by sending
3366 * Join confirm to SME.
3367 */
3368 mlmJoinCnf.resultCode = eSIR_SME_SUCCESS;
3369 mlmJoinCnf.protStatusCode = eSIR_MAC_SUCCESS_STATUS;
3370 /* Update PE sessionId*/
3371 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3372 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3373 } // if ((pMac->lim.gLimSystemRole == IBSS....
3374}
3375
3376/**
3377 * limExtractApCapabilities()
3378 *
3379 *FUNCTION:
3380 * This function is called to extract all of the AP's capabilities
3381 * from the IEs received from it in Beacon/Probe Response frames
3382 *
3383 *LOGIC:
3384 * This routine mimics the limExtractApCapability() API. The difference here
3385 * is that this API returns the entire tSirProbeRespBeacon info as is. It is
3386 * left to the caller of this API to use this info as required
3387 *
3388 *ASSUMPTIONS:
3389 * NA
3390 *
3391 *NOTE:
3392 *
3393 * @param pMac Pointer to Global MAC structure
3394 * @param pIE Pointer to starting IE in Beacon/Probe Response
3395 * @param ieLen Length of all IEs combined
3396 * @param beaconStruct A pointer to tSirProbeRespBeacon that needs to be
3397 * populated
3398 * @return status A status reporting eSIR_SUCCESS or eSIR_FAILURE
3399 */
3400tSirRetStatus limExtractApCapabilities( tpAniSirGlobal pMac,
3401 tANI_U8 *pIE,
3402 tANI_U16 ieLen,
3403 tpSirProbeRespBeacon beaconStruct )
3404{
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303405 vos_mem_set((tANI_U8 *) beaconStruct, sizeof( tSirProbeRespBeacon ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003406
3407 PELOG3(limLog( pMac, LOG3,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003408 FL( "In limExtractApCapabilities: The IE's being received are:" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003409 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );)
3410
3411 // Parse the Beacon IE's, Don't try to parse if we dont have anything in IE
3412 if (ieLen > 0) {
3413 if( eSIR_SUCCESS != sirParseBeaconIE( pMac, beaconStruct, pIE, (tANI_U32)ieLen ))
3414 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003415 limLog( pMac, LOGE, FL("APCapExtract: Beacon parsing error!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003416 return eSIR_FAILURE;
3417 }
3418 }
3419
3420 return eSIR_SUCCESS;
3421}
3422
3423
3424/**
3425 * limDelBss()
3426 *
3427 *FUNCTION:
3428 * This function is called to delete BSS context at hardware
3429 * whenever a STA is disassociated
3430 *
3431 *LOGIC:
3432 *
3433 *ASSUMPTIONS:
3434 * NA
3435 *
3436 *NOTE:
3437 * NA
3438 *
3439 * @param pMac - Pointer to Global MAC structure
3440 * @param pStaDs - Pointer to the STA datastructure created by
3441 * LIM and maintained by DPH
3442 * @return retCode - Indicates success or failure return code
3443 */
3444
3445tSirRetStatus
3446limDelBss(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tANI_U16 bssIdx,tpPESession psessionEntry)
3447{
3448 tpDeleteBssParams pDelBssParams = NULL;
3449 tSirMsgQ msgQ;
3450 tSirRetStatus retCode = eSIR_SUCCESS;
3451
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303452 pDelBssParams = vos_mem_malloc(sizeof(tDeleteBssParams));
3453 if (NULL == pDelBssParams)
3454 {
3455 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003456 return eSIR_MEM_ALLOC_FAILED;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303457 }
3458 vos_mem_set((tANI_U8 *) pDelBssParams, sizeof(tDeleteBssParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003459
3460
3461 pDelBssParams->sessionId = psessionEntry->peSessionId; //update PE session Id
3462
3463 //DPH was storing the AssocID in staID field,
3464 //staID is actually assigned by HAL when AddSTA message is sent.
3465 if (pStaDs != NULL)
3466 {
3467 pDelBssParams->bssIdx= pStaDs->bssId;
3468 pStaDs->valid = 0;
3469 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
3470 }
3471 else
3472 pDelBssParams->bssIdx = bssIdx;
3473 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003474 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_BSS_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003475
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07003476 if((psessionEntry->peSessionId == pMac->lim.limTimers.gLimJoinFailureTimer.sessionId) &&
3477 (VOS_TRUE == tx_timer_running(&pMac->lim.limTimers.gLimJoinFailureTimer)))
3478 {
3479 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
3480 }
3481
Jeff Johnson295189b2012-06-20 16:38:30 -07003482 pDelBssParams->status= eHAL_STATUS_SUCCESS;
3483 pDelBssParams->respReqd = 1;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303484
3485 PELOGW(limLog( pMac, LOGW, FL("Sessionid %d : Sending HAL_DELETE_BSS_REQ "
3486 "for bss idx: %X BSSID:"MAC_ADDRESS_STR), pDelBssParams->sessionId,
3487 pDelBssParams->bssIdx,
3488 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003489
3490 //we need to defer the message until we get the response back from HAL.
3491 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3492
3493 msgQ.type = WDA_DELETE_BSS_REQ;
3494 msgQ.reserved = 0;
3495 msgQ.bodyptr = pDelBssParams;
3496 msgQ.bodyval = 0;
3497
Jeff Johnsone7245742012-09-05 17:12:55 -07003498 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003499
3500 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
3501 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003502 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003503 limLog( pMac, LOGE, FL("Posting DELETE_BSS_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303504 vos_mem_free(pDelBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003505 }
3506
3507 return retCode;
3508}
3509
3510
Jeff Johnson295189b2012-06-20 16:38:30 -07003511
3512/**
3513 * limSendAddBss()
3514 *
3515 *FUNCTION:
3516 *
3517 *LOGIC:
3518 * 1) LIM receives eWNI_SME_JOIN_REQ
3519 * 2) For a valid eWNI_SME_JOIN_REQ, LIM sends
3520 * SIR_HAL_ADD_BSS_REQ to HAL
3521 *
3522 *ASSUMPTIONS:
3523 * JOIN REQ parameters are saved in pMac->lim.gLimMlmJoinReq
3524 * ADD BSS parameters can be obtained from two sources:
3525 * 1) pMac->lim.gLimMlmJoinReq
3526 * 2) beaconStruct, passed as paramter
3527 * So, if a reqd parameter is found in bssDescriptions
3528 * then it is given preference over beaconStruct
3529 *
3530 *NOTE:
3531 *
3532 * @param pMac Pointer to Global MAC structure
3533 * pAssocRsp contains the structured assoc/reassoc Response got from AP
3534 * beaconstruct Has the ProbeRsp/Beacon structured details
3535 * bssDescription bssDescription passed to PE from the SME
3536 * @return None
3537 */
3538
3539tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
3540 tpSchBeaconStruct pBeaconStruct, tpSirBssDescription bssDescription, tANI_U8 updateEntry,
3541 tpPESession psessionEntry)
3542
3543{
3544 tSirMsgQ msgQ;
3545 tpAddBssParams pAddBssParams = NULL;
3546 tANI_U32 retCode;
3547 tANI_U8 i;
3548 tpDphHashNode pStaDs = NULL;
3549 tANI_U8 chanWidthSupp = 0;
krunal soni71343fb2013-09-16 16:16:26 -07003550 tANI_U32 shortGi20MhzSupport;
3551 tANI_U32 shortGi40MhzSupport;
Jeff Johnson295189b2012-06-20 16:38:30 -07003552 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303553 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
3554 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003555 {
3556 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303557 FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003558 retCode = eSIR_MEM_ALLOC_FAILED;
3559 goto returnFailure;
3560 }
3561 else
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303562 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003563
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303564 vos_mem_copy(pAddBssParams->bssId,bssDescription->bssId,
3565 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003566 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303567 vos_mem_copy(pAddBssParams->selfMacAddr,
3568 psessionEntry->selfMacAddr,
3569 sizeof(tSirMacAddr));
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303570
3571 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
3572 psessionEntry->smeSessionId,updateEntry,psessionEntry->limSystemRole);
3573
3574 limLog(pMac, LOG1, FL("BSSID: "MAC_ADDRESS_STR),
3575 MAC_ADDR_ARRAY(pAddBssParams->bssId));
3576
Jeff Johnson295189b2012-06-20 16:38:30 -07003577 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3578 {
3579 pAddBssParams->bssType = eSIR_BTAMP_AP_MODE;
3580 }
3581 else
3582 {
3583 pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE;
3584 }
3585
3586 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
3587
3588 /* Update PE session ID */
3589 pAddBssParams->sessionId = psessionEntry->peSessionId;
3590
3591 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
3592
3593 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
3594 pAddBssParams->updateBss = updateEntry;
3595
3596
3597 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
3598 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
3599 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
3600 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
3601
3602 pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303603 vos_mem_copy(pAddBssParams->rateSet.rate,
3604 pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07003605
3606 pAddBssParams->nwType = bssDescription->nwType;
3607
Jeff Johnsone7245742012-09-05 17:12:55 -07003608 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07003609 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
3610 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
3611 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
3612 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
3613
Abhishek Singh525045c2014-12-15 17:18:45 +05303614 limLog(pMac, LOG1, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303615 "cfpCount: %d"),pAddBssParams->bssType, pAddBssParams->beaconInterval,
3616 pAddBssParams->dtimPeriod, pAddBssParams->cfParamSet.cfpCount);
3617
Abhishek Singh525045c2014-12-15 17:18:45 +05303618 limLog(pMac, LOG1, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303619 " %d numRates: %d "),pAddBssParams->cfParamSet.cfpPeriod,
3620 pAddBssParams->cfParamSet.cfpMaxDuration,
3621 pAddBssParams->cfParamSet.cfpDurRemaining,
3622 pAddBssParams->rateSet.numRates);
3623
Abhishek Singh525045c2014-12-15 17:18:45 +05303624 limLog(pMac, LOG1, FL("nwType:%d shortSlotTimeSupported: %d"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303625 "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d"),
3626 pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported,
3627 pAddBssParams->llaCoexist, pAddBssParams->llbCoexist,
3628 pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist);
Jeff Johnson295189b2012-06-20 16:38:30 -07003629
3630 // Use the advertised capabilities from the received beacon/PR
3631
3632
3633 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present ))
3634 {
3635 pAddBssParams->htCapable = pAssocRsp->HTCaps.present;
Abhishek Singh525045c2014-12-15 17:18:45 +05303636 limLog(pMac, LOG1, FL("htCapable: %d"),pAddBssParams->htCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07003637 if ( pBeaconStruct->HTInfo.present )
3638 {
3639 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pAssocRsp->HTInfo.opMode;
3640 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pAssocRsp->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -07003641 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003642 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3643 (chanWidthSupp) )
3644 {
3645 pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
3646 pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset;
3647 }
3648 else
3649 {
3650 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003651 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003652 }
3653 pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
3654 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
3655 pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303656
Abhishek Singh525045c2014-12-15 17:18:45 +05303657 limLog(pMac, LOG1, FL("htOperMode: %d dualCTSProtection: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303658 "txChannelWidthSet: %d currentExtChannel: %d "),
3659 pAddBssParams->htOperMode, pAddBssParams->dualCTSProtection,
3660 pAddBssParams->txChannelWidthSet,pAddBssParams->currentExtChannel);
3661
Abhishek Singh525045c2014-12-15 17:18:45 +05303662 limLog(pMac, LOG1, FL("llnNonGFCoexist: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303663 "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d"),
3664 pAddBssParams->llnNonGFCoexist,
3665 pAddBssParams->fLsigTXOPProtectionFullSupport,
3666 pAddBssParams->fRIFSMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003667 }
3668 }
3669
3670 pAddBssParams->currentOperChannel = bssDescription->channelId;
Abhishek Singh525045c2014-12-15 17:18:45 +05303671 limLog(pMac, LOG1, FL("currentOperChannel %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303672 pAddBssParams->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07003673#ifdef WLAN_FEATURE_11AC
3674 if (psessionEntry->vhtCapability && ( pAssocRsp->VHTCaps.present ))
3675 {
3676 pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present;
3677 pAddBssParams->vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth;
3678 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003679 pAddBssParams->currentOperChannel,
3680 pAddBssParams->currentExtChannel,
3681 psessionEntry->apCenterChan,
3682 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003683 }
3684 else
3685 {
3686 pAddBssParams->vhtCapable = 0;
3687 }
Abhishek Singh525045c2014-12-15 17:18:45 +05303688 limLog(pMac, LOG1, FL("vhtCapable %d vhtTxChannelWidthSet %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303689 "currentExtChannel %d"),pAddBssParams->vhtCapable,
3690 pAddBssParams->vhtTxChannelWidthSet,
3691 pAddBssParams->currentExtChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07003692#endif
3693
3694
Jeff Johnson295189b2012-06-20 16:38:30 -07003695 // Populate the STA-related parameters here
3696 // Note that the STA here refers to the AP
3697 {
3698 /* staType = PEER*/
3699 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
3700
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303701 vos_mem_copy(pAddBssParams->staContext.bssId,
3702 bssDescription->bssId,
3703 sizeof( tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003704 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
3705
3706 /* Fill Assoc id from the dph table */
3707 pStaDs = dphLookupHashEntry(pMac, pAddBssParams->staContext.bssId,
3708 &pAddBssParams->staContext.assocId, &psessionEntry->dph.dphHashTable);
3709 if (pStaDs == NULL)
3710 {
Arif Hussain24bafea2013-11-15 15:10:03 -08003711 PELOGE(limLog(pMac, LOGE, FL("Couldn't get assoc id for "
3712 "MAC ADDR: " MAC_ADDRESS_STR),
3713 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003714 }
3715 pAddBssParams->staContext.uAPSD = 0;
3716 pAddBssParams->staContext.maxSPLen = 0;
Sushant Kaushikb90b4e22015-04-14 14:29:49 +05303717 pAddBssParams->staContext.shortPreambleSupported =
3718 psessionEntry->beaconParams.fShortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07003719 pAddBssParams->staContext.updateSta = updateEntry;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303720
Abhishek Singh525045c2014-12-15 17:18:45 +05303721 limLog(pMac, LOG1, FL("StaContext: "MAC_ADDRESS_STR
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303722 " shortPreambleSupported: %d"),
3723 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac),
3724 pAddBssParams->staContext.shortPreambleSupported);
3725
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003726 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && pBeaconStruct->HTCaps.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003727 {
3728 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
3729 pAddBssParams->staContext.htCapable = 1;
3730 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField;
3731 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection;
Abhishek Singh525045c2014-12-15 17:18:45 +05303732 limLog(pMac, LOG1,FL("StaContext htCapable: %d greenFieldCapable: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303733 "lsigTxopProtection: %d"), pAddBssParams->staContext.htCapable,
3734 pAddBssParams->staContext.greenFieldCapable,
3735 pAddBssParams->staContext.lsigTxopProtection);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003736#ifdef WLAN_FEATURE_11AC
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +05303737 if (psessionEntry->vhtCapability &&
3738 IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps))
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003739 {
3740 pAddBssParams->staContext.vhtCapable = 1;
3741 if ((pAssocRsp->VHTCaps.suBeamFormerCap ||
3742 pAssocRsp->VHTCaps.muBeamformerCap) &&
3743 psessionEntry->txBFIniFeatureEnabled)
3744 {
3745 pAddBssParams->staContext.vhtTxBFCapable = 1;
3746 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05303747 if (pAssocRsp->VHTCaps.muBeamformerCap &&
3748 psessionEntry->txMuBformee )
3749 {
3750 pAddBssParams->staContext.vhtTxMUBformeeCapable = 1;
3751 limLog(pMac, LOG1,FL("Enabling MUBformeeCapable for peer"));
3752 /* Dont allow any other MuBf session as concurrency
3753 * is not supported
3754 */
3755 pMac->isMuBfsessionexist = TRUE;
3756 }
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003757 }
3758#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003759 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3760 (chanWidthSupp) )
3761 {
3762 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07003763#ifdef WLAN_FEATURE_11AC
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003764 if (pAddBssParams->staContext.vhtCapable)
Jeff Johnsone7245742012-09-05 17:12:55 -07003765 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003766 pAddBssParams->staContext.vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; //pMac->lim.apChanWidth;
3767 }
Abhishek Singh525045c2014-12-15 17:18:45 +05303768 limLog(pMac, LOG1,FL("StaContext vhtCapable %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303769 "vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
3770 pAddBssParams->staContext.vhtCapable,
3771 pAddBssParams->staContext.vhtTxChannelWidthSet,
3772 pAddBssParams->staContext.vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07003773#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003774 }
3775 else
3776 {
3777 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3778 }
3779 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave;
3780 pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA;
3781 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize;
3782 pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity;
3783 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
krunal soni71343fb2013-09-16 16:16:26 -07003784 /*
3785 * We will check gShortGI20Mhz and gShortGI40Mhz from ini file.
3786 * if they are set then we will use what ever Assoc response coming
3787 * from AP supports. If these values are set as 0 in ini file then
3788 * we will hardcode this values to 0.
3789 */
3790 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
3791 (pMac, WNI_CFG_SHORT_GI_20MHZ,
3792 &shortGi20MhzSupport)))
3793 {
3794 if (VOS_TRUE == shortGi20MhzSupport)
3795 {
3796 pAddBssParams->staContext.fShortGI20Mhz =
3797 (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
3798 }
3799 else
3800 {
3801 pAddBssParams->staContext.fShortGI20Mhz = VOS_FALSE;
3802 }
3803 }
3804 else
3805 {
3806 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
3807 "CFG,setting value to default"));)
3808 pAddBssParams->staContext.fShortGI20Mhz =
3809 WNI_CFG_SHORT_GI_20MHZ_STADEF;
3810 }
3811
3812 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
3813 (pMac, WNI_CFG_SHORT_GI_40MHZ,
3814 &shortGi40MhzSupport)))
3815 {
3816 if (VOS_TRUE == shortGi40MhzSupport)
3817 {
3818 pAddBssParams->staContext.fShortGI40Mhz =
3819 (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
3820 }
3821 else
3822 {
3823 pAddBssParams->staContext.fShortGI40Mhz = VOS_FALSE;
3824 }
3825 }
3826 else
3827 {
3828 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
3829 "CFG,setting value to default"));)
3830 pAddBssParams->staContext.fShortGI40Mhz =
3831 WNI_CFG_SHORT_GI_40MHZ_STADEF;
3832 }
3833
Jeff Johnson295189b2012-06-20 16:38:30 -07003834 pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor;
Sushant Kaushik4fb4da72015-02-20 21:37:29 +05303835 if( pAddBssParams->staContext.vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP )
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08003836 {
3837 pAddBssParams->staContext.htLdpcCapable = 0;
3838 pAddBssParams->staContext.vhtLdpcCapable = 0;
3839 }
3840 else
3841 {
3842 pAddBssParams->staContext.htLdpcCapable = (tANI_U8)pAssocRsp->HTCaps.advCodingCap;
3843 pAddBssParams->staContext.vhtLdpcCapable = (tANI_U8)pAssocRsp->VHTCaps.ldpcCodingCap;
3844 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08003845
Jeff Johnson295189b2012-06-20 16:38:30 -07003846 if( pBeaconStruct->HTInfo.present )
3847 pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303848
Abhishek Singh525045c2014-12-15 17:18:45 +05303849 limLog(pMac, LOG1, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303850 " delBASupport: %d maxAmsduSize: %d"),
3851 pAddBssParams->staContext.txChannelWidthSet,
3852 pAddBssParams->staContext.mimoPS,
3853 pAddBssParams->staContext.delBASupport,
3854 pAddBssParams->staContext.maxAmsduSize);
3855
Abhishek Singh525045c2014-12-15 17:18:45 +05303856 limLog(pMac, LOG1, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303857 "fShortGI20Mhz: %d "),pAddBssParams->staContext.maxAmpduDensity,
3858 pAddBssParams->staContext.fDsssCckMode40Mhz,
3859 pAddBssParams->staContext.fShortGI20Mhz);
3860
Abhishek Singh525045c2014-12-15 17:18:45 +05303861 limLog(pMac, LOG1, FL("fShortGI40Mh: %d maxAmpduSize: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303862 "htLdpcCapable: %d vhtLdpcCapable: %d"),
3863 pAddBssParams->staContext.fShortGI40Mhz,
3864 pAddBssParams->staContext.maxAmpduSize,
3865 pAddBssParams->staContext.htLdpcCapable,
3866 pAddBssParams->staContext.vhtLdpcCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07003867 }
3868
Pratik Bhalgatb5b19b02012-11-22 16:28:19 +05303869 //If WMM IE or 802.11E IE is not present and AP is HT AP then enable WMM
3870 if ((psessionEntry->limWmeEnabled && (pAssocRsp->wmeEdcaPresent || pAddBssParams->htCapable)) ||
3871 (psessionEntry->limQosEnabled && (pAssocRsp->edcaPresent || pAddBssParams->htCapable)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003872 pAddBssParams->staContext.wmmEnabled = 1;
3873 else
3874 pAddBssParams->staContext.wmmEnabled = 0;
3875
3876 //Update the rates
3877
3878 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3879 if (pStaDs != NULL)
3880 {
3881 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303882 vos_mem_copy((tANI_U8*)&pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -07003883 (tANI_U8*)&pStaDs->supportedRates,
3884 sizeof(tSirSupportedRates));
3885 }
3886 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003887 PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003888
3889 }
3890
3891 //Disable BA. It will be set as part of ADDBA negotiation.
3892 for( i = 0; i < STACFG_MAX_TC; i++ )
3893 {
3894 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
3895 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
3896 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
3897 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
3898 }
3899
3900 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
3901
3902#if defined WLAN_FEATURE_VOWIFI
3903 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
Abhishek Singh525045c2014-12-15 17:18:45 +05303904 limLog(pMac, LOG1,FL("maxTxPower: %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303905 pAddBssParams->maxTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07003906#endif
3907 // FIXME_GEN4 - Any other value that can be used for initialization?
3908 pAddBssParams->status = eHAL_STATUS_SUCCESS;
3909 pAddBssParams->respReqd = true;
3910
3911 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
3912
Jeff Johnson295189b2012-06-20 16:38:30 -07003913 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
3914 {
3915 pAddBssParams->staContext.p2pCapableSta = 1;
3916 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003917
Bansidhar Gopalacharib099ac62013-06-12 19:02:39 -07003918 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07003919
3920#if defined WLAN_FEATURE_VOWIFI_11R
3921 pAddBssParams->extSetStaKeyParamValid = 0;
Abhishek Singh525045c2014-12-15 17:18:45 +05303922 limLog(pMac, LOG1,FL("extSetStaKeyParamValid: %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303923 pAddBssParams->extSetStaKeyParamValid);
Jeff Johnson295189b2012-06-20 16:38:30 -07003924#endif
3925
Chet Lanctot186b5732013-03-18 10:26:30 -07003926#ifdef WLAN_FEATURE_11W
3927 if (psessionEntry->limRmfEnabled)
3928 {
3929 pAddBssParams->rmfEnabled = 1;
3930 pAddBssParams->staContext.rmfEnabled = 1;
3931 }
3932#endif
3933
Jeff Johnson295189b2012-06-20 16:38:30 -07003934 // Set a new state for MLME
3935 if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState )
3936 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
3937 else
3938 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003939 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003940
Abhishek Singh525045c2014-12-15 17:18:45 +05303941 limLog(pMac, LOG1, FL("staContext wmmEnabled: %d encryptType: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303942 "p2pCapableSta: %d"),pAddBssParams->staContext.wmmEnabled,
3943 pAddBssParams->staContext.encryptType,
3944 pAddBssParams->staContext.p2pCapableSta);
3945
Abhishek Singh525045c2014-12-15 17:18:45 +05303946 limLog(pMac, LOG1, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303947 "LimMlm state to %d"), pAddBssParams->bSpectrumMgtEnabled,
3948 pAddBssParams->halPersona, psessionEntry->limMlmState);
3949
Jeff Johnson295189b2012-06-20 16:38:30 -07003950 //we need to defer the message until we get the response back from HAL.
3951 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3952
3953 msgQ.type = WDA_ADD_BSS_REQ;
3954 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
3955 msgQ.reserved = 0;
3956 msgQ.bodyptr = pAddBssParams;
3957 msgQ.bodyval = 0;
3958
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303959 limLog( pMac, LOG1, FL("SessionId:%d Sending SIR_HAL_ADD_BSS_REQ" ),
3960 psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07003961 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003962
3963 retCode = wdaPostCtrlMsg( pMac, &msgQ );
3964 if( eSIR_SUCCESS != retCode)
3965 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003966 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303967 vos_mem_free(pAddBssParams);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003968 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003969 retCode );
3970 goto returnFailure;
3971
3972 }
3973 else
3974 return retCode;
3975
3976 returnFailure:
3977 // Clean-up will be done by the caller...
3978 return retCode;
3979}
3980
3981
3982
3983
3984tSirRetStatus limStaSendAddBssPreAssoc( tpAniSirGlobal pMac, tANI_U8 updateEntry, tpPESession psessionEntry)
3985{
3986 tSirMsgQ msgQ;
3987 tpAddBssParams pAddBssParams = NULL;
3988 tANI_U32 retCode;
3989 tANI_U8 i;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003990 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07003991 tANI_U8 chanWidthSupp = 0;
krunal soni71343fb2013-09-16 16:16:26 -07003992 tANI_U32 shortGi20MhzSupport;
3993 tANI_U32 shortGi40MhzSupport;
Jeff Johnson295189b2012-06-20 16:38:30 -07003994 tpSirBssDescription bssDescription = &psessionEntry->pLimJoinReq->bssDescription;
3995
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303996 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
3997 if (NULL == pBeaconStruct)
Jeff Johnson32d95a32012-09-10 13:15:23 -07003998 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303999 limLog(pMac, LOGE, FL("Unable to allocate memory during ADD_BSS") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004000 return eSIR_MEM_ALLOC_FAILED;
4001 }
4002
Jeff Johnson295189b2012-06-20 16:38:30 -07004003
4004 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304005 pAddBssParams = vos_mem_malloc(sizeof(tAddBssParams));
4006 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07004007 {
4008 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304009 FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004010 retCode = eSIR_MEM_ALLOC_FAILED;
4011 goto returnFailure;
4012 }
4013
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304014 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004015
4016
4017 limExtractApCapabilities( pMac,
4018 (tANI_U8 *) bssDescription->ieFields,
4019 limGetIElenFromBssDescription( bssDescription ),
Jeff Johnson32d95a32012-09-10 13:15:23 -07004020 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004021
4022 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Jeff Johnson32d95a32012-09-10 13:15:23 -07004023 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304024 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
4025 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004026
4027 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304028 vos_mem_copy(pAddBssParams->selfMacAddr,
4029 psessionEntry->selfMacAddr,
4030 sizeof(tSirMacAddr));
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304031 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
4032 psessionEntry->smeSessionId,updateEntry,psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004033
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304034 limLog(pMac, LOG1, FL("BSSID: "MAC_ADDRESS_STR),
4035 MAC_ADDR_ARRAY(pAddBssParams->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07004036 /* Incorrect BSS Type which caused UMA Descriptor to be overwritten on
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304037 * top of an already established Infra link. This lead to issues in
Jeff Johnson295189b2012-06-20 16:38:30 -07004038 * concurrent data transfer.
4039 */
4040
4041 pAddBssParams->bssType = psessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
4042 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
4043
4044 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
4045
Jeff Johnson32d95a32012-09-10 13:15:23 -07004046 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07004047 pAddBssParams->updateBss = updateEntry;
4048
4049
Jeff Johnson32d95a32012-09-10 13:15:23 -07004050 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
4051 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
4052 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
4053 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -07004054
4055
Jeff Johnson32d95a32012-09-10 13:15:23 -07004056 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304057 vos_mem_copy(pAddBssParams->rateSet.rate,
4058 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07004059
4060 pAddBssParams->nwType = bssDescription->nwType;
4061
Jeff Johnson32d95a32012-09-10 13:15:23 -07004062 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07004063 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
4064 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
4065 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304066 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
Jeff Johnson295189b2012-06-20 16:38:30 -07004067
Abhishek Singh525045c2014-12-15 17:18:45 +05304068 limLog(pMac, LOG1, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304069 "cfpCount: %d"),pAddBssParams->bssType, pAddBssParams->beaconInterval,
4070 pAddBssParams->dtimPeriod, pAddBssParams->cfParamSet.cfpCount);
4071
Abhishek Singh525045c2014-12-15 17:18:45 +05304072 limLog(pMac, LOG1, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304073 " %d numRates: %d "),pAddBssParams->cfParamSet.cfpPeriod,
4074 pAddBssParams->cfParamSet.cfpMaxDuration,
4075 pAddBssParams->cfParamSet.cfpDurRemaining,
4076 pAddBssParams->rateSet.numRates);
4077
Abhishek Singh525045c2014-12-15 17:18:45 +05304078 limLog(pMac, LOG1, FL("nwType:%d shortSlotTimeSupported: %d"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304079 "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d"),
4080 pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported,
4081 pAddBssParams->llaCoexist, pAddBssParams->llbCoexist,
4082 pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist);
Jeff Johnson295189b2012-06-20 16:38:30 -07004083 // Use the advertised capabilities from the received beacon/PR
Jeff Johnson32d95a32012-09-10 13:15:23 -07004084 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004085 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004086 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Abhishek Singh525045c2014-12-15 17:18:45 +05304087 limLog(pMac, LOG1, FL("htCapable: %d"),pAddBssParams->htCapable);
Jeff Johnson32d95a32012-09-10 13:15:23 -07004088 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07004089 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004090 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
4091 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -07004092
Jeff Johnson295189b2012-06-20 16:38:30 -07004093 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
Jeff Johnson32d95a32012-09-10 13:15:23 -07004094 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004095 (chanWidthSupp) )
4096 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004097 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
4098 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07004099 }
4100 else
4101 {
4102 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004103 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07004104 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07004105 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
4106 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
4107 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304108
Abhishek Singh525045c2014-12-15 17:18:45 +05304109 limLog(pMac, LOG1, FL("htOperMode: %d dualCTSProtection: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304110 "txChannelWidthSet: %d currentExtChannel: %d "),
4111 pAddBssParams->htOperMode, pAddBssParams->dualCTSProtection,
4112 pAddBssParams->txChannelWidthSet,pAddBssParams->currentExtChannel);
4113
Abhishek Singh525045c2014-12-15 17:18:45 +05304114 limLog(pMac, LOG1, FL("llnNonGFCoexist: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304115 "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d"),
4116 pAddBssParams->llnNonGFCoexist,
4117 pAddBssParams->fLsigTXOPProtectionFullSupport,
4118 pAddBssParams->fRIFSMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07004119 }
4120 }
4121
4122 pAddBssParams->currentOperChannel = bssDescription->channelId;
Abhishek Singh525045c2014-12-15 17:18:45 +05304123 limLog(pMac, LOG1, FL("currentOperChannel %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304124 pAddBssParams->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07004125#ifdef WLAN_FEATURE_11AC
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +05304126 if (psessionEntry->vhtCapability &&
4127 IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps))
Jeff Johnsone7245742012-09-05 17:12:55 -07004128 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004129 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
4130 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004131 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
4132 pAddBssParams->currentOperChannel,
4133 pAddBssParams->currentExtChannel,
4134 psessionEntry->apCenterChan,
4135 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07004136 }
4137 else
4138 {
4139 pAddBssParams->vhtCapable = 0;
4140 }
Abhishek Singh525045c2014-12-15 17:18:45 +05304141 limLog(pMac, LOG1, FL("vhtCapable %d vhtTxChannelWidthSet %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304142 "currentExtChannel %d"),pAddBssParams->vhtCapable,
4143 pAddBssParams->vhtTxChannelWidthSet,
4144 pAddBssParams->currentExtChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07004145#endif
4146
Jeff Johnson295189b2012-06-20 16:38:30 -07004147 // Populate the STA-related parameters here
4148 // Note that the STA here refers to the AP
4149 {
4150 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
4151
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304152 vos_mem_copy(pAddBssParams->staContext.bssId,
4153 bssDescription->bssId,
4154 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004155 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
4156
4157 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
4158 pAddBssParams->staContext.uAPSD = 0;
4159 pAddBssParams->staContext.maxSPLen = 0;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004160 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07004161 pAddBssParams->staContext.updateSta = updateEntry;
4162
Abhishek Singh525045c2014-12-15 17:18:45 +05304163 limLog(pMac, LOG1, FL("StaContext: "MAC_ADDRESS_STR
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304164 " shortPreambleSupported: %d"),
4165 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac),
4166 pAddBssParams->staContext.shortPreambleSupported);
4167
Jeff Johnson32d95a32012-09-10 13:15:23 -07004168 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004169 {
4170 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
4171 pAddBssParams->staContext.htCapable = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004172 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
4173 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
Abhishek Singh525045c2014-12-15 17:18:45 +05304174 limLog(pMac, LOG1, FL("StaContext htCapable: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304175 "greenFieldCapable: %d lsigTxopProtection: %d"),
4176 pAddBssParams->staContext.htCapable,
4177 pAddBssParams->staContext.greenFieldCapable,
4178 pAddBssParams->staContext.lsigTxopProtection);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004179#ifdef WLAN_FEATURE_11AC
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +05304180 if (psessionEntry->vhtCapability &&
4181 IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps))
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004182 {
4183 pAddBssParams->staContext.vhtCapable = 1;
4184 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
4185 pBeaconStruct->VHTCaps.muBeamformerCap) &&
4186 psessionEntry->txBFIniFeatureEnabled )
4187 {
4188 pAddBssParams->staContext.vhtTxBFCapable = 1;
4189 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05304190 if (pBeaconStruct->VHTCaps.muBeamformerCap &&
4191 psessionEntry->txMuBformee )
4192 {
4193 pAddBssParams->staContext.vhtTxMUBformeeCapable = 1;
4194 limLog(pMac, LOG1,FL("Enabling MUBformeeCapable for peer"));
4195 /* Dont allow any other MuBf session as concurrency
4196 * is not supported
4197 */
4198 pMac->isMuBfsessionexist = TRUE;
4199 }
4200
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004201 }
4202#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07004203 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004204 (chanWidthSupp) )
4205 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004206 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004207#ifdef WLAN_FEATURE_11AC
4208 if (pAddBssParams->staContext.vhtCapable)
Jeff Johnsone7245742012-09-05 17:12:55 -07004209 {
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004210 pAddBssParams->staContext.vhtTxChannelWidthSet =
4211 pBeaconStruct->VHTOperation.chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -07004212 }
Abhishek Singh525045c2014-12-15 17:18:45 +05304213 limLog(pMac, LOG1,FL("StaContext vhtCapable %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304214 "vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
4215 pAddBssParams->staContext.vhtCapable,
4216 pAddBssParams->staContext.vhtTxChannelWidthSet,
4217 pAddBssParams->staContext.vhtTxBFCapable);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004218#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004219 }
4220 else
4221 {
4222 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4223 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07004224 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
4225 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
4226 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
4227 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
4228 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
krunal soni71343fb2013-09-16 16:16:26 -07004229 /*
4230 * We will check gShortGI20Mhz and gShortGI40Mhz from ini file.
4231 * if they are set then we will use what ever Beacon coming from AP
4232 * supports. If these values are set as 0 in ini file then
4233 * we will hardcode this values to 0.
4234 */
4235 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
4236 (pMac, WNI_CFG_SHORT_GI_20MHZ,
4237 &shortGi20MhzSupport)))
4238 {
4239 if (VOS_TRUE == shortGi20MhzSupport)
4240 {
4241 pAddBssParams->staContext.fShortGI20Mhz =
4242 (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
4243 }
4244 else
4245 {
4246 pAddBssParams->staContext.fShortGI20Mhz = VOS_FALSE;
4247 }
4248 }
4249 else
4250 {
4251 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
4252 "CFG,setting value to default"));)
4253 pAddBssParams->staContext.fShortGI20Mhz =
4254 WNI_CFG_SHORT_GI_20MHZ_STADEF;
4255 }
4256
4257 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
4258 (pMac, WNI_CFG_SHORT_GI_40MHZ,
4259 &shortGi40MhzSupport)))
4260 {
4261 if (VOS_TRUE == shortGi40MhzSupport)
4262 {
4263 pAddBssParams->staContext.fShortGI40Mhz =
4264 (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
4265 }
4266 else
4267 {
4268 pAddBssParams->staContext.fShortGI40Mhz = VOS_FALSE;
4269 }
4270 }
4271 else
4272 {
4273 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
4274 "CFG,setting value to default"));)
4275 pAddBssParams->staContext.fShortGI40Mhz =
4276 WNI_CFG_SHORT_GI_40MHZ_STADEF;
4277 }
4278
Jeff Johnson32d95a32012-09-10 13:15:23 -07004279 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Sushant Kaushik4fb4da72015-02-20 21:37:29 +05304280 if( pAddBssParams->staContext.vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP )
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08004281 {
4282 pAddBssParams->staContext.htLdpcCapable = 0;
4283 pAddBssParams->staContext.vhtLdpcCapable = 0;
4284 }
4285 else
4286 {
4287 pAddBssParams->staContext.htLdpcCapable = (tANI_U8)pBeaconStruct->HTCaps.advCodingCap;
4288 pAddBssParams->staContext.vhtLdpcCapable = (tANI_U8)pBeaconStruct->VHTCaps.ldpcCodingCap;
4289 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004290
Jeff Johnson32d95a32012-09-10 13:15:23 -07004291 if( pBeaconStruct->HTInfo.present )
4292 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Abhishek Singh525045c2014-12-15 17:18:45 +05304293 limLog(pMac, LOG1, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304294 " delBASupport: %d maxAmsduSize: %d"),
4295 pAddBssParams->staContext.txChannelWidthSet,
4296 pAddBssParams->staContext.mimoPS,
4297 pAddBssParams->staContext.delBASupport,
4298 pAddBssParams->staContext.maxAmsduSize);
4299
Abhishek Singh525045c2014-12-15 17:18:45 +05304300 limLog(pMac, LOG1, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304301 "fShortGI20Mhz: %d "),pAddBssParams->staContext.maxAmpduDensity,
4302 pAddBssParams->staContext.fDsssCckMode40Mhz,
4303 pAddBssParams->staContext.fShortGI20Mhz);
4304
Abhishek Singh525045c2014-12-15 17:18:45 +05304305 limLog(pMac, LOG1, FL("fShortGI40Mh: %d maxAmpduSize: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304306 "htLdpcCapable: %d vhtLdpcCapable: %d"),
4307 pAddBssParams->staContext.fShortGI40Mhz,
4308 pAddBssParams->staContext.maxAmpduSize,
4309 pAddBssParams->staContext.htLdpcCapable,
4310 pAddBssParams->staContext.vhtLdpcCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07004311 }
4312
Pratik Bhalgatb5b19b02012-11-22 16:28:19 +05304313 //If WMM IE or 802.11E IE is not present and AP is HT AP then enable WMM
4314 if ((psessionEntry->limWmeEnabled && (pBeaconStruct->wmeEdcaPresent || pAddBssParams->staContext.htCapable)) ||
4315 (psessionEntry->limQosEnabled && (pBeaconStruct->edcaPresent || pAddBssParams->staContext.htCapable)))
Jeff Johnson295189b2012-06-20 16:38:30 -07004316 pAddBssParams->staContext.wmmEnabled = 1;
4317 else
4318 pAddBssParams->staContext.wmmEnabled = 0;
4319
4320 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -07004321#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07004322 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07004323 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry,
4324 &pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -07004325#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07004326 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07004327 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07004328#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004329 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,psessionEntry);
4330
4331 }
4332
4333
4334 //Disable BA. It will be set as part of ADDBA negotiation.
4335 for( i = 0; i < STACFG_MAX_TC; i++ )
4336 {
4337 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
4338 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
4339 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
4340 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
4341 }
4342
4343 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
4344
4345#if defined WLAN_FEATURE_VOWIFI
4346 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
Abhishek Singh525045c2014-12-15 17:18:45 +05304347 limLog(pMac, LOG1,FL("maxTxPower: %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304348 pAddBssParams->maxTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07004349#endif
4350
4351 pAddBssParams->status = eHAL_STATUS_SUCCESS;
4352 pAddBssParams->respReqd = true;
4353
4354 pAddBssParams->staContext.sessionId = psessionEntry->peSessionId;
4355 pAddBssParams->sessionId = psessionEntry->peSessionId;
4356
4357 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
4358
Bansidhar Gopalacharib099ac62013-06-12 19:02:39 -07004359 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07004360
4361#if defined WLAN_FEATURE_VOWIFI_11R
4362 pAddBssParams->extSetStaKeyParamValid = 0;
Abhishek Singh525045c2014-12-15 17:18:45 +05304363 limLog(pMac, LOG1,FL("extSetStaKeyParamValid: %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304364 pAddBssParams->extSetStaKeyParamValid);
Jeff Johnson295189b2012-06-20 16:38:30 -07004365#endif
4366
Chet Lanctot186b5732013-03-18 10:26:30 -07004367#ifdef WLAN_FEATURE_11W
4368 if (psessionEntry->limRmfEnabled)
4369 {
4370 pAddBssParams->rmfEnabled = 1;
4371 pAddBssParams->staContext.rmfEnabled = 1;
4372 }
4373#endif
4374
Jeff Johnson295189b2012-06-20 16:38:30 -07004375 // Set a new state for MLME
4376
4377 //pMac->lim.gLimMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
4378 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
4379
Jeff Johnsone7245742012-09-05 17:12:55 -07004380 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004381
Abhishek Singh525045c2014-12-15 17:18:45 +05304382 limLog(pMac, LOG1, FL("staContext wmmEnabled: %d encryptType: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304383 "p2pCapableSta: %d"),pAddBssParams->staContext.wmmEnabled,
4384 pAddBssParams->staContext.encryptType,
4385 pAddBssParams->staContext.p2pCapableSta);
4386
Abhishek Singh525045c2014-12-15 17:18:45 +05304387 limLog(pMac, LOG1, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304388 "LimMlm state to %d"), pAddBssParams->bSpectrumMgtEnabled,
4389 pAddBssParams->halPersona, psessionEntry->limMlmState);
4390
Jeff Johnson295189b2012-06-20 16:38:30 -07004391 //we need to defer the message until we get the response back from HAL.
4392 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
4393
4394 msgQ.type = WDA_ADD_BSS_REQ;
4395 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
4396 msgQ.reserved = 0;
4397 msgQ.bodyptr = pAddBssParams;
4398 msgQ.bodyval = 0;
4399
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304400 limLog( pMac, LOG1, FL( "SessionId:%d Sending SIR_HAL_ADD_BSS_REQ" ),
4401 psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07004402 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004403
4404 retCode = wdaPostCtrlMsg( pMac, &msgQ );
4405 if( eSIR_SUCCESS != retCode)
4406 {
Jeff Johnsone7245742012-09-05 17:12:55 -07004407 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304408 vos_mem_free(pAddBssParams);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004409 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004410 retCode );
4411 goto returnFailure;
4412
4413 }
4414 else
Jeff Johnson32d95a32012-09-10 13:15:23 -07004415 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304416 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004417 return retCode;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004418 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004419
4420 returnFailure:
4421 // Clean-up will be done by the caller...
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304422 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004423 return retCode;
4424}
4425
4426
4427
4428
4429
Jeff Johnson295189b2012-06-20 16:38:30 -07004430
4431/** -------------------------------------------------------------
4432\fn limPrepareAndSendDelStaCnf
4433\brief deletes DPH entry
4434 changes the MLM mode for station.
4435 calls limSendDelStaCnf
4436\param tpAniSirGlobal pMac
4437\param tpDphHashNode pStaDs
4438\return none
4439 -------------------------------------------------------------*/
4440
4441
4442void
4443limPrepareAndSendDelStaCnf(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tSirResultCodes statusCode,tpPESession psessionEntry)
4444{
4445 tANI_U16 staDsAssocId = 0;
4446 tSirMacAddr staDsAddr;
4447 tLimMlmStaContext mlmStaContext;
4448
4449 if(pStaDs == NULL)
4450 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004451 PELOGW(limLog(pMac, LOGW, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004452 return;
4453 }
4454 staDsAssocId = pStaDs->assocId;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304455 vos_mem_copy((tANI_U8 *)staDsAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004456 pStaDs->staAddr,
4457 sizeof(tSirMacAddr));
4458
4459 mlmStaContext = pStaDs->mlmStaContext;
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304460 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
4461 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004462 {
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304463 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004464 }
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304465 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4466
4467 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4468 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004469 {
4470 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304471 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
4472 psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004473 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004474 limSendDelStaCnf(pMac, staDsAddr, staDsAssocId, mlmStaContext, statusCode,psessionEntry);
4475}
4476
4477/** -------------------------------------------------------------
4478\fn limGetStaRateMode
4479\brief Gets the Station Rate Mode.
4480\param tANI_U8 dot11Mode
4481\return none
4482 -------------------------------------------------------------*/
4483tStaRateMode limGetStaRateMode(tANI_U8 dot11Mode)
4484{
4485 switch(dot11Mode)
4486 {
4487 case WNI_CFG_DOT11_MODE_11A:
4488 return eSTA_11a;
4489 case WNI_CFG_DOT11_MODE_11B:
4490 return eSTA_11b;
4491 case WNI_CFG_DOT11_MODE_11G:
4492 return eSTA_11bg;
4493 case WNI_CFG_DOT11_MODE_11N:
4494 return eSTA_11n;
Jeff Johnsone7245742012-09-05 17:12:55 -07004495#ifdef WLAN_FEATURE_11AC
4496 case WNI_CFG_DOT11_MODE_11AC:
4497 return eSTA_11ac;
4498#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004499 case WNI_CFG_DOT11_MODE_ALL:
4500 default:
4501 return eSTA_11n;
4502
4503 }
4504}
4505
4506/** -------------------------------------------------------------
4507\fn limInitPreAuthTimerTable
4508\brief Initialize the Pre Auth Tanle and creates the timer for
4509 each node for the timeout value got from cfg.
4510\param tpAniSirGlobal pMac
4511\param tpLimPreAuthTable pPreAuthTimerTable
4512\return none
4513 -------------------------------------------------------------*/
4514void limInitPreAuthTimerTable(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
4515{
4516 tANI_U32 cfgValue;
4517 tANI_U32 authNodeIdx;
4518 tpLimPreAuthNode pAuthNode = pPreAuthTimerTable->pTable;
4519
4520 // Get AUTH_RSP Timers value
4521
4522 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT,
4523 &cfgValue) != eSIR_SUCCESS)
4524 {
4525 /*
4526 ** Could not get AUTH_RSP timeout value
4527 ** from CFG. Log error.
4528 **/
4529 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004530 FL("could not retrieve AUTH_RSP timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004531 return;
4532 }
4533
4534 cfgValue = SYS_MS_TO_TICKS(cfgValue);
4535 for(authNodeIdx=0; authNodeIdx<pPreAuthTimerTable->numEntry; authNodeIdx++, pAuthNode++)
4536 {
4537 if (tx_timer_create(&pAuthNode->timer,
4538 "AUTH RESPONSE TIMEOUT",
4539 limAuthResponseTimerHandler,
4540 authNodeIdx,
4541 cfgValue,
4542 0,
4543 TX_NO_ACTIVATE) != TX_SUCCESS)
4544 {
4545 // Cannot create timer. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004546 limLog(pMac, LOGP, FL("Cannot create Auth Rsp timer of Index :%d."), authNodeIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07004547 return;
4548 }
4549 pAuthNode->authNodeIdx = (tANI_U8)authNodeIdx;
4550 pAuthNode->fFree = 1;
4551 }
4552
4553}
4554
4555/** -------------------------------------------------------------
4556\fn limAcquireFreePreAuthNode
4557\brief Retrives a free Pre Auth node from Pre Auth Table.
4558\param tpAniSirGlobal pMac
4559\param tpLimPreAuthTable pPreAuthTimerTable
4560\return none
4561 -------------------------------------------------------------*/
4562tLimPreAuthNode * limAcquireFreePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
4563{
4564 tANI_U32 i;
4565 tLimPreAuthNode *pTempNode = pPreAuthTimerTable->pTable;
4566 for (i=0; i<pPreAuthTimerTable->numEntry; i++,pTempNode++)
4567 {
4568 if (pTempNode->fFree == 1)
4569 {
4570 pTempNode->fFree = 0;
4571 return pTempNode;
4572 }
4573 }
4574
4575 return NULL;
4576}
4577
4578/** -------------------------------------------------------------
4579\fn limGetPreAuthNodeFromIndex
4580\brief Depending on the Index this retrives the pre auth node.
4581\param tpAniSirGlobal pMac
4582\param tpLimPreAuthTable pAuthTable
4583\param tANI_U32 authNodeIdx
4584\return none
4585 -------------------------------------------------------------*/
4586tLimPreAuthNode * limGetPreAuthNodeFromIndex(tpAniSirGlobal pMac,
4587 tpLimPreAuthTable pAuthTable, tANI_U32 authNodeIdx)
4588{
4589 if ((authNodeIdx >= pAuthTable->numEntry) || (pAuthTable->pTable == NULL))
4590 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004591 limLog(pMac, LOGE, FL("Invalid Auth Timer Index : %d NumEntry : %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 authNodeIdx, pAuthTable->numEntry);
4593 return NULL;
4594 }
4595
4596 return pAuthTable->pTable + authNodeIdx;
4597}
4598
4599/* Util API to check if the channels supported by STA is within range */
4600tSirRetStatus limIsDot11hSupportedChannelsValid(tpAniSirGlobal pMac, tSirAssocReq *assoc)
4601{
4602 /*
4603 * Allow all the stations to join with us.
4604 * 802.11h-2003 11.6.1 => An AP may use the supported channels list for associated STAs
4605 * as an input into an algorithm used to select a new channel for the BSS.
4606 * The specification of the algorithm is beyond the scope of this amendment.
4607 */
4608
4609 return (eSIR_SUCCESS);
4610}
4611
4612/* Util API to check if the txpower supported by STA is within range */
4613tSirRetStatus limIsDot11hPowerCapabilitiesInRange(tpAniSirGlobal pMac, tSirAssocReq *assoc,tpPESession psessionEntry)
4614{
4615 tPowerdBm localMaxTxPower;
4616 tANI_U32 localPwrConstraint;
4617
4618 localMaxTxPower = cfgGetRegulatoryMaxTransmitPower(pMac, psessionEntry->currentOperChannel);
4619
4620 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004621 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004622 return eSIR_FAILURE;
4623 }
4624 localMaxTxPower -= (tPowerdBm)localPwrConstraint;
4625
4626 /**
4627 * The min Tx Power of the associating station should not be greater than (regulatory
4628 * max tx power - local power constraint configured on AP).
4629 */
4630 if(assoc->powerCapability.minTxPower > localMaxTxPower)
4631 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004632 limLog(pMac, LOGW, FL("minTxPower (STA) = %d, localMaxTxPower (AP) = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004633 assoc->powerCapability.minTxPower, localMaxTxPower);
4634 return (eSIR_FAILURE);
4635 }
4636
4637 return (eSIR_SUCCESS);
4638}
4639
4640/** -------------------------------------------------------------
4641\fn limFillRxHighestSupportedRate
4642\brief Fills in the Rx Highest Supported Data Rate field from
4643\ the 'supported MCS set' field in HT capability element.
4644\param tpAniSirGlobal pMac
4645\param tpSirSupportedRates pRates
4646\param tANI_U8* pSupportedMCSSet
4647\return none
4648 -------------------------------------------------------------*/
4649void limFillRxHighestSupportedRate(tpAniSirGlobal pMac, tANI_U16 *rxHighestRate, tANI_U8* pSupportedMCSSet)
4650{
4651 tSirMacRxHighestSupportRate *pRxHighestRate;
4652 tANI_U8 *pBuf;
4653 tANI_U16 rate=0;
4654
4655 pBuf = pSupportedMCSSet + MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET;
4656 rate = limGetU16(pBuf);
4657
4658 pRxHighestRate = (tSirMacRxHighestSupportRate *) &rate;
4659 *rxHighestRate = pRxHighestRate->rate;
4660
4661 return;
4662}
Chet Lanctot186b5732013-03-18 10:26:30 -07004663
4664#ifdef WLAN_FEATURE_11W
4665/** -------------------------------------------------------------
4666\fn limSendSmeUnprotectedMgmtFrameInd
4667\brief Forwards the unprotected management frame to SME.
4668\param tpAniSirGlobal pMac
4669\param frameType - 802.11 frame type
4670\param frame - frame buffer
4671\param sessionId - id for the current session
4672\param psessionEntry - PE session context
4673\return none
4674 -------------------------------------------------------------*/
4675void limSendSmeUnprotectedMgmtFrameInd(
4676 tpAniSirGlobal pMac, tANI_U8 frameType,
4677 tANI_U8 *frame, tANI_U32 frameLen, tANI_U16 sessionId,
4678 tpPESession psessionEntry)
4679{
4680 tSirMsgQ mmhMsg;
4681 tSirSmeUnprotMgmtFrameInd * pSirSmeMgmtFrame = NULL;
4682 tANI_U16 length;
4683
4684 length = sizeof(tSirSmeUnprotMgmtFrameInd) + frameLen;
4685
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304686 pSirSmeMgmtFrame = vos_mem_malloc(length);
4687 if (NULL == pSirSmeMgmtFrame)
Chet Lanctot186b5732013-03-18 10:26:30 -07004688 {
4689 limLog(pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304690 FL("AllocateMemory failed for tSirSmeUnprotectedMgmtFrameInd"));
Chet Lanctot186b5732013-03-18 10:26:30 -07004691 return;
4692 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304693 vos_mem_set((void*)pSirSmeMgmtFrame, length, 0);
Chet Lanctot186b5732013-03-18 10:26:30 -07004694
4695 pSirSmeMgmtFrame->sessionId = sessionId;
4696 pSirSmeMgmtFrame->frameType = frameType;
4697
4698 vos_mem_copy(pSirSmeMgmtFrame->frameBuf, frame, frameLen);
4699 pSirSmeMgmtFrame->frameLen = frameLen;
4700
4701 mmhMsg.type = eWNI_SME_UNPROT_MGMT_FRM_IND;
4702 mmhMsg.bodyptr = pSirSmeMgmtFrame;
4703 mmhMsg.bodyval = 0;
4704
4705 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
4706 return;
4707}
4708#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004709
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004710#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004711/** -------------------------------------------------------------
4712\fn limSendSmeTsmIEInd
4713\brief Forwards the TSM IE information to SME.
4714\param tpAniSirGlobal pMac
4715\param psessionEntry - PE session context
4716\param tid - traffic id
4717\param state - tsm state (enabled/disabled)
4718\param measurementInterval - measurement interval
4719\return none
4720 -------------------------------------------------------------*/
4721void limSendSmeTsmIEInd(tpAniSirGlobal pMac, tpPESession psessionEntry,
4722 tANI_U8 tid, tANI_U8 state, tANI_U16 measInterval)
4723{
4724 tSirMsgQ mmhMsg;
4725 tpSirSmeTsmIEInd pSirSmeTsmIeInd = NULL;
4726
4727 if (!pMac || !psessionEntry)
4728 {
4729 return;
4730 }
4731 pSirSmeTsmIeInd = vos_mem_malloc(sizeof(tSirSmeTsmIEInd));
4732 if (NULL == pSirSmeTsmIeInd)
4733 {
4734 limLog(pMac, LOGP,
4735 FL("AllocateMemory failed for tSirSmeTsmIEInd"));
4736 return;
4737 }
4738 vos_mem_set((void*)pSirSmeTsmIeInd, sizeof(tSirSmeTsmIEInd), 0);
4739
4740 pSirSmeTsmIeInd->sessionId = psessionEntry->smeSessionId;
4741 pSirSmeTsmIeInd->tsmIe.tsid = tid;
4742 pSirSmeTsmIeInd->tsmIe.state= state;
4743 pSirSmeTsmIeInd->tsmIe.msmt_interval= measInterval;
4744
4745 mmhMsg.type = eWNI_SME_TSM_IE_IND;
4746 mmhMsg.bodyptr = pSirSmeTsmIeInd;
4747 mmhMsg.bodyval = 0;
4748
4749 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
4750 return;
4751}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004752#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004753
4754