blob: 4249bb14f20f156c7a22434aa0e96a467f404747 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
Jeff Johnson295189b2012-06-20 16:38:30 -070041/*
42 * Airgo Networks, Inc proprietary. All rights reserved.
43 * This file schBeaconProcess.cc contains beacon processing related
44 * functions
45 *
46 * Author: Sandesh Goel
47 * Date: 02/25/02
48 * History:-
49 * Date Modified by Modification Information
50 * --------------------------------------------------------------------
51 *
52 */
53
54#include "palTypes.h"
Jeff Johnson62c27982013-02-27 17:53:55 -080055#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070056
57#include "cfgApi.h"
58#include "pmmApi.h"
59#include "limApi.h"
60#include "utilsApi.h"
61#include "schDebug.h"
62#include "schApi.h"
63
Jeff Johnson295189b2012-06-20 16:38:30 -070064
65#include "limUtils.h"
66#include "limSendMessages.h"
67#include "limStaHashApi.h"
68
69#if defined WLAN_FEATURE_VOWIFI
70#include "rrmApi.h"
71#endif
72
73#ifdef FEATURE_WLAN_DIAG_SUPPORT
74#include "vos_diag_core_log.h"
75#endif //FEATURE_WLAN_DIAG_SUPPORT
76
77/**
78 * Number of bytes of variation in beacon length from the last beacon
79 * to trigger reprogramming of rx delay register
80 */
81#define SCH_BEACON_LEN_DELTA 3
82
83// calculate 2^cw - 1
84#define CW_GET(cw) (((cw) == 0) ? 1 : ((1 << (cw)) - 1))
85
86static void
87ap_beacon_process(
88 tpAniSirGlobal pMac,
89 tANI_U8* pRxPacketInfo,
90 tpSchBeaconStruct pBcnStruct,
91 tpUpdateBeaconParams pBeaconParams,
92 tpPESession psessionEntry)
93{
94 tpSirMacMgmtHdr pMh = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
95 tANI_U32 phyMode;
96 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
97 //Get RF band from psessionEntry
98 rfBand = psessionEntry->limRFBand;
99
100 limGetPhyMode(pMac, &phyMode, psessionEntry);
101
102 if(SIR_BAND_5_GHZ == rfBand)
103 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700104 if (psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -0700105 {
106 if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
107 {
108 //11a (non HT) AP overlaps or
109 //HT AP with HT op mode as mixed overlaps.
110 //HT AP with HT op mode as overlap legacy overlaps.
111 if ((!pBcnStruct->HTInfo.present) ||
112 (eSIR_HT_OP_MODE_MIXED == pBcnStruct->HTInfo.opMode) ||
113 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBcnStruct->HTInfo.opMode))
114 {
115 limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlap11aParams));
116
117 if (pMac->lim.gLimOverlap11aParams.numSta &&
118 !pMac->lim.gLimOverlap11aParams.protectionEnabled)
119 {
120 limEnable11aProtection(pMac, true, true, pBeaconParams,psessionEntry);
121 }
122 }
123 //HT AP with HT20 op mode overlaps.
124 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBcnStruct->HTInfo.opMode)
125 {
126 limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlapHt20Params));
127
128 if (pMac->lim.gLimOverlapHt20Params.numSta &&
129 !pMac->lim.gLimOverlapHt20Params.protectionEnabled)
130 {
131 limEnableHT20Protection(pMac, true, true, pBeaconParams,psessionEntry);
132 }
133 }
134 }
135 }
136 }
137 else if(SIR_BAND_2_4_GHZ == rfBand)
138 {
139 //We are 11G AP.
140 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700141 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -0700142 {
143 if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
144 {
145 if (((!(pBcnStruct->erpPresent)) &&
146 !(pBcnStruct->HTInfo.present))||
147 //if erp not present then 11B AP overlapping
148 (pBcnStruct->erpPresent &&
149 (pBcnStruct->erpIEInfo.useProtection ||
150 pBcnStruct->erpIEInfo.nonErpPresent)))
151 {
152#ifdef FEATURE_WLAN_CCX
153 if( psessionEntry->isCCXconnection )
154 {
155 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
156 "%s: [INFOLOG]CCX 11g erpPresent=%d useProtection=%d nonErpPresent=%d\n", __func__,
157 pBcnStruct->erpPresent,
158 pBcnStruct->erpIEInfo.useProtection,
159 pBcnStruct->erpIEInfo.nonErpPresent);
160 }
161#endif
162 limEnableOverlap11gProtection(pMac, pBeaconParams, pMh,psessionEntry);
163 }
164
165 }
166 }
167 // handling the case when HT AP has overlapping legacy BSS.
Jeff Johnsone7245742012-09-05 17:12:55 -0700168 else if(psessionEntry->htCapability)
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700169 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700170 if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
171 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700172 if (((!(pBcnStruct->erpPresent)) &&
173 !(pBcnStruct->HTInfo.present))||
174 //if erp not present then 11B AP overlapping
175 (pBcnStruct->erpPresent &&
176 (pBcnStruct->erpIEInfo.useProtection ||
177 pBcnStruct->erpIEInfo.nonErpPresent)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700178 {
179#ifdef FEATURE_WLAN_CCX
180 if( psessionEntry->isCCXconnection )
181 {
182 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
183 "%s: [INFOLOG]CCX 11g erpPresent=%d useProtection=%d nonErpPresent=%d\n", __func__,
184 pBcnStruct->erpPresent,
185 pBcnStruct->erpIEInfo.useProtection,
186 pBcnStruct->erpIEInfo.nonErpPresent);
187 }
188#endif
189 limEnableOverlap11gProtection(pMac, pBeaconParams, pMh,psessionEntry);
190 }
191
192 //11g device overlaps
193 if (pBcnStruct->erpPresent &&
194 !(pBcnStruct->erpIEInfo.useProtection ||
195 pBcnStruct->erpIEInfo.nonErpPresent) && !(pBcnStruct->HTInfo.present))
196 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700197 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlap11gParams));
198
199 if (psessionEntry->gLimOverlap11gParams.numSta &&
200 !psessionEntry->gLimOverlap11gParams.protectionEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -0700201 {
202 limEnableHtProtectionFrom11g(pMac, true, true, pBeaconParams,psessionEntry);
203 }
204 }
205
206 //ht device overlaps.
207 //here we will check for HT related devices only which might need protection.
208 //check for 11b and 11g is already done in the previous blocks.
209 //so we will not check for HT operating mode as MIXED.
210 if (pBcnStruct->HTInfo.present)
211 {
212 //if we are not already in mixed mode or legacy mode as HT operating mode
213 //and received beacon has HT operating mode as legacy
214 //then we need to enable protection from 11g station.
215 //we don't need protection from 11b because if that's needed then our operating
216 //mode would have already been set to legacy in the previous blocks.
217 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBcnStruct->HTInfo.opMode)
218 {
219 if((eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode) &&
220 (eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode))
221 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700222 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlap11gParams));
223 if (psessionEntry->gLimOverlap11gParams.numSta &&
224 !psessionEntry->gLimOverlap11gParams.protectionEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -0700225 {
226 limEnableHtProtectionFrom11g(pMac, true, true, pBeaconParams,psessionEntry);
227 }
228 }
229 }
230 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBcnStruct->HTInfo.opMode)
231 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700232 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlapHt20Params));
233 if (psessionEntry->gLimOverlapHt20Params.numSta &&
234 !psessionEntry->gLimOverlapHt20Params.protectionEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -0700235 {
236 limEnableHT20Protection(pMac, true, true, pBeaconParams,psessionEntry);
237 }
238 }
239 }
240
241 }
242 }
243 }
244 pMac->sch.gSchBcnIgnored++;
245}
246// --------------------------------------------------------------------
247
248
249
250
251/**
252 * __schBeaconProcessNoSession
253 *
254 * FUNCTION:
255 * Process the received beacon frame when
256 * -- Station is not scanning
257 * -- No corresponding session is found
258 *
259 * LOGIC:
260 * Following scenarios exist when Session Does not exist:
261 * * IBSS Beacons, when IBSS session already exists with same SSID,
262 * but from STA which has not yet joined and has a different BSSID.
263 * - invoke limHandleIBSScoalescing with the session context of existing IBSS session.
264 *
265 * * IBSS Beacons when IBSS session does not exist, only Infra or BT-AMP session exists,
266 * then save the beacon in the scan results and throw it away.
267 *
268 * * Infra Beacons
269 * - beacons received when no session active
270 * should not come here, it should be handled as part of scanning,
271 * else they should not be getting received, should update scan results and drop it if that happens.
272 * - beacons received when IBSS session active:
273 * update scan results and drop it.
274 * - beacons received when Infra session(STA) is active:
275 * update scan results and drop it
276 * - beacons received when BT-STA session is active:
277 * update scan results and drop it.
278 * - beacons received when Infra/BT-STA or Infra/IBSS is active.
279 * update scan results and drop it.
280 *
281
282 */
283static void __schBeaconProcessNoSession(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon,tANI_U8* pRxPacketInfo)
284{
285 tpPESession psessionEntry = NULL;
286
287 if( (psessionEntry = limIsIBSSSessionActive(pMac)) != NULL)
288 {
289 limHandleIBSScoalescing(pMac, pBeacon, pRxPacketInfo, psessionEntry);
290 }
291
292 //If station(STA/BT-STA/BT-AP/IBSS) mode, Always save the beacon in the scan results, if atleast one session is active
293 //schBeaconProcessNoSession will be called only when there is atleast one session active, so not checking
294 //it again here.
295 limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
296 return;
297}
298
299
300
301/*
302 * __schBeaconProcessForSession
303 *
304 * FUNCTION:
305 * Process the received beacon frame when
306 * -- Station is not scanning
307 * -- Corresponding session is found
308 *
309 * LOGIC:
310 * Following scenarios exist when Session exists
311 * * IBSS STA receving beacons from IBSS Peers, who are part of IBSS.
312 * - call limHandleIBSScoalescing with that session context.
313 * * Infra STA receving beacons from AP to which it is connected
314 * - call schBeaconProcessFromAP with that session's context.
315 * * BTAMP STA receving beacons from BTAMP AP
316 * - call schBeaconProcessFromAP with that session's context.
317 * * BTAMP AP receiving beacons from BTAMP STA
318 * (here need to make sure BTAP creates session entry for BT STA)
319 * - just update the beacon count for heart beat purposes for now,
320 * for now, don't process the beacon.
321 * * Infra/IBSS both active and receives IBSS beacon:
322 * - call limHandleIBSScoalescing with that session context.
323 * * Infra/IBSS both active and receives Infra beacon:
324 * - call schBeaconProcessFromAP with that session's context.
325 * any updates to EDCA parameters will be effective for IBSS as well,
326 * even though no WMM for IBSS ?? Need to figure out how to handle this scenario.
327 * * Infra/BTSTA both active and receive Infra beacon.
328 * - change in EDCA parameters on Infra affect the BTSTA link.
329 * Update the same parameters on BT link
330 * * Infra/BTSTA both active and receive BT-AP beacon.
331 * -update beacon cnt for heartbeat
332 * * Infra/BTAP both active and receive Infra beacon.
333 * - BT-AP starts advertising BE parameters from Infra AP, if they get changed.
334 *
335 * * Infra/BTAP both active and receive BTSTA beacon.
336 * - update beacon cnt for heartbeat
337 */
338
339static void __schBeaconProcessForSession( tpAniSirGlobal pMac,
340 tpSchBeaconStruct pBeacon,
341 tANI_U8* pRxPacketInfo,
342 tpPESession psessionEntry)
343{
344 tANI_U32 bi;
345 tANI_U8 bssIdx = 0;
346 //tpSirMacMgmtHdr pMh = SIR_MAC_BD_TO_MPDUHEADER(pRxPacketInfo);
347 //tANI_U8 bssid[sizeof(tSirMacAddr)];
348 tUpdateBeaconParams beaconParams;
349 tANI_U8 sendProbeReq = FALSE;
350 tpDphHashNode pStaDs = NULL;
Mohit Khanna4a70d262012-09-11 16:30:12 -0700351#ifdef WLAN_FEATURE_11AC
352 tpSirMacMgmtHdr pMh = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
353 tANI_U16 aid;
354 tANI_U8 operMode;
355#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700356
357
358 beaconParams.paramChangeBitmap = 0;
359
360 if(eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
361 {
362 limHandleIBSScoalescing(pMac, pBeacon, pRxPacketInfo, psessionEntry);
363 }
364 else if( (eLIM_STA_ROLE == psessionEntry->limSystemRole) ||
365 (eLIM_BT_AMP_STA_ROLE == psessionEntry->limSystemRole))
366 {
367 /*
368 * This handles two cases:
369 * -- Infra STA receving beacons from AP
370 * -- BTAMP_STA receving beacons from BTAMP_AP
371 */
372
373
374 //Always save the beacon into LIM's cached scan results
375 limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
376
377 /**
378 * This is the Beacon received from the AP we're currently associated with. Check
379 * if there are any changes in AP's capabilities
380 */
381 if((tANI_U8) pBeacon->channelNumber != psessionEntry->currentOperChannel)
382 {
383 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
384 "Ignoring beacon!\n"),
385 psessionEntry->currentOperChannel, pBeacon->channelNumber);)
386 goto fail;
387 }
388 limDetectChangeInApCapabilities(pMac, pBeacon, psessionEntry);
389 if(limGetStaHashBssidx(pMac, DPH_STA_HASH_INDEX_PEER, &bssIdx, psessionEntry) != eSIR_SUCCESS)
390 goto fail;
391 beaconParams.bssIdx = bssIdx;
392 palCopyMemory( pMac->hHdd, ( tANI_U8* )&psessionEntry->lastBeaconTimeStamp, ( tANI_U8* )pBeacon->timeStamp, sizeof(tANI_U64) );
393 psessionEntry->lastBeaconDtimCount = pBeacon->tim.dtimCount;
394 psessionEntry->lastBeaconDtimPeriod= pBeacon->tim.dtimPeriod;
395 psessionEntry->currentBssBeaconCnt++;
396
397
398
Jeff Johnsone7245742012-09-05 17:12:55 -0700399 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, pBeacon->timeStamp[0]);)
400 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, pBeacon->timeStamp[1]);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700401
402 /* Read beacon interval session Entry */
403 bi = psessionEntry->beaconParams.beaconInterval;
404 if (bi != pBeacon->beaconInterval)
405 {
406 PELOG1(schLog(pMac, LOG1, FL("Beacon interval changed from %d to %d\n"),
407 pBeacon->beaconInterval, bi);)
408
409 bi = pBeacon->beaconInterval;
410 psessionEntry->beaconParams.beaconInterval = (tANI_U16) bi;
411 beaconParams.paramChangeBitmap |= PARAM_BCN_INTERVAL_CHANGED;
412 beaconParams.beaconInterval = (tANI_U16)bi;
413 }
414
415 if (pBeacon->cfPresent)
416 {
417 cfgSetInt(pMac, WNI_CFG_CFP_PERIOD, pBeacon->cfParamSet.cfpPeriod);
418 limSendCFParams(pMac, bssIdx, pBeacon->cfParamSet.cfpCount, pBeacon->cfParamSet.cfpPeriod);
419 }
420
421 if (pBeacon->timPresent)
422 {
423 cfgSetInt(pMac, WNI_CFG_DTIM_PERIOD, pBeacon->tim.dtimPeriod);
424 //No need to send DTIM Period and Count to HAL/SMAC
425 //SMAC already parses TIM bit.
426 }
427
428
429 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
430
431 limDecideStaProtection(pMac, pBeacon, &beaconParams, psessionEntry);
432 if (pBeacon->erpPresent)
433 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 if (pBeacon->erpIEInfo.barkerPreambleMode)
435 limEnableShortPreamble(pMac, false, &beaconParams, psessionEntry);
436 else
437 limEnableShortPreamble(pMac, true, &beaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 }
439 limUpdateShortSlot(pMac, pBeacon, &beaconParams,psessionEntry);
440
441 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
442 if ((pBeacon->wmeEdcaPresent && (psessionEntry->limWmeEnabled)) ||
443 (pBeacon->edcaPresent && (psessionEntry->limQosEnabled)))
444 {
445 if(pBeacon->edcaParams.qosInfo.count != psessionEntry->gLimEdcaParamSetCount)
446 {
447 if (schBeaconEdcaProcess(pMac, &pBeacon->edcaParams, psessionEntry) != eSIR_SUCCESS)
448 PELOGE(schLog(pMac, LOGE, FL("EDCA parameter processing error\n"));)
449 else if(pStaDs != NULL)
450 {
451 // If needed, downgrade the EDCA parameters
452 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
453
454 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
455 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
456 else
457 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
458 }
459 else
460 PELOGE(limLog(pMac, LOGE, FL("Self Entry missing in Hash Table\n"));)
461 }
462 }
463 else if( (pBeacon->qosCapabilityPresent && psessionEntry->limQosEnabled) &&
464 (pBeacon->qosCapability.qosInfo.count != psessionEntry->gLimEdcaParamSetCount))
465 sendProbeReq = TRUE;
466 }
467
Jeff Johnsone7245742012-09-05 17:12:55 -0700468 if ( psessionEntry->htCapability && pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 {
470 limUpdateStaRunTimeHTSwitchChnlParams( pMac, &pBeacon->HTInfo, bssIdx,psessionEntry);
471 }
472
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) ||
474 (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
475 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 /* Channel Switch information element updated */
477 if(pBeacon->channelSwitchPresent ||
478 pBeacon->propIEinfo.propChannelSwitchPresent)
479 {
480 limUpdateChannelSwitch(pMac, pBeacon, psessionEntry);
481 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700482 else if (psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 {
484 limCancelDot11hChannelSwitch(pMac, psessionEntry);
485 }
486 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700487
Mohit Khanna4a70d262012-09-11 16:30:12 -0700488#ifdef WLAN_FEATURE_11AC
489 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
490 {
491 // check for VHT capability
492 if(psessionEntry->vhtCapability && pBeacon->OperatingMode.present)
493 {
494 pStaDs = dphLookupHashEntry(pMac, pMh->sa, &aid, &psessionEntry->dph.dphHashTable);
495 operMode = pStaDs->vhtSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_80MHZ : pStaDs->htSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
496 if( operMode != pBeacon->OperatingMode.chanWidth)
497 {
Jeff Johnson1250df42012-12-10 14:31:52 -0800498 PELOG1(limLog(pMac, LOG1, FL(" received Chanwidth %d, staIdx = %d\n"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700499 pBeacon->OperatingMode.chanWidth,
500 pStaDs->staIndex);)
501 PELOG1(limLog(pMac, LOG1, FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x\n"),
502 pMh->sa[0],
503 pMh->sa[1],
504 pMh->sa[2],
505 pMh->sa[3],
506 pMh->sa[4],
507 pMh->sa[5]);)
508
509 if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
510 {
511 pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
512 pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ ;
513 }
514 else if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
515 {
516 pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
517 pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
518 }
519 else if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_20MHZ)
520 {
521 pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
522 pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
523 }
524 limCheckVHTOpModeChange(pMac, psessionEntry, pBeacon->OperatingMode.chanWidth, pStaDs->staIndex);
525 }
526 }
527 }
528#endif
529
Jeff Johnson295189b2012-06-20 16:38:30 -0700530#if defined FEATURE_WLAN_CCX
531 if( psessionEntry->isCCXconnection )
532 {
533 tPowerdBm localConstraint = 0, regMax = 0, maxTxPower = 0;
534 if (pBeacon->ccxTxPwr.present)
535 {
536 localConstraint = pBeacon->ccxTxPwr.power_limit;
537 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700538 maxTxPower = limGetMaxTxPower(regMax, localConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -0700539
540 //If maxTxPower is increased or decreased
541 if( maxTxPower != psessionEntry->maxTxPower )
542 {
543 limLog( pMac, LOG1, "RegMax = %d, lpc = %d, MaxTx = %d", regMax, localConstraint, maxTxPower );
544 limLog( pMac, LOG1, "Local power constraint change..updating new maxTx power to HAL");
Jeff Johnsone7245742012-09-05 17:12:55 -0700545 if( limSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eSIR_SUCCESS )
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 psessionEntry->maxTxPower = maxTxPower;
547 }
548 }
549 }
550#endif
551
552
553#if defined WLAN_FEATURE_VOWIFI
554 if( pMac->rrm.rrmPEContext.rrmEnable )
555 {
556 tPowerdBm localConstraint = 0, regMax = 0, maxTxPower = 0;
557 if (pBeacon->powerConstraintPresent && pMac->rrm.rrmPEContext.rrmEnable)
558 {
559 localConstraint = pBeacon->localPowerConstraint.localPowerConstraints;
560 }
561 else
562 {
563 localConstraint = 0;
564 }
565 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
566 maxTxPower = VOS_MIN( regMax , (regMax - localConstraint) );
567 //If maxTxPower is increased or decreased
568 if( maxTxPower != psessionEntry->maxTxPower )
569 {
570#if defined WLAN_VOWIFI_DEBUG
571 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localConstraint, maxTxPower );
572 limLog( pMac, LOGE, "Local power constraint change..updating mew maxTx power to HAL");
573#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700574 if( rrmSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eSIR_SUCCESS )
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 psessionEntry->maxTxPower = maxTxPower;
576
577 }
578 }
579#endif
580
581 // Indicate to LIM that Beacon is received
582
583 if (pBeacon->HTInfo.present)
584 limReceivedHBHandler(pMac, (tANI_U8)pBeacon->HTInfo.primaryChannel, psessionEntry);
585 else
586 limReceivedHBHandler(pMac, (tANI_U8)pBeacon->channelNumber, psessionEntry);
587
588 // I don't know if any additional IE is required here. Currently, not include addIE.
589 if(sendProbeReq)
590 limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId,
591 psessionEntry->bssId, psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
592 psessionEntry->dot11mode, 0, NULL);
593
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 if(beaconParams.paramChangeBitmap)
595 {
596 PELOGW(schLog(pMac, LOGW, FL("Beacon for session[%d] got changed. \n"), psessionEntry->peSessionId);)
597 PELOGW(schLog(pMac, LOGW, FL("sending beacon param change bitmap: 0x%x \n"), beaconParams.paramChangeBitmap);)
598 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
599 }
600
601fail:
602 return;
603
604}
605
606
607
608/**
609 * schBeaconProcess
610 *
611 * FUNCTION:
612 * Process the received beacon frame
613 *
614 * LOGIC:
615 *
616 * ASSUMPTIONS:
617 *
618 * NOTE:
619 *
620 * @param pRxPacketInfo pointer to buffer descriptor
621 * @return None
622 */
623
624void schBeaconProcess(tpAniSirGlobal pMac, tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
625{
626 static tSchBeaconStruct beaconStruct;
627 tUpdateBeaconParams beaconParams;
628 tpPESession pAPSession = NULL;
629 beaconParams.paramChangeBitmap = 0;
630
631 pMac->sch.gSchBcnRcvCnt++;
632
633 // Convert the beacon frame into a structure
634 if (sirConvertBeaconFrame2Struct(pMac, (tANI_U8 *) pRxPacketInfo, &beaconStruct)!= eSIR_SUCCESS)
635 {
636 PELOGE(schLog(pMac, LOGE, FL("beacon parsing failed\n"));)
637 pMac->sch.gSchBcnParseErrorCnt++;
638 return;
639 }
640
641 if (beaconStruct.ssidPresent)
642 {
643 beaconStruct.ssId.ssId[beaconStruct.ssId.length] = 0;
644 }
645
646 /*
647 * First process the beacon in the context of any existing AP or BTAP session.
648 * This takes cares of following two scenarios:
649 * - psessionEntry = NULL:
650 * e.g. beacon received from a neighboring BSS, you want to apply the protection settings to BTAP/InfraAP beacons
651 * - psessionEntry is non NULL:
652 * e.g. beacon received is from the INFRA AP to which you are connected on another concurrent link.
653 * In this case also, we want to apply the protection settings(as advertised by Infra AP) to BTAP beacons
654 *
655 *
656 */
657
658 if((pAPSession = limIsApSessionActive(pMac)) != NULL)
659 {
660 beaconParams.bssIdx = pAPSession->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -0700661 if (pAPSession->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700662 ap_beacon_process(pMac, pRxPacketInfo, &beaconStruct, &beaconParams, pAPSession);
663
664 if (beaconParams.paramChangeBitmap)
665 {
666 //Update the beacons and apply the new settings to HAL
667 schSetFixedBeaconFields(pMac, pAPSession);
668 PELOG1(schLog(pMac, LOG1, FL("Beacon for PE session[%d] got changed. \n"), pAPSession->peSessionId);)
669 PELOG1(schLog(pMac, LOG1, FL("sending beacon param change bitmap: 0x%x \n"), beaconParams.paramChangeBitmap);)
670 limSendBeaconParams(pMac, &beaconParams, pAPSession);
671 }
672 }
673
674 /*
675 * Now process the beacon in the context of the BSS which is transmitting the beacons, if one is found
676 */
677 if(psessionEntry == NULL)
678 {
679 __schBeaconProcessNoSession(pMac, &beaconStruct, pRxPacketInfo );
680 }
681 else
682 {
683 __schBeaconProcessForSession(pMac, &beaconStruct, pRxPacketInfo, psessionEntry );
684 }
685
686}
687
688
689
690
691
692// --------------------------------------------------------------------
693/**
694 * schBeaconEdcaProcess
695 *
696 * FUNCTION:
697 * Process the EDCA parameter set in the received beacon frame
698 *
699 * LOGIC:
700 *
701 * ASSUMPTIONS:
702 *
703 * NOTE:
704 *
705 * @param edca reference to edca parameters in beacon struct
706 * @return success
707 */
708
709tSirRetStatus schBeaconEdcaProcess(tpAniSirGlobal pMac, tSirMacEdcaParamSetIE *edca, tpPESession psessionEntry)
710{
711 tANI_U8 i;
712#ifdef FEATURE_WLAN_DIAG_SUPPORT
713 vos_log_qos_edca_pkt_type *log_ptr = NULL;
714#endif //FEATURE_WLAN_DIAG_SUPPORT
715
716 PELOG1(schLog(pMac, LOG1, FL("Updating parameter set count: Old %d ---> new %d\n"),
717 psessionEntry->gLimEdcaParamSetCount, edca->qosInfo.count);)
718
719 psessionEntry->gLimEdcaParamSetCount = edca->qosInfo.count;
720 psessionEntry->gLimEdcaParams[EDCA_AC_BE] = edca->acbe;
721 psessionEntry->gLimEdcaParams[EDCA_AC_BK] = edca->acbk;
722 psessionEntry->gLimEdcaParams[EDCA_AC_VI] = edca->acvi;
723 psessionEntry->gLimEdcaParams[EDCA_AC_VO] = edca->acvo;
724//log: LOG_WLAN_QOS_EDCA_C
725#ifdef FEATURE_WLAN_DIAG_SUPPORT
726 WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C);
727 if(log_ptr)
728 {
729 log_ptr->aci_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].aci.aci;
730 log_ptr->cw_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.max << 4 |
731 psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.min;
732 log_ptr->txoplimit_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].txoplimit;
733 log_ptr->aci_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].aci.aci;
734 log_ptr->cw_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.max << 4 |
735 psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.min;
736 log_ptr->txoplimit_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].txoplimit;
737 log_ptr->aci_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].aci.aci;
738 log_ptr->cw_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.max << 4 |
739 psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.min;
740 log_ptr->txoplimit_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].txoplimit;
741 log_ptr->aci_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].aci.aci;
742 log_ptr->cw_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.max << 4 |
743 psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.min;
744 log_ptr->txoplimit_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].txoplimit;
745 }
746 WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
747#endif //FEATURE_WLAN_DIAG_SUPPORT
748 PELOG1(schLog(pMac, LOGE, FL("Updating Local EDCA Params(gLimEdcaParams) to: "));)
749 for(i=0; i<MAX_NUM_AC; i++)
750 {
751 PELOG1(schLog(pMac, LOG1, FL("AC[%d]: AIFSN: %d, ACM %d, CWmin %d, CWmax %d, TxOp %d\n"),
752 i,
753 psessionEntry->gLimEdcaParams[i].aci.aifsn,
754 psessionEntry->gLimEdcaParams[i].aci.acm,
755 psessionEntry->gLimEdcaParams[i].cw.min,
756 psessionEntry->gLimEdcaParams[i].cw.max,
757 psessionEntry->gLimEdcaParams[i].txoplimit);)
758 }
759
760 return eSIR_SUCCESS;
761}