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